Repository navigation
test: pin whole outcomes where tests asserted fragments, counts, or catalog-derived expectations - #121
Conversation
File size check23 over a hard cap (fails), 108 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 8 managed file(s) skipped; repo-platform owns them. |
Template checkIntegrityPassed - this repository matches the state it was stamped with. FreshnessThis repository is behind the build branch by 17 commit(s). The next sync PR updates the managed files; nothing to do here. |
db23481 to
a81132b
Compare
521a9b7 to
c1a6661
Compare
…atalog-derived expectations
Survey of 89 test files (every test file outside the sibling builders' territory) found 324 weak or redundant rows: 215 substring pins, 52 counts, 30 shape pins, 19 vacuous, 13 redundant. This commit fixes the high-value half: every vacuous and redundant row, and every substring, count, and shape row in test/engine (validate, execute), test/github, test/discovery, test/report, test/sections, and the small root suites. About 196 assertions now pin a whole value against an independent literal; 11 test declarations are gone. test/engine/orchestrate.test.ts is left untouched (another builder owns it); its 22 rows are recorded in the PR backlog.
Deleted tests and the stronger pin that covers each: registry.test.ts grant-caveat map (the exact-literal EXPECTED_GRANT test in the same file); actions_secrets.test.ts not-base64 / wrong-length key (secrets-engine.test.ts parseSealingKey matrix); openapi/validate.test.ts USED_PATHS-carries-no-undocumented-path (holds by construction; excludeUndocumented is tested directly); graphql-pipeline.test.ts multi-mode mutation-without-node-id (same branch as the single-mode test); state.test.ts explicit-labels-replaces-baseline (the sparse-seed test now pins the whole one-element arrays); file-fuzz-issue.test.ts no-assignment sweep (both paths pin the whole gh argv); graduate-upstream-gaps.test.ts three generateIndex fragment tests and the source-derived determinism test (the committed-index byte-for-byte test and the whole-render multi-file test); single assertions in api.test.ts, discover.test.ts, schema-corpus.test.ts, checks-workflow.test.ts subsumed by an adjacent whole pin.
Mutations proven red (each reverted): src/github/api.ts:568 drop 'in the settings file' from the not-sent advice (old toContain("was not sent") passed; 13 whole pins fail); src/sections/contract/errors.ts:76 drop the higher-rate-limit advice tail (old /rate limit was hit/ passed; four whole pins fail); src/report/composer.ts:67 render adminRepo in the Target row (old ten toContain passed; the whole-document pin fails).
Accepted churn, recorded on purpose: the 145-key allEndpoints() inventory in registry.test.ts is the contract, so a new endpoint touches it; validate.test.ts verdicts embed zod's issue wording, as that file already did before this change.
Backlog (about 186 rows, listed in the PR): orchestrate.test.ts, and substring, count, and shape pins in the per-section suites under src/sections, test/e2e/mock, test/e2e/openapi/validate.test.ts, and test/docs plus test/scripts.
The deleted toBeGreaterThan(150) floor had no successor: a scenarioDocs() that returned only the five KNOWN_DIVERGENCES documents still passed the file. The exact count (252 on this branch) fails on a dropped root, file, or document kind; a new scenario updates the number, the same accepted-churn class as the allEndpoints() inventory pin.
c1a6661 to
91024e2
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The test-only changes consistently strengthen outcome verification without altering production behavior.
Pull request overview
Strengthens regression tests by replacing partial assertions with exact outcomes while consolidating redundant coverage. Production code is unchanged.
Changes:
- Pins complete errors, reports, API calls, plans, and schema inventories.
- Strengthens security and redaction assertions.
- Removes tests already covered by stronger assertions elsewhere.
File summaries
| File | Description |
|---|---|
test/sections/setup-section.test.ts |
Pins setup plans and failure messages. |
test/sections/secrets-engine.test.ts |
Pins sealing and duplicate errors. |
test/sections/registry.test.ts |
Pins policies, endpoints, and GraphQL contracts. |
test/sections/plan-idempotence.test.ts |
Pins recurring operations. |
test/sections/loosen.test.ts |
Verifies preserved parsed data and exact errors. |
test/sections/list-section.test.ts |
Pins list errors and handler keys. |
test/sections/graphql-contract.test.ts |
Pins GraphQL outcomes and errors. |
test/sections/docs-registry.test.ts |
Tightens documentation validation paths. |
test/sections/contract.test.ts |
Pins operation metadata and contract errors. |
test/scripts/graduate-upstream-gaps.test.ts |
Pins complete generated indexes. |
test/scripts/file-fuzz-issue.test.ts |
Pins complete gh command sequences. |
test/schema-corpus.test.ts |
Pins corpus cardinality. |
test/report/issue-report.test.ts |
Pins issue delivery calls and warnings. |
test/report/delivery.test.ts |
Pins report-channel warnings. |
test/report/composer.test.ts |
Pins the complete rendered report. |
test/report/artifact-report.test.ts |
Pins artifact failure outcomes. |
test/published-schema.test.ts |
Pins wrapper and fixture inventories. |
test/private.test.ts |
Pins private-value serialization. |
test/github/paginate.test.ts |
Pins pagination request paths. |
test/github/graphql.test.ts |
Pins GraphQL errors and redaction. |
test/github/api.test.ts |
Pins API bodies, errors, and secret handling. |
test/engine/validate.test.ts |
Pins complete validation verdicts. |
test/engine/execute.test.ts |
Pins complete execution outcomes. |
test/e2e/openapi/validate.test.ts |
Removes construction-derived assertions. |
test/e2e/mock/state.test.ts |
Pins complete seeded state. |
test/e2e/mock/server.test.ts |
Pins pagination request logs. |
test/e2e/mock/graphql-pipeline.test.ts |
Removes duplicate decode coverage. |
test/docs/checks-workflow.test.ts |
Removes a redundant hash assertion. |
test/discovery/targets.test.ts |
Pins deduplication results and notices. |
test/discovery/repos-input.test.ts |
Pins the mixed-input error. |
test/discovery/discover.test.ts |
Pins discovery errors and notices. |
test/discovery/central.test.ts |
Pins central target resolution. |
src/sections/workflows/workflows.test.ts |
Pins persistent workflow drift. |
src/sections/rulesets/rulesets.test.ts |
Simplifies a compile-time contract test. |
src/sections/repository/repository.test.ts |
Pins literal permission advice. |
src/sections/labels/mock.test.ts |
Pins minted label identities. |
src/sections/labels/labels.test.ts |
Pins duplicate-label errors. |
src/sections/interaction_limits/interaction_limits.test.ts |
Pins permission advice and type contracts. |
src/sections/environments/pins.test.ts |
Pins complete pin-order drift. |
src/sections/check_suite_preferences/check_suite_preferences.test.ts |
Pins notes across idempotence passes. |
src/sections/branches/branches.test.ts |
Pins missing-actor failures. |
src/sections/actions_secrets/actions_secrets.test.ts |
Removes duplicate sealing-key tests. |
Review details
- Files reviewed: 42/42 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Whole-value pins where tests asserted fragments, counts, key sets, or expectations derived from the code under test. Test files only; no source changed.
Before / After
Before (test/report/composer.test.ts):
After:
Before (test/sections/loosen.test.ts, the def-surgery tripwire), which passed with
loosenreplaced by the identity function:After:
How
test/engine/orchestrate.test.tsis untouched; another builder owns it on refactor(engine): secret provenance is one source per document #119, so its 22 rows moved to the backlog.Proof
bun run checkgreen (2580 pass);bun run test:e2e215/215.Technical details
Counts
Survey: 89 files, 324 finding rows, 162 keep rows. Written to
/tmp/fleet-7691fa85/weak-tests-survey.mdon the builder's machine.Deleted tests and their stronger pin
test/sections/registry.test.tsgrant-caveat map:sectionGrantisgrantFor(permission, caveat), so the map test only re-derived the source; the exact-literalEXPECTED_GRANTtest in the same file pins every grant string.src/sections/actions_secrets/actions_secrets.test.tsnot-base64 / wrong-length sealing key:test/sections/secrets-engine.test.tsparseSealingKey rejects %spins the same defects with the same prefix.test/e2e/openapi/validate.test.ts"USED_PATHS carries no undocumented path":USED_PATHSis built byexcludeUndocumented, so it holds by construction;excludeUndocumentedis tested directly above.test/e2e/mock/graphql-pipeline.test.tsmulti-mode mutation-without-node-id: the decode runs in routes.ts before the single/multi split; the single-mode test covers the branch.test/e2e/mock/state.test.tsexplicit-labels-replaces-baseline: the sparse-seed completion test now pinsstate.labelsandstate.autolinksas whole one-element arrays.test/scripts/file-fuzz-issue.test.tsno-assignment sweep: both paths pin the wholeghargv list.test/scripts/graduate-upstream-gaps.test.tsthree generateIndex fragment tests plus the determinism test whose expected wasgenerateIndex(...)itself: the committed-index byte-for-byte test and the whole-render multi-file test (unsorted input) cover them.api.test.tsJSON-scan after a wholetoEqual;discover.test.tsnot.toContainafter a wholetoBe;checks-workflow.test.tstoContainbeforeexpectKeyPinned.Mutation proofs (each applied, run, reverted)
src/github/api.ts:568dropin the settings filefrom the not-sent advice. OldtoContain("was not sent")passed. New whole pins: 13 fail in api.test.ts.src/sections/contract/errors.ts:76drop, or use a token with a higher rate limit. Old/rate limit was hit/passed. New whole pins: 4 fail across contract, graphql-contract, execute.src/report/composer.ts:67renderinput.adminRepoin the Target row. Old tentoContainpassed. New whole-document pin: 1 fail in composer.test.ts.Codex rubber-duck
Round 1: 4 blocking, 8 non-blocking. All addressed:
toMatchwas the only pin of the actor name: both tests now pin the wholeGHOST_ACTOR_ERRORliteral.[...SECTION_KEYS]on the expected side: reverted to the exact-elementtoContain("workflows").toThrow(string)substring semantics, a source-derivedsorted: each reverted or tightened.Round 2: 0 blocking, 4 non-blocking. Three fixed (age error wording unpinned, two order-incidental comparisons sorted). One recorded:
test/engine/validate.test.tsverdicts embed zod's issue wording; that file already pinned a whole verdict that way before this change.Accepted churn (deliberate)
test/sections/registry.test.ts: the 145-keyallEndpoints()inventory is a literal. A new endpoint touches it.test/e2e/mock/state.test.ts: the deploy key's minted id90_000_002is a literal tied to seed order.test/schema-corpus.test.ts: the scenario corpus size is pinned exactly (252). The oldtoBeGreaterThan(150)floor was deleted first, but a loader returning only the five divergence docs still passed, so the exact count replaces it. A new scenario updates the number.Backlog (about 186 rows, in the survey file)
test/discovery/central.test.ts(around lines 8, 31, 41) pinspath.joinoutput with forward slashes, which holds on the ubuntu-only CI and would fail on Windows.test/published-schema.test.ts(around line 267) pins the fixture list in declaration order.test/engine/orchestrate.test.ts(excluded, owned by PR refactor(engine): secret provenance is one source per document #119): 22 rows. Whole pins for the preflight denial annotation andpreflightDenied, the prefixed drift log line, the knobbed-section validate verdict, the unset-variable and literal-secret refusals, the unknown-top-level-key error (with the known-section list spelled out), the non-mapping and YAML-tagged document errors, the probe-error annotation, the workflows drift and notice lines, the read-denial barrier line, and the mutation lists in the mid-plan failure, thunk-failure, and warn-policy tests.src/sections/*/*.test.ts: ~85 substring/count/shape rows (whole notes, live-shape messages,shapeErrorverdicts, ops projections). Largest: environments, repository, interaction_limits, branches.test/e2e/mock/*.test.ts: ~50 rows, mostlytoHaveLength(0)on violations (toEqual([])prints the violation) and.some(includes)on violation messages.test/e2e/openapi/validate.test.ts: ~28 rows, whole finding arrays instead of.some(kind ===).test/docs,test/scripts: ~12 rows (diagramsrejects %stables, graduate-upstream-gaps foreign lists, e2e-nightly if/env/run lines).Gates
bun run check: green (2580 pass, biome, tsc, knip, arch lint, build:check).bun run test:e2e: 215/215 passed.