Skip to content

test(schema): bidirectional guard on the OSS/FULL problemspec variant split - #216

Merged
jack-champagne merged 2 commits into
mainfrom
wip/oss-variant-guard
Jul 28, 2026
Merged

test(schema): bidirectional guard on the OSS/FULL problemspec variant split#216
jack-champagne merged 2 commits into
mainfrom
wip/oss-variant-guard

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Small follow-up to #212 (already merged). One new test file, no source changes.

packages/schema/schemas/ vendors two problemspec variants — FULL (emitted from private Piccolissimo, and the one registered as the problemspec kind) and OSS (emitted from public Piccolo, vendored for Phase-3 package-access staging). Piccolo's own suite asserts the schema it emits carries no private capability names, but nothing on this side asserted the vendored copies stayed distinct.

A re-vendor that wrote the FULL schema over the OSS filename — or an OSS build that shipped FULL — would expose six private capability names (altissimo backend, continuation/staged strategies, hermite_bending_energy/hermite_c2 objectives, robust wrapper), and every existing test would still pass, because both files parse and validate identically well. Silent open-core leak, and precisely the failure the two-variant design exists to prevent.

Why bidirectional

Asserting only "OSS lacks the private names" would still pass if someone vendored the OSS schema over both filenames — quietly narrowing the shipped schema so it rejects specs Piccolissimo can really run. So the test asserts:

  1. the private names are absent from OSS;
  2. they are present in FULL (catches the other direction);
  3. the two files differ;
  4. FULL − OSS is exactly the known private set — so adding a new private capability without listing it here trips the test;
  5. OSS introduces nothing FULL lacks — which would mean the variants were built from divergent revisions.

It compares enum/const values rather than raw text, so public names that merely contain a private substring can't false-positive (SplinePulseProblem, cubic_spline, magnus_* are all legitimately public).

Verified fail-closed

Copying the FULL schema over the OSS filename fails 3 of 5 assertions and names all six leaked capabilities in the message. Restored after.

@amicode/schema 104/104.

Note: this was originally committed on wip/typed-specs-amicode, but #212 had already merged, so it was stranded on a merged branch. Re-branched onto current main (c4c9719) and re-verified against main's vendored schemas rather than assumed.

🤖 Generated with Claude Code

aarontrowbridge and others added 2 commits July 25, 2026 18:18
… split

packages/schema/schemas/ vendors two problemspec variants -- FULL (emitted
from PRIVATE Piccolissimo, and the one registered as the `problemspec` kind)
and OSS (emitted from public Piccolo, for Phase-3 package-access staging).
Piccolo's suite asserts the schema IT emits carries no private capability
names, but nothing on this side asserted the vendored COPIES stayed distinct.

A re-vendor that wrote the FULL schema over the OSS filename -- or an OSS
build that shipped FULL -- would expose six private capability names, and
every existing test would still pass, because both files parse and validate
identically well. That is a silent open-core leak, and it is exactly the
failure mode the two-variant design exists to prevent.

Deliberately BIDIRECTIONAL. Asserting only "OSS lacks the private names"
would still pass if someone vendored the OSS schema over BOTH filenames,
quietly narrowing the shipped schema so it rejects specs Piccolissimo can
really run. So this asserts the private names are absent from OSS AND
present in FULL, that the files differ, that FULL-minus-OSS is EXACTLY the
known private set (a new private capability added without listing it here
trips this), and that OSS introduces nothing FULL lacks (which would mean
the variants were built from divergent revisions).

Compares enum/const VALUES rather than raw text, so public names that merely
contain a private substring cannot false-positive.

Verified it fails closed: copying the FULL schema over the OSS filename
fails 3 of 5 assertions and names all six leaked capabilities.

schema suite 97/97 (was 92, +5).
The five set-difference assertions here cannot see an OSS schema that starts
offering the paid `exponential`/`spline` integrator backends — the exact leak
this file exists to prevent.

`enumValues` flattens every enum in the document into one Set, so a value
becomes invisible to it once that value appears anywhere. `exponential` and
`spline` ALREADY appear in the OSS schema, inside a conditional:
`allOf[3].then` requires `integrator.kind ∈ {exponential, spline}` for a spline
pulse. So they are members of `ossEnums` even though the OSS schema does not
OFFER them in the enum a caller picks from, they cancel out of `onlyInFull`,
and the widening is undetectable by set difference.

Verified fail-closed: injecting the leak (OSS integrator.kind enum widened to
["bilinear","exponential","spline"]) fails the two new assertions while ALL
FIVE original ones still pass.

So the real FULL − OSS capability delta is eight, not the six in PRIVATE_ONLY.
The two integrator backends need their own positional assertion because, unlike
the six, they are not absent from the OSS document — merely not offered.

Reaching into a fixed schema path is deliberately brittle: if the shape moves
this should fail loudly and make someone re-derive the guard, rather than
silently stop guarding.
@jack-champagne
jack-champagne merged commit ca86031 into main Jul 28, 2026
5 checks passed
@jack-champagne
jack-champagne deleted the wip/oss-variant-guard branch July 28, 2026 23:37
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.

2 participants