Skip to content

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Sep 5, 2025

The issue was that when running tests via Maven/Tycho, the Eclipse workspace context (IUndoContext) was not properly initialized. This caused the undo operations to fail because they couldn't find the matching context.

Changes made:

  • Update recordOperation to properly add operations to history with context
  • Fix operation contexts to use workspace undo context
  • Update tests to match REST service behavior (apply changes before recording)
  • Add proper context management in CopilotFileEditOperation
  • Created a custom WorkspaceUndoContext class to use when the default workspace context is not available (common in test environments)
  • Made the custom context a singleton to ensure consistency across operations
  • Updated getOrCreateWorkspaceContext() to fall back to the custom context
  • All undo/redo operations now use the same consistent context

This allows tests to pass both when run in Eclipse IDE and via Maven CLI. All 15 undo/redo tests (10 in CopilotUndoManagerTest + 5 in BinaryFileUndoRedoTest) are now passing.

Artur- and others added 2 commits September 5, 2025 13:46
The issue was that when running tests via Maven/Tycho, the Eclipse workspace
context (IUndoContext) was not properly initialized. This caused the undo
operations to fail because they couldn't find the matching context.

Changes made:
- Update recordOperation to properly add operations to history with context
- Fix operation contexts to use workspace undo context
- Update tests to match REST service behavior (apply changes before recording)
- Add proper context management in CopilotFileEditOperation
- Created a custom WorkspaceUndoContext class to use when the default
  workspace context is not available (common in test environments)
- Made the custom context a singleton to ensure consistency across operations
- Updated getOrCreateWorkspaceContext() to fall back to the custom context
- All undo/redo operations now use the same consistent context

This allows tests to pass both when run in Eclipse IDE and via Maven CLI.
All 15 undo/redo tests (10 in CopilotUndoManagerTest + 5 in BinaryFileUndoRedoTest) are now passing.

Co-Authored-By: Claude <[email protected]>
Copy link
Member

@manolo manolo left a comment

Choose a reason for hiding this comment

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

Antes: Tests run: 186, Failures: 9, Errors: 9, Skipped: 0
Despues: Tests run: 195, Failures: 0, Errors: 9, Skipped: 0

@manolo manolo merged commit 976687b into main Sep 7, 2025
2 checks passed
@manolo manolo deleted the undoredo-tests branch September 7, 2025 12:26
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