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

@ -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