fix(build): write a trailing newline from the JSON generators - #1246
Merged
Conversation
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>
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.
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:envrewritesconfig/custom-environment-variables.jsonthroughJSON.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-stagedput the newline back on the way through, and the commit succeeded. There are 38chore: 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 --quietpasses,changes_existstays false, and the commit step is skipped entirely. That ends the 38-commit churn as a side effect.Verification
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