test: direct-mode shadow-buffer invariant over forward/reverse/forward - #78
Merged
Conversation
Direct Mode (RFC 0015) consumes the output callback as deltas: 0 = insert, 1 = delete (frontends send one backspace per code point), 2 = clear. Regression guard: replaying those events into a shadow buffer must always reproduce dasher_get_output_text() byte-for-byte. Investigation context (Dasher-Windows build .24 reports): the invariant holds on both v0.1.6 (the pin .24 shipped with) and current main across 20 scenarios — shallow and deep reversals, with and without pointer-up pauses — so the 'zoom back to delete, zoom forward again, previous word corrupted' report was the Windows newline-injection path (fixed Dasher-Windows bfdafb4), not the engine. Signed-off-by: will wade <willwade@gmail.com>
- Apply the repo clang-format the CI expects - create_isolated_context() leaks its temp dir by design; new tests should use ScopedContext per test_common.h — the sweep now cleans up after itself Signed-off-by: will wade <willwade@gmail.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
dasher_get_output_text()byte-for-byteInvestigation context
This test was written while investigating a Dasher-Windows build .24 report ("zoom back to delete a word or a bunch of words, zoom forward again — it messes up just the previous word"). The invariant holds on both v0.1.6 (the pin .24 shipped with) and current main — the engine's insert/delete stream is consistent. The corruption was the Windows newline-injection path (fixed in Dasher-Windows bfdafb4:
KEYEVENTF_UNICODE0x0A is ignored by target apps; now mapped toVK_RETURN), which made paragraph-node deletes eat a character of the preceding word.Kept as a permanent guard: any future engine-side drift in the delete/re-emit path breaks direct mode on every frontend.
Greptile Summary
The PR adds a Direct Mode regression test that replays output callback events into a shadow buffer and checks that it remains byte-for-byte consistent with the engine’s output across forward/reverse/forward navigation.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Test participant Engine as DasherCore participant Shadow as Shadow buffer Test->>Engine: Drive forward navigation Engine-->>Shadow: Insert callbacks Test->>Engine: Drive reverse navigation Engine-->>Shadow: Delete callbacks Test->>Engine: Drive forward again Engine-->>Shadow: Re-emitted insert callbacks Test->>Engine: dasher_get_output_text() Test->>Shadow: Compare byte-for-byte Shadow-->>Test: Matching invariantReviews (2): Last reviewed commit: "style: clang-format; switch to ScopedCon..." | Re-trigger Greptile