refactor(app): extract focused window lifetime

Move the exact retryable shutdown manifest, typed root snapshot, terminal reporting, and native-window-last release out of GameWindow. Keep session and GPU convergence as hard barriers while reporting persistent physical callback cleanup without stranding dependent owners.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-22 19:43:52 +02:00
parent 5a55d08106
commit 31e6e192b3
21 changed files with 1297 additions and 572 deletions

View file

@ -38,9 +38,12 @@ What does NOT go here:
publication, and lifecycle resource snapshot source. I.8c makes session
start the terminal `OnLoad` operation. I.9 corrected the production root to
invoke the exact tested pipeline and made every consumed platform/settings
result explicit. `GameWindow.OnUpdate` and `GameWindow.OnRender` are typed
orchestration handoffs and the class is 1,945 raw lines. Checkpoint I is
complete; the shutdown/lifetime cutover and closeout remain active in
result explicit. Checkpoint J moves the exact retryable shutdown graph into
`GameWindowLifetime`, including typed roots, hard session/GPU barriers,
reportable physical detach, structured terminal state, and native-window-last
release. `GameWindow.OnUpdate` and `GameWindow.OnRender` are typed
orchestration handoffs and the class is 1,625 raw lines. Checkpoints KL—the
canonical soak snapshots and final closeout—remain active in
[`docs/architecture/code-structure.md`](architecture/code-structure.md).
This is the behavior-preserving prerequisite before new M4 feature bodies.
- **Connected-gate fidelity:** `#232` adds canonical managed/GPU/cache-owner

View file

@ -839,8 +839,13 @@ Current movement/collision ownership:
persistence/current-state owner, supplies the immutable pre-window snapshot,
applies startup pacing/display/FOV/audio once, and later borrows complete
runtime targets without replay. Checked GL construction/state boundaries
retain exact cleanup obligations across failure. Ordered production
composition is the next checkpoint. The reconciled ledger and sequence live in
retain exact cleanup obligations across failure. The executable nine-phase
production pipeline and terminal session start are complete. Checkpoint J
moves the exact shutdown dependency graph into `GameWindowLifetime`, whose
typed roots preserve hard session/GPU barriers, reportable physical detach,
retry/no-replay progress, and native-window-last release. `GameWindow` is
1,625 raw lines; only the canonical soak instrumentation and final connected
closeout checkpoints remain. The reconciled ledger and sequence live in
`docs/architecture/code-structure.md`. This decision does not reclassify the
remaining L.2 conformance work or Track LH.

View file

@ -35,6 +35,8 @@ after Slice 8 checkpoint D 4,330 lines / 192 fields / 67 method
after Slice 8 checkpoint E 4,266 lines / 194 fields / 65 methods
after Slice 8 checkpoint F 4,057 lines / 198 fields / 54 methods
after Slice 8 checkpoint G 3,663 lines / 162 fields / 37 methods
after Slice 8 checkpoint I 1,945 lines / startup composition shell
after Slice 8 checkpoint J 1,625 lines / focused lifetime shell
```
`GameWindow` is the single object that:
@ -683,7 +685,7 @@ Issue #232 records the coarse process-residency gate's run-to-run variance so
future diagnostics can distinguish canonical owner growth from OS/driver/GC
residency without weakening leak detection.
#### Slice 8 — composition and shutdown cleanup — ACTIVE
#### Slice 8 — composition and shutdown cleanup — ACTIVE (KL remain)
Detailed execution ledger:
[`docs/plans/2026-07-22-gamewindow-slice-8-composition-lifecycle.md`](../plans/2026-07-22-gamewindow-slice-8-composition-lifecycle.md).
@ -741,12 +743,17 @@ body into `FrameRootCompositionPhase`, publishes the pair through an exact
lease, and gives lifecycle resource sampling a focused source. `GameWindow` is
1,945 raw lines after I.9 corrects production to invoke the same executable
pipeline as the failure oracle, carries exact platform/settings results through
the typed contract, and keeps live-session start terminal. Checkpoint I is
complete; JL remain active with lifetime/shutdown extraction next. The App gate
passes 3,431 tests / 3 intentional skips and the complete Release suite passes
7,803 tests / 5 intentional skips. The clean solution build retains only the 17
test-project warnings tracked by #228; the complete Checkpoint-I behavior,
architecture, and adversarial corrected-diff passes are clean.
the typed contract, and keeps live-session start terminal. Checkpoint J then
moves the complete shutdown manifest into `GameWindowLifetime`: typed root
groups, retry/no-replay progress, structured reportable physical-detach
failures, hard session/GPU barriers, and native-window-last release now live
outside the host. The shell captures roots once and makes one lifetime call
from Closing/Dispose; no shutdown stage remains in it. `GameWindow` is 1,625
raw lines after J. The App gate passes 3,441 tests / 3 intentional skips and
the complete Release suite passes 7,813 tests / 5 intentional skips. The clean
solution build retains only the 17 test-project warnings tracked by #228; the
complete Checkpoint-J behavior, architecture, and adversarial corrected-diff
passes are clean. Checkpoints KL remain active.
### 4.4 Exit criteria

View file

@ -1,6 +1,6 @@
# acdream — strategic roadmap
**Status:** Living document. Updated 2026-07-22. **M3 landed; M4 is next after the active `GameWindow` structural prerequisite.** M3's retail casting/UI, R6 locomotion/collision/projectile/teleport/radar rebaseline, deterministic fresh-login/portal world lifecycle, and final two-client portal observer flow are user-gated. The current program is the behavior-preserving ownership campaign in [`docs/architecture/code-structure.md`](../architecture/code-structure.md); Slices 17 and Slice 8 checkpoints AH are complete, with the remaining composition/shutdown checkpoints active. New M4 quest/emote/character-creation feature bodies wait until that campaign is complete. Issue #225's lifestone/particle alpha comparison remains a separate rendering visual gate.
**Status:** Living document. Updated 2026-07-22. **M3 landed; M4 is next after the active `GameWindow` structural prerequisite.** M3's retail casting/UI, R6 locomotion/collision/projectile/teleport/radar rebaseline, deterministic fresh-login/portal world lifecycle, and final two-client portal observer flow are user-gated. The current program is the behavior-preserving ownership campaign in [`docs/architecture/code-structure.md`](../architecture/code-structure.md); Slices 17 and Slice 8 checkpoints AJ are complete, with only canonical soak instrumentation and final closeout checkpoints KL active. New M4 quest/emote/character-creation feature bodies wait until that campaign is complete. Issue #225's lifestone/particle alpha comparison remains a separate rendering visual gate.
**Purpose:** One source of truth for where the project is and where it's going. Every observed defect or missing feature has a named phase that owns it; when something looks wrong in-game, look here to find the phase that'll address it. Implementation details live in per-phase specs under `docs/superpowers/specs/`, not in this file.
---
@ -105,10 +105,13 @@ resources have transactional phase ownership and exact-owner late bindings.
I.7 adds the complete streaming/session/hydration/local-player/teleport phase,
including explicit reversible ownership for every late edge. `GameWindow` is
now 1,945 raw lines after I.9 makes production invoke the same typed pipeline
as the failure oracle and keeps session start terminal. Checkpoint I is
complete; shutdown, canonical soak snapshots, and closeout checkpoints JL
remain. The App gate passes 3,431 tests / 3 intentional skips, the complete
Release suite passes 7,803 tests / 5 skips, and the complete Checkpoint-I
as the failure oracle and keeps session start terminal. Checkpoint J extracts
the exact shutdown dependency graph into `GameWindowLifetime`, with typed
immutable roots, hard session/GPU barriers, reportable physical cleanup,
retry/no-replay state, and native-window-last terminal reporting. The host is
now 1,625 raw lines. Only canonical soak snapshots and closeout checkpoints
KL remain. The App gate passes 3,441 tests / 3 intentional skips, the complete
Release suite passes 7,813 tests / 5 skips, and the complete Checkpoint-J
corrected-diff review is clean.
This is a behavior-preserving structural program. Severe regressions still get

View file

@ -64,12 +64,14 @@ and attaches command/input owners before frame publication. I.8b composes and
atomically publishes the complete frame pair and extracts lifecycle resource
sampling. I.8c makes session start the terminal `OnLoad` operation.
`GameWindow` is 1,945 raw lines after I.9 routes production through the exact
tested pipeline with explicit prior-result dependencies. Checkpoint I is
complete and checkpoints JL remain active. Issue #232 tracks
process-residency variance in the soak without loosening its leak threshold.
The App gate passes 3,431 tests / 3 skips, the complete Release suite passes
7,803 tests / 5 skips, and the complete Checkpoint-I corrected-diff review is
clean.
tested pipeline with explicit prior-result dependencies. Checkpoint J adds the
focused `GameWindowLifetime`, immutable typed shutdown roots, hard dependency
barriers, structured report-and-continue physical cleanup, retry/no-replay
state, and native-window-last terminal reporting. The host is now 1,625 raw
lines. Checkpoints KL remain active; Issue #232 tracks process-residency
variance in the soak without loosening its leak threshold. The App gate passes
3,441 tests / 3 skips, the complete Release suite passes 7,813 tests / 5 skips,
and the complete Checkpoint-J corrected-diff review is clean.
Carried:
#153 far-teleport residual, #116 slide-response, the remaining R6 ownership cleanup plus

View file

@ -1,6 +1,6 @@
# GameWindow Slice 8 Checkpoint J — lifetime and shutdown
**Status:** Active 2026-07-22.
**Status:** Complete 2026-07-22.
**Parent:**
[`2026-07-22-gamewindow-slice-8-composition-lifecycle.md`](2026-07-22-gamewindow-slice-8-composition-lifecycle.md),
Checkpoint J.
@ -12,6 +12,17 @@ passes 7,803 tests / 5 skips.
frame withdrawal, GL dependency, and native-window-last order. This checkpoint
changes lifetime ownership and failure reporting, not gameplay behavior.
**Result:** `GameWindowLifetime` now owns the immutable typed root snapshot,
retryable staged transaction, structured terminal report, and native window.
Persistent physical-detach failures are retried and reported without stranding
later owners; session convergence and GPU drain remain hard barriers. Clean
native release drops the completed transaction/root graph, while terminal
abandonment retains it. `GameWindow.cs` is 1,625 raw lines, down 14,098 lines
(89.7%) from the campaign baseline. The App Release gate passes 3,441 tests / 3
skips; the complete Release gate passes 7,813 / 5 skips; the solution build has
only #228's 17 existing test warnings. Three corrected-diff review passes are
clean and no retail-divergence row changed.
## 1. Outcome
Replace `GameWindow.CreateShutdownTransaction` and the window-owned transaction

View file

@ -32,7 +32,7 @@ audit.
transactional partial-acquisition rollback. Production and failure tests now
invoke the same pipeline and carry exact typed prior results. Detailed plan:
[`2026-07-22-gamewindow-slice-8-checkpoint-i-ordered-composition.md`](2026-07-22-gamewindow-slice-8-checkpoint-i-ordered-composition.md).
- [ ] J — move the exact retryable shutdown manifest to a focused lifetime
- [x] J — move the exact retryable shutdown manifest to a focused lifetime
owner and prove all partial-load/reentrant/retry paths. Detailed plan:
[`2026-07-22-gamewindow-slice-8-checkpoint-j-lifetime-shutdown.md`](2026-07-22-gamewindow-slice-8-checkpoint-j-lifetime-shutdown.md).
- [ ] K — in a separate #232 commit, add canonical owner snapshots to every soak
@ -41,6 +41,12 @@ audit.
lifecycle/soak, framebuffer comparison, documentation, memory, and final
visual handoff.
Checkpoint J leaves `GameWindow.cs` at 1,625 raw lines. The focused lifetime
owner now holds the typed shutdown roots, exact 18-stage dependency manifest,
retry/no-replay state, structured soft-cleanup failures, hard-barrier fallback,
and native-window-last release. App Release passes 3,441 tests / 3 skips and
the complete Release suite passes 7,813 / 5 skips. Checkpoint K is next.
Each checked checkpoint lands as a bisectable commit. A checkpoint is not done
while a new class delegates a substantial body back into `GameWindow`, stores
`GameWindow`, or replaces 196 fields with one runtime/service-locator bag.
@ -656,6 +662,15 @@ correction; Checkpoint L retains the connected lifecycle and soak gates.
after native fallback the terminal abandoned state makes repeated Dispose
inert.
Result: `GameWindowLifetime` owns the typed root snapshot, 18-stage manifest,
transaction progress, terminal report, and native window. Clean, soft-failure,
hard-failure, native-failure, retry, reentrant, and never-run paths are pinned.
The UI host remains explicitly rooted through failed physical detach until the
native edge is gone; successful finalization releases the completed lifetime
graph, while abandonment retains it. No shutdown stage remains in `GameWindow`,
which is now 1,625 raw lines. App Release passes 3,441 tests / 3 skips and the
complete Release suite passes 7,813 / 5 skips.
### K — canonical soak checkpoints (#232, separate commit)
- Extract `WorldLifecycleResourceSnapshotSource` from the window and reuse the