Conversation
The nested leading-word gate switch pushed applyStreamedPartial to a cyclomatic complexity of 11, failing the strict lint gate. Move the gate into passesStreamedLeadingWordGate, mirroring how handleTypoGate keeps generateFromCurrentFocus within budget. Behavior is unchanged: a pending gate consults the seam guard once, a settled gate answers without another spell lookup. Also fix the CompletionSeamGuard header, which still said "Both rules" after the leading-word rule made three. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Cover the cases that were easy to misread while reviewing the guard: the final verdict suppresses a correctable last word with no trailing boundary (only the streamed verdict waits for one), a connector continuing the caret word stays in the mid-word rule, hyphenated tokens are assessed whole, and words under four letters skip the lookup entirely. Co-Authored-By: Claude Fable 5.1 <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.
Summary
Mirror of upstream FuJacob#814 by @BaptisteGarcin plus the fix for the strict SwiftLint gate that was failing there. The guard hides ghost text whose first generated word the native spell checker flags as a correctable typo, and the streaming path holds that word back until its boundary arrives so the spell lookup runs once per generation. The lint fix moves the nested gate
switchout ofapplyStreamedPartialintopassesStreamedLeadingWordGate(complexity 11 is over the cap of 10), mirroring the existinghandleTypoGateprecedent, with no behavior change; four tests pin down the boundary semantics that were easy to misread. Opened on the fork so CI can validate the combined branch; the two fix commits alone live onclaude/pr-814-fix-onlyfor pushing to the contributor's branch.Validation
RUN_LLAMA_EVAL, Qwen3.5-0.8B-Base, 117 cases): 11 seam-guard suppressions, all attributable to the pre-existing mid-word rule; the new leading-word rule fired 0 times, so eval scores are unchanged by this branch.ecrir plus vitewas suppressed withleadingWordMisspelling(word: "ecrir")in 5 of 5 generations; withhello there friendthe streamed session became acceptable only once the second chunk completed the word "hello", and Tab pressed mid-stream accepted it (Tab-accepted-chunk). Also exercised with the real llama model in TextEdit: suggestion shown, typed through, and accepted.Linked issues
Refs FuJacob#814, Refs FuJacob#811 (upstream context).
Risk / rollout notes
NSSpellCheckerlookup per generation on the main actor: about 0.1 ms when the first word is known, about 9 ms when it is not (theguessescall), and the final apply repeats it with no shared memo.changelog,webhook,hotfix,iterable,hashable,swiftlint,swiftui,openai,gguf, andcotabbyare all correctable and would be suppressed as a first generated word; capitalized forms are exempt. Worth watching theleadingWordMisspellingsuppression metric after rollout.🤖 Generated with Claude Code