Skip to content

bundled outputs: dedup provenance.json (file-size inflation, non-blocking) #4875

Closed

Description

@bokelley

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

Options (need a design call)

  1. Strip sibling description before 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).
  2. Identity-based hoist ($ref target identity, not shape match). Preserves call-site descriptions, hoisted $defs entry carries its own. Cost: JSON Schema draft-07 (what AdCP uses) treats sibling keywords with $ref as 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.
  3. 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

Activity

  1. added
    enhancement
    schema
    claude-triaging
    on May 20, 2026
  2. bokelley commented on May 20, 2026

    @bokelley
    ContributorAuthor

    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

  3. added
    claude-triaged
    and removed
    claude-triaging
    on May 20, 2026
  4. added
    release:3.1-candidate
    on May 30, 2026
  5. bokelley commented on May 30, 2026

    @bokelley
    ContributorAuthor

    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.

  6. added
    claude-triaging
    and removed
    claude-triaged
    on May 30, 2026
  7. bokelley commented on May 30, 2026

    @bokelley
    ContributorAuthor

    Triage

    Classification: Feature request
    Bucket(s): schema
    Status: ready-to-implement
    Milestone: Spec Backlog (release:3.1-candidate label signals 3.1 target)

    What the experts said:

    • ad-tech-protocol-expert: Sound — replacing 94 inline copies with $defs/Provenance + 94 $ref-siblings is non-normative under JSON Schema draft-07 (sibling keywords alongside $ref are ignored by validators); wire contract unchanged; --empty changeset (bundler tooling, not a published spec surface).
    • code-reviewer: Feasible but NOT via x-adcp-hoist: true on provenance.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 within scripts/build-schemas.cjs and 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:

    • Add hoistBySourceIdentity(schema, sourceDir, refPaths) to scripts/build-schemas.cjs as a pre-inline pass before resolveRefs. It reads provenance.json's body, writes it to schema.$defs.Provenance, then replaces every {"$ref": "/schemas/core/provenance.json", ...siblings} with {"$ref": "#/$defs/Provenance", ...siblings} — preserving all sibling keys including per-call-site description.
    • $defs/Provenance carries provenance.json's own description (not a call-site value); the call-site description stays as a $ref-sibling.
    • Changeset: --empty (bundler-only, no protocol-spec impact).
    • Tests: 5 cases in a new 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.
    • No source schema edits; no dist schemas need manual changes.

    Triaged by Claude Code. Session: https://claude.ai/code/cse_01jws6xqfvqfhttms11j6d5e1p


    Generated by Claude Code

  8. added
    claude-triaged
    and removed
    claude-triaging
    release:3.1-candidate
    on May 30, 2026
  9. modified the milestones: Spec Backlog, 3.2.0 on May 30, 2026
  10. bokelley commented on May 30, 2026

    @bokelley
    ContributorAuthor

    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.

  11. modified the milestones: 3.2.0, 3.3.0 on Aug 2, 2026
  12. added a commit that references this issue on Oct 8, 2026
    2de51b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-triagedenhancementschema

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions