Skip to content

build(schemas): fail CI when a minor release makes a non-additive schema change - #8502

Merged
bokelley merged 3 commits into
mainfrom
build/additive-minor-check
Oct 26, 2026
Merged

bokelley merged 3 commits into
mainfrom
build/additive-minor-check

Conversation

@KonstantinMirin

@KonstantinMirin KonstantinMirin commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

AdCP promises that a minor release only adds to the protocol. Some published schemas break that promise. This pull request adds a continuous integration (CI) check that fails when a schema change breaks it.

If you know protobuf tooling, this is the JSON Schema counterpart of buf breaking, closest to its WIRE_JSON category. It compares the schemas against the last stable release and fails on changes that break existing payloads, such as a removed field, a narrowed type or a removed enum value. Experimental schemas are exempt, much as ignore_unstable_packages skips alpha and beta packages.

It adds one rule protobuf doesn't need. In protobuf, adding a field never breaks a receiver, because unknown fields are kept. In JSON Schema, a closed object rejects unknown fields, so adding one breaks older validators. It also checks constraints that buf breaking leaves to other tools, such as newly required fields and tighter bounds.

Why

Many AdCP schemas are closed. A closed schema tells a validator to reject any field it doesn't recognize. In JSON Schema, additionalProperties: false closes an object.

Some buyers validate each response against the schemas of the release they built for. Suppose that a minor release adds an optional field to a closed schema. A seller on the later release sends that field. The buyer's validator doesn't recognize the field, so it rejects the whole response. The buyer changed nothing, yet its integration stops working.

Two published schemas show the pattern:

  • The brand reference (brand-ref) has been closed since 3.0. Release 3.1 added brand_kit_override to it, and 3.2 added countries. A buyer that validates against 3.0 rejects a brand reference that carries either field.
  • The account reference (account-ref) has a closed form that names an account by brand and operator. Release 3.2 added currency, timezone, and operator_unit to that form.

The following table counts the non-additive changes between consecutive releases. It leaves out experimental surfaces. Most of the changes are fields added to closed objects.

Release pair Non-additive changes Files affected
3.0.0 → 3.1.0 79 33
3.1.0 → 3.2.1 70 31
3.2.1 → 3.2.7 0 0
3.2.7 → 3.3.0-beta.0 41 23
3.3.0-beta.0 → main 17 12

Release 3.2.0 was withdrawn, so the 3.2 line starts at 3.2.1. The patch lines add a few more: 8 changes from 3.0.0 to 3.0.28, and 2 from 3.1.0 to 3.1.29.

What changes

The check, lint-additive-minor.cjs, runs in the build check job. It works as follows:

  • It compares the schema source with the last stable release in the same major line. On main, that release is 3.2.7.
  • It fails on a change that an implementation validating against that release can reject. It recognizes nine kinds of change, listed after these bullets.
  • A baseline records the 58 cases already on main. The baseline can only shrink, so a pull request that adds an entry fails.
  • It exempts schemas marked x-status: "experimental". The versioning policy classes experimental-only changes as patch-level.
  • A history mode runs the same comparison across the 3.x releases. It produced the earlier table.

The check fails on these kinds of change:

  • A property added to a closed object
  • A property removed
  • A property made required
  • A type narrowed
  • An enum value removed
  • A constant changed
  • A numeric bound tightened, such as a lower maxLength
  • An object closed with additionalProperties: false
  • A schema file or $id removed without an alias

The check has these known limits:

  • It reads JSON Schema keywords only. It doesn't see a rule that exists only in prose.
  • A property that moves to another nesting level appears as a removal and an addition.
  • It pairs oneOf and anyOf branches by heuristic. It skips a branch that it can't pair safely.
  • It ignores an added pattern, format, or uniqueItems, and an enum added where any value was allowed.

Compatibility impact

  • No schema, wire format, or published artifact changes. The change is tooling only, so it carries no changeset.
  • The build check job gains one step, which runs in under two seconds.
  • A recorded decision, DR-0019, says that adding an optional field to a closed schema counts as a minor change. This check fails exactly that change.
  • Merging this check therefore means that the working group (WG) updates DR-0019. Issue Minor releases sometimes break older buyers, and our versioning rules disagree about whether that's allowed #8501 explains why.
  • The 58 baseline entries are changes on main that are planned for 3.3.0. Each entry carries the reason "pending WG decision". The WG can resolve each entry before release.

Test plan

  • All 35 unit tests pass. Each of the nine kinds has one test that applies a single change to a valid fixture.
  • Negative tests pass for a field added to an open object, a schema file added, and a change inside an experimental schema.
  • A test confirms that the check reads closure from the older release, not the newer one.
  • A test confirms that the baseline can only shrink.
  • Three deliberate faults each fail their matching test: reading closure from the newer release, removing the experimental exemption, and reversing a bound's direction.
  • The check passes on main with 58 recorded changes and 0 unrecorded ones.
  • The shrink-only check passes against the target branch's baseline.
  • History mode lists the brand-ref and account-ref additions.
  • The test registration check passes, so CI runs the test file.
  • The build check on this pull request passes.

…ema change

Add scripts/lint-additive-minor.cjs. It compares two schema trees and
reports every change that a validator pinned to the base release rejects:
a property added to a closed object, a property removed, a newly required
property, a narrowed type, a removed enum value, a changed const, a new
enum, a tightened bound, an added pattern or format, additionalProperties
closed, and a removed schema file. Changes it cannot classify reliably are
reported for review and never fail.

CI compares static/schemas/source with the latest stable release of the
same major line. It fails on any violation that
scripts/lint-additive-minor-baseline.json does not record. The baseline
holds the 64 current violations against 3.2.7, each with the reason
"pending WG decision". On pull requests the baseline may only shrink
relative to the target branch.

--history runs the comparison across the 3.x releases.
The required-added rule compared only a node's own `required` list. A name
that the base already required through an `allOf` entry, or on the schema
enclosing a composition branch, was reported as newly required. History
showed 12 such false violations in `core/format.json` from 3.0.0 to 3.1.0.

Add tests for both cases, and a test that reads closure from the base, so
opening an object while adding a property still fails. Correct the header,
which claimed the check reports every change a pinned validator rejects.
…or check

Skip any base schema marked x-status experimental, or in a file whose
root is, because the versioning policy classes experimental-only changes
as patch-level. The baseline drops six entries, from 64 to 58.

Keep only the violations that break an implementation pinned to the
older release. Remove the review findings, union expansion, the
patternProperties exemption, the moved-out-of-composition branch,
--update-baseline, and the enum-introduced, pattern-added, and
format-added kinds. Bound checks cover numeric bounds only.

Keep one single-fault test per kind, and split the baseline entry test
into a reason test and a kind test.

@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 requires human/CODEOWNERS approval.

This PR modifies .github/workflows/build-check.yml, which matches the gated path glob .github/workflows/**. gated_paths is true and review_decision is REVIEW_REQUIRED (not APPROVED), so decision-table row 2 fires: the hard approval gate is not satisfied and the outcome cannot be approve or plain comment.

No blocking (critical/high) findings exist. The reviewer confirms this is additive-minor CI tooling only — no schema/wire/dist change — and correctly carries no changeset. The one follow-up (matchBranches rest-pairing leaving a removed oneOf/anyOf branch unreported at L1014) is deliberately scoped out and noted as a non-blocking future pass; not a blocking finding.

Escalation reasons

  • .github/workflows/build-check.yml (modified) is under a hard approval gate (.github/workflows/**); requires human/CODEOWNERS review (review_decision is REVIEW_REQUIRED, not APPROVED).

Once a real reviewer/CODEOWNERS approval lands (review_decision: APPROVED), this clean diff with no blocking findings can fall through to approve.

Why human review

  • Modifies .github/workflows/build-check.yml — gated path (.github/workflows/**) under a hard approval gate; review_decision is REVIEW_REQUIRED, so human/CODEOWNERS approval is required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/build-check.yml (modified) matches .github/workflows/**) 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 26, 2026
@aao-secretariat
aao-secretariat Bot requested a review from bokelley October 26, 2026 11:56
@bokelley
bokelley merged commit 327feff into main Oct 26, 2026
75 of 77 checks passed
@bokelley
bokelley deleted the build/additive-minor-check branch October 26, 2026 15:33
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants