Skip to content

fix: skip auto-commit when committed reading is shorter than 2 kana#213

Merged
send merged 4 commits intomainfrom
fix/auto-commit-min-reading-length
Apr 8, 2026
Merged

fix: skip auto-commit when committed reading is shorter than 2 kana#213
send merged 4 commits intomainfrom
fix/auto-commit-min-reading-length

Conversation

@send
Copy link
Copy Markdown
Owner

@send send commented Apr 8, 2026

Summary

  • Auto-commit was firing on single-kana first segments (e.g. "じ" from "じぇのさいど"), destroying longer word boundaries
  • When typing "jenosaid" → "ジェノサイド", Viterbi segmented intermediate input as [自(じ), ぇ, 之(の), 再(さい)] and auto-committed "自" after stability threshold was met
  • After the premature commit, remaining "ぇのさいど" could not produce "ジェノサイド"
  • Added a minimum committed reading length check (>= 2 kana chars) to prevent this

Test plan

  • cargo fmt --all --check && cargo clippy --workspace --all-features -- -D warnings && cargo test --workspace --all-features all pass
  • Manually verified "じぇのさいど" → "ジェノサイド" works without premature auto-commit

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 8, 2026 08:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents premature auto-commit in lex-session when the Viterbi best path begins with a single-kana segment, which can break longer-word conversions during incremental typing.

Changes:

  • Add a minimum committed reading length check (>= 2 chars) before auto-commit triggers.
  • Document why single-kana auto-commits are harmful for longer, still-in-progress words.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread engine/crates/lex-session/src/auto_commit.rs Outdated
Comment thread engine/crates/lex-session/src/auto_commit.rs Outdated
send and others added 2 commits April 8, 2026 18:16
When typing "jenosaid" (じぇのさいど→ジェノサイド), the Viterbi segmented
intermediate input as [自(じ), ぇ, 之(の), 再(さい)], causing auto-commit
to fire on the single-kana first segment "じ". This destroyed the longer
word boundary, making it impossible to produce "ジェノサイド".

Add a minimum committed reading length check (>= 2 chars) to prevent
premature auto-commit of single-kana segments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Compute committed_reading.chars().count() once and reuse for both
  the minimum-length guard and kana slicing
- Add test_auto_commit_skips_single_kana_first_segment regression test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@send send force-pushed the fix/auto-commit-min-reading-length branch from 3a58211 to 52199e9 Compare April 8, 2026 09:18
@send send requested a review from Copilot April 8, 2026 09:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread engine/crates/lex-session/src/tests/candidates.rs
Assert resp.commit.is_none() and kana unchanged directly, instead of
only checking committed text length.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread engine/crates/lex-session/src/auto_commit.rs Outdated
Comment thread engine/crates/lex-session/src/tests/candidates.rs
Comment thread engine/crates/lex-session/src/tests/candidates.rs
- Only apply single-kana auto-commit guard to hiragana readings
  (ASCII prefixes like URLs are not affected)
- Add stability precondition assert in regression test to ensure
  the test actually exercises the min-length guard

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@send send merged commit 6b7ea21 into main Apr 8, 2026
10 checks passed
@send send deleted the fix/auto-commit-min-reading-length branch April 8, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants