From cd4904d3613dc65a351281ed63fcf163261ab36e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 20:35:18 +0000 Subject: [PATCH] test(spec): pin the WRITE refusal on the generator's diagnostic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 --- packages/spec/scripts/openapi-self-consistency.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/spec/scripts/openapi-self-consistency.test.ts b/packages/spec/scripts/openapi-self-consistency.test.ts index 22914648812..7c520abd186 100644 --- a/packages/spec/scripts/openapi-self-consistency.test.ts +++ b/packages/spec/scripts/openapi-self-consistency.test.ts @@ -375,6 +375,14 @@ describe('build-openapi.ts end to end', () => { ), ); expect(run.status).not.toBe(0); + // A non-zero status and a missing artifact are BOTH satisfied by a subprocess + // that never started, so on their own they cannot tell "the gate refused the + // write" apart from "the spawn failed to launch" — which is how this case + // stayed green while the gate it pins never ran once. The generator's own + // diagnostic is what pins the refusal to the gate, and it is the assertion + // the three siblings above already carry. + expect(run.output).toMatch(/unresolvable \$ref/); + expect(run.output).toContain('#/components/schemas/ApiErrorTypo'); // The gate runs before the write, so no half-broken document is published. expect(fs.existsSync(run.artifact)).toBe(false); });