Repository navigation
fix(skills): api-contract named a deleted client and a gate that never fires - #688
Merged
Merged
Conversation
…r fires A /skill-audit of `api-contract` found twelve findings, two of which would mislead a session into doing the wrong thing rather than merely confusing it. **The server-only client it named does not exist.** `src/lib/api/erserver.ts` was deleted in #434, which consolidated five hand-built upstream paths into `lib/bff/upstream.ts` so `traceparent` could be attached to every one of them. The skill still routed a reader there from the pipeline diagram, the two-clients table and the whole of eval 4 — and `upstream.ts`'s own header anticipates the consequence: "a path with no callers is still a path the next person can revive". Following the skill was a route back to the dead sixth path. **`every_generated_entity_schema_is_registered` does not enforce its name.** It asserts the *size* of `ApiDoc`'s hand-written registration list, so it is blind to `entities/`: add an entity, never register its schema, and the size is unchanged and the test is green. The skill called it "the one that catches the quiet mistake: adding an entity and forgetting to register its schema", which is precisely the mistake it cannot see. Stated plainly now, with the gap in the gate table and a new eval scenario; the durable fix is a set difference against `entities/`, left as follow-up because which entities belong on the control lane is a design decision, not a doc edit. Verified against source and corrected, each previously asserted as fact: - `er-openapi-check` runs in the Rust `entities` job, not `lint` (two places), and only on pull requests — on a push to `main` it has no base and examines nothing. - "the utoipa doc paths in `lib.rs`" named annotations that do not exist; there are no `utoipa::path` attributes in `er-server`. The route shape is the axum router's hand-written `.route(...)` calls. - `mock_contract.rs` holds the mock to the router in **one** direction (the mock may serve no route the router lacks), not both. - The regeneration command could not work from either directory: the cargo workspace root is `rust/`, so the redirect has to be relative to it. - Nothing in `frontend/src` imports `schema.d.ts`, and `openapi-fetch` has no call sites. The gates prove the document and the types agree with the Rust structs; they prove nothing about frontend call sites, and the skill now says so instead of implying the opposite. Routing, per the standard's both-ways rule: `entity-framework` never named `api-contract`, so it won the trigger on "add a column and expose it in the API" and answered only the entity half. #686 landed that direction while this was open, so what remains here is the other one — `api-contract` gained the `frontend-bff` tail that eval 4 always assumed. Also deduplicated: the reference is canonical for the gate and breaking-change tables, which is how two of the corrections above came to be wrong in two files at once. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
fix/api-contract-skill-drift
branch
from
November 6, 2026 05:06
61dd5e3 to
dbb7d75
Compare
athvin
pushed a commit
that referenced
this pull request
Nov 6, 2026
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]>
athvin
pushed a commit
that referenced
this pull request
Nov 6, 2026
… 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]>
athvin
pushed a commit
that referenced
this pull request
Nov 6, 2026
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]>
athvin
pushed a commit
that referenced
this pull request
Nov 6, 2026
… 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]>
athvin
added a commit
that referenced
this pull request
Nov 6, 2026
… unseen (#711) * docs: two design-doc claims the frontend never actually implemented 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]> * fix(api): the schema-coverage gate was a count, so the gap grew to 15 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]> * docs(skills): polling.md's intro still counted six false greens, and 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]> --------- Co-authored-by: bmoore813 <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
/skill-auditofapi-contractreturned twelve findings. Two of them would mislead a session into doing the wrong thing rather than merely confusing it; the rest are claims that were asserted as fact and are false against the current tree. Every correction below was verified by reading the source it describes.The two that matter
The server-only client it named does not exist.
src/lib/api/erserver.tswas deleted in #434, which consolidated five hand-built upstream paths intolib/bff/upstream.tsso thattraceparentcould be attached to every one of them. The skill still routed a reader there from the pipeline diagram, the two-clients table and the whole of eval 4 — andupstream.ts's own header anticipates the consequence: "a path with no callers is still a path the next person can revive." Following the skill was a route back to the dead sixth path.every_generated_entity_schema_is_registereddoes not enforce its name. It asserts the size ofApiDoc's hand-written registration list, so it is blind toentities/. Add an entity, never register its schema, and the size is unchanged and the test stays green. The skill called it "the one that catches the quiet mistake: adding an entity and forgetting to register its schema" — precisely the mistake it cannot see. Now stated plainly, with the gap as its own row in the gate table and a new eval scenario.The durable fix for that gate is a set difference against
entities/rather than a count, which is the shapedocs/agent-skills.mdrecommends. Left as follow-up: which entities belong on the control lane is a design decision, not a doc edit.Corrected, each previously asserted as fact
er-openapi-checkruns in the Rustlintjobentitiesjob, and only on pull requests — a push tomainhas no base and it examines nothinglib.rs"utoipa::pathattributes iner-server; the route shape is the axum router's hand-written.route(...)callsmock_contract.rsholds the mock to the router "in both directions"rust/, so the redirect must be relative to itfrontend/srcimportsschema.d.tsandopenapi-fetchhas no call sites. The gates prove the document and the types agree with the Rust structs; they prove nothing about frontend call sitesschema.d.tsis listed, and ESLint does not read JSON. Deleted — nothing followed from itRouting
Per the standard's both-ways rule,
entity-frameworknever namedapi-contract, so it won the trigger on "add a column and expose it in the API" and answered only the entity half. Its description now routes onward, andapi-contractgained thefrontend-bfftail that eval 4 always assumed.Also
The reference is now canonical for the gate and breaking-change tables — the duplication is how two of the corrections above came to be wrong in two files at once. Eval 1 gained a selection check (does this skill fire at all on a phrasing
entity-frameworkalso matches), and eval 6 is new.Gate
bash scripts/skills-check.sh allgreen with the command last in the pipeline, so the exit code is its own. Descriptions are 848 and 971 characters against the 1,024 cap;SKILL.mdis 162 lines; the reference keeps its## Contents. No generated block changed — both description edits append past the first em-dash clause the inventory tables derive from. No Rust or frontend code is touched, sodetectshould skip the compile jobs.🤖 Generated with Claude Code