Repository navigation
Conversation
`bun fmt` under bunfig.toml's [fmt] section (#1376) on the pinned 1.4.3-canary.20261013.1. No hand edits in this commit; regenerate it with `bun run format` on any later main rather than resolving conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JrwabjbnqxMv6U4YmV57aF
…s it needed On top of the mechanical reformat in the previous commit: - package.json: `format` (bun fmt) and `format:check`, which check:fast now runs. Named format so the script never shadows the built-in the way `lint` shadows `bun lint` (gotcha 67). - ci.yml: a Format step in validate, background like Lint, 0.1s. - tools/format-hook.ts, registered in .claude/settings.json on PostToolUse for Edit|Write|MultiEdit: formats the one edited file from the project root. bun fmt honours [fmt].ignorePatterns for explicit paths, so protected files stay byte for byte. It never fails the call. - 8 contract-test regexes in 5 files that spelled out one-line source now accept the wrapped form too (`\s*` where the formatter breaks). - shell/desktop and llms/endpoints re-locked: their input digests moved with the formatted sources; both outputs regenerated byte-identical. - CLAUDE.md, bunfig.toml and the fmt contract test now say the tree is formatted; gotcha 74 says what a new source-reading test must do. The contract test gains two cases: the hook formats an in-scope file, leaves an ignored one and anything outside the project alone, and exits 0 on bad input (control: a hook that spawns `fmtx` fails it); and the scripts, the validate step and the hook registration are all wired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JrwabjbnqxMv6U4YmV57aF
75fc308 to
fc4ad87
Compare
Wire-size diff vs merge base
Brotli q11, the quality the edge serves. Every number here is deterministic: Client assetsTotal Brotli: 205.67 KiB → 205.67 KiB (+0.00 KiB, +0.0%) across 39 files, 1 changed.
PagesNo change. 74 files, 667.11 KiB Brotli total. Worker bundleNo change. 285.80 KiB gzip. Dictionary transportFamily dictionary acquisition: no change, 14.50 KiB q11.
|
| renderInline(d.children, ctx) | ||
| .replace(/\|/g, "\\|") |
There was a problem hiding this comment.
This existed before this PR. The formatter only wrapped the chain across lines; main has the same tokens on one line (.replace(/\|/g, "\\|")). CodeQL's own summary notes that a diff this large can surface alerts the PR didn't introduce.
The pattern is also deliberate. The cell text comes from renderInline, which has already run escapeMd on it, and the comment right above this line records the measurement: double-backslash-then-pipe, lone backslashes and trailing backslashes, in both text and code-span cells, all 10 of 10 round-tripped. contract-md-table-escapes.test.mjs pins those bytes.
Escaping backslashes again here would double-escape them and break that test, so I'm not changing it in a formatting PR. Whether to dismiss the alert is the owner's call, so I'm leaving this thread open.
Generated by Claude Code
|
CodeQL is red: 2 high "Incomplete string escaping" alerts. I don't think this PR introduced either one. The reformat only wraps lines, and CodeQL's summary itself warns that a diff this large can surface alerts a PR didn't introduce.
CodeQL isn't a required check ( Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
aadhar-sh | fc4ad87 | Commit Preview URL Branch Preview URL |
Oct 16 2026, 06:07 PM |
What changed
Two commits. Review them separately:
2a8e182(mechanical):bun fmtunder the[fmt]section from docs(gotchas): the bun fmt hazards, held by a safe [fmt] config #1376 on the pinned canary (1.4.3-canary.20261013.1). It touches 503 files, +31.2K / -14.7K lines. There are no hand edits in this commit.fc4ad87(everything else):package.json:format(bun fmt) andformat:check, whichcheck:fastnow runs.ci.yml: a Format step invalidatethat runsbun run format:check, in the background like Lint. It takes 0.1 s.tools/format-hook.ts: registered in.claude/settings.jsonon PostToolUse forEdit|Write|MultiEdit. It runsbun fmton the one file an agent just edited, from the project root, and never fails the tool call.\s*where the formatter breaks a line.shell/desktopandllms/endpointsare re-locked. Their input digests moved with the formatted sources, and both outputs regenerated byte-identical.CLAUDE.mdgets a command and a working-in-this-repo rule,validate's list gains format, andbunfig.toml, the fmt test header and gotcha 74 now say the tree is formatted.Rebuilt once already. #1372, #1374 and #1377 landed minutes after this opened and left it conflicted. Rather than merge
mainin, I regenerated the mechanical commit onb8eb4a8and reapplied the fix commit. The reapply stopped only on the two derivation digest files: #1377 and the formatted sources had each re-lockedllms/endpoints. Both outputs were regenerated (byte-identical) and re-locked, never hand-merged.Why
You asked for it after the trial and impact review. One style everywhere, with no taste calls left in review:
The hook means agents never have to remember the formatter, and the
validatestep catches whatever a human or an edit outside Claude Code misses.Understanding check
[fmt]and the pinned bun, so the mechanical commit can be regenerated rather than merged. Everything the formatter must not touch is excluded in[fmt](gotchas 71 to 74), and the hook inherits those exclusions because bun fmt honoursignorePatternsfor explicit paths./a/URL re-mints and no dictionary delta changes..srctwins and thesw.jsunregister stub.tools/) shares 327 of its 385 files with this PR, and chore(worker): fix and trim src/worker comments under docs/COMMENTS.md #1327 (src/worker/) shares 91 of 107. Merge those first, then regenerate the mechanical commit on the newmain(git checkout origin/main -- . && bun run format) and reapplyfc4ad87. Don't resolve conflicts in a formatter's output by hand. The other open PRs overlap by 0 to 4 files..git-blame-ignore-revs, which GitHub honours.main(b8eb4a8) and on this head in the same sandbox:/a/orpd/file changed; 147 staged files differ: 100 Worker sources staged for wrangler, 46.srctwins andsw.js.derive:check,pages:checkand cal's suite: same as main.fmt --check: passes on 616 files.9bcbf1ecb,408c9374band5f5799ed1, 10-13 to 10-16) agree on every file.fmtxfails the new hook test.pkg.pr.newis blocked).routes:checkfails the same way on unformattedmainthere, and wrangler's real bundle was never built. This PR'svalidatecovers both.Validation
mainand on this head.bun test tools/contract-bun-fmt-keeps-out-of-what-it-would-break.test.mjs: 6 pass. The 2 new cases cover the hook and the wiring.release-path, because this changesvalidate, the one required check.🤖 Generated with Claude Code
https://claude.ai/code/session_01JrwabjbnqxMv6U4YmV57aF