Skip to content

Commit cd4904d

Browse files
committed
test(spec): pin the WRITE refusal on the generator's diagnostic
`refuses to WRITE the artifact when the document is inconsistent` asserted only a non-zero exit status and a missing artifact. A subprocess that never starts satisfies both, so the case stayed green in exactly the scenario where the gate it exists to pin never ran at all — measured by parking tsx aside, where 8 of the 9 spawn tests go red and this one is among the 13 that still pass. Assert the generator's own dangling-ref diagnostic as well, which is the shape its three sibling spawn tests already carry. Claude-Session: https://claude.ai/code/session_01JbZnqu8bt6YqfJsr9vaFb3 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2085be2 commit cd4904d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎packages/spec/scripts/openapi-self-consistency.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,14 @@ describe('build-openapi.ts end to end', () => {
375375
),
376376
);
377377
expect(run.status).not.toBe(0);
378+
// A non-zero status and a missing artifact are BOTH satisfied by a subprocess
379+
// that never started, so on their own they cannot tell "the gate refused the
380+
// write" apart from "the spawn failed to launch" — which is how this case
381+
// stayed green while the gate it pins never ran once. The generator's own
382+
// diagnostic is what pins the refusal to the gate, and it is the assertion
383+
// the three siblings above already carry.
384+
expect(run.output).toMatch(/unresolvable \$ref/);
385+
expect(run.output).toContain('#/components/schemas/ApiErrorTypo');
378386
// The gate runs before the write, so no half-broken document is published.
379387
expect(fs.existsSync(run.artifact)).toBe(false);
380388
});

0 commit comments

Comments
 (0)