Repository navigation
fix(commit): recompose commit text after compatibility folding - #10794
Merged
Merged
Conversation
ntdatt812
force-pushed
the
fix/commit-unicode-recompose
branch
from
September 4, 2026 09:28
19716a7 to
6cb5007
Compare
roboomp
reviewed
Sep 4, 2026
roboomp
left a comment
Collaborator
There was a problem hiding this comment.
lgtm — P0: normalizeCommitUnicode() now fixes the UTF-8 byte-limit regression while retaining the existing compatibility folds; focused coverage exercises summaries, body details, footers, and ASCII mappings.
Verified bun test packages/coding-agent/test/commit-conventional.test.ts: 20 pass, 0 fail. Thanks @ntdatt812.
`normalizeCommitUnicode` runs NFKD to fold fractions, super/subscripts, ligatures and fullwidth forms down to ASCII, but never recomposes. Every precomposed letter is left split into a base plus combining marks, so the byte guard in `postProcessCommitMessage` measures a decomposition the author never wrote — Vietnamese inflates ~1.23x and Hangul ~2.4x. A summary of 113 UTF-8 bytes is measured at 139 and rejected with "Summary exceeds 128 bytes"; nothing catches that throw, so commit generation fails outright. Recompose with NFC after the replacement passes. Compatibility mappings never recompose, so every folding is preserved while the author's letters are restored and measured at the length they were written.
H4vC
force-pushed
the
fix/commit-unicode-recompose
branch
from
September 4, 2026 15:34
6cb5007 to
7ef0883
Compare
darsrc
pushed a commit
to darsrc/dar-oh-my-pi
that referenced
this pull request
Oct 10, 2026
…compose fix(commit): recompose commit text after compatibility folding
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.
What
normalizeCommitUnicodefolds compatibility forms (fractions, super/subscripts, ligatures, fullwidth) to ASCII by runningNFKD, but never recomposes afterwards. NFKD also decomposes every precomposed letter into a base plus combining marks, which is not part of that intent — and the function keeps the decomposition.This change appends
.normalize("NFC")to the pipeline. Compatibility mappings never recompose, so all the intended foldings survive; only the author's letters are put back together.Why
postProcessCommitMessagemeasures the summary in UTF-8 bytes after that call:Decomposition inflates the measurement for any script that uses precomposed letters — Vietnamese by ~1.23x, Hangul by ~2.4x — so a summary that fits gets rejected for exceeding the limit. Measured with the repo's own code:
normalizeCommitUnicodesửa lỗi bộ đệm không được giải phóng khi người dùng đóng phiên làm việc giữa chừng한국어 입력기에서 조합 중인 글자가 사라지는 문제를 수정The limit is 128 bytes, so both are rejected.
postProcessCommitMessageis called uncaught invalidateAndProcess, so the throw propagates out ofgenerateConventionalCommitand commit generation fails rather than degrading. The upstream cap does not help either:generate.ts:313usessliceCodePoints(chosen, 0, config.summaryHardLimit), which counts code points against a budget the guard then reads as bytes.Text that is short enough to pass is still affected — it reaches Git decomposed rather than as the author typed it.
Testing
Reproduced and confirmed fixed against the byte guard itself, through the repo's own code path:
postProcessCommitMessagewith the 113-byte Vietnamese summary above threwSummary exceeds 128 bytes.normalizeCommitUnicodereturned 139 bytes / 109 code points, byte-identical toNFKDof the input.Four tests added to
commit-conventional.test.ts. Reverting the one-line change fails three of them, includingaccepts non-ASCII summaries that fit the byte limit as written, which fails with the production errorSummary exceeds 128 bytes. The fourth (still folds compatibility forms down to ASCII) passes either way by design — it is the regression guard proving NFC does not undo the folding, checked over ½ ² ₂ fi ① full ≠ “” → α.Checks run:
bun test packages/coding-agent/test/commit-conventional.test.ts— 20 pass, 0 failbun run check:ts— passes across the workspace (oxlint, oxfmt, andtsgo --noEmitper package). This change is TypeScript only, socheck:rswas not run.commit-execute.test.tshas one failure (abortOnGitFailure (issue #7834) > surfaces a refusing hook's message...). It reproduces identically on an unpatched tree — same test name, same 2 pass / 1 fail — so it does not come from this change.bun run check:tspasses (Rust untouched;check:rsnot run)