Summary
Several notebook view snapshot tests currently poke into App::context_mut() to flip internal state (e.g. setting last_log, mutating tabs, forcing vim_keymap). This bypasses real user flows and makes the tests fragile.
Examples
tui/tests/notebook_views.rs manually edits context.notebook.editors, pushes synthetic tabs, and sets breadcrumb vectors directly.
- The same file toggles
context.vim_keymap to display overlays instead of driving the key sequences that would normally open them.
Impact
- Tests couple snapshots to internal implementation details instead of public behaviour.
- It is hard to refactor the TUI context because tests rely on private state.
App::context_mut remains in tui/app.rs purely to support these tests.
Proposal
- Introduce helper functions or actions that exercise the notebook flows through real transitions (e.g. dedicated commands to show Vim keymaps, helpers for log/saving indicators).
- Refactor tests to use those helpers or existing input sequences instead of reaching into
context.
- Remove
App::context_mut entirely once no tests depend on it.
Acceptance Criteria
- Notebook view snapshot tests operate via user-level inputs or dedicated helpers; no direct
context mutation remains.
App::context_mut is no longer needed and is removed from tui/app.rs.
- Existing coverage stays unchanged after the refactor.
Summary
Several notebook view snapshot tests currently poke into
App::context_mut()to flip internal state (e.g. settinglast_log, mutatingtabs, forcingvim_keymap). This bypasses real user flows and makes the tests fragile.Examples
tui/tests/notebook_views.rsmanually editscontext.notebook.editors, pushes synthetic tabs, and sets breadcrumb vectors directly.context.vim_keymapto display overlays instead of driving the key sequences that would normally open them.Impact
App::context_mutremains intui/app.rspurely to support these tests.Proposal
context.App::context_mutentirely once no tests depend on it.Acceptance Criteria
contextmutation remains.App::context_mutis no longer needed and is removed fromtui/app.rs.