Skip to content

feat(schema): report audience size as a range on sync_audiences - #8024

Merged
bokelley merged 1 commit into
mainfrom
bokelley/audience-size-range
Oct 8, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/audience-size-range

Conversation

@bokelley

@bokelley bokelley commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements part 1 of #8023: audience size fields on sync_audiences. Audience overlap (part 2 of the RFC) is not included and follows separately.

A buyer syncing one CRM list to several platforms needs to know how many people each platform reached and how many it can serve now. Platforms report size as an interval, an approximation, or a bucket, and not all report a matched count, so a seller today has to invent a point value for matched_count. This adds a range-with-precision shape for size and says where the existing counts may be absent.

Field evidence from #8023 (all are in the PR body only; the normative schema text names no vendor, per docs/spec-guidelines.md):

  • Meta: approximate_count_lower_bound / approximate_count_upper_bound, no matched count or match rate.
  • Google Customer Match: size_for_display / size_for_search, bucketed size_range_*, match_rate_percentage.
  • LinkedIn: approximate audienceSize and rolling-7-day matchedCount.
  • Snap: approximate_number_users. X: audience_size. Pinterest: size.

What changed

New shared definitions (defined once, so #5966 and #7763 can reuse them):

  • core/audience-size.json: { lower_bound, upper_bound, precision, as_of? }. lower_bound, upper_bound, precision required; integers >= 0; as_of is date-time. upper_bound >= lower_bound always, and lower_bound == upper_bound when precision is exact (documented as MUST; JSON Schema draft-07 cannot compare two fields).
  • enums/audience-size-precision.json: exact | approximate | bucketed.
  • enums/audience-match-rate-basis.json: platform_reported | derived.
  • All three registered in static/schemas/source/index.json.

media-buy/sync-audiences-response.json, each per-audience result, new optional fields:

  • audience_size ($ref core size): people matched on the platform.
  • targetable_size ($ref core size): people the platform can serve now.
  • match_rate_basis ($ref enum): describes effective_match_rate.

Description-only clarifications (no type, range, or required change):

  • matched_count and effective_match_rate: MAY be absent when the seller cannot report them; buyers MUST NOT read absence as zero.
  • Size MUST NOT be disclosed below the seller minimum: audience_size and targetable_size are omitted when status is too_small, which stays governed by the existing too_small status and minimum_size. The existing too_small semantics (including matched_count) are untouched.
  • enums/audience-status.json ready description no longer says the counts are always populated, so it does not contradict the above.

Docs and tests:

  • docs/media-buy/task-reference/sync_audiences.mdx: new field rows, an "Audience size" section with a short example, and an updated ready status row.
  • tests/audience-size-range.test.cjs (wired into test:schemas): shared $ref shape, required/optional, valid and malformed size objects, size without matched_count, pre-3.3 results still valid, and the MUST wording.
  • .changeset/audience-size-range.md: minor, adcontextprotocol.

Additive and non-breaking

Nothing is renamed, removed, or made required, and no existing type changes. A message without the new fields validates as before. The only 3.2 messages affected are ones that already used audience_size, targetable_size, or match_rate_basis on an audience result with a different shape (these results allow additional properties, so such a use was legal), the same class of exception as dooh_placement_attributes.location in the 3.3 notes.

Not in this PR

Judgment calls for review (#8023 is needs-wg-review)

  1. Stable, not x-status: experimental. The issue does not ask for experimental. If the WG wants it incubated through 3.3, it is one flag on each new field.
  2. Design question 2 (per-surface targetable_size) is answered with the simplest default: one value, surface left to the seller. A per-surface breakdown can be added later as a separate optional field.
  3. Sizes are omitted on too_small (the issue says "not disclosed"). That is stated as prose MUST, not as an if/then schema rule, to keep the change strictly additive.
  4. as_of is optional, per the issue's required-property list.

Validation

Run from a fresh clone of main at 0efa4bee05 plus this branch; every command exited 0:

  • node --test tests/audience-size-range.test.cjs (8 tests)
  • npm run test:schemas (includes the new test), test:platform-agnostic, test:schema-utf8, test:composed, test:examples, test:contracts, test:audience-external-sources, test:build-schemas-hoist-enums, test:oneof-discriminators, test:error-codes, test:doc-compliance-drift, test:dist-schema-version-ids, test:mcp-schema-projection
  • npm run build:schemas, node scripts/build-compliance.cjs --check, npm run lint:schema-links, npm run check:x-entity-gaps, npm run test:docs-nav, npm run test:owned-links, npm run typecheck
  • node tests/json-schema-validation.test.cjs --file and node tests/snippet-validation.test.cjs --file on sync_audiences.mdx
  • node scripts/check-changeset-protocol-scope.cjs origin/main and changesets status --since=origin/main

Not run: the full npm test and npm run build aggregate (training-agent runtime, hosted storyboards), which this schema-and-docs change does not touch; CI is the check.

Refs #8023

🤖 Generated with Claude Code

Add optional audience_size and targetable_size to each sync_audiences
audience result, both using one new shared core/audience-size.json
object (lower_bound, upper_bound, precision, optional as_of), and an
optional match_rate_basis (platform_reported | derived) qualifying
effective_match_rate. Clarify that matched_count and effective_match_rate
MAY be absent and buyers MUST NOT read absence as zero, and that size is
never disclosed below the seller minimum (too_small stays authoritative).

Additive and non-breaking. Part 1 of #8023; audience overlap follows
separately.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@bokelley bokelley added schema JSON Schema source-of-truth: definitions, codegen artifacts, validation, hygiene media-buy Issue concerns the media-buy protocol domain labels Oct 8, 2026
@bokelley bokelley added this to the 3.3.0 milestone Oct 8, 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: Escalate to human review

Escalate — gated paths touched and review not yet approved.

This is an additive, non-breaking sync_audiences size-reporting change: new optional audience_size/targetable_size (shared core/audience-size.json), new match_rate_basis, and matched_count/effective_match_rate relaxed to MAY-be-absent. The reviewer found a correct minor changeset, coherent schema↔docs, new enums registered in index.json, no new undiscriminated oneOf, no dist mutation, and a thorough validation test wired into test:schemas. No blocking or Medium findings.

However, the diff touches files under static/schemas/source/**, which are under a hard, deterministic approval gate (gated_paths: true), and review_decision is REVIEW_REQUIRED (not APPROVED). Per decision rule row 2, the outcome must be escalate until a human/CODEOWNERS approval satisfies the gate.

Escalation reasons

  • Touches gated protocol-source files (static/schemas/source/core/audience-size.json, .../enums/audience-match-rate-basis.json, .../enums/audience-size-precision.json, .../enums/audience-status.json, .../index.json, .../media-buy/sync-audiences-response.json) under the static/schemas/source/** hard approval gate; review_decision is REVIEW_REQUIRED. Human/CODEOWNERS review is required before merge.

No code-level concerns block this PR — it is clean on the merits. The gate lifts once review is approved.

Why human review

  • Gated paths: PR modifies files under static/schemas/source/** (protocol source of truth) while review_decision is REVIEW_REQUIRED, not APPROVED. Human/CODEOWNERS review required per hard approval gate (row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/audience-size.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-match-rate-basis.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-size-precision.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-status.json (modified) matches static/schemas/source/**; static/schemas/source/index.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-audiences-response.json (modified) matches static/schemas/source/**) 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 Oct 8, 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: Escalate to human review

Escalate — gated path change requires human/CODEOWNERS approval.

This PR touches static/schemas/source/**, which is under a hard, deterministic approval gate (gated_paths: true), and review_decision is REVIEW_REQUIRED — not APPROVED. Per decision rule row 2, the outcome must be escalate until a real human/CODEOWNERS approval lifts the gate.

The change itself is clean and additive: adds optional audience_size/targetable_size (shared core/audience-size.json) and match_rate_basis to each sync_audiences result, plus two new enums. Nothing renamed, removed, or made required. Reviewer verified schema↔docs coherence (sync_audiences.mdx table, "Audience size" section, and ready status row all match the schema), correct minor changeset for a non-breaking protocol-surface addition, no new undiscriminated oneOf, additionalProperties: true per DR-0009, no dist/** edits, and a new test wired into test:schemas. No blocking or medium findings.

Despite the clean diff, auto-approve is not available: the gated-paths rule is non-overridable and requires explicit approval review status.

Escalation reasons

  • Touches gated schema source files (static/schemas/source/core/audience-size.json, two new enums, and modifications to audience-status.json, index.json, sync-audiences-response.json); review_decision is REVIEW_REQUIRED. Human/CODEOWNERS review required to satisfy the hard approval gate.

Why human review

  • Gated paths touched (static/schemas/source/**) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required to lift the hard approval gate.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/audience-size.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-match-rate-basis.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-size-precision.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-status.json (modified) matches static/schemas/source/**; static/schemas/source/index.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-audiences-response.json (modified) matches static/schemas/source/**) 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 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 paths touched without an approving review.

This PR modifies the protocol source of truth under static/schemas/source/** (3 added files, 3 modified), which is under a deterministic hard approval gate (gated_paths: true). review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is not satisfied (decision table row 2).

No blocking findings. The reviewer found no Critical/High/Medium issues: the change is cleanly additive — optional audience_size/targetable_size (shared core/audience-size.json) and match_rate_basis on each sync_audiences result, plus two new enums. Schema↔docs coherence verified, correct minor changeset for an additive change, no new undiscriminated oneOf, no dist/** edits. The matched_count/effective_match_rate loosening is prose-only against fields never in required[], so no wire-validation change and every prior message stays valid.

Escalation reasons:

  • Touches gated path(s) static/schemas/source/core/audience-size.json, .../enums/audience-match-rate-basis.json, .../enums/audience-size-precision.json, .../enums/audience-status.json, .../index.json, .../media-buy/sync-audiences-response.json — human/CODEOWNERS review required (review_decision is REVIEW_REQUIRED, not APPROVED).
  • This is a Normative (additive) protocol change to the published wire surface; ratification is a human act per the constitution's decision-class gate.

Once a human/CODEOWNERS approval lands, the diff is clean and should fall through to approve.

Why human review

  • Gated paths touched (static/schemas/source/**) with review_decision=REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required (decision rule row 2)
  • Normative protocol change to the published wire surface (new optional fields + two new enums on sync_audiences); per the constitution's decision-class gate, normative ratification is a human act
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/audience-size.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-match-rate-basis.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-size-precision.json (added) matches static/schemas/source/**; static/schemas/source/enums/audience-status.json (modified) matches static/schemas/source/**; static/schemas/source/index.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-audiences-response.json (modified) matches static/schemas/source/**) 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.

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. media-buy Issue concerns the media-buy protocol domain schema JSON Schema source-of-truth: definitions, codegen artifacts, validation, hygiene

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant