Skip to content

Fix TeachingTip declared IsOpen: true on first render never opening (#949) - #978

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 16 commits into
mainfrom
azchohfi-congenial-goggles
Aug 1, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 16 commits into
mainfrom
azchohfi-congenial-goggles

Conversation

@azchohfi

Copy link
Copy Markdown
Collaborator

Fixes #949.

The bug

A TeachingTip whose first render declares IsOpen: true never opened. The mount-time write was issued — OneWayPropEntry.Mount writes unconditionally — and then silently lost.

Reactor, like XAML, fully configures a control before handing it to its parent:

DescriptorHandler.Mount   prop loop (IsOpen written here), EnsureSubscribed, ApplySetters
V1HandlerAdapter.Mount    children strategy (Content / HeroContent), AfterChildrenMount
Reconciler.Mount          ApplyModifiers (Margin, ...)
   ...the caller then adds the control to its parent   <-- parenting is LAST

On an unparented TeachingTip, WinUI discards a pending open as soon as anything else is written to the control. Parented, it's harmless. So the declared open was always thrown away by a later write. I confirmed by measurement that PreferredPlacement is the write that discards it — matching the descriptor bisect in the issue, and correcting its "PreferredPlacement is not special" note for the post-mount case.

Ordering the entry last inside the descriptor is not sufficient: setters, the content slots and common modifiers all run outside the descriptor's reach.

The fix

  1. [WrapManual("IsOpen")] takes IsOpen off the generator's auto-map.
  2. A bespoke .Imperative entry defers a declared true to the control's Loaded event — the first moment the tip is parented into a live tree and an open is guaranteed to stick. A declared false writes directly and disarms any pending open.
  3. Updates stay edge-triggered, so the contract locked in by Document and test the edge-triggered contract for native-mutated declared bools (R7) #940 holds: a re-render carrying the same declared true still does not re-assert against a natively dismissed tip.

Arm state lives on the control's existing TeachingTipEventPayload via the ReactorState attached-DP store — the documented home for per-element state. A side ConditionalWeakTable would be keyed per RCW, so two RCWs over the same native tip would see different arms.

New: ControlDescriptor.OnUnmount / .WithUnmount(...)

An arm could otherwise outlive the mount that created it: unmount before Loaded, re-parent, and the tip popped open on behalf of a mount that no longer existed. The engine already dispatched unmount to hand-coded handlers, but DescriptorHandler never forwarded it — descriptors had no teardown seam at all.

Because that dispatch is tag-gated, declaring the hook also makes DescriptorHandler force the control's ReactorState at mount. Without it the hook would fire for callback-bearing elements of a type and silently not for callback-free ones.

One behavior note for authors

A .Set(t => t.IsOpen = false) can no longer override a declared mount-time true, because the deferred write lands after the setter pass. Documented on TeachingTipElement.IsOpen, in the guide, and pinned by a test so it can't drift.

Also fixed

The gallery's "TeachingTip (Title Only)" card declared a tip with no IsOpen and no trigger, so it could never appear. The issue warns that the obvious one-line IsOpen = true fix lands straight on this bug; now that mount-open works it would present once and — being edge-triggered with nothing wired to OnClosed — never come back. It now uses the state-driven shape its sibling card already used.

Testing

New selftest fixture IsOpenEdge_TeachingTipMountOpen (10 checks) plus headless DescriptorUnmountHookTests. Every assertion was mutation-checked — none can pass vacuously:

Probe Fails
bypass the deferral DeclaredOpenOnFirstRenderOpens, PresentsAPopup, PresentedTipRaisesClosedOnTeardown, RisingEdgeBeforeLoadOpensOnLoad, DeclaredOpenWinsOverSetter, ReloadDoesNotReopenAfterNativeDismiss
Cancel no-op FallingEdgeBeforeLoadCancelsPendingOpen
mount always arms DeclaredClosedStaysClosed
unmount hook disabled UnmountBeforeLoadCancelsPendingOpen (selftest) + DescriptorHandler_Unmount_... (unit)

PresentedTipRaisesClosedOnTeardown is a real presentation oracle: WinUI raises Closed only for a tip that genuinely presented, so a "set the DP and hope" fix would not satisfy it. Presentation itself is waited for via a popup appearing on the XamlRoot, counted from a pre-open baseline, rather than assuming a fixed dwell.

13,000 unit tests pass. The full selftest suite (1378 fixtures) passes with zero failures.

Review

Ran the repo's pr-review skill (8 dimensions + a GPT-5.6 cross-check on a different model family). Security, correctness and packaging came back clean; the other findings are addressed in the second commit. Two are deliberately not taken:

  • Extracting a shared Loaded-deferral helper across the four existing near-duplicates in the repo — real, but a refactor beyond this fix's scope.
  • ReloadDoesNotReopenAfterNativeDismiss is named for what it actually pins. A probe that disabled the arm's self-cleanup did not fail it, because WinUI doesn't re-invoke the spent hook there, so claiming it tested that cleanup would have been false advertising.

Environment caveats

mur docs compile and mur --regen-api can't run in this environment — Reactor.Cli's GitHub.Copilot.SDK.targets npm download is TLS-blocked. I hand-applied a verified byte-identical docs block (confirmed no template-only constructs would transform) and used the supported in-process UPDATE_API_INDEX=1 path for the two API index copies. The ReactorGallery search index was regenerated and is unchanged.

…949)

A `TeachingTip` whose first render declared `IsOpen: true` never presented.
The mount-time write *was* issued — `OneWayPropEntry.Mount` writes
unconditionally — and then silently lost.

Root cause: Reactor configures a control fully before its parent takes it.
On an UNPARENTED `TeachingTip`, WinUI discards a pending open as soon as
anything else is written to the control; parented, it is harmless. So the
declared open was always thrown away by a later write:

    DescriptorHandler.Mount   prop loop (IsOpen), EnsureSubscribed, ApplySetters
    V1HandlerAdapter.Mount    Content/HeroContent slots, AfterChildrenMount
    Reconciler.Mount          ApplyModifiers (Margin, ...)
       ...caller adds the control to its parent   <-- parenting is LAST

Ordering the entry last inside the descriptor is not enough: setters, the
content slots and common modifiers all run outside the descriptor's reach.
Measurement pinned `PreferredPlacement` as the write that discards it,
matching the descriptor bisect in the issue.

The fix takes `IsOpen` off the generator's auto-map (`[WrapManual]`) and
routes it through a bespoke `.Imperative` entry backed by a new
`MountOpenDeferral` helper. A declared `true` is deferred to the control's
`Loaded` event — the first moment the tip is parented into a live tree and
an open is guaranteed to stick. A declared `false` still writes directly and
disarms any pending open, so the app's latest word always wins.

Post-mount behaviour is unchanged: updates stay edge-triggered, so a
re-render carrying the same declared `true` still does not re-assert against
a natively dismissed tip (the contract locked in by #940).

Descriptor unmount hook
-----------------------
An arm could otherwise outlive the mount that created it: unmount before
`Loaded`, then re-parent, and the tip popped open on behalf of a mount that
no longer existed (proven — the new selftest fails without the hook). The
engine already dispatched unmount to hand-coded handlers, but
`DescriptorHandler` never forwarded it, so descriptors had no teardown seam
at all. Adds `ControlDescriptor.OnUnmount` / `.WithUnmount(...)` and the
forwarding implementation, and uses it to cancel a pending open.

Testing
-------
New `IsOpenEdge_TeachingTipMountOpen` selftest, registered in both required
places. Every assertion was mutation-checked so none can pass vacuously:

  A  bypass the deferral      -> DeclaredOpenOnFirstRenderOpens,
                                 PresentedTipRaisesClosedOnTeardown,
                                 RisingEdgeBeforeLoadOpensOnLoad
  B  Cancel becomes a no-op   -> FallingEdgeBeforeLoadCancelsPendingOpen
  C  mount always arms open   -> DeclaredClosedStaysClosed
  D  unmount hook disabled    -> UnmountBeforeLoadCancelsPendingOpen

`PresentedTipRaisesClosedOnTeardown` is the presentation oracle: WinUI raises
`Closed` only for a tip that genuinely presented, so a "set the DP and hope"
fix would not satisfy it.

Also refreshes the now-stale scope notes on `TeachingTipEdgeTriggered`, which
documented the mount path as broken, and adds a shared `CloseAndSettle`
teardown guard — these fixtures now really do present overlays, and
`WaitFor(() => !tip.IsOpen)` would have pumped the dispatcher zero times
because `IsOpen` flips synchronously.

Also fixed
----------
The gallery's "TeachingTip (Title Only)" card declared a tip with no `IsOpen`
and no trigger, so it could never appear. The issue warns that the obvious
one-line `IsOpen = true` fix lands straight on this bug; now that mount-open
works it would present once and, being edge-triggered with nothing wired to
`OnClosed`, never come back. Switched to the state-driven shape the sibling
"Basic TeachingTip" card already uses, and made it actually title-only.

12,933 unit tests pass; the full selftest suite matches the `main` baseline.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515
Multi-dimensional review (8 dimensions + a GPT-5.6 cross-check on a different
model family than the author) produced 8 findings. Security, correctness and
packaging came back clean.

Arm state moves off a private ConditionalWeakTable
--------------------------------------------------
`AGENTS.md` names `ReactorAttached.StateProperty` as the store for per-element
state, explicitly not `Tag` and not a new side table — and `Reconciler` documents
why: a `ConditionalWeakTable` keyed per-RCW hands back different state for the
same native control. The deferral now keeps its two slots on the control's
existing `TeachingTipEventPayload`, reached through
`GetOrCreateControlEventPayload` / the non-allocating `TryGetControlEventPayload`
so a tip that never arms still allocates nothing.

That also closes a latent hazard the cross-check raised: arming now forces the
`ReactorState` into existence, and the engine's unmount dispatch is tag-gated.

OnUnmount is no longer silently conditional
-------------------------------------------
`Reconciler.UnmountRecursive` only reaches a V1 handler when `GetElementTag`
returns an element, and `SetElementTagIfNeeded` allocates state only for elements
carrying callbacks, a key, extensions or reference modifiers. A descriptor
declaring `OnUnmount` would therefore have had it fire for callback-bearing
elements of a type and silently not for callback-free ones. `DescriptorHandler`
now forces the state at mount when the hook is declared, so the contract holds
unconditionally. (TeachingTip itself was never affected — its `Target` reference
entry already forced the state — which is why the original probe passed.)

Tests
-----
- `tests/Reactor.Tests/DescriptorUnmountHookTests.cs` — headless coverage of the
  new public seam: storage, the null guard's parameter name, and a differential
  test where two descriptors differing only by the hook must behave differently.
  Mutation-checked: a no-op `DescriptorHandler.Unmount` fails it.
- `MountOpen_TeachingTip_DeclaredOpenOnFirstRenderPresentsAPopup` — presentation
  is now waited for via a real signal (a popup appearing on the XamlRoot, counted
  from a pre-open baseline) instead of assuming a fixed dwell was long enough. The
  300 ms dwell that remains covers only the entrance animation, which must finish
  before a close raises `Closed`.
- `MountOpen_TeachingTip_DeclaredOpenWinsOverSetter` — pins the documented
  setter-precedence consequence so the XML doc cannot drift from reality.
- `MountOpen_TeachingTip_ReloadDoesNotReopenAfterNativeDismiss` — a natively
  dismissed tip stays dismissed across an unload/reload, with the reload itself
  asserted rather than assumed. Deliberately named for what it actually pins: a
  probe that disabled the arm's self-cleanup did NOT fail it, because WinUI does
  not re-invoke the spent hook here, so claiming it tested that cleanup would have
  been false advertising.

One unit test written during this pass was deleted rather than shipped: it
"forwarded" a control that could only ever be null headlessly, so it asserted
`Same(null, null)`.

Docs
----
- CHANGELOG `[Unreleased]` gains an Added entry for the descriptor teardown hook
  and a Fixed entry for #949, matching the precedent set by the #917 fix.
- The event caveat in the authoring guide still told descriptor authors to
  abandon descriptors and override `IElementHandler.Unmount`; it now points at
  `.WithUnmount(...)` and reserves the hand-coded path for cases that need the
  unmount disposition or the element.

Not taken: extracting a shared `Loaded`-deferral helper across the four existing
near-duplicates in the repo. Real, but a refactor beyond this fix's scope.

13,000 unit tests pass. The full selftest suite passes with zero failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes WinUI TeachingTip losing a mount-time IsOpen: true write by deferring the open until Loaded (when the control is parented), while preserving the existing edge-triggered semantics for updates. To support safe deferrals and other descriptor-owned control state, this also adds a descriptor teardown seam (ControlDescriptor.OnUnmount / .WithUnmount(...)) and forwards unmount through DescriptorHandler.

Changes:

  • Add ControlDescriptor.OnUnmount / .WithUnmount(...) and forward unmount in DescriptorHandler (including ensuring tag/state allocation so unmount dispatch is consistent).
  • Make TeachingTipElement.IsOpen a bespoke descriptor entry that defers mount-time open to Loaded, supports cancellation on falling edge/unmount, and keeps update behavior edge-triggered.
  • Add unit + selftest coverage, update docs/templates, changelog, API indices, and fix the ReactorGallery “TeachingTip (Title Only)” sample to be state-driven.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Reactor.Tests/DescriptorUnmountHookTests.cs Headless unit tests pinning the new descriptor unmount hook plumbing.
tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs Registers the new IsOpenEdge_TeachingTipMountOpen selftest fixture (name list + factory).
tests/Reactor.AppTests.Host/SelfTest/Fixtures/IsOpenEdgeTriggeredFixtures.cs Adds/extends TeachingTip selftests to cover mount-open deferral, cancellation, and teardown behavior.
src/Reactor/Core/V1Protocol/Descriptor/DescriptorHandler.cs Forces state allocation when OnUnmount is declared and forwards Unmount to the descriptor hook.
src/Reactor/Core/V1Protocol/Descriptor/ControlDescriptor.cs Introduces DescriptorUnmountCallback<TControl>, OnUnmount, and fluent .WithUnmount(...).
src/Reactor/Core/V1Protocol/ControlEventPayloads.cs Extends TeachingTipEventPayload with fields to store the deferred-open arm state per native control.
src/Reactor/Core/Element.cs Removes auto-map for TeachingTip.IsOpen, adds imperative deferral implementation + descriptor unmount cancellation, updates docs on IsOpen.
skills/reactor.api.txt Updates public API index for new descriptor unmount surface.
plugins/reactor/skills/reactor-dsl/references/reactor.api.txt Mirrors the API index updates for the plugin reference copy.
samples/ReactorGallery/ControlPages/DialogsAndFlyouts/TeachingTipPage.cs Fixes the “Title Only” gallery card to be state-driven so it can actually present.
docs/guide/extending-reactor-controls.md Documents mount/write ordering pitfalls and recommends .WithUnmount(...) for deferred writes.
docs/_pipeline/templates/extending-reactor-controls.md.dt Updates the source template for the generated guide content above.
CHANGELOG.md Documents the new descriptor teardown hook and the TeachingTip mount-open fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

It failed intermittently on the post-merge run, and a mutation probe that disabled the arm's self-cleanup did not fail it -- WinUI does not re-invoke the spent Loaded hook there. Its only remaining signal (the whole deferral being removed) is already covered by five other checks in the same fixture, so it was pure flake surface.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515
Copilot AI review requested due to automatic review settings July 31, 2026 07:35
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build metrics

Artifact sizes for 1771c37 vs the base branch (1ed2644).

Packages (compressed .nupkg)

Artifact base PR Δ
Microsoft.UI.Reactor.nupkg 1.60 MB 1.60 MB +3.02 KB (+0.18%) ⚠️
Microsoft.UI.Reactor.Advanced.nupkg 478.5 KB 478.5 KB -1 B (0.00%) ≈
Microsoft.UI.Reactor.Devtools.nupkg 278.2 KB 278.2 KB +2 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor

Artifact base PR Δ
Reactor.Analyzers.dll 355.0 KB 355.0 KB +0 B (0.00%) ≈
Reactor.dll 2.38 MB 2.38 MB +2.50 KB (+0.10%) ⚠️
Reactor.Localization.Generator.dll 16.0 KB 16.0 KB +0 B (0.00%) ≈
Reactor.Wrappers.Abstractions.dll 10.5 KB 10.5 KB +0 B (0.00%) ≈
Reactor.Wrappers.Generator.dll 99.5 KB 99.5 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Advanced

Artifact base PR Δ
Reactor.Advanced.dll 1014.5 KB 1014.5 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Devtools

Artifact base PR Δ
Microsoft.UI.Reactor.Devtools.dll 777.5 KB 777.5 KB +0 B (0.00%) ≈

✅ smaller / ⚠️ larger / ≈ within noise. Sizes come from a Release dotnet pack on the CI runner: packages are the compressed .nupkg download size, assemblies the uncompressed DLL inside it.
workflow run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (1)

samples/ReactorGallery/ControlPages/DialogsAndFlyouts/TeachingTipPage.cs:53

  • The "TeachingTip (Title Only)" sample’s code snippet (the string literal shown in the UI) still references show / setShow, but the sample now uses showTitleOnlyTip / setShowTitleOnlyTip and a different button label. This makes the displayed snippet misleading/inaccurate compared to the live sample. Consider updating the snippet to match the actual state variable names (and, while nearby, the "Basic TeachingTip" snippet can also be aligned to showTip / setShowTip).
                    @"Button(""Show tip"", () => setShow(true)),
TeachingTip(""Did you know you can customize the title bar?"") with {
    IsOpen = show,
    OnClosed = () => setShow(false),
}"),

@azchohfi

Copy link
Copy Markdown
Collaborator Author

Re: the suppressed review comment on TeachingTipPage.cs:53 — the displayed snippet still using show / setShow.

Declining this one deliberately, because the gallery's displayed snippets are minimal teaching examples, not verbatim copies of the card code, and that is the established convention on this page and elsewhere.

All three cards on this page already do it, including the two I did not touch:

Card Code uses Snippet shows
Basic TeachingTip (pre-existing) showTip / setShowTip, button "Show Teaching Tip" show / setShow, button "Show Tip"
TeachingTip (Title Only) (this PR) showTitleOnlyTip / setShowTitleOnlyTip show / setShow
Targeting another subtree (pre-existing) showTargetedTip / setShowTargetedTip show / setShow

ContentDialogPage.cs follows the same pattern. The "Basic" snippet also shortens the subtitle text, so the abstraction is intentional rather than drift.

Changing only the card in this PR would make it the one inconsistent card on the page; changing all three is unrelated churn in a bugfix PR. The pr-review docs-and-samples pass reached the same conclusion independently ("snippets are simplified/abstracted but consistent with the actual code above them").

Happy to normalise the whole page in a follow-up if the team would rather the snippets be verbatim — that is a page-wide (arguably gallery-wide) editorial decision, not a property of this fix.

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Merged coverage

Coverage for 1771c37 vs the base branch (1ed2644) — unit + selftest merged.

Metric base PR Δ
Line 85.74% 85.77% +0.03 pp ≈
Branch 77.10% (899/1166) 77.19% (900/1166) +0.09 pp ≈

No coverage change beyond the noise floor. ✅

✅ higher / ⚠️ lower / ≈ within noise. Δ is in percentage points; coverage is unit + selftest merged (Debug x64) on the CI runner. Cobertura reports attached to the workflow run as artifacts.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

CI's Selftests job hit the 300s selftest-process cap with InitialOnly merely in flight (every later fixture reported Skipped), so the failure was a budget overrun rather than an assertion bug. Measured locally: this branch 325.7s vs origin/main 327.4s -- the suite already sits on the cap and my run tipped over on a slower agent.

The presenting TeachingTip checks are the only new wall-clock in the diff, so they pay it back: CloseAndSettle pumps 2 passes instead of 4, and the three stays-closed checks use a 75ms settle window instead of the 300ms entrance dwell, which only the Closed oracle actually needs. Re-verified with the mount-always-arms mutation that the shorter window still catches a wrongly-opened tip, so the negative checks did not become vacuous. Full suite now 290.5s.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515
Copilot AI review requested due to automatic review settings July 31, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (1)

samples/ReactorGallery/ControlPages/DialogsAndFlyouts/TeachingTipPage.cs:53

  • The SampleCard snippet for "TeachingTip (Title Only)" uses show/setShow, but the live sample uses showTitleOnlyTip/setShowTitleOnlyTip. This makes the displayed snippet inaccurate/confusing for users copying it from the gallery. Update the snippet to match the live sample’s state variable names (and button label).
                    @"Button(""Show tip"", () => setShow(true)),
TeachingTip(""Did you know you can customize the title bar?"") with {
    IsOpen = show,
    OnClosed = () => setShow(false),
}"),

Copilot flagged the displayed snippet using show/setShow while the card binds showTitleOnlyTip/setShowTitleOnlyTip. I first declined this: all three cards on the page (and ContentDialogPage) do the same, so matching would have made mine the odd one out.

That was wrong. PR #974 is landing a CI-gated lint -- 'every lowerCamelCase name a snippet uses must exist in the code beside it' -- and names this exact file's show/setShow as drift it fixes. The convention I cited is being deleted, not upheld, and a reader copying the snippet gets a name that does not compile. Only this PR's card is touched; #974 owns the other 23.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515
Copilot AI review requested due to automatic review settings July 31, 2026 08:35
@azchohfi

Copy link
Copy Markdown
Collaborator Author

Correcting my earlier reply — I was wrong to decline this, and I have now fixed it in 2d953e8a.

My reasoning was that all three cards on this page (plus ContentDialogPage.cs) use generic show / setShow in the displayed snippet, so matching only the card I touched would make it the inconsistent one.

That read the convention as settled when it is actively being removed. #974 is landing a CI-gated lint whose rule is "every lowerCamelCase name a snippet uses must exist in the code beside it", and its description names this exact file's show / setShow as genuine drift it fixes. So the snippet would have failed the new gate, and in the meantime a reader copying it gets a name that does not compile — which is the actual harm the reviewer was pointing at.

The snippet now uses showTitleOnlyTip / setShowTitleOnlyTip and the real button label. I deliberately did not touch the two sibling cards or ContentDialogPage.cs: #974 already rewrites 23 cards across 19 pages, and duplicating that here would just create a conflict.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 31, 2026 09:16
@azchohfi

Copy link
Copy Markdown
Collaborator Author

Addressed: suppressed finding in review 4831445806 (IsOpenEdgeTriggeredFixtures.cs popup baseline)

That review raised, in its body rather than as a thread, that popupsBeforeOpen was captured before a render pass, so parent.XamlRoot could still be null and the baseline would read 0 regardless of any already-open popups. Fixed in 3c497a2b — with one correction to the finding and one generalisation beyond it.

The specific exploit path does not reproduce. I instrumented OpenPopupCount at the exact call site and measured the root rather than reasoning about it: H.SetContent(parent) populates XamlRoot synchronously, so rootNull=False at the baseline. The stated sequence (null root at :317, first pump at :321) is not what the fixture actually does.

The shape it describes is real anyway, and that is the part worth fixing. The helper returned 0 for both "I measured and found none" and "I could not measure", and those are not the same fact. The direction matters: a 0 baseline makes OpenPopupCount(tip) > popupsBeforeOpen easier to satisfy, so a leftover popup from an earlier fixture could satisfy it with no tip presented — while the comment directly above claimed immunity to exactly that. A reader trusting the comment would not re-derive it. Being unreachable today is a property of the current call order, not of the helper.

Fix — convert the class, not the instance. OpenPopupCount now returns int? and yields null on an unavailable XamlRoot; both call sites treat null as a failed check, never as a value. A new check MountOpen_TeachingTip_PopupBaselineIsMeasurable asserts the baseline was actually taken, so an unmeasurable one fails loudly instead of quietly lowering the bar. A render pass is pumped before the baseline as well — belt and braces, since it is what the finding assumed.

Mutation-checked, because this is precisely an oracle that could have been passing for a reason other than the one claimed. With the mount-open deferral bypassed, MountOpen_TeachingTip_DeclaredOpenOnFirstRenderPresentsAPopup reddens (6 checks fail in total). It is measuring the fix, not the environment.

This is the same fail-open pattern tracked in #992 — a could-not-measure status crossing a boundary that cannot carry it and arriving as a legitimate value.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jul 31, 2026
Findings from the repo `pr-review` fan-out (7 dimensions + a multi-model
cross-check on a different model family). No critical findings; both high
findings were the same shape and both were confirmed independently.

High — two seams were tested in isolation while the wiring that reaches them
was not, so reverting the caller would have left the suite entirely green:

  * `ClassifyAbort` had four tests, all calling it directly. Production reaches
    it from `RunSelfTests`. Extracted `ApplyAbortOutcome` so the composed
    classify -> stamp -> fall-through decision is testable, and covered the
    early-abort suppression that only a timeout triggers. The single line in
    `[ClassInitialize]` that invokes the pair stays uncovered — it launches a
    five-minute subprocess — and the test says so rather than implying more.

  * The `$GITHUB_STEP_SUMMARY` report is the mechanism that stops the budget
    eroding back to #988, and its delivery was only tested through
    `TryAppendSummary` directly. No-oping the production call would have made
    CI's duration report silent with 26 green tests. Composition and delivery
    now live in `PublishSuiteDuration` / `PublishBudgetKill`, which production
    calls and tests assert against a real file.

Medium:

  * Diagnostics formatted `:F1` with the current culture while the tests and
    the documented triage snippets assume `.` — a comma-decimal machine turned
    a healthy suite red on locale alone. Formatting now matches the parsing,
    which was already invariant. Test switches to de-DE to prove it.
  * `SuiteDuration_WithinBudget` now asserts the Host actually emitted its
    `# Suite elapsed:` trailer. Every other test of that parser feeds it a
    fabricated string, so drift between the two duplicated marker literals
    (the Host is referenced with ReferenceOutputAssembly=false) would have gone
    unnoticed while the report quietly measured wrapper overhead instead.
  * The pacing gate that removed ~2.3s from the suite had no coverage, and
    nothing else depends on the delays — an inverted gate would just make CI
    slower again, invisibly. Added a check that reads the environment directly
    rather than consulting the flag under test.
  * Extracted `ResolveTimeoutMilliseconds` so the environment-to-budget
    conversion is reachable from a test.
  * Documented that `REACTOR_SELFTEST_HANG_TIMEOUT_SECONDS` treats 0/negative
    as "disable".

Also separates a failure that this PR's own triage table would otherwise have
absorbed. A Host that dies mid-fixture (#978) presents exactly like a budget
kill (#988) from outside — one arbitrary victim, everything downstream
missing, victim moves between runs — but raising the budget does nothing for
it. The discriminator is the `# Total failures:` trailer: a budget kill
interrupts a Host that would have printed one, and a mid-run death never
reaches it. `DescribeSilentDeath` states which happened and hedges its timing
claim when the run did land near the cap, since timing alone cannot separate
them. The `Run aborted after/before fixture 'X'` prefixes are unchanged, so
existing greps and published triage procedures keep working.

Validation: 40 headless tests (was 26), four mutations applied and each caught
by its intended test. Full suite 294.2s wrapper / 292.3s Host-reported, 1401
fixtures, 6318 ok. Three failures, none from this change: the Issue487_SV2 pair
(#990, deterministic on a non-interactive session, present in every arm
including baseline) and UseIsCovered_RerendersOnZOrderChange, which fails 3 of
5 runs in isolation on an untouched fixture — a pre-existing 200ms WaitFor race.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3b02a0c6-20bc-4aa6-90ca-4d74c8e4556d
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jul 31, 2026
…resent

Copilot found this in a suppressed comment, and it was a real hole in my own
tests: every existing case passed `sawTotalFailures: false`, so the `true` arm
was written and never asserted.

In that arm the message contradicted itself. The trailer line said the Host
"reached the end of its run", while the headline three lines above said
"SELFTEST HOST STOPPED MID-RUN", the remaining line said those fixtures were
"never RUN", and the closing advice cited #978 -- the no-trailer failure
specifically. A triager reading top-down would have gone hunting a mid-run
crash that did not happen.

It is reachable: the gate only returns early on `exitCode == 0 &&
SawTotalFailures`, so a non-zero exit with the trailer present still gets here
whenever a name in `--list-fixtures` never appears in the run's results.

The trailer now decides the whole message rather than one line of it -- headline,
trailer, remaining and advice are chosen together. The `true` arm names the
second cause explicitly, because it is the more likely one and it is a documented
repo trap: two-place fixture registration, where `--list-fixtures` reports a name
the run's `Create()` switch does not produce. TESTING.md's row gains it too,
alongside the already-known #680 (0xC0000005 at final process exit), which is
verified to be exactly this failure.

The new test asserts the `true` arm does NOT claim MID-RUN, NOT claim "never
RUN", and NOT cite #978, while both arms still rule out #988. Mutation-checked
by collapsing the headline back to unconditional.

Also from the same review: `ContainsKey` + indexer -> `TryGetValue`. The nearby
hang case had a bare `ContainsKey` with no content assertion at all, which was
the weaker problem of the two, so it now asserts the stamped detail actually
names the culprit -- the property that distinguishes a causal hang attribution
from the positional one.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3b02a0c6-20bc-4aa6-90ca-4d74c8e4556d
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Aug 1, 2026
The '# Total failures:' trailer is now the documented discriminator between a
budget kill (#988) and a silent mid-run death (#978), so what it does NOT
establish is load-bearing. It is silent about binary provenance: --no-build
after a failed build runs the previous binary and emits a byte-identical
trailer, exit code and TAP plan.

Note the direction -- this fails toward a false GREEN, which ends an
investigation, where the more familiar staleness traps produce a false red,
which starts one.

Records the bound in the triage section next to the existing "unproven, not
exonerated" caveat, with a fail-closed build step, and adds the matching clause
to the comment that directs readers to TrailerDiscriminator so the code and the
guide do not drift apart.

Reported by the #1010 session, hit live during a trial merge. Comment- and
docs-only; no behaviour change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3b02a0c6-20bc-4aa6-90ca-4d74c8e4556d
Copilot AI review requested due to automatic review settings August 1, 2026 06:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (1)

tests/Reactor.AppTests.Host/SelfTest/Fixtures/IsOpenEdgeTriggeredFixtures.cs:379

  • The failure check name here is inconsistent with the rest of the fixture’s mount-failure checks ("*_FixtureMounted"). Keeping the naming consistent makes TAP output easier to grep/triage when this specific sub-test fails.
                H.Check("MountOpen_TeachingTip_ControlMounted", false);

The six mount-failure guards in TeachingTipMountOpen were unique but not all
identifying: MountOpen_TeachingTip_Mounted and _ControlMounted said nothing
about which sub-fixture failed, while the other four name theirs. A TAP
trailer carrying a bare _ControlMounted tells a triager that a precondition
failed but not which one, which is most of what the name is for.

The two IsOpenEdge_*_Mounted guards are left alone: each is the sole guard in
its own fixture class, so its name is already unambiguous there.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ca0dab3f-2cff-4f78-a3b0-cb546975b515
Copilot AI review requested due to automatic review settings August 1, 2026 06:57
@azchohfi

Copy link
Copy Markdown
Collaborator Author

Addressed: suppressed finding in review 4833897099 (IsOpenEdgeTriggeredFixtures.cs:379)

Fixed in 1771c378 — and the finding understated itself, so the fix is wider than what was asked.

The review flagged MountOpen_TeachingTip_ControlMounted as inconsistent with the surrounding *_FixtureMounted guards. Correct. But mapping every guard in the file to the sub-fixture it actually guards shows two names failing the same way, not one:

MountOpen_TeachingTip_Mounted                  <- MountOpenPresents          (generic)
MountOpen_TeachingTip_ControlMounted           <- MountClosedStaysClosed     (generic)
MountOpen_TeachingTip_CancelFixtureMounted     <- FallingEdgeBeforeLoad...
MountOpen_TeachingTip_UnmountFixtureMounted    <- UnmountBeforeLoad...
MountOpen_TeachingTip_RisingEdgeFixtureMounted <- RisingEdgeBeforeLoad...
MountOpen_TeachingTip_SetterFixtureMounted     <- SetterCannotOverride...

Both are now renamed to name their sub-fixture: _PresentsFixtureMounted and _StaysClosedFixtureMounted.

Why this isn't a style nit. These guards sit on a H.Check(..., false); return; path, so when one fires the fixture stops and the TAP trailer is the only evidence a triager gets. A bare _ControlMounted says a precondition failed but not which — and attribution is most of what the name is for. Six guards in one class means the generic ones are actively ambiguous, not merely terse.

Left alone deliberately: IsOpenEdge_InfoBar_Mounted and IsOpenEdge_TeachingTip_Mounted. Each is the sole guard in its own fixture class, so there is nothing for its name to disambiguate. Renaming those would be churn.

Verified after the rename: IsOpenEdge selftests 25 ok / 0 not ok, and zero stale references to either old name anywhere in the tree.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit 81866f9 into main Aug 1, 2026
22 checks passed
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) deleted the azchohfi-congenial-goggles branch August 1, 2026 17:49
Alexandre Zollinger Chohfi (azchohfi) pushed a commit that referenced this pull request Aug 1, 2026
PR #978 landed while this branch was clean, taking it from mergeable_state
clean to dirty. One content conflict, CHANGELOG.md; the two-place selftest
fixture registry auto-merged and needed vetting rather than trust.

CHANGELOG.md resolved as a union, not a side-pick. Both sides added bullets
under "### Fixed" with no textual overlap:

  mine   - pooled control no longer leaks padding/background/border/enabled
           (issue #985), and REACTOR_POOL_001 receiver-aware selection (#1051)
  theirs - TeachingTip IsOpen:true on first render (issue #949)

Verified by name in both directions rather than by count, since a count is
equally satisfied by a swapped bullet:

  base 67 + mine 69 + theirs 69  =>  merged 71   (69 + 69 - 67 = 71, MATCH)
  control: a merged count of 70 would have failed the same check

  issue #985 / issue #1051 / issue #949 / TeachingTip (Title Only) all present
  negative control 'zzz-not-present' = 0
  conflict markers = 0, with '### Fixed' as the positive control

SelfTestFixtureRegistry.cs auto-merged and both sides had touched it, which
is the two-place-registry hazard: AllFixtures and the Create() switch can
diverge silently and greenly. A hand-rolled probe returned a confident
"Create cases = 0" because the switch is an expression ("Name" => ...) and
not case labels, so the validated leg was used instead:

  AllFixtures == Create switch: names=1409 == arms=1409, sets identical

Gates on the merged tree:

  check-union.ps1     RESULT: PASS (18 passed, 0 failed), exit 0
  Release build       0 warnings / 0 errors
  Reactor.Tests       13053 passed / 0 failed / 64 skipped  (was 13050; +3 from main)

No product code changed by this merge.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d1564805-7a78-452e-9c6e-ad1c81947d4d
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Aug 19, 2026
* Report a fully-skipped selftest fixture as SKIPPED, not PASSED (#1061)

`Harness.Skip` emits `ok <name> # SKIP <reason>`. `SelfTestBatch.ParseTap`
branched on `line.StartsWith("ok ")`, discarded the payload, and set
`sawChecksForCurrent = true` — the flag whose entire purpose is to catch a
fixture that asserted nothing. A fixture whose *only* TAP output was a skip
therefore reported PASSED, with zero `not ok` lines and `# Total failures: 0`.
Two anti-vacuity mechanisms cancelled: `H.Skip` says "I could not assert this",
`sawChecksForCurrent` asks "did you assert anything?", and the first satisfied
the second.

Simply not setting the flag is the wrong fix: it yields `passed = false`, so
`CenterOnCurrent_UsesCursorMonitor` (non-interactive desktops, where
`GetCursorPos` returns ACCESS_DENIED) and `CornerStyle_Apply` (Windows 10)
would go red on exactly the machines their skips were added to accommodate.
A genuine third verdict is required.

Host (Reactor.AppTests.Host):
- `Harness` counts `Checks` and `Skips`; the throwing overloads count their
  catch arms too, since an exception is an assertion attempt.
- `SelfTestRunner` snapshots both around each fixture. Zero assertions plus at
  least one skip paints the title-bar segment amber via `MarkFixtureSkipped`
  and emits `# Skipped fixture: <name> - N check(s) skipped, 0 assertions ran`.
- New `# Total skipped fixtures: N` trailer, plus `# Skipped fixtures: <names>`
  when non-zero. Placed *after* `# Total failures:`, which is the documented
  #978-vs-#988 abort discriminator and the key for `sawTotalFailures`. This is
  what serves raw-TAP consumers: the AOT CI job pipes `--self-test` straight to
  a .tap artifact and greps `^not ok `, so it never sees a skip at all.

Wrapper (Reactor.SelfTests):
- `_byFixture` widens from `(bool Passed, string Detail)` to a three-state
  `FixtureOutcome(FixtureStatus, Detail, SkippedChecks)`.
- `ParseTap` parses the `# SKIP` directive (case-insensitively, per TAP 14)
  instead of discarding it, and is now `internal` taking the map as a
  parameter — the `ApplyAbortOutcome` seam pattern, so production still calls
  the extracted function and reverting the caller is caught.
- A runner-level `ok <n> <fixture> # SKIP` is attributed to *that* fixture
  rather than contaminating the previous fixture's bucket, fixing a
  pre-existing mis-attribution on the AOT path.
- `Flush()` is four-armed: failures win; a real check passes; skips only report
  Skipped; and genuinely-silent still fails with "fixture emitted no TAP
  checks", which guards the regression the obvious fix would have caused.
- `Fixture()` reports Skipped via `Assert.Inconclusive` with the reasons, so
  the run stays green on the machines the skips exist for.
- The skipped-check inventory — including partial skips, whose fixtures stay
  PASSED — is published to `GITHUB_STEP_SUMMARY`. Per the rationale already at
  `SelfTestBatch.cs`, an Inconclusive message never reaches the Actions log
  because the testhost's stdout is not forwarded, so the step summary is the
  only channel that renders.
- `SkipDirectives_SurviveIntoTheReport` hard-fails on zero parsed directives.
  Nothing else would notice if either side of the literal drifted — the Host is
  referenced with `ReferenceOutputAssembly=false`, so `# SKIP` is duplicated,
  not shared — and the silent result of that drift is this bug returning. It
  mirrors the existing `_hostElapsedSeconds` precedent, is inert on aborted or
  timed-out runs, and names both explanations in its failure message.

Tests: new headless `SkipReportingTests` (20 cases) covering the parser, the
inventory and the report, built on a differential oracle — the same fixture
name must come out Passed from one stream and Skipped from another, so a stub
returning a constant cannot pass. `SuiteBudgetDiagnosticsTests` migrates to the
new record and asserts `Status == Failed` rather than `!Passed`.

No fixture was rewritten; the fixtures were always individually correct.
`CenterOnCurrent_UsesCursorMonitor` and `CornerStyle_Apply` change verdict
(PASSED -> SKIPPED) on the affected machines without a line of fixture code
changing, which is the evidence the fix landed in the right layer.

Verified: 1525/1525 selftests green; mutation check (restoring the
unconditional `sawChecksForCurrent`) reddens the acceptance test and 4
siblings; a temporary skip-only probe fixture produced
`# Total skipped fixtures: 1` from the real Host and
`Skipped Fixture ("...")` from the real wrapper.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Address PR review findings on the skip-verdict change (#1061)

Multi-dimensional review of the branch (8 dimensions + a GPT-5.4 cross-check
against this Claude orchestrator) returned 1 high, 3 medium and 1 low finding.
Security, alternative-solution, docs-and-samples and packaging came back clean.

H1 — TryParseSkipDirective anchored on the FIRST '#', so a skipped check whose
name embeds a tracking number was parsed as an ordinary pass. The repo spells
those names `ContentDialogLive_Rerender_TextAdvanced_#1069`, `..._#948`,
`..._#246`, so on those lines the first hash belongs to the name and the
candidate directive became `1069 # SKIP …`, which fails the match and lands in
the ordinary-pass arm. That is issue #1061 restored in full, and precisely for
the checks whose names already say they are known trouble. The scan now
considers every '#', and `continue`s past a false candidate so a name
containing `#SKIPPABLE` cannot swallow the real directive. The cross-check
independently traced this and upgraded it from medium to high.

M1 — The rewritten H.Skip doc asserted skips happen because "a precondition is
undeterminable, not because the product is broken". Its own call sites disagree:
alongside undeterminable preconditions (GetCursorPos on a non-interactive
desktop, DWM corners on Windows 10) there are tier deferrals ("covered by Appium
E2E KeyDownTest") and tracked product gaps ("issue #942 - decorator retags the
target"), where the product really is broken. Documenting only the first case
invites the reader to treat every skip as benign — the same misreading that made
reporting them PASSED look acceptable. All three categories are now stated, in
Harness.Skip, TESTING.md, DescribeFullySkipped and the Inconclusive rationale,
with the point drawn explicitly: a skip is never evidence the product works,
only that this run did not establish otherwise.

M2 — The Host's "asserted nothing" branch had no automated coverage; it was
verified once by hand and the evidence went with the session. It is not
reachable from any test project, because Reactor.SelfTests and Reactor.AppTests
both reference the Host with ReferenceOutputAssembly=false, so no fabricated TAP
stream can reach the code that makes the decision. Added
SelfTestVerdict_OnlySkips_PositiveControl, a fixture that asserts nothing on
purpose, and an assertion in SkippedFixtures_AreReported that it is reported
fully skipped on every run. That is the only end-to-end proof that the Host
still classifies, that the '# SKIP' literal still matches across the duplicated
boundary, and that the wrapper still reports SKIPPED rather than green — all
failures that are otherwise silent, because their symptom is a green suite.
The control is excluded from the "unexpected skips" report so it does not make
that test permanently Inconclusive and drown the signal it protects.

This also removes an incidental dependency: SkipDirectives_SurviveIntoTheReport
was non-vacuous only because Spec047EventStateSplitFixtures happens to skip
unconditionally, which was true but could be closed at any time by work with no
idea the guard leaned on it. It now leans on a fixture that exists for the
purpose.

M3 — SkippedFixtures_AreReported never checked that the inventory reached
GITHUB_STEP_SUMMARY, so a dead channel would lose the report in silence — the
one surface that renders it, since an Inconclusive message never reaches the
Actions log. Mirrors SuiteDuration_WithinBudget exactly, including asserting the
env var is set on a runner so the check cannot pass by skipping.

L1 — `# Skipped fixture:` and `# Skipped fixtures:` differed by one character
and both are grepped by contributors. Renamed to `# Fully skipped fixture:` and
`# Skipped fixture list:`, leaving three distinct prefixes.

Verified: 1529/1529 selftests green (1528 passed + the control skipped, exit 0);
Release build clean. Both fixes mutation-checked — reverting the parser to
first-'#' reddens the two new differential tests while the other 66 stay green,
and giving the control a real H.Check reddens SkippedFixtures_AreReported with
its diagnostic message. Confirmed the change is safe against CI's
"Fail on skipped input-injection E2Es" gate: it reads app-tests.trx from the E2E
job only, and filters on input-injection messages, so the selftest job's
Inconclusive results are not caught by it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Address Copilot review: qualify StringBuilder, correct CHANGELOG trailer name

- Qualify global::System.Text.StringBuilder at both sites in PublishSkipReport.
  Microsoft.UI.System shadows System inside Microsoft.UI.Reactor.* namespaces
  (AGENTS.md), and two sibling files in this same project already qualify for that
  reason -- SuiteBudgetDiagnosticsTests.cs does so 19 times. It compiles today only
  because Microsoft.UI.System is not visible through this project's references,
  which is a property of the reference graph rather than of this code.

- CHANGELOG named the per-fixture TAP comment # Skipped fixture:. The Host emits
  # Fully skipped fixture:; the entry described the pre-rename spelling from the
  first commit and was never updated when the trailers were renamed to remove a
  one-character grep collision. The whole point of that rename was greppability, so
  a changelog naming the wrong prefix defeats it. Also names the
  # Skipped fixture list: roll-up, which the entry omitted entirely. Swept the
  repo for other stale references to the old spellings; none remain.

Verified: 1529/1529 green (1528 passed + the positive control skipped); Release
build clean.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Address Copilot review: rename shadowing local, use Path.Join

- SkippedCheckWhoseNameEmbedsAnIssueNumber_IsStillASkip declared a method-local
  \const string Reason\ while the class already has one holding a different
  value. Renamed to GapReason, which also says what it is: the tracked-product-gap
  category of skip reason, as opposed to the class constant's undeterminable
  precondition.

- Path.Combine -> Path.Join for the temp summary file. The second argument is a
  generated \
eactor-skip-summary-<guid>.md\ and can never be rooted, so this
  could not actually drop the temp directory today; Join has no rooted-reset
  semantics at all, so the property holds without depending on that argument.

Swept the file for other instances of both patterns; none.

Verified: 69/69 headless tests green; Release build clean.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Fail a fixture that emits no check and no skip, on the Host side too

Copilot review: a fixture that ran to completion emitting neither a check nor a
skip was painted GREEN by the Host and produced no 'not ok' line, while the
wrapper reported it Failed ('fixture emitted no TAP checks'). The two sides
disagreed, and raw-TAP consumers had only the Host to go on -- the AOT job greps
'^not ok ', so a fixture that asserted nothing was invisible exactly where there
is no wrapper to correct it. TESTING.md's verdict table already claimed this row
was a failure, so the docs described the wrapper and not the Host.

This is the same defect class as #1061 with the one mitigating detail removed: a
skip at least states a reason, which is why it is reported rather than failed.
Silence states nothing, so there is no verdict to be generous about.

The Host now emits 'not ok <n> <fixture> - fixture ran to completion without
emitting a single check or skip' and records the failure. The line carries no
_CRASH/_TIMEOUT-style suffix on purpose: the wrapper strips only those two, so
any other decoration would attribute the failure to a fixture name that does not
exist instead of to the silent one.

Cannot redden anything today: the wrapper has always failed this case, so a
fixture emitting nothing would already have failed the suite, and the suite is
green.

Tests: RunnerLevelNoChecksFailure_IsAttributedToTheSilentFixture covers the
attribution and asserts no phantom entry is created. Verified against the real
Host with a temporary silent fixture -- it produced the 'not ok' line and
'# Total failures: 1' where it previously produced neither.

Verified: 1531/1531 green (1530 passed + the positive control skipped); Release
build clean.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Label runner-level skips instead of naming them after their fixture

Copilot review (suppressed comment): a runner-level skip -- the AOT pattern
list, which skips a fixture before it runs -- recorded its SkippedChecks entry
as "<fixture> - <reason>". BuildSkipInventory then prefixes the fixture again,
so the job summary rendered `AotHostile` - AotHostile - crashes/hangs under
NativeAOT: the name twice, and an implicit claim that a check called AotHostile
was skipped. No such check exists -- the fixture never ran, so no H.Skip was
reached, and the name on that TAP line is the fixture's.

That matters because the inventory is the only place a reader learns what a run
did not establish, so an entry that invents a check name is misinformation in
the one surface built to prevent it.

Now records the RunnerLevelSkipLabel sentinel "(whole fixture)".

The test asserts the RENDERED inventory line, not just the stored entry: the
label is only correct if it composes into a truthful entry, and the duplication
came from the composition rather than from either half. Mutation-checked --
restoring the fixture name reddens
RunnerLevelSkip_IsLabelled_NotNamedAfterItsFixture.

Verified: 1532/1532 green (1531 passed + the positive control skipped); Release
and Debug builds clean.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207

* Use TryGetValue instead of ContainsKey plus indexer

Copilot review (CodeQL): combines the existence check and the retrieval into a
single lookup. Matches the sibling assertion in
RunnerLevelSkip_IsAttributedToItsOwnFixture_NotThePrecedingOne, which already
uses TryGetValue. Swept the file; no other instances.

Verified: 25/25 SkipReportingTests green; Release build clean.

* Make every TAP prefix test ordinal

Copilot review (suppressed): the 'ok ' and 'not ok ' dispatch tests used the
culture-sensitive StartsWith overload, while neighbouring prefixes in the same
method already passed StringComparison.Ordinal. TAP is a machine format, so
ordinal is the semantically correct comparison, and a parser whose dispatch arms
disagree about which comparison they use invites the next one to guess.

Also fixes '# Running: ', which the review did not flag but has the same defect.
Fixing only the two named would have left exactly the inconsistency the comment
is about. Every StartsWith in the file now passes a comparison explicitly.

No behaviour change for the ASCII prefixes involved; this is about the parser
not depending on the machine's locale to agree with itself.

Verified: 1532/1532 green; Release and Debug builds clean.

* Pin that a fixture which skips then crashes keeps its skip

Copilot review (suppressed) argued that Flush's early return for an
already-Failed fixture drops skipsForCurrent when a fixture skips and then
crashes, undercounting the skip inventory.

Tested rather than reasoned about, and the concern does not hold: the crash
arrives as 'not ok <n> <fixture>_CRASH', StripRunnerFailureSuffix removes the
suffix, the name then matches the running fixture, and the failure is added to
failuresForCurrent -- so the early return, which requires
failuresForCurrent.Count == 0, never fires and the skips are carried into the
Failed outcome.

No code change. Adding the test anyway because the answer depends on a two-step
inference across two functions, and the failure mode it rules out is silent:
the skip would vanish from the inventory in the one case where a reader most
wants both facts -- what the fixture gave up on, and what then broke.

Mutation-checked: dropping _CRASH from StripRunnerFailureSuffix reddens it.

Verified: 72/72 headless tests green; Release build clean.

* Stop the partial-skip heading claiming its members passed

Copilot review (suppressed): BuildSkipInventory routes every non-Skipped outcome
into the partial bucket, so a FAILED fixture that skipped a check lands there
too -- exactly the crash-after-skip case pinned by the test in the previous
commit. The job-summary heading read 'Partially skipped - passed on their
remaining checks', which asserts something false about those entries, in the one
report whose purpose is to tell a reader what a run did and did not establish.

Heading is now verdict-neutral and points at the per-fixture result. Updated the
BuildSkipInventory doc comment, which made the same claim.

The test asserts the rendered markdown does not contain the old wording, so the
heading cannot drift back while the bucket keeps admitting failures.

Verified: 1533/1533 green; Release and Debug builds clean.

---------

Co-authored-by: z <z@z.z>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25096dd2-f3f6-42ce-9ec6-33b0c2455207
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Aug 25, 2026
A user hit a hard crash in the ReactorGallery 'Both ends need the same key'
card: toggle the destination key off, activate the source, and the process dies
with 0xC0000005 inside Microsoft.UI.Xaml.dll 3.2.3.0 (confirmed in the Windows
Application Error log).

Root cause was this PR's own ghost-suppression. Reactor snapshots every
unmounting keyed element, since the reconciler cannot know which sibling the
user activated, and the earlier revision withdrew the unclaimed ones with
ConnectedAnimation.Cancel() so they would not hang over the new view. By flush
time the source has been unmounted and returned to ElementPool, so the animation
holds a visual CleanElement has already reset, and cancelling faults natively.
Bisected: with the Cancel() the repro fixture exits -1073741819, without it the
same fixture is green.

Removing Cancel() alone was not enough -- the whole track-and-reconcile-orphans
mechanism is unsound here -- so it is gone entirely:
_preparedConnectedAnimationKeys, ConnectedAnimationReleaseCount,
ReleaseUnclaimedConnectedAnimations and ResetConnectedAnimationsForNewPass are
removed, and the per-pass reset is a plain list clear that cannot throw.

What survives is the actual defect this PR set out to fix, which is independent
and verified: Mount resolved the animation key before the unmount that publishes
the snapshot had run, so GetAnimation returned null and nothing ever started.
Resolution now happens in FlushConnectedAnimations, after the whole pass.

Consequence, documented rather than hidden: unclaimed snapshots now expire on
WinUI's own ~1s timeout instead of being withdrawn, so unpicked keyed siblings
briefly overlap the new view. A cosmetic wart beats a crash. Guide template,
gallery copy and the search index all updated to say so.

This also supersedes the earlier #978 attribution for the CI Selftests and AOT
Selftests failures. The full selftest suite now completes with no access
violation -- the wandering crash site that looked like non-determinism was a
dangling native object faulting on later use, which is what this class of
corruption looks like from the outside.

ConnectedAnimation_OrphanOnlyPassDoesNotCrash pins the repro. Full unit suite
13,304 passed; full selftest suite has no crash.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Aug 26, 2026
* fix(animation): start connected animations after the reconcile pass, release unclaimed sources

Connected animations declared with .ConnectedAnimation(key) never played when
source and destination lived in subtrees the child reconciler REPLACES.

Two defects, both observed live in the docs animation demo:

1. Ordering. Mount() resolved the key against ConnectedAnimationService
   immediately, but the reconciler mounts a replacement BEFORE unmounting the
   control it replaces (ChildReconciler's type-mismatch arm calls Mount() and
   only then ReplaceChildWithExitTransition -> Unmount). PrepareToAnimate had
   therefore not run yet, GetAnimation(key) returned null, and the animation was
   silently dropped -- the destination just appeared at its final position.
   Resolution now happens in FlushConnectedAnimations, which runs after the whole
   pass, so visit order no longer matters.

2. Ghosting. Reactor prepares a snapshot for EVERY unmounting element carrying a
   key, since the reconciler cannot know which sibling the user picked. The
   unclaimed preparations were left in the service, and WinUI keeps each one
   composited at its source element's old position until it times out -- the old
   list stayed painted over the new view for ~1s. The flush now cancels what no
   destination claimed, which also stops an orphan leaking into a later pass
   where a same-key mount would travel from a stale snapshot.

Verified live against docs/_pipeline/apps/animation ConnectedAnimationDemo by
capturing frames DURING the transition (the settled state looks correct either
way, which is how this hid). Pre-fix: 0 animations started on the forward
navigation and Photos/Music ghosts still painted at click+556ms. Post-fix: the
source travels button-size -> headline and lands clean, no ghosts.

Selftests added; ConnectedAnimReplace_AnimationStarted was mutation-checked --
it reads baseline+0 (red) against the pre-fix resolution and baseline+1 (green)
after.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* feat(gallery): add a Motion category with Connected Animation and Transitions pages

The gallery had zero coverage of Reactor's animation APIs -- AnimatedVisualPlayer
and AnimatedIcon are Lottie/vector playback, a different feature -- so there was
no page to deep-link to for .ConnectedAnimation, .OpacityTransition,
.ScaleTransition, .TranslationTransition, or .LayoutAnimation.

Adds a Motion category (named after WinUI's own design-language section) with:

- Connected Animation: a list-to-detail hero sample, plus a card whose toggle
  drops the destination key so you can see what a mismatch looks like -- an
  unpaired key never throws and never warns, so it reads exactly like a broken
  animation.
- Transitions: OpacityTransition, ScaleTransition, TranslationTransition, and
  LayoutAnimation. The layout card inserts at the FRONT, because appending moves
  no existing row and would render identically with the modifier deleted, and its
  Easing toggle really does swap LayoutAnimation for SpringLayoutAnimation.

Verified by running the gallery, not just building it: reactor-gallery:///item/
connected-animation lands on the page (GalleryRoutes falls back to Home silently,
so this was checked rather than assumed), and frames captured DURING the
transition show the row snapshot travelling at button size (click+163ms), morphed
to headline weight mid-flight (click+330ms), and landed (click+479ms), with no
ghost rows. The layout card was driven over UIA to confirm prepending really
reorders the list.

reactor-search-index.json regenerated (95 controls) with editorial keywords for
both new tags; the Reactor.Tests byte-compare gate passes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(gallery): hoist the LayoutAnimation seed out of Render (REACTOR_HOOKS_013)

A collection expression passed inline to UseState is rebuilt on every render even
though only the first one is ever read. Caught by the Release build, where the
analyzer is promoted to an error.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(gallery): declare items in the connected-animation snippet

GallerySnippetAgreementTests gates snippet->live name agreement: a snippet may
omit, but a name it invents is one the reader copies and cannot compile. The
List to detail snippet said 'items' where the live card uses the static 'Items'.
Declaring the seed in the snippet satisfies the gate and makes the sample
copy-pasteable rather than just renaming it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(animation): release orphaned snapshots when a pass never reaches the flush

Addresses Copilot review on #1124.

Both host render loops flush only after Reconcile returns, so a pass that throws
mid-reconcile shows the error fallback and skips FlushConnectedAnimations. The
per-pass reset then cleared _preparedConnectedAnimationKeys outright, dropping
the only handle on snapshots the service still holds -- they stay composited over
the fallback, and a later same-key mount can travel from one.

The reset now cancels before clearing (ResetConnectedAnimationsForNewPass).
Resolving the service is a COM call, so it is skipped entirely on the common path
where nothing was prepared.

Also fixes the second review comment: the LayoutAnimation card's *displayed*
snippet still showed the inline collection expression in UseState that
REACTOR_HOOKS_013 flags, immediately after the live sample hoisted it. The
snippet now shows the same class-level seed.

New selftest ConnectedAnimation_ReleasesAcrossUnflushedPass drives the reconciler
directly (a completed pass with no flush after it -- same shape as a throw,
without needing to inject one mid-traversal). Mutation-checked: reverting to a
bare Clear() makes ConnectedAnimUnflushed_OrphanReleasedOnNextPass go red.
Reading before+1 also proves the snapshot was really prepared, so a
PrepareToAnimate that silently no-opped would fail rather than pass trivially.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* chore(gallery): regenerate search index after the snippet edits

f15bfb9 satisfied GallerySnippetAgreementTests by declaring the seed in the
List to detail snippet, and 4eeb983 changed the LayoutAnimation snippet for the
Copilot review. Both are inputs to the generated search index, so the committed
JSON went stale and SearchIndexGeneratorTests.Index_IsUpToDate failed.

The two Tooling gates read the same snippet from opposite ends -- one checks the
snippet against the live card, the other checks the index against the snippet --
so satisfying one is what invalidated the other. Verified together, not
separately.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* refactor(animation): log swallowed teardown COMExceptions instead of eating them

Addresses the code-quality review on #1124 (three empty-catch findings).

The connected-animation paths swallowed teardown-reentry COMExceptions with a
bare { }. The repo already has a helper for exactly this and the dominant
convention is to use it: 25 sites across src/Reactor call
DiagnosticLog.SwallowedError, against 5 empty catches -- all 5 in this file's
connected-animation region. So this follows the codebase rather than the bot's
suggested _logger?.LogDebug / Debug.WriteLine.

Each of the five now names its site (PrepareConnectedAnimationSource,
FlushConnectedAnimations.start, FlushConnectedAnimations,
ReleaseUnclaimedConnectedAnimations, ResetConnectedAnimationsForNewPass). The
filter, control flow, counters, and cleanup are unchanged -- observability only.
SwallowedError is gated on Keywords.Errors being enabled, so the disabled path
costs nothing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(animation): make the per-pass connected-animation reset total

Addresses Copilot review round 2 on #1124.

ResetConnectedAnimationsForNewPass runs after _debugReconcileDepth (and
_reconcileTraceDepth) have been incremented but before the try/finally that
decrements them. Its catch filtered to teardown-reentry only, so any other COM
failure would escape and strand the counter above zero -- and every later
top-level reconcile would then look nested, skipping this reset, the hot-reload
consume, and the dirty-ancestor path. That is a permanent corruption from a
best-effort cleanup, and the COM calls in that window are ones this PR
introduced.

The reset is now total: a failure degrades to a logged no-op via
DiagnosticLog.SwallowedError, matching the four existing catch (Exception) +
SwallowedError sites in src/Reactor. The narrow teardown-only filters elsewhere
in the file are left as they are -- they are deliberate, and it is specifically
the caller's depth bookkeeping that needs protecting here.

_preparedConnectedAnimationKeys.Clear() sits after the catch, so the set is
drained whether or not the release succeeded.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* docs(gallery): stop describing LayoutAnimation as value-driven

Addresses the suppressed finding from Copilot review round 3 on #1124.

The Transitions registry description lumped layout animation in with the
implicit value transitions -- but LayoutAnimation animates position changes the
layout pass produced, not a value you set, which is exactly the distinction the
page itself draws. The description is also emitted into the generated search
index, so the inaccuracy shipped to search results too.

Reworded and regenerated the index; both Tooling gates verified together.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(animation): drop the unsafe ghost-suppression, keep the ordering fix

A user hit a hard crash in the ReactorGallery 'Both ends need the same key'
card: toggle the destination key off, activate the source, and the process dies
with 0xC0000005 inside Microsoft.UI.Xaml.dll 3.2.3.0 (confirmed in the Windows
Application Error log).

Root cause was this PR's own ghost-suppression. Reactor snapshots every
unmounting keyed element, since the reconciler cannot know which sibling the
user activated, and the earlier revision withdrew the unclaimed ones with
ConnectedAnimation.Cancel() so they would not hang over the new view. By flush
time the source has been unmounted and returned to ElementPool, so the animation
holds a visual CleanElement has already reset, and cancelling faults natively.
Bisected: with the Cancel() the repro fixture exits -1073741819, without it the
same fixture is green.

Removing Cancel() alone was not enough -- the whole track-and-reconcile-orphans
mechanism is unsound here -- so it is gone entirely:
_preparedConnectedAnimationKeys, ConnectedAnimationReleaseCount,
ReleaseUnclaimedConnectedAnimations and ResetConnectedAnimationsForNewPass are
removed, and the per-pass reset is a plain list clear that cannot throw.

What survives is the actual defect this PR set out to fix, which is independent
and verified: Mount resolved the animation key before the unmount that publishes
the snapshot had run, so GetAnimation returned null and nothing ever started.
Resolution now happens in FlushConnectedAnimations, after the whole pass.

Consequence, documented rather than hidden: unclaimed snapshots now expire on
WinUI's own ~1s timeout instead of being withdrawn, so unpicked keyed siblings
briefly overlap the new view. A cosmetic wart beats a crash. Guide template,
gallery copy and the search index all updated to say so.

This also supersedes the earlier #978 attribution for the CI Selftests and AOT
Selftests failures. The full selftest suite now completes with no access
violation -- the wandering crash site that looked like non-determinism was a
dangling native object faulting on later use, which is what this class of
corruption looks like from the outside.

ConnectedAnimation_OrphanOnlyPassDoesNotCrash pins the repro. Full unit suite
13,304 passed; full selftest suite has no crash.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* docs(gallery): GAPS.md no longer claims ConnectedAnimation is impossible

Addresses the last open Copilot review thread on #1124.

The gallery's README points users at GAPS.md, which listed ConnectedAnimation
under 'Controls with No Reactor Equivalent' with 'Not expressible in the current
Reactor model' -- directly contradicting the Motion page this PR adds.

Moved to 'Visual Effects (Partial Support)' alongside the other animation
entries, and the summary row flipped to supported. The partial framing is
deliberate rather than cosmetic: the ghosting caveat is stated there too, so a
reader who hits the ~1s sibling overlap finds it documented instead of filing it
as a bug.

GAPS.md is prose only -- no generator consumes it, so nothing to regenerate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* docs(animation): document the exit-transition limitation, drop a stale comment

Addresses the two remaining Copilot review comments on #1124.

1. The per-pass reset comment still described the withdrawn cancellation
   mechanism ('cancelling snapshots it still holds') and duplicated the accurate
   paragraph below it -- an artifact of the earlier splice. The list holds
   destination keys and targets; Clear() cannot cancel anything the service owns.
   Kept only the accurate wording.

2. The reviewer is right that connected animation does not compose with an exit
   .Transition() on the same element: ReplaceChildWithExitTransition defers
   UnmountAndPool, and with it PrepareToAnimate, into the exit animation's
   completion callback -- long after both hosts have flushed -- so the
   destination's lookup finds nothing and the animation silently no-ops.

   I tried the suggested eager prepare and it is NOT a safe fix: PrepareToAnimate
   on a control mid-replace throws a non-teardown exception that escapes
   ReplaceChildWithExitTransition and aborts the whole reconcile, losing the
   entire UI update -- strictly worse than the animation not playing. Recorded as
   a known limitation at the call site, in the guide, and in GAPS.md instead of
   shipping a change I could not make correct.

   Worth recording for whoever picks this up: my first fixture for it was
   VACUOUS. Nesting the keyed element inside a container means the container is
   what ReplaceChildWithExitTransition sees, so the deferred path never runs --
   the mutation check passed with the fix disabled, which is what exposed it. The
   keyed element must be the direct child being replaced.

   A fixture pinning the limitation is also deliberately NOT included: it leaves
   a deferred teardown in flight that lands during a later fixture and crashed
   the suite with 0xC0000409. Full suite is green and crash-free without it.

Full unit suite 13,304 passed; full selftest suite 0 failures, exit 0.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix(animation): scope the flush lookup to this pass; make the Scale snippet runnable

Addresses the remaining suppressed review comments on #1124.

1. FlushConnectedAnimations resolved keys against the view-wide
   ConnectedAnimationService with no pass scope. Since unclaimed preparations are
   deliberately left to expire (~1s), a later render mounting the same key could
   in principle consume one and animate unrelated UI from wherever the old source
   sat. Queued destinations now resolve only against keys this pass prepared.

   Carried as defence-in-depth and labelled as such in the code, because I could
   NOT build a non-vacuous regression test: a fixture that unmounts a keyed
   source in one pass and mounts the same key in a later pass reads green with
   the guard disabled, so WinUI did not hand the stale snapshot over anyway and
   the hazard may be theoretical in this build. Two attempts, including fixing an
   obvious flush-before-layout flaw in the fixture, both stayed vacuous. Rather
   than ship a test that proves nothing, the fixture is removed and the gap is
   written down at the field. The guard is a strict narrowing -- it can only
   prevent a start, never cause one -- so it is safe to keep.

2. The ScaleTransition snippet exported into reactor-search-index.json never
   called setEnlarged, so copying it produced a static element that could never
   animate. Added the toggle button and a line saying why it is load-bearing.
   Index regenerated; both Tooling gates verified.

Full unit suite 13,304 passed; full selftest suite 0 failures, exit 0.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TeachingTip declared IsOpen: true on its first render never opens (mount-path only; click-driven open works)

2 participants