Skip to content

fix(schema): define the duration unit vocabulary once in enums/duration-unit.json - #7481

Draft
bokelley wants to merge 1 commit into
mainfrom
chore/duration-unit-enum-7478
Draft

bokelley wants to merge 1 commit into
mainfrom
chore/duration-unit-enum-7478

Conversation

@bokelley

@bokelley bokelley commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Item 4 of #7478, split out of #7480.

Summary

Defines the duration unit vocabulary once in enums/duration-unit.json. core/duration.json#/properties/unit (previously an inline enum) and get_adcp_capabilities media_buy.frequency_capping.supported_window_units items (previously an untyped string) now reference it, so the value type and the capability that advertises it cannot drift. Accepted values are unchanged; supported_window_units now rejects strings outside the vocabulary its description already mandated.

  • scripts/lint-schema-enum-drift.cjs allowlists the intentional maximum_age narrowing in the two audience-evidence schemas (a campaign-relative evidence age is meaningless, so campaign is excluded on purpose).
  • tests/mcp-schema-analysis.test.cjs pinned counts move 622/168/117 → 629/169/118 for the one added shared definition.
  • static/schemas/source/index.json registers the enum next to reach-unit.
  • Patch changeset included.

Blocked on adcp-client-python

The "Generate Python SDK" job in validate-schema-bundle.yml fails on this branch with ImportError: cannot import name 'Unit' from 'adcp.types.generated_poc.core.duration'. src/adcp/types/aliases.py (line ~2109) imports Unit as DurationUnit from the inline enum this PR removes; the shared enum generates as adcp.types.generated_poc.enums.duration_unit.DurationUnit. tests/test_collision_aliases.py also lists ("DurationUnit", "core.duration", "Unit"). The SDK needs to point both at the new module (or accept either) before this can merge. Opened as a draft until that lands.

Coordination with #7438

mesa-verde adds core/frequency-cap-duration-unit.json with the same five values and bumps the same pinned counts in tests/mcp-schema-analysis.test.cjs. Whichever lands second should reference enums/duration-unit.json and re-pin.

Testing

node scripts/lint-schema-enum-drift.cjs, node tests/schema-validation.test.cjs, node --test tests/mcp-schema-analysis.test.cjs tests/mcp-schema-projection.test.cjs, npm run test:openapi, npm run test:sdk-response-conformance, npm run test:json-schema, npm run typecheck, node scripts/check-changeset-protocol-scope.cjs origin/main, npx @changesets/cli status --since=origin/main: all pass locally.

🤖 Generated with Claude Code


Open workspace in Conductor

Draft disposition — 2026-10-09

This draft is retained for the stated workstream. Continue on this existing branch; no parallel PR is needed. This disposition does not waive CI, review, migration, or release gates.

…on-unit.json

Item 4 of #7478. core/duration.json#/properties/unit and get_adcp_capabilities
media_buy.frequency_capping.supported_window_units items now reference the
shared enum instead of an inline copy / untyped string. The enum-drift lint
allowlists the intentional maximum_age narrowing (evidence age excludes
"campaign") and the MCP schema-analysis pinned counts move 622/168/117 ->
629/169/118 for the one added shared definition.

Depends on adcp-client-python updating src/adcp/types/aliases.py: it imports
`Unit as DurationUnit` from generated_poc.core.duration, and this change
generates that enum as enums/duration_unit instead.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bokelley
bokelley force-pushed the chore/duration-unit-enum-7478 branch from b41c6dc to 64a7312 Compare September 23, 2026 16:08

Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto current main at 64a73124cfe994155409d4c3168e02394fbc34f5.

The refresh also folds in the newer structured frequency-cap schemas: core/duration, capability supported_window_units, frequency-cap requirements, and interval constraints now all reference the single enums/duration-unit.json vocabulary, and the superseded core/frequency-cap-duration-unit.json duplicate is removed.

Validation completed locally:

  • full npm run test:schemas (302 schema-contract tests plus premium-display and geo suites)
  • npm run typecheck
  • MCP schema analysis (6/6)
  • generated MCP safety/parity projection focused gate
  • enum-drift lint
  • changeset scope/status checks
  • git diff --check

The generated compliance projection initially crossed its 1.25 MB parity ceiling by 388 bytes because the shared enum carried verbose annotations at every expanded reference. I kept the enum description concise; the rebuilt projection is 1,249,953 bytes and the safety gate passes.

Keeping this draft until the Python compatibility prerequisite, adcontextprotocol/adcp-client-python#1213, actually merges. That PR is approved, current, and fully green with auto-merge armed, but GitHub still reports its branch-protection state as blocked.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant