BS-PR-603 - Editor session persistence and crash diagnostics #41

Closed
opened 2026-07-10 04:03:23 -04:00 by Rbanh · 2 comments
Owner

Summary

Restore a productive editor session after restart and make abnormal termination actionable.

Scope

  • Persist open scene, dock layout, active panels, viewport bookmarks, hierarchy expansion, and non-destructive tool preferences.
  • Track clean shutdown versus abnormal termination without collecting user content.
  • On restart, offer safe resume and link relevant launch/render/plugin logs.
  • Add a diagnostics bundle command that records versions, GPU/backend, project paths, recent editor errors, and validation summaries.
  • Keep machine-local session state out of project source control.

Acceptance criteria

  • Clean restart restores the last working session without changing project files.
  • Crash restart offers safe resume and recovery rather than silently reopening a bad state.
  • Diagnostics bundle excludes scene contents and credentials.
  • Persistence schema is versioned and migration-tested.
## Summary Restore a productive editor session after restart and make abnormal termination actionable. ## Scope - Persist open scene, dock layout, active panels, viewport bookmarks, hierarchy expansion, and non-destructive tool preferences. - Track clean shutdown versus abnormal termination without collecting user content. - On restart, offer safe resume and link relevant launch/render/plugin logs. - Add a diagnostics bundle command that records versions, GPU/backend, project paths, recent editor errors, and validation summaries. - Keep machine-local session state out of project source control. ## Acceptance criteria - [ ] Clean restart restores the last working session without changing project files. - [ ] Crash restart offers safe resume and recovery rather than silently reopening a bad state. - [ ] Diagnostics bundle excludes scene contents and credentials. - [ ] Persistence schema is versioned and migration-tested.
Rbanh added this to the M6 - Reliability, recovery, and project workflow milestone 2026-07-10 04:03:23 -04:00
Rbanh added the
type:feature
priority:P0
area:quality
roadmap:production
labels 2026-07-10 04:03:23 -04:00
Author
Owner

Current-state audit (2026-07-10):

Already persisted machine-locally:

  • dock layout (UserPreferences.dock_layout),
  • hierarchy filter/expanded paths/generated/runtime/sort preferences,
  • recent levels/projects and last project root,
  • autosave and save-before-play preferences.

Confirmed gaps:

  • editor_prefs.ron has no explicit schema version or migration layer;
  • startup still seeds SceneIo from the compiled default scene rather than a versioned last-session record;
  • CameraBookmarks is memory-only;
  • Diagnostics / Brush Diagnostics / Rendering / Project Settings open state is memory-only;
  • no editor-owned clean-shutdown marker or safe-resume decision (the desktop launcher lock/log is outside the editor state contract);
  • no privacy-bounded diagnostics bundle command.

Implementation direction for the next slice:

  • separate versioned session document under XDG state (blacksite-editor/session.ron) from durable user preferences;
  • store project root, active scene, dock/panel state, bookmarks, hierarchy state snapshot, and clean-shutdown generation;
  • write an early running marker and a clean marker on normal exit; abnormal prior state enables safe resume without auto-restoring modal/dirty tool state;
  • generate a diagnostics manifest containing versions/backend/project paths/recent errors/validation summary only, explicitly excluding scene contents, environment values, and credentials;
  • migration and privacy allowlist tests before live crash/restart QA.
Current-state audit (2026-07-10): Already persisted machine-locally: - dock layout (`UserPreferences.dock_layout`), - hierarchy filter/expanded paths/generated/runtime/sort preferences, - recent levels/projects and last project root, - autosave and save-before-play preferences. Confirmed gaps: - `editor_prefs.ron` has no explicit schema version or migration layer; - startup still seeds `SceneIo` from the compiled default scene rather than a versioned last-session record; - `CameraBookmarks` is memory-only; - Diagnostics / Brush Diagnostics / Rendering / Project Settings open state is memory-only; - no editor-owned clean-shutdown marker or safe-resume decision (the desktop launcher lock/log is outside the editor state contract); - no privacy-bounded diagnostics bundle command. Implementation direction for the next slice: - separate versioned session document under XDG state (`blacksite-editor/session.ron`) from durable user preferences; - store project root, active scene, dock/panel state, bookmarks, hierarchy state snapshot, and clean-shutdown generation; - write an early running marker and a clean marker on normal exit; abnormal prior state enables safe resume without auto-restoring modal/dirty tool state; - generate a diagnostics manifest containing versions/backend/project paths/recent errors/validation summary only, explicitly excluding scene contents, environment values, and credentials; - migration and privacy allowlist tests before live crash/restart QA.
Author
Owner

Implemented locally and acceptance-tested end to end.

Delivered:

  • Versioned session.ron schema v1 in the XDG user-state directory, written transactionally and kept outside project source control.
  • Clean-shutdown marker ordered after Bevy window exit emission.
  • Clean restart restores the active authored scene, dock/hierarchy metadata, panel visibility, and finite viewport bookmarks without writing project files.
  • Abnormal restart opens the safe startup state and presents explicit Resume Last Scene / Continue Safe choices; modal operators, dirty previews, and ECS data are never restored.
  • Privacy-bounded Window -> Diagnostics -> Export Diagnostic Bundle command. The transactional RON report includes editor/Bevy/build identity, OS/arch, GPU/backend/driver, project and scene paths, dirty flags, aggregate validation counts, prior-crash state, and the bounded Scene I/O log.
  • Bundle excludes scene/asset contents, environment values, host/user identity, credentials, access tokens, camera transforms, and modal state.
  • ADR 0024 plus session-recovery, architecture, README, and editor-index documentation.
  • Migration/privacy/unit coverage for legacy schema, newer-schema rejection, invalid camera poses, allowlisted session serialization, allowlisted diagnostic sections, and bounded control-free event messages.

Live acceptance evidence:

  1. Normal Alt+F4 persisted clean_shutdown: true; clean relaunch restored assets/levels/editor_scene.scn.ron with no recovery prompt.
  2. Forced SIGKILL left clean_shutdown: false; relaunch displayed the recovery prompt.
  3. Resume Last Scene closed the prompt and reloaded the authored scene; a following clean exit/relaunch returned to normal startup.
  4. Live bundle captured Bevy 0.19, RTX 3080 Ti / Vulkan / NVIDIA 610.43.03, 29 level objects, three valid brushes, clean dirty flags, and the bounded load event. Direct forbidden-field scan was empty.

Verification:

  • cargo fmt --all -- --check
  • git diff --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo clippy -p editor --all-targets --features dev -- -D warnings
  • cargo test --workspace: 141 passed, 1 intentionally ignored
  • cargo validate-levels: ok

The rebuilt editor is left open after a final clean launch.

Implemented locally and acceptance-tested end to end. Delivered: - Versioned `session.ron` schema v1 in the XDG user-state directory, written transactionally and kept outside project source control. - Clean-shutdown marker ordered after Bevy window exit emission. - Clean restart restores the active authored scene, dock/hierarchy metadata, panel visibility, and finite viewport bookmarks without writing project files. - Abnormal restart opens the safe startup state and presents explicit **Resume Last Scene** / **Continue Safe** choices; modal operators, dirty previews, and ECS data are never restored. - Privacy-bounded **Window -> Diagnostics -> Export Diagnostic Bundle** command. The transactional RON report includes editor/Bevy/build identity, OS/arch, GPU/backend/driver, project and scene paths, dirty flags, aggregate validation counts, prior-crash state, and the bounded Scene I/O log. - Bundle excludes scene/asset contents, environment values, host/user identity, credentials, access tokens, camera transforms, and modal state. - ADR 0024 plus session-recovery, architecture, README, and editor-index documentation. - Migration/privacy/unit coverage for legacy schema, newer-schema rejection, invalid camera poses, allowlisted session serialization, allowlisted diagnostic sections, and bounded control-free event messages. Live acceptance evidence: 1. Normal `Alt+F4` persisted `clean_shutdown: true`; clean relaunch restored `assets/levels/editor_scene.scn.ron` with no recovery prompt. 2. Forced `SIGKILL` left `clean_shutdown: false`; relaunch displayed the recovery prompt. 3. **Resume Last Scene** closed the prompt and reloaded the authored scene; a following clean exit/relaunch returned to normal startup. 4. Live bundle captured Bevy 0.19, RTX 3080 Ti / Vulkan / NVIDIA 610.43.03, 29 level objects, three valid brushes, clean dirty flags, and the bounded load event. Direct forbidden-field scan was empty. Verification: - `cargo fmt --all -- --check` - `git diff --check` - `cargo clippy --workspace --all-targets -- -D warnings` - `cargo clippy -p editor --all-targets --features dev -- -D warnings` - `cargo test --workspace`: 141 passed, 1 intentionally ignored - `cargo validate-levels`: ok The rebuilt editor is left open after a final clean launch.
Rbanh closed this issue 2026-07-10 11:37:56 -04:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Falling-Metal-Interactive/Blacksite#41
No description provided.