Repository navigation
Description
Background
Spun off from #4859 / #4867. PR #4867 fixes the codegen-crashing duplication (data-provider-signal-selector) via x-adcp-hoist. This issue tracks a separate, non-blocking dedup opportunity in the same bundled outputs.
Observation
provenance.json is $ref'd ~94 times across the schema source (creative manifest, all 18 asset types, content-standards artifact at multiple positions, index.json, etc.). After bundling, these become ~94 fully inlined copies — accounting for the majority of tasks-get-response.json's 79k-line size.
hoistMarkedSchemas() (used in #4867) cannot collapse these directly: each call site attaches a different description as a sibling to the $ref, e.g.:
creative-manifest.json: "Serves as the default provenance for all assets in this manifest…"card-asset.json: "Provenance metadata for this card, overrides manifest-level provenance."zip-asset.json: "Provenance metadata for this asset, overrides manifest-level provenance"
After inline resolution these become distinct shapes, and the same-title/different-shape guard correctly rejects hoisting them.
Impact
- No codegen crash (unlike 3.1.0-beta.1 bundled mega-schemas fully inline duplicated structures, breaking downstream codegens #4859). datamodel-code-generator handles these without fabricating discriminators.
- File-size only:
bundled/core/tasks-get-response.jsonis ~300× larger than 3.0 (79,505 vs 262 lines). Bandwidth + parse cost for adopters who consume bundled outputs. - Adopter friction for anyone reading the bundle manually.
Options (need a design call)
- Strip sibling
descriptionbefore hoist comparison. Mechanically works. Cost: loses per-call-site context that's there on purpose ("overrides manifest-level provenance" is real semantic information for adopters). - Identity-based hoist (
$reftarget identity, not shape match). Preserves call-site descriptions, hoisted$defsentry carries its own. Cost: JSON Schema draft-07 (what AdCP uses) treats sibling keywords with$refas ignored — so per-call-site descriptions are technically informational only on the wire today, but adopters/tools may rely on them anyway. Changing this is a schema-semantics call. - Leave it, document in 3.1 migration notes. Bundled-output consumers learn to either consume per-resource schemas or accept the inflation.
Recommendation
Probably option (2): identity-based hoist with the bundler re-attaching the per-site description as a $ref-sibling at the call site, hoisted entry holds the schema's own description. This is the lowest-loss path but needs protocol review on whether we want to keep relying on the draft-07 sibling-ignore behavior or migrate the convention.
Cross-references
- 3.1.0-beta.1 bundled mega-schemas fully inline duplicated structures, breaking downstream codegens #4859 — original codegen-break bug
- fix(bundled): add x-adcp-hoist to data-provider-signal-selector to fix codegen discriminator fabrication #4867 — fix for the crash-causing case (
data-provider-signal-selector)
Activity
bokelley commentedon May 20, 2026
Triage
Classification: Feature request
Bucket(s): schema
Status: deferred
Blocked-on: #4867 — resurfaces on merge
The design call (identity-based hoist vs. strip-sibling-description vs. document-and-move-on) needs the bundler work in #4867 as context and would materially expand that PR's scope if folded in. Parking here until #4867 lands.
Triaged by Claude Code. Session: https://claude.ai/code/cse_01PbstLaw13qiJQJAoEiiuVG
Generated by Claude Code
bokelley commentedon May 30, 2026
Flagging as 3.1-candidate if it is a mechanical bundled-output cleanup only. It is non-normative and should be safe to knock out before ship if the diff is limited to deduping generated provenance schema output and the schema build/tests stay green.
bokelley commentedon May 30, 2026
Triage
Classification: Feature request
Bucket(s): schema
Status: ready-to-implement
Milestone: Spec Backlog (
release:3.1-candidatelabel signals 3.1 target)What the experts said:
$defs/Provenance + 94 $ref-siblingsis non-normative under JSON Schema draft-07 (sibling keywords alongside$refare ignored by validators); wire contract unchanged;--emptychangeset (bundler tooling, not a published spec surface).x-adcp-hoist: trueonprovenance.json—hoistMarkedSchemas()Pass 2 drops all sibling keys and would silently delete all 24 call-site descriptions. Requires a distinct pre-inline pass; ~160 lines + 5 new test cases, entirely withinscripts/build-schemas.cjsand its test file.My take: #4867 has merged, unblocking this. Both experts converge: the change is non-normative, appropriately scoped, and fits 3.1. The implementation is slightly larger than "mechanical cleanup" (~160 lines + tests), so this lands as a ready-to-implement brief rather than an auto-PR.
Implementation scope:
hoistBySourceIdentity(schema, sourceDir, refPaths)toscripts/build-schemas.cjsas a pre-inline pass beforeresolveRefs. It readsprovenance.json's body, writes it toschema.$defs.Provenance, then replaces every{"$ref": "/schemas/core/provenance.json", ...siblings}with{"$ref": "#/$defs/Provenance", ...siblings}— preserving all sibling keys including per-call-sitedescription.$defs/Provenancecarriesprovenance.json's own description (not a call-site value); the call-sitedescriptionstays as a$ref-sibling.--empty(bundler-only, no protocol-spec impact).tests/build-schemas-hoist-by-identity.test.cjs— basic hoist, sibling description preserved, multiple distinct call-site descriptions, internal refs resolved post-inline, no-op on absent ref.Triaged by Claude Code. Session: https://claude.ai/code/cse_01jws6xqfvqfhttms11j6d5e1p
Generated by Claude Code
bokelley commentedon May 30, 2026
Leaving this for 3.2. It is non-blocking file-size/provenance-bundling cleanup and needs a bundling semantics decision rather than a quick 3.1 patch.
perf(schema): hoist provenance into bundled $defs (adcontextprotocol#…