Files
ARCADIA-Studio/harness/release-scenario-focus-fix-20260911.md
T

40 lines
6.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Scenario parent focus correction — source handoff
Codex-956atf `/root/scenario_focus_fix`, 2026-09-11, root checkout at supplied base `8d55d2d`. Implements the two source-derived findings in the frozen `harness/release-chooser-contextual-integration-review-20260911.md`. That earlier review is unchanged. Coordination: Gitea issue 1 comment 292; the isolated canvas worker retains its own App/workspace changes.
## Changes
- I1: `State::form_mount` is a separate presentation identity. The first mount uses the new session token; successful source Back, Use and Escape create another mount/focus intent without changing `form_session`, invocation, source identities, raw parent fields or model history. `form_mount()` is absent while the source child owns the editor. The production parent sensor reports the mount token; its editor scroll identity remains the form session.
- I2: `App::view` wraps the complete current tree in a small root ownership marker. The live owner includes document session, semantic owner, document revision, form session and parent mount, and is absent for source children, busy state, Review, hosted UI and other App modal owners. The exact name widget ID contains the same stamp. A delayed operation first collects the live marker and mounted exact target without modifying focus. Only a match produces the apply traversal; it rechecks the live marker before touching focus or ancestor scroll offsets. An absent target produces no apply traversal and leaves other inputs alone. Geometry epoch changes do not change the parent identity.
- The focus operation reveals its exact field through ancestor scrollables. Existing scenario canvas pending-marker reveal, parent editor scroll key, and source-versus-parent branches remain intact.
## Prepared regression gates — not executed
All five tests below are in `crates/oa-desktop/src/behavior/scenario/workspace/tests.rs`, under filter `scenario_form_focus`. Four use the actual production `App::view` at 1100×700 with `iced::Renderer` through its headless API; a missing backend is an explicit test failure, never a silent skip.
1. `scenario_form_focus_targets_the_name_and_rejects_stale_sessions_or_modals`: existing stale-dispatch coverage now executes current focus against the production root and checks exclusive Name focus, unchanged raw draft/source/history and one-shot delivery. Viewport epoch changes remain accepted. The scroll gate requires an actually overflowing parent with measured initial offset greater than 64, then requires the Name's effective bounds to lie within the measured parent viewport after focus. This replaces the first, potentially vacuous final-offset assertion identified by the independent reviewer.
2. `scenario_form_focus_returns_from_back_use_and_escape_after_initial_focus_is_consumed`: consume actual initial sensor/task; mount and focus actual source Name; return by Back, valid Use or Escape; execute the newly mounted production parent's sensor task. Checks stable semantic/raw identities and form session, changed mount, correct parent focus, unchanged recovery after focus, identical accepted Project/source bundle and untouched Undo/Redo.
3. `scenario_form_focus_saved_action_is_inert_on_replacement_child_review_and_changed_context`: obtain S1's real widget Action before changing state. Delay it across S2, source child, real Review candidate input, changed document session/revision/owner, same-session child return to a new mount, and hosted UI. Operate it on the newly mounted production tree; require no chained mutation, unchanged current focus/raw/source/history. Child and Review cases explicitly focus their own mounted inputs.
4. `scenario_form_focus_missing_exact_target_leaves_other_inputs_untouched`: matching root owner with absent target must leave a separate focused input untouched.
5. `scenario_form_focus_chained_apply_rechecks_live_review_owner`: execute current Collect, retain its chained Apply, open and focus a real Review candidate input, then execute the retained Apply. Requires unchanged modal focus, raw draft/source/history and no further chained mutation.
The async action helper deliberately does not poll task completion while retaining its widget operation: that operation owns the task channel until drop. It executes any chained operation against the current production tree.
## Validation and integration
Only source inspection and `git diff --check` were performed by this worker; the whitespace check passed before handoff. No Cargo, rustc, native UI, install, formatting, commit or release was run. Source still requires root's scoped rustfmt, compiler, `scenario_form_focus`, complete workspace tests, contextual-source tests and relevant Clippy gates. The headless renderer/backend requirement and actual minimum-size/native focus timing remain explicit runtime gates. Independent source review has been requested separately and must record its own verdict.
Owned implementation paths: `crates/oa-desktop/src/app.rs`, `behavior/scenario.rs`, `behavior/scenario/workspace.rs`, `behavior/scenario/workspace/tests.rs`, and new `behavior/scenario/focus.rs`. The last four paths are relative to `crates/oa-desktop/src`. Only this new report was written under `harness`; shared ledgers and the frozen prior review were not edited by this worker.
When merging the isolated canvas candidate, preserve the new outer App marker and `scenario_focus_owner`, guarded FormShown handler, scenario mount/state methods, generated exact Name ID and parent sensor key/payload. The canvas worker changes the surrounding workspace host and its old layout tests: union these five focus regressions and helpers instead of replacing the entire test file. Root owns the combined freeze, validation and any versioned publication; no acceptance or release completion is claimed here.
Final pre-format SHA256 fingerprints (source-only; root formatting will legitimately change them):
| Path below desktop src | SHA256 |
| --- | --- |
| `app.rs` | `4B700DBC6F8C0E8258B0F409C0B8F28266838F66ADAEABBEACE6B37E6DCAF736` |
| `behavior/scenario.rs` | `6E26E0EDD44D11D473B67E9DFE634185D77AE080E26776E9F55230D587ABA083` |
| `behavior/scenario/workspace.rs` | `D58CD2EA3F4603801BBD268906141076C5F70A83FB87A102B19A8806B083DEAE` |
| `behavior/scenario/workspace/tests.rs` | `CBA10D3A5C2EC0DF9E5FA67EA2B2570412DACE45BBD1D351431CC1579970C56D` |
| `behavior/scenario/focus.rs` | `48E1F227527E66CF0B56D75B23E05A1F4F89C3D0681760BE471D3E31362F2FBA` |