Skip to content

fix(build): write a trailing newline from the JSON generators - #1246

Merged
TurtIeSocks merged 1 commit into
v2from
fix/generator-trailing-newlines
Aug 24, 2026
Merged

fix(build): write a trailing newline from the JSON generators#1246
TurtIeSocks merged 1 commit into
v2from
fix/generator-trailing-newlines

Conversation

@TurtIeSocks

Copy link
Copy Markdown
Collaborator

The config sync job failed on v2 right after #1245 landed, and locales sync was queued behind it with the same bug waiting.

bun run config:env rewrites config/custom-environment-variables.json through JSON.stringify, which does not emit a trailing newline. Biome wants one, the pre-commit hook now runs Biome, so the job's own commit gets rejected and the whole main pipeline stops. Reproduced locally before touching anything, and the failure is exactly the one CI printed.

The interesting part is that this is not new. It has been happening on every push for a long time, and Prettier was quietly cleaning up after it: the generator stripped the newline, the job saw a diff and committed, lint-staged put the newline back on the way through, and the commit succeeded. There are 38 chore: sync config [skip ci] commits in the history and the most recent one, 90f94e63, changes exactly one line from } to }. That is the newline, and that is the entire content of the commit. Swapping Prettier for Biome did not cause the bug, it just stopped covering for it.

Fixed in the generators rather than by adding an ignore rule, because these are text files and should end with a newline no matter who is checking them. Three other generators had the same line, including the locales one, whose job also commits its output and would have failed the same way the first time it got to run.

Once the generated file matches what is committed, git diff --quiet passes, changes_exist stays false, and the commit step is skipped entirely. That ends the 38-commit churn as a side effect.

Verification

bun run config:env    regenerated file is byte-identical to the committed one
biome check           passes on the regenerated file
bun run masterfile    output now ends with a newline
bun test              76 pass, 0 fail
bun run typecheck     clean
bun run lint          clean

The commit in this PR was made through the real husky hook, which runs the same Biome check that failed in CI, so the fix is exercised end to end rather than argued for.

🤖 Generated with Claude Code

The config sync job on v2 failed because `bun run config:env` rewrites
config/custom-environment-variables.json without a trailing newline, and the
pre-commit hook now runs Biome, which wants one. The committed file only had
that newline because Prettier used to add it on the way past, so nothing
noticed until Prettier went away.

Fixing it in the generators rather than teaching Biome to ignore the file:
these are text files and should end with a newline regardless of who is
checking them. The same bug was sitting in three other generators, including
the locales one, whose job also commits its output and would have failed the
same way the first time it ran.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@TurtIeSocks
TurtIeSocks merged commit 0909e0c into v2 Aug 24, 2026
2 checks passed
@TurtIeSocks
TurtIeSocks deleted the fix/generator-trailing-newlines branch August 24, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant