Skip to content

Gate DeliberatelyExcludedAttached rows that name an instance owner - #1100

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-gate-exclusion-rows-on-instance-owners
Aug 18, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-gate-exclusion-rows-on-instance-owners

Conversation

@azchohfi

@azchohfi Alexandre Zollinger Chohfi (azchohfi) commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1066.

What was wrong

ModifierTable.DeliberatelyExcludedAttached is a suppression list — genuinely attached properties CleanElement clears that the Owner.SetPROP(x, v) rule can't match. PoolResetSetConsistencyTests.InstancePropertyOwnerProbes is the classification input. A row whose owner appears in the probes is wrong in both directions:

  • The owner declares a static Owner.SetPROP → the probe calls the property attached, the rule can match it, so it belongs in AttachedProperties, not the suppression list.
  • It doesn't → the probe calls it an instance DP, it never reaches the attached scan, and the row is inert-but-harmful: a standing allow-list entry that pre-approves a future genuinely-attached reset on that owner.

main carried exactly this shape (Grid.Padding, Grid.CornerRadius, StackPanel.CornerRadius) until it was cleaned up. The current list is a strict subset of the older one, so a merge that reconciles by taking the other side's rows restores the misclassification and builds green.

Correcting the issue's premise

The issue was measured at 89f2bdd2, before #1099 replaced the bare InstancePropertyOwners set with the per-property InstancePropertyOwnerProbes map. I re-measured rather than assuming: the mutation is not fully silent today. Restoring ["Grid.Padding"] reddens exactly one test.

PoolResetSetConsistencyTests + ModifierTableIntegrityTests
baseline 87 passed, 0 failed
["Grid.Padding"] restored 86 passed, 1 failed — Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names

But that coverage is incidental and points at the wrong repair. Its message reads:

The CleanElement attached-reset scan found no ClearValue at all for these owners: [Grid]. Either the resets were removed (drop the table entries) or ReadResetAttachedProperties' regex no longer matches how they are written in ElementPool.cs.

Both suggested repairs are wrong — the row is the defect. And it only fires while the 8 probed owners happen to be disjoint from the owners with attached clears in the scanned block ({AutomationProperties, TitleBar, ToolTipService, FlexPanel}). Give Grid one attached clear there — the #1067 shape — and the neighbour goes quiet while the bogus row survives. So the gate is still warranted; it just isn't closing a total blind spot.

What this adds

Excluded_Attached_Rows_Never_Name_An_Instance_Owner over the real table, naming the offending keys and the actual remedy. Owner membership is the predicate rather than IsAttachedReset, since a row on a probed owner is wrong either way — and membership also correctly rejects ["Grid.Row"], which IsAttachedReset would wave through.

Plus a positive-control [Theory] driving the same detector, and a key-shape assertion inside the [Fact] itself (see the review section below for why that second half is load-bearing).

Also appends a conditional clause to Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names — emitted only when an unseen owner is contributed solely by a DeliberatelyExcludedAttached key — so the two failures don't argue with each other during merge triage. And one line in the DeliberatelyExcludedAttached remarks recording that the rule is now enforced rather than described.

Second commit: what the PR review caught

I ran the repo's pr-review skill on the first commit. The multi-model cross-check and the correctness pass independently landed on the same defect, and it was a real one — the first draft's positive control did not guard the hazard its own comment claimed it guarded.

The [Fact] is absence-shaped over a join key recovered by key.Substring(0, key.IndexOf('.')). The comment argued that re-keying the table with a qualified owner (Microsoft.UI.Xaml.Automation.AutomationProperties.DescribedBy → "Microsoft") would match no probe and switch the invariant off for every row at once. True — but the [Theory] drives the detector with hardcoded short-form literals, so it stays green through exactly that mutation. The control demonstrated the detector worked; it did nothing to establish the real table still spoke the detector's language. I'd written the hazard down and then not closed it.

Fixed by pinning the key shape in the [Fact] itself, so the gate is self-guarding rather than dependent on a spelling nobody asserts, plus a qualified-owner theory row so the mis-answer is a measurement rather than a claim in a comment.

Measuring the re-key then corrected a second overclaim of mine. It is not globally silent — three tests fail:

test message
Every_Reset_Attached_Property_Is_Classified DescribedBy is "in neither table"
Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names missing owner [Microsoft] — and the new Note clause correctly names the exclusion list
the new key-shape assertion names the key shape and the two owner splits to keep in sync

So the assertion message now makes the narrower true claim: the one check that would catch a restored Grid.* row is exactly the one that goes quiet.

The review also caught a plain factual error — the comment introducing the three false theory rows called them all live exclusion rows, but only AutomationProperties.DescribedBy is; ToolTipService.ToolTip and FlexPanel.Grow are in AttachedProperties.

One finding I rejected: that "fails the build" in the ModifierTable remarks overclaims for a test-enforced invariant. AdvancedInternalSurfaceTests.cs:26 uses the identical phrase for the identical kind of gate, and ci.yml runs Reactor.Tests as a required step — so it's repo convention, and changing it would be churn. The cross-check adjudicated the same way.

Evidence

Every assertion was mutation-checked; none is vacuous.

  • Gate: with ["Grid.Padding"] restored and --filter naming only the new test — so the verdict isn't borrowed from the neighbour — it fails naming [Grid.Padding] with the correct remedy. Re-confirmed after the second commit's edits.
  • Key shape: re-keying a row to the qualified form fails it naming the offending key.
  • Detector: replacing the ContainsKey(...) clause with false reddens all 5 offender rows and leaves the legitimate rows green.
  • Affected classes: 97 passed.
  • Full unit suite: 13299 passed, 64 skipped, 0 failed.
  • Release build of the changed projects: 0 warnings, 0 errors (TreatWarningsAsErrors is Release-only, so this is what proves the new XML doc crefs resolve).

Full-solution -c Release couldn't complete on my machine — 4 NU1301 restore failures for Reactor.VsExtension ×3 and Reactor.Compile.Analyzer.Tests, none of them touched here, all network-unreachability at restore time. CI has since covered that gap: 22 check runs against 74fa680c, 19 success + 3 skipped, 0 failures — including Build solution, Unit Tests, Selftests, E2E Tests (winapp ui), AOT Trim Proof and Docs build. Build metrics show every artifact delta at 0 B, and merged coverage is 85.84% → 85.87%.

Scope

Test-only plus a doc comment; no product behaviour changes. No new REACTOR_* diagnostic, so no AnalyzerReleases.Unshipped.md row, no mur check rule, no API index regeneration, no docs recompile.

#1048 remains open and is complementary — it asks for a content oracle over the exclusion reason text, which this doesn't touch.

A ModifierTable.DeliberatelyExcludedAttached row whose owner also appears in
PoolResetSetConsistencyTests.InstancePropertyOwnerProbes is wrong in both
directions, and nothing asserted it:

- If the owner declares a static Owner.SetPROP, the probe classifies the
  property as attached and the analyzer rule can match it, so it belongs in
  AttachedProperties rather than the suppression list.
- If it does not, the probe classifies it as an instance DP, it never reaches
  the attached scan, and the row is inert-but-harmful: a standing allow-list
  entry that pre-approves a future genuinely-attached reset on that owner.

main carried exactly this shape (Grid.Padding, Grid.CornerRadius,
StackPanel.CornerRadius) until it was cleaned up, so the current list is a
strict subset of the older one and a merge that reconciles by taking the other
side's rows silently restores the misclassification.

Adds Excluded_Attached_Rows_Never_Name_An_Instance_Owner over the real table,
plus a positive-control [Theory] driving the same detector with keys that must
and must not match. The absence-shaped assertion would otherwise pass forever
if DeliberatelyExcludedAttached were re-keyed with a qualified owner, since the
substring join key would stop matching any probe.

Also appends a conditional clause to
Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names, which incidentally
reddens on this mutation today but blames ReadResetAttachedProperties' regex,
and records the now-enforced rule in the DeliberatelyExcludedAttached remarks.

Measured: PoolResetSetConsistencyTests + ModifierTableIntegrityTests 87 -> 96
passing. Restoring ["Grid.Padding"] reddens the new test in isolation naming
[Grid.Padding]; disabling the detector's ContainsKey clause reddens 5 of the 8
theory rows and leaves the 3 legitimate ones green.

Fixes #1066

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ad27f18-0d5e-4540-82b0-ec500db8e0ef
@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build metrics

Artifact sizes for 74fa680 vs the base branch (2b4385f).

Packages (compressed .nupkg)

Artifact base PR Δ
Microsoft.UI.Reactor.nupkg 1.61 MB 1.61 MB +26 B (0.00%) ≈
Microsoft.UI.Reactor.Advanced.nupkg 487.4 KB 487.4 KB +5 B (0.00%) ≈
Microsoft.UI.Reactor.Devtools.nupkg 278.2 KB 278.2 KB +8 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor

Artifact base PR Δ
Reactor.Analyzers.dll 356.0 KB 356.0 KB +0 B (0.00%) ≈
Reactor.dll 2.39 MB 2.39 MB +0 B (0.00%) ≈
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 1021.5 KB 1021.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%) ≈

No size change beyond the noise floor. ✅

✅ 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.

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Merged coverage

Coverage for 74fa680 vs the base branch (2b4385f) — unit + selftest merged.

Metric base PR Δ
Line 85.84% 85.84% 0.00 pp ≈
Branch 77.36% (902/1166) 77.36% (902/1166) 0.00 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.

PR review (multi-model cross-check agreeing with the correctness pass) found
the positive-control [Theory] did not guard the hazard the code comment
claimed it guarded. Both the [Fact] and the theory drive the detector with
short-form Owner.Property keys, and the theory's are literals, so re-keying
DeliberatelyExcludedAttached with qualified owners left every row green:
the owner resolves to "Microsoft", matches no probe, and the offender list
empties for all rows at once — including any a merge restored.

Pins the key shape in the [Fact] itself so the gate is self-guarding rather
than dependent on a spelling nobody asserts, and adds the qualified spelling
as a theory row so the mis-answer is a measurement instead of a claim.

MEASURED, re-keying one row to the qualified form: three tests fail —
Every_Reset_Attached_Property_Is_Classified (DescribedBy "in neither table"),
Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names (missing owner
"Microsoft", with the new Note clause correctly naming the exclusion list),
and the new key-shape assertion. So a re-key was never globally silent, and
the first draft's assertion message overstated that; corrected to the narrower
true claim — the one check that would catch a restored Grid.* row is exactly
the one that goes quiet. Re-confirmed the primary mutation still reddens the
membership assertion naming [Grid.Padding].

Also corrects a factual error in the theory's row comment: of the three
false-verdict keys only AutomationProperties.DescribedBy is a live exclusion
row; ToolTipService.ToolTip and FlexPanel.Grow are mapped in
AttachedProperties.

Reviewed and rejected: rewording "fails the build" in the ModifierTable
remarks. AdvancedInternalSurfaceTests.cs:26 uses the same phrase for the same
kind of test-enforced gate, and ci.yml runs Reactor.Tests as a required step.

Affected classes 97 passed; full unit suite 13299 passed, 0 failed; Release
build 0 warnings, 0 errors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ad27f18-0d5e-4540-82b0-ec500db8e0ef

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

Adds a regression gate preventing attached-property exclusions from overlapping instance-owner probes.

Changes:

  • Adds key-shape validation, invariant coverage, and positive-control theory cases.
  • Clarifies related scan failures and documents the enforced rule.

Reviewed changes

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

File Description
tests/Reactor.Tests/AnalyzerTests/PoolResetSetConsistencyTests.cs Adds and validates the exclusion-owner invariant.
src/Reactor.Analyzers/ModifierTable.cs Documents the new enforcement.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit b5b2d62 into main Aug 18, 2026
22 checks passed
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) deleted the azchohfi-gate-exclusion-rows-on-instance-owners branch August 18, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants