Honor applicable_intents in the Rust demo evaluator#15
Open
aleksUIX wants to merge 2 commits into
Open
Conversation
…outing The new tests decode every samples/*.json through the proto schema (via a descriptor set emitted at build time) and run them through the demo evaluator. Writing them surfaced two existing bugs, fixed here: - The evaluator matched auction ids (auction-123, auction-456, ...) against the top-level RTBRequest envelope id, so no bundled sample ever produced mutations. It now routes on bid_request.id and echoes the envelope id in the response, matching the Go implementation's use of the enclosed BidRequest. The dead app-123 arm now matches native-ad.json's auction-native-123. - multi-impression.json and native-ad.json encoded proto bool fields (device.js, regs.coppa, regs.gdpr, source.fd) as 0/1, which the proto JSON mapping rejects. This is bug 4 of IABTechLab#11 (expecting boolean, instead got 1); both samples now decode cleanly. Test coverage added: - mutation/builder.rs: payload shapes for segments, deals, bid shade - bidder/evaluator.rs: routing table, envelope id echo, fallbacks - sample_tests.rs: schema-validates all five samples and asserts each drives its documented demo mutations end to end cargo test: 13 passed. No changes to the generated proto code.
The evaluator returned every mutation its auction arm defines, ignoring the request's applicable_intents. The Go implementation gates every mutation through IsIntentApplicable, and the field is documented as the list of intents the server is eligible to send back. Mutations are now filtered with the same semantics: an empty list means all intents are applicable. samples/bid-shading.json declares only BID_SHADE, so its response drops from 3 mutations to 1; verified over a live gRPC call. All other samples declare the intents their mutations use and are unchanged. cargo test: 16 passed.
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
The Rust demo evaluator returned every mutation its auction arm defines, ignoring the request's
applicable_intents. The Go implementation gates every mutation throughIsIntentApplicable(internal/handlers/handlers.go), andRTBRequest.applicable_intentsis documented as the list of intents the server is eligible to send back. A container proposing intents it was not offered violates that contract.Example:
samples/bid-shading.jsondeclares onlyBID_SHADEapplicable, but the Rust server responded withACTIVATE_SEGMENTSandACTIVATE_DEALSmutations as well.Change
bidder/evaluator.rs: mutations are now filtered againstapplicable_intentsbefore the response is returned, with the same semantics as the Go implementation (empty list means all intents are applicable).Verification
cargo test: 16 passedsamples/bid-shading.jsonnow returns only theBID_SHADEmutation:Note
Stacked on #13 (builds on its evaluator routing fix and test suite). The first commit in the diff belongs to that PR and will drop out once it merges; independent of #14.