Put the layout store behind a boundary, and assert the words it puts on screen

Persistence here has two rules and neither was tested. Losing the layout must
never lose the session, so every failure falls back to the first-run workspace
and carries on; and the fallback must be visible, so each path returns a
status string the footer shows. Nine different strings, one of which is the
only notice a user gets that the arrangement they spent a morning on has been
dropped, and not one of them was asserted anywhere. The way to find out that
a corrupt snapshot reports "invalid layout ignored" was to corrupt one.

Ten tests now cover the branches a real machine reaches: nowhere to write, a
data directory that cannot be created, a database SQLite refuses to open, a
fresh database that is ready rather than restored, a round trip that restores
a panel created before the save, and both ways a snapshot can be unusable --
malformed JSON and well-formed JSON describing a workspace with no attached
panel, since parsing is not validation and only the second is easy to write by
accident.

workspace_database_path now reads through EnvSource rather than std::env, for
exactly the reason that trait was introduced in lumbridge-settings: the
workspace forbids unsafe, set_var is unsafe in Rust 2024, and a precedence
rule that cannot be exercised without mutating the process running the test is
a precedence rule that stays untested. The one behavioural consequence is that
a non-UTF-8 value in LUMBRIDGE_SPIKE_DB, XDG_DATA_HOME or HOME is now treated
as unset rather than used as a path; that is what every other setting in the
shell already does with such a value.

persist_panels stays a method, reduced to the one thing the shell owns: a
workspace with no store is not a save failure. It is memory-only, the footer
has said so since startup, and replacing that standing message with an error
every time a pane moved would say less, not more.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SPYebLiN2w4TqnHUYGdECq
This commit is contained in:
Metal Agent
2026-09-01 13:00:46 -07:00
co-authored by Claude Opus 5
parent ae22f5522b
commit beaffbd0a7
4 changed files with 332 additions and 77 deletions
+3
View File
@@ -20,5 +20,8 @@ lumbridge-ui-fixture = { path = "../../crates/lumbridge-ui-fixture" }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
[dev-dependencies]
tempfile = "3.27.0"
[lints]
workspace = true