feat(training-agent): metric-mode forcing function for clicks/reach/completed_views scenarios#4766
Merged
Merged
Conversation
…elivery for clicks/reach/completed_views Declares seller-level `media_buy.supported_optimization_metrics` (honest union across catalog products), validates `reach_unit` / `view_duration_seconds` against product capabilities on create_media_buy, and emits `cost_per_click` plus goal-gated `reach + frequency` / `completed_views + completion_rate` on get_media_buy_delivery. Flips three capability-gated storyboards from `not_applicable` to applicable: clicks_buy_flow, reach_buy_flow, completed_views_buy_flow. Same forcing-function shape as #4654 and #4664. Manual rollup pending adcp-client#1818 (SDK seller-level field exposure). Refs: #4637, #4642, #4654, #4664, #4722. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…r_click negative tests (PR 4766 review) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
media_buy.supported_optimization_metricson both surfaces (v5 legacy/mcphandler and v6TrainingSalesPlatform.capabilities) as the honest union across catalog products:[clicks, views, completed_views, engagements, reach].reach_unitagainst the product'smetric_optimization.supported_reach_unitsandview_duration_secondsagainstsupported_view_durationsoncreate_media_buy, returningINVALID_REQUESTwith literal JSONPath-liteerror.field. Mirrors the event_source_id / audience_id checks already in place.cost_per_click(always when clicks + spend > 0), plus goal-gatedreach + frequencyandcompleted_views + completion_rateonget_media_buy_delivery. Placeholder ratios documented inline (reach = floor(impressions / 3); completed_views = floor(impressions × 0.7)).optimization_goalsonPackageStateso delivery handlers can gate metric emission on what the buyer actually requested.Flips three capability-gated storyboards from
not_applicableto applicable on the training agent:clicks_buy_flow,reach_buy_flow,completed_views_buy_flow.Same forcing-function shape as #4654 (event_source validation + CPA) and #4664 (audience_buy_flow / event_dedup_flow). Manual declaration is required until adcp-client#1818 (SDK auto-rollup from product-level
supported_metrics) ships — that PR is blocked on the SDK exposing the seller-level field.Refs: #4637, #4642, #4654, #4664, #4722.
Test plan
npm run build:schemasnpm run build:compliancenpm run typechecknpx vitest run server/tests/unit/training-agent.test.ts— 382 tests pass (6 new)applicable(no longernot_applicable) against the training agent on the next compliance run🤖 Generated with Claude Code