Add adversarial tests for early cursor-line divergence cancellation#309516
Merged
Add adversarial tests for early cursor-line divergence cancellation#309516
Conversation
Expand test coverage for the InlineEditsXtabEarlyCursorLineDivergenceCancellation feature across all three layers: isModelCursorLineCompatible (+20 tests): - Case sensitivity (F vs f correctly cancels) - Unicode/emoji/CJK characters - Replacement edge cases (shorter replacement, pure deletion, different region) - Auto-close angle brackets (<>) - Non-auto-close text ((x) correctly uses startsWith, not subsequence) - Model produced less than user typed - Identical changes, net-zero edits - Substring vs prefix distinction - Whitespace edits outside model range getCurrentCursorLine (+7 tests): - Compound edits (line shift + cursor line modification) - Multi-line replacement of cursor line - Empty document, edit at document end Integration streaming wrapper (+6 tests): - Feature disabled: no cancellation with divergent typing - Model output shorter than edit window: cursor line never reached - getCurrentCursorLine returns undefined: check safely skipped - Net-zero intermediate edit: check skipped - Partial edits yielded before cursor-line cancellation - Auto-close pair end-to-end
Contributor
There was a problem hiding this comment.
Pull request overview
Adds adversarial test coverage for early cursor-line divergence cancellation in the Copilot xtab pipeline, exercising both the core compatibility logic and the integration streaming behavior.
Changes:
- Adds multiple integration tests in
xtabProvider.spec.tsto validate cancellation/skip conditions and end-to-end auto-close compatibility. - Expands unit tests in
cursorLineDivergence.spec.tsforisModelCursorLineCompatibleandgetCurrentCursorLineacross edge cases (case sensitivity, Unicode, replacements, compound edits, empty doc, end-of-doc edits).
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/xtab/test/node/xtabProvider.spec.ts | Adds integration-level streaming/cancellation tests for cursor-line divergence behavior. |
| extensions/copilot/src/extension/xtab/test/node/cursorLineDivergence.spec.ts | Adds unit tests covering adversarial inputs for cursor-line compatibility and cursor-line mapping under edits. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
extensions/copilot/src/extension/xtab/test/node/xtabProvider.spec.ts
Outdated
Show resolved
Hide resolved
extensions/copilot/src/extension/xtab/test/node/cursorLineDivergence.spec.ts
Outdated
Show resolved
Hide resolved
Contributor
- Rename 'returns undefined when cursor line is entirely replaced' to 'returns first replacement line when cursor line start coincides with replacement start' — aligns name with actual assertion (returns 'X'). - Clarify partial-edit-before-cancellation test: ResponseProcessor.diff may buffer lines, so pre-cursor edits aren't guaranteed to be yielded before stream termination.
3c9cbe7 to
7e1150e
Compare
roblourens
approved these changes
Apr 13, 2026
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.
Expand test coverage for the
InlineEditsXtabEarlyCursorLineDivergenceCancellationfeature across all three architectural layers (+33 tests total).isModelCursorLineCompatible(+20 tests)Fvsfcorrectly cancels — intentional for code identifiers)<>(x)correctly usesstartsWith, not subsequence)getCurrentCursorLine(+7 tests)Integration streaming wrapper (+6 tests)
getCurrentCursorLinereturnsundefined→ divergence check safely skipped()typed, model fills parens → compatible)Findings