BS-PR-710 - Keep editor actions safe during scoped UI rendering #57

Closed
opened 2026-07-13 05:59:06 -04:00 by Rbanh · 1 comment
Owner

Summary

Keep synchronous editor UI actions safe while the main egui state is temporarily scoped out of the ECS world during rendering.

Why

Native #55 acceptance on 2026-07-13 reproduced an immediate editor crash after File > New Scene followed by toolbar Spawn cube:

Requested resource editor::ui::UiState does not exist in the World
crates/editor/src/ui/toolbar.rs

show_ui_system intentionally owns UiState through Bevy resource_scope while drawing the editor. Synchronous UI callbacks must use state already owned by that UI call or communicate through independent resources; they cannot query the temporarily absent UiState.

Independent review found the same root in:

  • toolbar primitive, point-light, and navigation-bounds placement;
  • three Diagnostics Select buttons that deterministically panic;
  • Inspector component-collapse and Locate in Asset Browser actions that silently no-op because optional UiState lookup always fails inside the scope.

Deferred command-palette actions run after the scope and are not affected.

Implementation notes

  • Pass the current viewport rectangle explicitly through toolbar/navigation placement helpers.
  • Route diagnostic selection through SelectedEntity; let end-of-pass reconciliation update the owned egui selection.
  • Pass or mutate owned inspector/UI state explicitly for component-collapse and asset-browser focus.
  • Keep the resource_scope architecture unchanged.
  • Audit every synchronous UI call path for remaining mandatory or optional UiState lookup.
  • Preserve placement, selection, history, tab-focus, and inspector-state behavior.

Acceptance criteria

  • Cube, ramp, sphere, point-light, and navigation-bounds toolbar actions are safe with UiState scoped out.
  • Scene-menu navigation creation is safe under the same scope.
  • Diagnostics Select actions do not panic and reconcile hierarchy/inspector selection.
  • Inspector collapse state persists and Locate in Asset Browser focuses the intended asset tab.
  • Scoped-resource regressions exercise real spawn and selection helpers.
  • Native Linux QA proves representative toolbar, navigation, and diagnostic/inspector actions remain live with clean logs.
  • Formatting, clippy, focused tests, and workspace tests pass.

Docs/tests

This restores intended workflows rather than changing them. Record the native regression evidence and exact commit. Packaged-runtime tests remain owner-deferred.

## Summary Keep synchronous editor UI actions safe while the main egui state is temporarily scoped out of the ECS world during rendering. ## Why Native #55 acceptance on 2026-07-13 reproduced an immediate editor crash after **File > New Scene** followed by toolbar **Spawn cube**: ``` Requested resource editor::ui::UiState does not exist in the World crates/editor/src/ui/toolbar.rs ``` `show_ui_system` intentionally owns `UiState` through Bevy `resource_scope` while drawing the editor. Synchronous UI callbacks must use state already owned by that UI call or communicate through independent resources; they cannot query the temporarily absent `UiState`. Independent review found the same root in: - toolbar primitive, point-light, and navigation-bounds placement; - three Diagnostics **Select** buttons that deterministically panic; - Inspector component-collapse and **Locate in Asset Browser** actions that silently no-op because optional `UiState` lookup always fails inside the scope. Deferred command-palette actions run after the scope and are not affected. ## Implementation notes - Pass the current viewport rectangle explicitly through toolbar/navigation placement helpers. - Route diagnostic selection through `SelectedEntity`; let end-of-pass reconciliation update the owned egui selection. - Pass or mutate owned inspector/UI state explicitly for component-collapse and asset-browser focus. - Keep the `resource_scope` architecture unchanged. - Audit every synchronous UI call path for remaining mandatory or optional `UiState` lookup. - Preserve placement, selection, history, tab-focus, and inspector-state behavior. ## Acceptance criteria - [ ] Cube, ramp, sphere, point-light, and navigation-bounds toolbar actions are safe with `UiState` scoped out. - [ ] Scene-menu navigation creation is safe under the same scope. - [ ] Diagnostics Select actions do not panic and reconcile hierarchy/inspector selection. - [ ] Inspector collapse state persists and Locate in Asset Browser focuses the intended asset tab. - [ ] Scoped-resource regressions exercise real spawn and selection helpers. - [ ] Native Linux QA proves representative toolbar, navigation, and diagnostic/inspector actions remain live with clean logs. - [ ] Formatting, clippy, focused tests, and workspace tests pass. ## Docs/tests This restores intended workflows rather than changing them. Record the native regression evidence and exact commit. Packaged-runtime tests remain owner-deferred.
Rbanh added this to the M7 - Content production and shipping milestone 2026-07-13 05:59:06 -04:00
Rbanh changed title from BS-PR-710 - Keep toolbar authoring safe during scoped UI rendering to BS-PR-710 - Keep editor actions safe during scoped UI rendering 2026-07-13 06:02:48 -04:00
Author
Owner

Completed and published on main.

Implementation

Source gates

  • cargo fmt --all -- --check: pass
  • git diff --check: pass
  • cargo clippy --workspace --all-targets -- -D warnings: pass
  • cargo test --workspace --all-targets --no-fail-fast: pass; editor 290/290
  • Six scoped-resource regressions plus same-primary secondary-selection precedence: pass
  • Independent post-fix re-review: no blockers

Native Linux acceptance

  • Cube, Ramp, Sphere, Point Light, and Navigation Bounds toolbar actions all spawned after New Scene without a panic.
  • Selection, transform gizmo, navigation overlay, hierarchy, and Inspector stayed synchronized.
  • Transform component collapse persisted.
  • Brush Diagnostics > Select remained live and synchronized the Foundation Brush selection.
  • Guarded native close with Discard exited with code 0 and clean logs.

Scoped toolbar actions

Diagnostics selection

Packaged-runtime acceptance remains explicitly owner-deferred; no production-candidate signoff is claimed.

Completed and published on `main`. **Implementation** - Scoped UI action safety: [`9e23ae731f95dc351ecc744d6ca61f6bc4467317`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/commit/9e23ae731f95dc351ecc744d6ca61f6bc4467317) - Acceptance record: [`a048233fceab86649f8c1004137a59f0cd62ac12`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/commit/a048233fceab86649f8c1004137a59f0cd62ac12) **Source gates** - `cargo fmt --all -- --check`: pass - `git diff --check`: pass - `cargo clippy --workspace --all-targets -- -D warnings`: pass - `cargo test --workspace --all-targets --no-fail-fast`: pass; editor 290/290 - Six scoped-resource regressions plus same-primary secondary-selection precedence: pass - Independent post-fix re-review: no blockers **Native Linux acceptance** - Cube, Ramp, Sphere, Point Light, and Navigation Bounds toolbar actions all spawned after **New Scene** without a panic. - Selection, transform gizmo, navigation overlay, hierarchy, and Inspector stayed synchronized. - Transform component collapse persisted. - **Brush Diagnostics > Select** remained live and synchronized the Foundation Brush selection. - Guarded native close with **Discard** exited with code 0 and clean logs. ![Scoped toolbar actions](https://git.spacetrainclubhouse.com/attachments/d265651b-aa8e-4ea5-841c-1fa8eb622766) ![Diagnostics selection](https://git.spacetrainclubhouse.com/attachments/ba176d82-fb2f-403b-a71c-108de9649f11) Packaged-runtime acceptance remains explicitly owner-deferred; no production-candidate signoff is claimed.
Rbanh closed this issue 2026-07-13 10:25:39 -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#57
No description provided.