merge: RawBrowseModal post-await staleness guard (deferment §0.1 race ported from the 2026-08-05 sibling fix)

This commit is contained in:
Joseph Doherty
2026-08-09 21:08:00 -04:00
3 changed files with 450 additions and 4 deletions
@@ -114,6 +114,21 @@ through a spec review + code review. Things the reviews changed or decided:
(out of this branch's scope). Recorded in `deferment.md` §0.1. Lower stakes there — the browse
modal resolves the device it was opened for and shows its own error banner — but the shape is
identical.
- **Ported 2026-08-09.** The `_openGeneration` counter now guards **every** post-await write in
`ResetAndResolveAsync`: the merged-config write, the group-context write
(`_groupPrefix`/`_effectiveDeviceId` — a second await the siblings do not have), the `catch`'s
error banner, and the `finally`'s `_resolving` + `StateHasChanged`. The `finally` is the one
departure from the sibling shape and it is load-bearing: this modal resolves inside a
`try`/`finally`, so a stale `return` still runs the tail and would drop the **live** open's
spinner mid-resolve. Pinned by four facts in `RawBrowseModalStaleOpenTests`
(`A_stale_open_never_feeds_the_browser_another_devices_config`,
`A_stale_group_resolve_never_retargets_the_displayed_open`,
`A_stale_open_completing_late_never_clears_the_live_opens_loading_state`,
`A_stale_resolve_failure_never_paints_its_error_over_the_live_open`), each observed red before
the guard and each re-falsified afterwards by reverting **only its own** guard. Driving this
modal as a class needs one thing the siblings did not: it calls `StateHasChanged` on the open
path, which throws without a render handle, so the test attaches an inert `Renderer` subclass
(file-local `#pragma warning disable BL0006`).
- **Component-class tests must not set `[Parameter]` properties directly**: analyzer BL0005 is an
error under `TreatWarningsAsErrors`. The two test files legitimately solve it two ways (file-local
pragma vs a reflection `SetParameters` helper); the reflection helper is the preferred convention