From c4bbec8549d2a0137c3178c9c0587e2d3aded2c2 Mon Sep 17 00:00:00 2001 From: Klink <85062+dogmar@users.noreply.github.com> Date: Sun, 14 Jun 2026 12:49:21 -0700 Subject: [PATCH] fix: fail loudly if generated format files can't be formatted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The format step in generate-formats.ts ran `npx vp check --fix` inside a try/catch that swallowed every error. The raw generator output has unwrapped imports, so formatting is load-bearing — and the sync-generated CI workflow commits whatever the script writes. A swallowed failure would therefore land unformatted files on main with no signal (the original audit's hazard, via the post-#9 code path). Replace it with a targeted `npx vp fmt` and no catch, so a formatting failure aborts generation (and the CI step). `vp fmt` alone reproduces the committed output exactly; lint/typecheck correctness is already enforced by the `ready` gate, so the heavier `vp check --fix` was unnecessary here. Co-Authored-By: Claude Opus 4.8 --- package/scripts/generate-formats.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/package/scripts/generate-formats.ts b/package/scripts/generate-formats.ts index 4c47c03..5b19123 100644 --- a/package/scripts/generate-formats.ts +++ b/package/scripts/generate-formats.ts @@ -318,13 +318,12 @@ for (const format of formats) { console.log(` wrote src/formats/${kebab}.ts`); } -// Run linting and formatting on generated files using vp's bundled toolchain -// so output matches `vp fmt` / `vp check --fix` behavior everywhere. -console.log("Running linter and formatter..."); -try { - execSync(`npx vp check --fix ${FORMATS_DIR}`, { cwd: ROOT, stdio: "pipe" }); -} catch { - // vp check --fix may exit non-zero for unfixable issues; that's OK -} +// Format the generated files in place with vp's bundled oxfmt (the raw output +// has unwrapped imports). This must succeed: the sync-generated CI workflow +// commits whatever this writes, so a swallowed failure would land unformatted +// files on main. Fail loudly instead. Lint/typecheck correctness is enforced +// separately by the `ready` gate, so formatting is all that's needed here. +console.log("Formatting generated files..."); +execSync(`npx vp fmt ${FORMATS_DIR}`, { cwd: ROOT, stdio: "inherit" }); console.log("Done.");