test: integration-test the mode persist-on-unload wiring (#14)

The post-/runda DA pass on 4cd574b found the persist-on-unload wiring
(quit + project switch calling Database::set_mode) had no integration
test — only the db-level set_mode behaviour was covered, not that the
runtime actually invokes it on unload.

Add runtime::switch_persists_the_outgoing_projects_mode, driving the
real handle_project_switch end-to-end and asserting the outgoing
project's project.yaml recorded the mode it was left in. Red-first
verified: with the set_mode call disabled it fails (None vs
Some(Advanced)). The quit unload site shares the same set_mode call;
Action::Quit emission is already covered in app tests.

Updates ADR-0015 Amendment 1 coverage note.
This commit is contained in:
claude@clouddev1
2026-06-02 08:06:48 +00:00
parent 4cd574b909
commit 516848ff63
2 changed files with 62 additions and 3 deletions
+7 -3
View File
@@ -677,9 +677,13 @@ time").
(the teacher-export round-trip); `cli` `--mode` parse/precedence;
`app::{mode_command_changes_mode_and_emits_persist_action,
mode_command_via_one_shot_escape_persists_advanced,
project_switched_event_restores_the_stored_mode}`. The runtime's
unload call sites (quit + `handle_project_switch`) are thin
wiring over the tested `Database::set_mode`.
project_switched_event_restores_the_stored_mode}`;
`runtime::switch_persists_the_outgoing_projects_mode` — an
integration test driving the real `handle_project_switch` to
prove the unload wiring calls `set_mode` (red-first verified).
The quit unload site shares that `set_mode` call; the
`Action::Quit` emission is covered by `app`'s
`quit_command_returns_quit_action` / `ctrl_c_returns_quit_action`.
### Relationship to the Iteration 6 backlog