Skip to content

Honor applicable_intents in the Rust demo evaluator#15

Open
aleksUIX wants to merge 2 commits into
IABTechLab:mainfrom
aleksUIX:rust-intent-filtering
Open

Honor applicable_intents in the Rust demo evaluator#15
aleksUIX wants to merge 2 commits into
IABTechLab:mainfrom
aleksUIX:rust-intent-filtering

Conversation

@aleksUIX

@aleksUIX aleksUIX commented Jul 6, 2026

Copy link
Copy Markdown

Summary

The Rust demo evaluator returned every mutation its auction arm defines, ignoring the request's applicable_intents. The Go implementation gates every mutation through IsIntentApplicable (internal/handlers/handlers.go), and RTBRequest.applicable_intents is 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.json declares only BID_SHADE applicable, but the Rust server responded with ACTIVATE_SEGMENTS and ACTIVATE_DEALS mutations as well.

Change

  • bidder/evaluator.rs: mutations are now filtered against applicable_intents before the response is returned, with the same semantics as the Go implementation (empty list means all intents are applicable).
  • Tests: three new evaluator tests cover the restricted, empty, and no-match cases; the bid-shading sample expectation drops from 3 mutations to 1.

Verification

  • cargo test: 16 passed
  • Live gRPC call with samples/bid-shading.json now returns only the BID_SHADE mutation:
{
  "id": "sample-bidshade-001",
  "mutations": [
    {
      "intent": "BID_SHADE",
      "op": "OPERATION_REPLACE",
      "path": "/seatbid/dsp-001/bid/bid-abc",
      "adjustBid": { "price": 4.675 }
    }
  ],
  ...
}

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.

aleksUIX added 2 commits July 5, 2026 18:38
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant