Skip to content

Complete caret movement, final fixes, and re-anchoring - #35

Merged
HusseinBaraja merged 2 commits into
mainfrom
Complete-caret-movement-behavior
Oct 3, 2026
Merged

HusseinBaraja merged 2 commits into
mainfrom
Complete-caret-movement-behavior

Conversation

@HusseinBaraja

@HusseinBaraja HusseinBaraja commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

Caret movement previously retired unchecked typing on short forward hops, while final-fix handling only logged eligibility. This change completes correction and re-anchoring through the existing worker and native replacement pipeline.

  • Keep the old context until typing resumes. Backward movement within known typing continues that context; forward hops within the configurable limit (default five words) retain typed spans and keep skipped text read-only.
  • Run one final check on eligible old spans after longer forward movement or movement away from pending work. Commit corrected or unchanged text, then continue with fresh typing at the new position.
  • Verify each editable range before the live caret, preserve skipped text and newer typing, and retain app-level undo. Unproved or different-field positions re-anchor without unsafe replacement.
  • Add session, worker, queue, cancellation, policy, and native editor regressions; update the behavior documentation.

Validation

  • cargo test --workspace: 397 passed, 7 ignored.
  • dotnet test .\AutoFix.sln --no-build: 151 passed.
  • Rust and .NET builds passed; .NET reported zero warnings and errors. Formatting and diff checks passed.
  • Targeted native caret-movement smoke passed, including changed/no-change results, read-only gaps, text after the caret, and undo.
  • Isolated engine startup, IPC status, and graceful shutdown passed.

Native smoke follow-up (0c5df3e): activation retries now preserve the case's caret/selection, completion waits no longer report a timeout after successful completion, and native smoke runs emit metadata diagnostics. Added caret/selection preservation assertions. The automatic-trigger smoke passed five consecutive runs after these fixes; automatic-trigger, caret-movement, and full native replacement/undo smoke tests then all passed with the new assertions. The Rust suite (397 passed, 7 ignored), build, formatting and diff checks also passed again. .NET and isolated startup results above are from the original feature validation; this follow-up changes only the Rust test harness.

An unexpected stray character was reproduced once before these harness fixes, then did not recur in repeated runs. Its precise source remains unproved; the passing runs establish current verification, not a confirmed explanation of that earlier character.

Summary by CodeRabbit

  • Bug Fixes
    • Typing context is now handled more reliably when you move the caret. Short moves can preserve prior typed text for correction, while longer moves start a fresh segment and may trigger a final check on eligible earlier text.
    • Corrections no longer change text after the caret. Skipped text, intervening gaps, and newer typing are preserved.
    • Moving away from pending corrections cancels stale results; uncertain positions and unverified text are handled without unsafe edits.
    • Manual and automatic correction triggers now account for retained typing and configured limits.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 71bd7566-9e67-423a-a442-bcff30d58500
📥 Commits

Reviewing files that changed from the base of the PR and between 6416041 and c1ccf9a.

📒 Files selected for processing (12)
  • README.md
  • app-core-rust/README.md
  • app-core-rust/src/background/mod.rs
  • app-core-rust/src/background/pipeline.rs
  • app-core-rust/src/background/pipeline/tests.rs
  • app-core-rust/src/background/pipeline/tests/movement.rs
  • app-core-rust/src/background/replacement/tests.rs
  • app-core-rust/src/background/session.rs
  • app-core-rust/src/background/session/movement.rs
  • app-core-rust/src/background/session/pending.rs
  • app-core-rust/src/background/session/undo.rs
  • app-core-rust/src/background/triggers.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

Caret movement handling now retains owned typed spans and separates them from skipped text. Automatic and manual triggers can request corrections for retained spans. Pipeline checks validate pending work against current session and document state before applying edits.

Changes

Caret Movement Corrections

Layer / File(s) Summary
Retained movement state
app-core-rust/src/background/session.rs, app-core-rust/src/background/session/movement.rs, app-core-rust/src/background/session/pending.rs
Sessions track retained typed spans, intervening gaps, and submission state. Verified movement can rebuild executable context from owned text, while uncertain or unprovable movement avoids combining text from separate positions.
Movement trigger scheduling
README.md, app-core-rust/README.md, app-core-rust/src/background/mod.rs, app-core-rust/src/background/triggers.rs
Input and movement resolution schedule automatic or manual requests for retained spans using correction-specific context. The documentation describes movement behavior, limits, and final checks.
Correction validation and completion
app-core-rust/src/background/pipeline.rs, app-core-rust/src/background/session/undo.rs, app-core-rust/src/background/pipeline/tests/*, app-core-rust/src/background/replacement/tests.rs
Pipeline validation checks pending submission and the known text range before applying results. Tests cover movement-triggered corrections, cancellation, edit outcomes, queue ordering, and undo.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Merge Risk: 🔵 Low · up to c1ccf

Caret-movement retention and final checks are covered by the new unit tests and a passing targeted native smoke test. The broader native automatic-trigger smoke test still fails with unexpected editor input, and the cause is unknown. That failure should be understood, or explicitly accepted, before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c1ccf

Earlier typing can now be corrected after caret movement, but edits remain tied to the authorized field and verified owned text. No policy bypass or unsafe expansion of editing authority was established. Remaining uncertainty concerns interrupted native edits and the unresolved broader editor smoke check.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected mutation path is bounded to verified owned text in the currently authorized focused field. The behavioral expansion is temporal—earlier typing can remain eligible after movement—not demonstrated cross-field, cross-process, or service-level authority.

Security Findings and Attack Paths

  • observed — The inspected protected-target and stale-caret regression rejects dispatch or completion without calling replacement. Production code independently checks policy, field identity, input stamps, pending ownership, and live text; this is counterevidence to a movement-induced authorization bypass, not proof about every host editor.

Trust Boundaries and Controls

  • observed — The native boundary verifies the selected original span before mutation, then reacquires the provider to verify replacement and preserved following text before restoring the caret. Success also requires clipboard restoration; an uncertain attempt cannot fall through to another strategy.

Resilience and Maintainability Implications

  • observed — Uncertain native failure cancels work and deactivates tracking. Interruption after native success likewise abandons stale ownership rather than restoring unchecked originals. App-level undo is recorded only after successful session commit, so it is not guaranteed in that interruption state; this containment behavior predates the PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 81.58% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 76 functions across 10 files. (2 skipped: 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: completing caret movement handling, final fixes, and re-anchoring.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HusseinBaraja

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HusseinBaraja
HusseinBaraja merged commit 45c02d0 into main Oct 3, 2026
3 checks passed
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.

1 participant