Add Rust test suite seeded from bundled samples; fix demo evaluator routing and sample bool encoding#13
Open
aleksUIX wants to merge 1 commit 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.
This was referenced Jul 6, 2026
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
Adds a test suite to the Rust reference implementation, seeded from the bundled
samples/*.jsonpayloads. Writing the tests surfaced two existing bugs; both are fixed here.Bug 1: the demo evaluator never matched any bundled sample
bidder/evaluator.rsmatched its auction arms (auction-123,auction-456, ...) against the top-levelRTBRequest.idenvelope id, but those values arebid_request.idin every sample (the envelope ids aresample-banner-001etc.). Result: the demo server returned zero mutations for all five bundled samples. The evaluator now routes on the enclosedbid_request.id, consistent with how the Go implementation reads the enclosed BidRequest, and still echoes the envelope id in the response. The unreachableapp-123arm now matchesnative-ad.json's actual auction id,auction-native-123.Bug 2: two samples encode proto bool fields as 0/1
multi-impression.jsonandnative-ad.jsonused0/1fordevice.js,regs.coppa,regs.gdpr, andsource.fd, which the proto JSON mapping rejects ("expecting boolean; instead got 1"). This is bug 4 of #11. Both samples now decode cleanly against the schema, which also unblocks sending them to the Go server.Test coverage
rust/src/mutation/builder.rs: unit tests for segment, deal, and bid shade mutation payload shapes, plus metadata versionsrust/src/bidder/evaluator.rs: routing table for all five demo auctions, envelope id echo, unknown-auction and missing-bid_request fallbacksrust/src/sample_tests.rs(new): decodes every bundled sample through the compiled proto schema (unknown fields rejected) and asserts each sample drives its documented demo mutations end to endTo support the schema validation tests,
build.rsnow also emits a file descriptor set toOUT_DIR, andprost-reflectis added as a dev-dependency only. No changes to the committed generated code.Verification
cargo test: 13 passedcargo buildproduces no diff in the generated proto sources/health/liveresponds OK