Skip to content

fix(api): the schema-coverage gate was a count, so the gap grew to 15 unseen - #711

Merged
athvin merged 3 commits into
mainfrom
fix/openapi-schema-coverage-gate
Nov 6, 2026
Merged

athvin merged 3 commits into
mainfrom
fix/openapi-schema-coverage-gate

Conversation

@athvin

@athvin athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner

The follow-ups flagged at the end of #688, done — one commit each, plus the consistency sweep that turned up two more.

1. The schema-coverage gate is now a set difference (e3ec815b)

every_generated_entity_schema_is_registered asserted schemas.len() == 14 against ApiDoc's own hand-written list. A count cannot see an entity arriving unregistered, because the count doesn't change — the test's name promised a gate that didn't exist.

I deferred this in #688 thinking it needed a design call on which entities belong on the control lane. It doesn't: the signal is already declared. Each entity.yaml has generate.wire, and Wire::Json's own doc comment said "the OpenAPI component schema is emitted". Deriving that set from the catalog and subtracting the registered schemas shows 15 entities declare wire: [json] with no component schema — so the drift the count couldn't see had already happened 15 times.

every_json_wire_entity_has_a_schema_or_a_declared_gap a new wire: [json] entity fails until registered or named in JSON_WIRE_WITHOUT_SCHEMA; a stale entry fails too, so the list can't accumulate names and hide the next gap
no_schema_is_registered_for_an_entity_that_is_not_on_the_json_wire the reverse direction, which holds today and would otherwise rot silently

Registering the 15 is deliberately not done here. Each becomes a documented schema that er-openapi-check then tracks for breaking changes — a public-API decision. The gate's job is to force that decision when an entity is added, not to make it.

Supporting changes, each the smallest version of itself: er-entity-gen's casing module becomes public so the test uses the generator's own entity-name → struct-name mapping instead of a duplicate that could disagree, and Wire::Json's doc comment now says it declares rather than emits, since asserting the invariant is how the gap stayed invisible. Both tests guard their own derivation — an empty catalog fails loudly, because a vacuous gate is the failure being replaced.

2. rust.yml's concurrency group — skipped, and I disagree with my own flag

I flagged the merge-burst cancellation as worth fixing. Having looked properly: cancel-in-progress is correctly false for pushes, and the run that survives a burst tests the accumulated tree, which is exactly what a post-merge gate is for. Dropping the group or keying it per-SHA would multiply full Rust runs during precisely the bursts where they're most redundant, and this repo's CI cost tracks run count. What's actually lost is per-commit attribution, recoverable by bisection, and the merge bus already covers proving a combination. No workflow change.

3. The polling traps (3b7e32fb)

What actually cost the time was misreading those runs, not the cancellation — so that's the half worth fixing. #705 landed the same finding first and better, so this branch's duplicate SKILL.md bullet is dropped entirely. But #705 prescribes "poll conclusion == null", and gh run list --json conclusion reports an unresolved run as the empty string, never null. Verified against four live unresolved runs, one a pending rust run on main: is_null: false, is_empty: true for every one. So that predicate matches nothing and reproduces the bug #705 was closing. Corrected, with the predicate pair that works and the zero-job disambiguation (pending vs starved vs held-bot — three causes, one symptom).

4. Consistency sweep (bb6fa72c)

Two documents assert, in the present tense, things #688 established are false:

  • entity-framework-design.md has the control lane typed through openapi-fetch and schema.d.ts. Nothing under frontend/src imports schema.d.ts, openapi-fetch has no call sites, and schema.d.ts opens with export type paths = Record<string, never> — there is no route for a typed client to type against. Marked design-not-state at the load-bearing paragraph; the later narrative passages left alone deliberately.
  • batch-orchestration-design.md cited the schema count twice as "12 → 13" against a document carrying 14 — the stale-count failure the entity-framework skill was itself fixed for. Both now name the condition instead of a number.

Also fixed in commit 1: the api-contract skill documented the old test by name and promised in two places that nothing would catch a forgotten registration. Both are now false, and leaving them would recreate the exact drift #688 existed to remove.

Verification

  • bash scripts/skills-check.sh all — green, with the command last so the exit code is its own.
  • cargo check -p er-entity-gen -p er-entity-spec --all-targets — clean.
  • cargo test -p er-server --lib openapi — running locally; CI's test job is the authoritative run and gates this PR.
  • The three gh/git commands added to polling.md were executed against this repo, not written from memory.
  • Both descriptions are untouched, so skill selection is unchanged by construction; what changed is body content, checked against each eval scenario. Eval 6 was rewritten — it tested the old gate's absence, which this PR makes false.

Message-only history rewrite after the rebase; HEAD^{tree} verified byte-identical before and after.

🤖 Generated with Claude Code

bmoore813 and others added 3 commits November 6, 2026 01:19
Found doing a consistency sweep after #688, which asserted the opposite of what
these two documents say. Both describe intent in the present tense, so a reader
hitting the skill and the design doc could not tell which was current.

**`entity-framework-design.md` has the control lane typed through
`openapi-fetch` and `schema.d.ts`.** It is not: nothing under `frontend/src`
imports `schema.d.ts`, `openapi-fetch` has no call sites, and the document
carries no `paths` — `schema.d.ts` opens with
`export type paths = Record<string, never>`, so there is nothing for a typed
client to type a route against. The types that reach components come from
`bindings/<Entity>.ts`. Marked as design-not-state at the load-bearing
paragraph rather than rewritten, because the design is still the intent; the
narrative passages later in the document are left alone deliberately.

**`batch-orchestration-design.md` cited a schema count twice**, as "12 → 13",
against a document that carried 14 before this branch — the stale-count failure
the entity-framework skill was itself fixed for. Both now name the condition
(`TaskInstance` declares `wire: [json]`, so a schema is required) instead of a
number that moves whenever anyone registers one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… unseen

`every_generated_entity_schema_is_registered` asserted `schemas.len() == 14`
against `ApiDoc`'s own hand-written registration list. That cannot see an entity
arriving unregistered, because the count does not change — so the test's name
promised a gate that did not exist. #688 documented the defect; this fixes it.

The invariant was already declared and already derivable. `Wire::Json`'s own doc
comment said "the OpenAPI component schema is emitted", and `generate.wire` in
each `entity.yaml` says which entities cross the JSON wire. Deriving that set
from the catalog and subtracting the registered schemas shows **15 entities
declare `wire: [json]` with no component schema**: candidate_key,
column_profile, entity_link, ingest_batch, matching_model, metric_snapshot,
metric_snapshot_source, pair_label, profile_finding, profile_run,
record_quality, s3_ingest_cursor, tag, tagging, webhook_delivery. The drift the
count could not see had already happened 15 times.

So the replacement is a set difference pinned to that list:

- `every_json_wire_entity_has_a_schema_or_a_declared_gap` — a new `wire: [json]`
  entity fails until it is registered or named in `JSON_WIRE_WITHOUT_SCHEMA`,
  and a **stale** entry fails too, so the list cannot accumulate names and hide
  the next real gap.
- `no_schema_is_registered_for_an_entity_that_is_not_on_the_json_wire` — the
  other direction, which holds today and would otherwise rot silently.

Registering the 15 is deliberately **not** done here. Each becomes a documented
schema that `er-openapi-check` then tracks for breaking changes, which is a
public-API decision rather than a formality; the gate's job is to force the
decision at the point an entity is added, not to make it.

Two supporting changes, each the smallest version of itself. `er-entity-gen`'s
`casing` module becomes public so the test maps an entity name to its struct
name with the generator's own function rather than a second copy that could
disagree — the mapping is the one thing a hand-rolled duplicate would get wrong.
And `Wire::Json`'s doc comment now says it declares rather than emits, because
asserting the invariant was how the gap stayed invisible.

Both new tests guard their own derivation (a catalog that came back empty, or a
json-wire set that came back small, fails loudly) — a vacuous gate is the exact
failure being replaced.

The `api-contract` skill is updated in the same commit: it documented the old
test by name, and in two places promised that nothing would catch a forgotten
registration. Leaving that would recreate the drift #688 existed to remove.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…there are seven

#705 added a seventh case and #709 added the warning not to reason from the
list's length, but the intro paragraph above both still said "the six ways the
obvious reading is wrong". Drops the number, which is the fix the standard
prescribes and the one that cannot go stale again.

This is all that survives of a larger change this branch originally carried.
#709 landed the same `conclusion` correction first and better — it normalises
with `(.conclusion // "") == ""` rather than testing two branches, and it also
fixed the main assertion block and `post-merge.md`, neither of which this branch
had touched. The zero-job disambiguation is dropped too: `action_required` and
the starved `steps: []` case are each already documented in their own sections,
and a third paragraph tying them together would be the duplication an audit
should flag rather than add.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the fix/openapi-schema-coverage-gate branch from e3ec815 to 85089b3 Compare November 6, 2026 06:20
@athvin
athvin merged commit 9633179 into main Nov 6, 2026
39 checks passed
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