Dump full SSAT prebid responses in ts-debug auction comment#890
Open
prk-Jr wants to merge 3 commits into
Open
Conversation
The server-side auction stream path only emitted a summary counter (ssp/mediator/winning/time), so an operator seeing winning=0 could not tell whether prebid returned nothing, errored, or bid below the floor. Serialize the full provider_responses (and mediator_response) into the ts-debug HTML comment so the SSAT surfaces the same prebid server response detail available from the /auction endpoint. Bid creative and metadata are attacker/partner-influenced, so neutralize the '-->' and '--!>' comment terminators before embedding to keep the dump inside the comment and out of the live DOM.
When Prebid Server returns a non-2xx status, the parser returned a bare
AuctionResponse::error with empty metadata — indistinguishable in the
ts-debug dump from a transport, parse, or timeout failure, all of which
tag error_type. An operator seeing status=error with metadata={} had no
way to know the upstream HTTP code without log access.
Attach error_type=http_status, the status code, and a 512-byte body
snippet to the error response metadata so the auction dump shows exactly
why prebid errored (e.g. a 4xx from a PBS rejecting the request).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ts-debugHTML comment (ssp/mediator/winning/time), so an operator seeingwinning=0could not tell whether prebid returned nothing, errored, or bid below the floor.provider_responses(andmediator_response) into the comment so the SSAT surfaces the same prebid server response detail an operator gets from the/auctionendpoint — status, every bid, andmetadata(which carries PBSext.errors/ext.debug.httpcallswhen prebiddebug=true).Changes
crates/trusted-server-core/src/publisher.rsprepend_auction_debug_commentnow serializesprovider_responses+mediator_responseas JSON into thets-debugcomment; neutralizes-->/--!>in the payload; adds a unit test asserting status is surfaced and terminators are neutralized (exactly one closing-->).Closes
Closes #889
Test plan
cargo fmt --all -- --checkcargo test-fastly(new testauction_debug_comment_dumps_provider_status_and_neutralises_terminatorspasses;cargo check-fastlyclean)cargo test-axum— deferred to CIcargo clippy-fastly && cargo clippy-axum— deferred to CINotes
[debug].auction_html_commentflag — off by default.Bid.creative(full ad markup) inline and can be large; intended for debugging, not steady-state production.Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)