You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spelling: bound a word's language and index results by offset - #1767
Word language:paragraph_words gave every word its own copy of the run's language string, and imported language values have no length bound. A paragraph of many short words under one huge lang value made one copy per word.
Merging results:misspelt merged spelling and repetition results by linearly searching the results kept so far for the same offset. A paragraph of many repeated words (the the the …) made that quadratic.
What changed
MAX_LANG_LEN (64 bytes) bounds the language. A run or default language longer than that counts as none (no dictionary is ever found for it) and is not copied into words. BCP 47 tags in documents are a few bytes.
Result merging keys an offset → index map. A repeated misspelt word is still reported once, as repeated.
Added a test: 100,000 copies of one word under a 1 MB language value. No word carries the value, and 99,999 repeats are found.
Blast radius
deckcraft-engine spelling (review.spelling, the red underlines). Normal language tags behave as before.
No actionable comments were generated in the recent review.
Walkthrough
Spell processing now limits language tags to 64 bytes and uses word start positions to replace duplicate results. A regression test covers oversized language tags and repeated words.
Changes: Spell processing
Layer / File(s)
Summary
Language limits and repeated-word results crates/engine/src/spell.rs
Oversized default and run-level language tags resolve to empty strings. Result folding tracks word start positions and replaces existing results at matching positions. A regression test covers 100,000 repeated words and oversized language tags.
No merge-blocking issue is established for this change; the command-side performance concern predates it.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names two changes: bounding a word's language value and indexing spelling results by offset. The raw summary confirms both. paragraph_words now caps language tags at 64 bytes, and misspelt n…
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names two changes: bounding a word's language value and indexing spelling results by offset. The raw summary confirms both. paragraph_words now caps language tags at 64 bytes, and misspelt now deduplicates by start position with a position-to-result index. The title is specific and accurate, though it does not mention the regression test or the repeated-word dedup behavior, which is expected for a short title.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between aa13eeb and 206aab8.
Files selected for processing: 1
crates/engine/src/spell.rs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
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
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 was wrong
Spell checking a paragraph:
paragraph_wordsgave every word its own copy of the run's language string, and imported language values have no length bound. A paragraph of many short words under one hugelangvalue made one copy per word.misspeltmerged spelling and repetition results by linearly searching the results kept so far for the same offset. A paragraph of many repeated words (the the the …) made that quadratic.What changed
MAX_LANG_LEN(64 bytes) bounds the language. A run or default language longer than that counts as none (no dictionary is ever found for it) and is not copied into words. BCP 47 tags in documents are a few bytes.Blast radius
deckcraft-enginespelling (review.spelling, the red underlines). Normal language tags behave as before.Checks run
cargo fmt -p deckcraft-engine --checkcargo clippy -p deckcraft-engine --all-targets -- -D warningscargo test -p deckcraft-engineChecks not run
cargo xtask ciSummary by CodeRabbit