Implement generic Prebid bid param override rules#618
Conversation
Renames the new field to match the existing `bid_param_zone_overrides` naming convention. Updates all references: struct field, env var key, doc comments, TOML example, tests, and .env.example. Also replaces production IDs in test fixtures and examples with generic placeholder values.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Well-designed feature. The BidParamOverrideEngine with its canonical rule format and compatibility normalization from bid_param_overrides/bid_param_zone_overrides is a clean architecture. Good validation at startup via try_from_config and json_object_for_override. Test coverage is thorough — especially the engine unit tests and precedence ordering tests. A few suggestions below.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Well-designed PR — the unified rule engine is clean, well-tested, and the compatibility migration strategy is sound. Approving with two recommended fixes.
aram356
left a comment
There was a problem hiding this comment.
Summary
Replaces the split bid-param override paths with a single generic BidParamOverrideEngine that normalizes all three config surfaces into an ordered rule list at startup. Clean design, solid compatibility story, comprehensive tests.
Non-blocking
♻️ refactor
- Redundant validation-only engine build in
PrebidIntegration::try_new: builds and discards the engine just for validation — same work is repeated inPrebidAuctionProvider::try_new(prebid.rs:233)
🤔 thinking
deny_unknown_fieldsonBidParamOverrideWhen: strict is good, but adding new matcher fields later becomes a breaking config change (prebid.rs:189)- Shallow merge semantics vs. nested override values: real-world bidder params can be nested objects — shallow merge replaces the entire value rather than deep-merging (prebid.rs:504)
⛏ nitpick
parse_prebid_toml_resulterror message: "should be enabled" is misleading whenNonecould also mean the section is missing entirely (prebid.rs:1627)
🌱 seedling
- Zone-only rules (no bidder): the engine requires at least one matcher, so "for all bidders in zone X" rules aren't possible yet — could be useful for zone-wide floor overrides
CI Status
- fmt: PASS
- clippy: PASS
- cargo test: PASS
- vitest: PASS
- integration tests: PASS
- browser integration tests: PASS
Summary
bid_param_overridesandbid_param_zone_overridesas compatibility config, while adding canonicalbid_param_override_rulesfor future config-driven overrides.bidder/zonematch with shallow last-write-wins merges.Changes
crates/trusted-server-core/src/integrations/prebid.rsBidParamOverrideRule,BidParamOverrideWhen, andBidParamOverrideEngine; normalize compatibility fields and canonical rules into one runtime path; apply rules during OpenRTB construction; update testscrates/trusted-server-core/src/settings.rsTRUSTED_SERVER__INTEGRATIONS__PREBID__BID_PARAM_OVERRIDE_RULEStrusted-server.tomlbid_param_override_rulesand clarify that compatibility fields normalize into the same enginedocs/superpowers/plans/2026-04-08-prebid-generic-bid-param-override-rules.mdCloses
Closes #617
Related: #339, #383, #384
Test plan
cargo fmt --all -- --checkcargo test -p trusted-server-corecargo clippy -p trusted-server-core --all-targets --all-features -- -D warningscargo test --workspacecargo clippy --workspace --all-targets --all-features -- -D warningsChecklist
logmacros (notprintln!)