chore(contracts): CHAOS-5732 Mirror the cut-kind-census coverage detail code - #77
Merged
Merged
Conversation
Regenerates the pinned acr contract surface (provisional pin, a lane tip not yet on acr main -- re-pin to the merge sha before this PR merges): a new coverage-detail code, kind_census_truncated, with three additive fields (kind, declared, served). Renders it in CoveragePanel under its own "Kind census" section (kind, "declared N (floor) · served M"), and covers the shape with component tests (present/absent/boundary/no-double-render) and a contract-validation test for the pin.
Re-pins the provisional acr contract to the tip that derives a cut kind census's served count last, at every serving surface (stage-3 retry and reuse), and closes the kind property to the same closed subject-kind vocabulary Go already enforces.
Re-pins the provisional acr contract to its next tip; contracts/ and internal/mcp/schemas/ are byte-identical to the prior pin (acr's change there was comment-only), so only the source-commit pointer and generated-file banners move.
Re-pins to acr main's squash of the kind-census coverage detail work; every vendored file stays byte-identical to the pre-merge pin, only the source-commit pointer and generated-file banners move.
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.
Ticket: CHAOS-5732
TEST-EVIDENCE
What this change accomplishes, and for whom. Mirrors acr's
kind_census_truncatedcoverage-detail code (a discovered cohort's kind-scoped census was cut at its own row bound) into this workbench: the pinned contract types, theCoveragePanelrendering, and the wire-shape validation tests — so a caller of this workbench can see which kind's census was cut, the declared floor, and how many members were served, the moment acr starts emitting the code.EXECUTE-THE-CLAIM.
sync-acr-contracts.mjs's own doc comment: "Regeneration is CI-checked by EXACT DIFF"). Ranpnpm run acr:contracts:generateagainst a real checkout of the acr merge commit (final pin, acr shaa57b599b88a28c170444e786d701af980911db9d— acr main's own squash of the kind-census coverage detail work, closingkindto the same closed vocabulary Go enforces; clean and parked exactly on that commit — the script'sreadPinnedSourceFilesverifies both), thenpnpm run acr:contracts:checkwith no--source(reads the committed copies back and verifies each against the manifest digest, and regenerates the derived TypeScript types from THOSE copies) —ACR contracts are current., zero drift. The only wire-shape change this pin carries for this repo iskindclosing from an unenumerated string to the 15-member subject-kind union (verified in the generated type,tsc --noEmitclean, no test needed a fixture update). Every re-pin since the first (7ae3719f→72c9e3ea→a57b599b, the last being the squash merge) is a pointer move only:contracts/andinternal/mcp/schemas/stayed byte-identical across all three acr shas, so only generated-file banners and the manifestsource_commitmoved each time.pnpm exec tsc --noEmit— clean.pnpm run build(next build, Turbopack) — compiles, typechecks, prerenders all four routes, zero errors.pnpm run lint(eslint .) — clean.pnpm run format:check(prettier --check .) — clean (ranprettier --writeonce on the two touched test files + the component, to match this repo's own style; verified no test broke as a result).pnpm install(not a symlinked/inheritednode_modules) before any of the above, per this repo's own pre-TELL rule.ENUMERATE-THE-SURFACE.
scripts/sync-acr-contracts.mjsSOURCE_COMMITbump note + final value, the acr squash-merge shasrc/contracts/schemas/context_fabric_common.v1.schema.jsonsrc/contracts/generated/investigation-result.ts(+ banner-only sha bumps inerror.ts/investigation-request.ts)CoverageDetail.codeunion gains"kind_census_truncated"; 3 new optional fields (kind?: string,declared?: number,served?: number)src/contracts/manifest.jsonsource_commit+ the one changed file's sha256src/components/CoveragePanel.tsxdegradingDetailsOf,degradedReasonCountuntouched)src/components/CoveragePanel.test.tsxdescribeblock, 8 tests, covering the shape's own input domain (present/absent kind, absent declared/served together, boundary served===declared, served===0, phrasing-over-label precedence, no double-render, coexistence with a generic degraded reason)src/lib/acr/validate.test.tsdescribeblock mirroring the existingfact_read_origin_stateconsumer-pin pattern: GREEN (all fields present), GREEN (each field independently optional at the schema level — acr's own write path enforces the require-together rule, this schema does not duplicate it), RED CONTROL ×2 (served/declared wrong type or negative), the-already-live-codes-still-validate, vocabulary-stays-closed, and an EXECUTED repro that the PRIOR pin's own schema (enum member stripped) rejects the new code while still accepting a live oneINPUT-DOMAIN TABLE, executed through the real component render (
pnpm exec vitest run):and through the real JSON-Schema validator (ajv,
src/lib/acr/validate.ts):RED-FIRST, verified against origin/main directly (detached worktree at
dbf936d06a953788688c285d108e6e32e4b257a7, only the two modified test files copied in, component/lib left untouched):pnpm exec vitest run src/components/CoveragePanel.test.tsx→ 9 of 96 tests fail (the pinned-vocabulary count, the exactly-two-codes-render check, and the 6 new "Kind census" behavior tests that needdetail.kind/.declared/.servedto exist as recognized fields and the dedicated section to exist at all).src/lib/acr/validate.test.ts's new block was not separately red-checked this way since it is entirely new (no prior assertion to regress) — its own EXECUTED-repro test is the red-on-the-prior-pin proof, in miniature, run against a reproduction of the old schema rather than the old component.FULL SUITE, re-run at the final pin:
This is a contract-sync-only change (0 production TypeScript lines beyond the earlier
CoveragePanelmirror already covered above) stacked on the acr PR, which has already merged tomain— CI and PR-ref CodeQL on this PR's own pushed tip are the remaining gate.RISK-NOTES
SOURCE_COMMITpoints ata57b599b, the acr PR's own squash-merge sha onmain— no further re-pin is needed for this ticket.degradingDetails→genericDegradingDetailsrename at its map call site (the underlying array itself, and every OTHER consumer ofdegradingDetails, are untouched).declared/servedINTEGER fields verbatim (string interpolation of numbers, not a derived sentence) — the same disciplinecountPhrase/structured-field rendering already follows elsewhere in this panel; the engine's ownlabel/phrasingtext is what's shown for the prose half of the row, exactly like every other coverage detail.Coverage.Detailsreaches, not specifically tied to astructure_needs.kind_optionsco-occurrence (that field is a different, unrelated acr mechanism — see the acr PR body for the full trace).