Skip to content

fix(training-agent): inventory get_products filters by required_metrics; raise the inventory floors - #9169

Merged
bokelley merged 2 commits into
mainfrom
fix/inventory-required-metrics
Nov 22, 2026
Merged

bokelley merged 2 commits into
mainfrom
fix/inventory-required-metrics

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Two changes to the inventory tenants (/inventory-adserver, /inventory-content):

  1. get_products filters by filters.required_metrics. It keeps only products whose reporting_capabilities.available_metrics cover every required metric. The rule is the sales tenant's own, now exported as reportingMetricIsAvailable from task-handlers.ts:
    • a declared viewability container covers its numeric leaves (viewable_rate, viewable_impressions, measurable_impressions, viewed_seconds);
    • quartile_data covers its quartiles;
    • a leaf never covers a sibling leaf;
    • it filters and never fails.
  2. The inventory storyboard floors rise to this PR's CI result (a follow-up commit on this PR, once CI has run). Main was already above the feat(training-agent): comply_test_controller seeds on the inventory tenants, sharded storyboard CI #9150 floors after fix(training-agent): inventory update_media_buy answers NOT_CANCELLABLE to a second cancel #9163: 164 clean on both tenants, 236 and 218 passed steps.

Storyboard effect

media_buy_seller/metric_container_subsumption on /inventory-adserver, locally: 7P / 1F / 2S, up from 5P / 1F. Both required_metrics phases pass: the container satisfies [viewable_rate, viewed_seconds], and the leaf-only product is excluded.

It still isn't clean. Its requested_metrics phase drives delivery with simulate_delivery, which the inventory tenants don't serve (#9151), and that step fails UNKNOWN_SCENARIO. It goes clean once #9151 lands.

Test plan

  • New test on season products:
    • required_metrics: [completed_views] keeps only the two pre-roll products;
    • [viewable_rate] matches nothing, because the season declares the viewable_impressions leaf, not the container;
    • an empty list is no filter.
  • New test on seeded products: a viewability-container product and a viewable_rate-only product both match [viewable_rate]; only the container matches [viewable_rate, viewed_seconds].
  • Both new tests fail without the change. Inventory suite: 37/37.
  • npm run typecheck.
  • CI, then floors set from this head's result.

🤖 Generated with Claude Code

get_products on the inventory tenants ignored filters.required_metrics.
Keep only products whose reporting_capabilities report every required
metric, under the same container rule as the sales tenant (exported
reportingMetricIsAvailable): a declared viewability container covers its
numeric leaves, quartile_data its quartiles, and a leaf never covers a
sibling. Filter, never fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 22, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — app-only change to the training-agent inventory simulator.

Ports the sales tenant's required_metrics filter into the inventory-sim platform, reusing the container-subsumption rule exported as reportingMetricIsAvailable from task-handlers.ts. The new reportsAllMetrics helper mirrors the inline sales-tenant logic (task-handlers.ts:12047-12052) verbatim and is fail-closed: a product with no reporting_capabilities yields an empty declared set and is excluded; an empty required_metrics array is a no-op, matching the sales path. Both new tests cover season and seeded products and exercise container-vs-sibling-leaf semantics.

No static/schemas/source/**, docs/reference/**, dist/**, or migration files touched — app-only (training-agent), so no changeset required. No high-risk paths, no gated paths, no author-team gate. No Critical/High/Medium findings.

Decision table: rows 1–8 do not fire (no findings, gated_paths false, high_risk false, no team gate, zero medium findings). Falls through to row 9 — approve.

Run 45014175480 on bff25f1: /inventory-adserver 164 clean, 238 passed
steps; /inventory-content 164 clean, 220 passed steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Escalate to human review

Escalate — gated path requires human/CODEOWNERS approval.

This PR modifies .github/workflows/training-agent-storyboards.yml, which matches the hard approval gate glob .github/workflows/** (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is not satisfied (decision table row 2). The outcome must be escalate until a real human/CODEOWNERS approval lands.

Escalation reasons:

  • .github/workflows/training-agent-storyboards.yml is under a hard approval gate (.github/workflows/**) and review_decision is REVIEW_REQUIRED — human/CODEOWNERS review required.

Findings: None. The delta (CI floor bumps 163→164 / 235→238 / 217→220 plus an in-scope patch changeset) is clean and mechanically correct; the changeset is correctly required by the protocol-scope check and patch is the right bump for a non-breaking fail-closed floor raise. The prior pass was a clean approve with no blockers. There are no new critical/high/medium findings — this escalation is purely the deterministic gated-paths gate, not a code concern.

Why human review

  • .github/workflows/training-agent-storyboards.yml is under a hard approval gate (.github/workflows/**) and review_decision is REVIEW_REQUIRED — human/CODEOWNERS review required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/training-agent-storyboards.yml (modified) matches .github/workflows/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Nov 22, 2026
@bokelley

Copy link
Copy Markdown
Contributor Author

Admin merge at edc1da9, authorized by @bokelley, the PR author, who therefore can't supply the required approval. All 61 checks pass, no review threads are open, and Ladon reported no findings; it escalated only for the .github/workflows/** gate. This is the same route as #9146 and #9150.

@bokelley
bokelley merged commit ab48f0c into main Nov 22, 2026
63 checks passed
@bokelley
bokelley deleted the fix/inventory-required-metrics branch November 22, 2026 13:27
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
…dcontextprotocol#9169, adcontextprotocol#9171)

Brings in adcontextprotocol#9169 (inventory get_products filters by required_metrics;
the inventory storyboard floors rise) and adcontextprotocol#9171 (accept_proposal and
create_media_buy refuse a mismatched terms digest with
PROPOSAL_TERMS_CHANGED; compact_product_lifecycle gains its 11th step).

Resolution ledger:
- mechanical: none.
- semantic: none. git merged the four files both sides changed with no
  conflicts, and the hunks are disjoint:
  - scripts/run-storyboards-matrix.sh: main raises the
    compact_product_lifecycle exact count to 11 steps; this branch's
    changes are the queue and the build cache.
  - server/src/training-agent/task-handlers.ts: main changes the
    terms-digest checks and exports reportingMetricIsAvailable; this
    branch's changes are the imports and the lazy product-discovery
    input schemas.
  - server/src/training-agent/tenants/tenant-smoke.test.ts and
    server/tests/unit/training-agent-inventory-tenants.test.ts: main
    adds tests beside this branch's loopback-server and reset changes.
- The CI-only inventory floors in training-agent-storyboards.yml come in
  unchanged; the local pre-push queue has no inventory floors.

Checks on the merge result:
- npm run typecheck: pass.
- node --test tests/compact-product-lifecycle-storyboards.test.cjs
  tests/run-storyboards-sharding.test.cjs: pass.
- node scripts/precommit-server-unit.cjs --full: 867 files, 14,718
  tests, 31 skipped. Before the merge: 14,716; adcontextprotocol#9169 adds two tests.
  One test failed at load 112: the cold-worker exact-inference test,
  whose child hit that test's 25 s kill. Neither merged PR touches it,
  and main has the same 25 s kill.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 3 commits from main: adcontextprotocol#9123 (deprecates the single-value
branch of 17 scalar-or-list unions and fixes the bundler so call-site
keys beside a $ref stay at the call site), adcontextprotocol#9169 (training agent
inventory floors) and adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED for a mismatched
accept_proposal digest).

Resolution ledger

Mechanical files, resolved by rule:
- package.json (conflicted): the test list keeps both sides' entries,
  test:schema-named-constraints from this branch and
  test:build-schemas-exit-status from main. 119 entries, each defined.
- tests/mcp-schema-projection.test.cjs (auto-merged, failed the gate):
  the parity compile limit is the measured comply_test_controller
  projection rounded up to the next 1,000 bytes. Main's deprecation
  descriptions and the new error code bring main's controller from
  1,350,376 to 1,351,064 bytes; this branch's named schemas still add
  79,135, so the merged controller measures 1,430,199 and the limit
  moves from 1,430,000 to 1,431,000.

Semantic files, union of both sides:
- brand.json color_value, brand/get-brand-identity-response.json
  colors (5 sites), error-details/requote-required.json envelope_field:
  this branch's $ref to core/hex-color.json or
  #/definitions/envelope_field_path is kept, and main's deprecated,
  x-deprecated-in, x-removed-in and deprecation description sit beside
  it on the single-value branch. brand.json keeps x-removed-in 5.0.0;
  the others keep 4.0.0. The referenced definitions carry no
  deprecation, so the array branches and the other sites that reference
  them are not deprecated.
- media-buy/accept-proposal-request.json proposal_terms_digest: this
  branch's $ref to core/proposal-terms-digest.json with main's longer
  description from adcontextprotocol#9171.

Proof:
- Schema equivalence, origin/main -> merge, with the delta manifest:
  3,056 entries at 41 sites and 4,255 informational entries, the same
  as the branch against its previous merge base; the manifest matches,
  41/41 witnesses pass, and no corpus instance changes verdict.
- The annotation channel at source level is the union of both sides:
  each of main's 77 annotation changes (title, description, default,
  deprecated, x-*) lands at the same document and pointer in the merge,
  and each of this branch's 1,636 stays relative to main.
- Bundles: the 81 single-value deprecation nodes in the bundled schemas
  sit at the same pointers with the same keys as main's build, and none
  moves onto a shared definition.
- Inline pattern and enum counts stay at 83 and 471, and the $ref count
  is unchanged.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form
of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors),
adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11
overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs),
adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot).

Resolution ledger:
- package.json (conflicted): test:schemas keeps both sides' entries,
  the two equivalence tests from this branch and
  tests/oneof-overlap-resolution.test.cjs from main, at main's
  position. Main's test:build-schemas-exit-status auto-merged. Every
  test file it names exists. The version (3.3.0-rc.3) is main's.
- package-lock.json: main's (version field only).
- Invariants: no code change needed. The oneof check at the merged
  tree reports 223 reachable oneOfs, P 219, W 4, U 0, the same as main
  at 14651cc; adcontextprotocol#9170 resolves 12 of the 16 witnessed overlaps
  (main at 2db59ba, after adcontextprotocol#9123, still has 16). The 4 left are the either/or unions adcontextprotocol#9170 leaves for
  adcontextprotocol#8191. The construct catalog still reports its 37 known false
  alarms and no misses, and tests/oneof-overlap-resolution.test.cjs
  passes (38 of 38).
- Proof: schema equivalence of the merged tree against 14651cc:
  1113 roots, 0 differ, class 1, no informational entries.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form
of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors),
adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11
overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs),
adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot).

Resolution ledger:
- package.json (conflicted): test:schemas keeps both sides' entries,
  the five lint tests from this branch and
  tests/oneof-overlap-resolution.test.cjs from main, at main's
  position. Main's test:build-schemas-exit-status auto-merged. Every
  test file it names exists. The version (3.3.0-rc.3) is main's.
- package-lock.json: main's (version field only).
- Baseline: adcontextprotocol#9170's error-branch guards are local refs to #/oneOf/0,
  which the schema-path lint reports as ref-local-not-defs. They are
  main's schemas, so the seven findings are recorded in
  scripts/lint-schema-paths-baseline.json with --update-baseline
  rather than changed here:
  - adagents.json#/oneOf/1/not/$ref
  - content-standards/{calibrate-content,create-content-standards,
    get-content-standards,get-media-buy-artifacts,
    list-content-standards,validate-content-delivery}-response.json
    #/oneOf/1/not/$ref
  Schema paths go from 593 to 600. The other four lints are unchanged:
  enum values 58, property names 820, value lists 24,
  x-adcp-validation 337.
- Proof: schema equivalence against 14651cc: 1113 roots, 0 differ,
  class 1; 158 informational x-adcp-validation entries at 18 sites,
  as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant