Iteration 4a: rebuild command with confirmation modal

Adds the explicit `rebuild` app-level command (ADR-0015 §7, §11)
and a modal UI infrastructure to host its confirmation dialog.
Typing `rebuild` emits Action::PrepareRebuild; the runtime reads
project.yaml + data/ to compute a summary ("3 tables and 47 rows
will be reconstructed; the existing playground.db will be
replaced") and posts AppEvent::RebuildPrepared, which opens the
modal. Y confirms, N/Esc cancels. While the modal is open,
normal input is gated.

The worker's do_rebuild_from_text now wipes existing user tables
and metadata before reloading from text, so it works on both
fresh and populated databases. Source text is plumbed through
rebuild_from_text so the explicit rebuild logs to history.log
while the silent on-load rebuild from Iteration 3 stays silent.

Modal infrastructure (App.modal field + key routing + centered
overlay rendering + word-wrap) is reused by Iteration 4b's save
/ save as / load / new flows.

Tests: 314 passing (268 lib + 9 + 5 + 6 new + 9 + 17),
0 failing, 0 skipped. Clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-07 22:27:37 +00:00
parent f0fc063756
commit ba93d3c7d8
9 changed files with 638 additions and 20 deletions
+12
View File
@@ -24,4 +24,16 @@ pub enum Action {
command: Command,
source: String,
},
/// User issued the `rebuild` app-level command (ADR-0015
/// §7, §11). Runtime computes a summary from
/// `project.yaml` + `data/` and posts back as
/// `AppEvent::RebuildPrepared`, which opens the
/// confirmation modal.
PrepareRebuild,
/// User confirmed the rebuild from inside the modal.
/// Runtime wipes the current schema/data and reconstructs
/// from text sources.
Rebuild {
source: String,
},
}