Repository navigation
fix(training-agent): inventory-content claims only sales-guaranteed; spend never drifts by cents (#9025) - #9052
Merged
Merged
Conversation
…spend never drifts by cents (#9025) Two follow-ups from the hosted smoke of the #9025 inventory tenants: - An inventory tenant now declares the sales specialisms its seed actually sells. /inventory-content sells guaranteed sponsorships only, so it drops sales-non-guaranteed; /inventory-adserver keeps both. - A booking's daily spend is now the change in its rounded cumulative spend (Booking.spend_exact), so per-day rounding no longer drifts the total: 180,000 impressions at $14 CPM bill $2,520.00, not $2,520.02. A bid change mid-flight prices impressions from then on. States saved before this fall back to delivered.spend. The new engine test fails on the old code (an auction at $3.333 then $2.777 CPM came to $239.93 instead of $239.95). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean diff, no blocking or medium findings.
Two changes in the inventory training-sim:
simulation.tsbills each day as the delta of rounded cumulative spend via a newspend_exactfield, so daily rounding telescopes anddelivered.spendstays exactlyroundMoney(cumulative). Zero-impression days and the SoV budget cap both yield non-negative daily spend; pre-existing saved states degrade safely via?? delivered.spend.platform.tsderivesspecialismsfrom the seed's actual delivery_types (both enum values mapped) instead of a hardcoded pair.
Both changes are backed by tests. This is non-protocol code: no static/schemas/source/**, docs, or dist edits, so no changeset obligation and no spec drift. high_risk is false, no author team gate, and gated_paths is false (so the REVIEW_REQUIRED status does not trigger row 2). No critical/high/medium findings — falls through to row 9.
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.
Two follow-ups from the hosted smoke test of the #9025 inventory tenants.
/inventory-contentdeclares onlysales-guaranteedEach inventory tenant now derives its sales specialisms from the delivery types its seed actually sells (
inventory-sim/platform.ts)./inventory-contentsells guaranteed sponsorships only, so it no longer claimssales-non-guaranteed./inventory-adserverstill declares both.Spend no longer drifts by cents
Each day's spend was rounded to the cent independently, so a booking's total could drift from its exact cost. On the hosted agent, a guarantee of 180,000 impressions at $14 CPM billed $2,520.02.
Booking.spend_exact, so the total is always exact.spend_exact, and the engine falls back todelivered.spend.Tests
/inventory-contentdeclares['sales-guaranteed'].Checks run locally
npx tsc --project server/tsconfig.json --noEmit: clean.tests/lint-format-identity-boundaries.test.cjs: passes.Committed and pushed with
HUSKY=0, under the approval for this series. CI's storyboard job is the check that existing storyboards still pass. No changeset: this touches only the training agent.Refs #9025
🤖 Generated with Claude Code