test: drop the vacuous USED_PATHS case and pin the gaps index by resolution, not by text - #417
Merged
Merged
Conversation
…lution, not by text The "contains exactly the USED_PATHS paths" case compared trimDescriptor output with its own input, and the $ref sibling already pins the kept slice keys, so it goes, with the paths() accessor that existed for it alone. The generateIndex shape test pinned the emitted import lines and the GAPS literal; instead the index generated for the real gap directory is loaded beside copies of its files and every UNSHIPPED_GRAPHQL_SDL entry must name one of them. The empty-index tsc case becomes a test.each row beside that real-directory row, so a hyphenated base emitted as an unquoted key fails to compile and a camelCase key names a file that does not exist.
Contributor
File size check0 over a hard cap (fails), 30 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new semantic assertion can pass when a generated index silently omits a GraphQL gap.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates tests to validate generated gap indexes by behavior rather than emitted text and removes a redundant OpenAPI assertion.
Changes:
- Removes the self-referential
USED_PATHStest and unused accessor. - Type-checks and loads generated indexes in temporary source mirrors.
- Validates generated GraphQL gap file references.
| File | Description |
|---|---|
test/e2e/openapi/validate.test.ts |
Removes the redundant path-list assertion. |
test/e2e/openapi/validate.ts |
Removes the test-only paths() accessor. |
test/scripts/graduate-upstream-gaps.test.ts |
Replaces textual index assertions with compile/load checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.

Before / After
Before:
test/e2e/openapi/validate.test.tshad a case asserting the validator's path list equalsUSED_PATHS.trimDescriptor()builds that list by iteratingUSED_PATHS, so the assertion compared the function's output with its own input.test/scripts/graduate-upstream-gaps.test.tspinnedgenerateIndex()by its text: the import lines, theGAPSliteral, and template equality between an empty and a two-gap render.After:
USED_PATHScase is gone, with thepaths()accessor onOpenApiValidatorthat existed for it alone. Thetest.eachbeside it still pins the missing-path and now-documented arms by message.generateIndexis pinned at the boundary its output crosses: the index generated for the realsrc/upstream-gaps/type-checks beside copies of its gap files, loads (so every import resolves), and everyUNSHIPPED_GRAPHQL_SDLentry names a gap file that exists. The empty directory runs the same row.How
src/mirror in a temp dir: every sibling ofupstream-gaps/is symlinked (a gap may import../types.js), the gap files are copied beside the generated index.withTempDirremoves it on every path.unshippedGraphqlSdl()renders it as the file to retire. That is why the row loads the index instead of matching its text.Proof
Mutants, with the deleted or replaced cases gone:
trimDescriptorcopy loop skips a used path (usedPaths.slice(1))$refsibling fails: it pins the kept slice's keystrimDescriptorthrows at load; thetest.eachpins the message. The deleted case only failed as collateral of that throwgapEntryemits the camelCase alias as the key for every basesrc/upstream-gaps/issueCreationPolicy.ts, a file that does not existgapEntryemits a hyphenated key unquotedGreen after:
bun test test/e2e/openapi test/scripts/graduate-upstream-gaps.test.ts,typecheck,knip,lint,build:check.Line accounting
Reviewer note
paths()removal is a consequence of the deleted case, not a separate change: its docstring named that case as its consumer, and nothing else called it.camelCaseGapNamecall).issue-creation-policy.ts(graphql-schema) exists; after it graduates the row still pins compile + load.BEGIN_COMMIT_OVERRIDE
test: drop the vacuous USED_PATHS case and pin the gaps index by resolution, not by text
The "contains exactly the USED_PATHS paths" case compared trimDescriptor output with its own input, and the $ref sibling already pins the kept slice keys, so it goes, with the paths() accessor that existed for it alone.
The generateIndex shape test pinned the emitted import lines and the GAPS literal; instead the index generated for the real gap directory is loaded beside copies of its files and every UNSHIPPED_GRAPHQL_SDL entry must name one of them.
The empty-index tsc case becomes a test.each row beside that real-directory row, so a hyphenated base emitted as an unquoted key fails to compile and a camelCase key names a file that does not exist.
END_COMMIT_OVERRIDE