Repository navigation
Gate DeliberatelyExcludedAttached rows that name an instance owner - #1100
Conversation
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
📦 Build metricsArtifact sizes for Packages (compressed .nupkg)
Assemblies in Microsoft.UI.Reactor
Assemblies in Microsoft.UI.Reactor.Advanced
Assemblies in Microsoft.UI.Reactor.Devtools
No size change beyond the noise floor. ✅ ✅ smaller / |
🧪 Merged coverageCoverage for
No coverage change beyond the noise floor. ✅ ✅ higher / |
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
There was a problem hiding this comment.
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.
Fixes #1066.
What was wrong
ModifierTable.DeliberatelyExcludedAttachedis a suppression list — genuinely attached propertiesCleanElementclears that theOwner.SetPROP(x, v)rule can't match.PoolResetSetConsistencyTests.InstancePropertyOwnerProbesis the classification input. A row whose owner appears in the probes is wrong in both directions:Owner.SetPROP→ the probe calls the property attached, the rule can match it, so it belongs inAttachedProperties, not the suppression list.maincarried 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 bareInstancePropertyOwnersset with the per-propertyInstancePropertyOwnerProbesmap. I re-measured rather than assuming: the mutation is not fully silent today. Restoring["Grid.Padding"]reddens exactly one test.PoolResetSetConsistencyTests+ModifierTableIntegrityTests["Grid.Padding"]restoredAttached_Reset_Scan_Sees_Every_Owner_The_Table_NamesBut that coverage is incidental and points at the wrong repair. Its message reads:
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}). GiveGridone 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_Ownerover the real table, naming the offending keys and the actual remedy. Owner membership is the predicate rather thanIsAttachedReset, since a row on a probed owner is wrong either way — and membership also correctly rejects["Grid.Row"], whichIsAttachedResetwould 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 aDeliberatelyExcludedAttachedkey — so the two failures don't argue with each other during merge triage. And one line in theDeliberatelyExcludedAttachedremarks recording that the rule is now enforced rather than described.Second commit: what the PR review caught
I ran the repo's
pr-reviewskill 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 bykey.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:
Every_Reset_Attached_Property_Is_ClassifiedDescribedByis "in neither table"Attached_Reset_Scan_Sees_Every_Owner_The_Table_Names[Microsoft]— and the new Note clause correctly names the exclusion listSo 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
falsetheory rows called them all live exclusion rows, but onlyAutomationProperties.DescribedByis;ToolTipService.ToolTipandFlexPanel.Groware inAttachedProperties.One finding I rejected: that "fails the build" in the
ModifierTableremarks overclaims for a test-enforced invariant.AdvancedInternalSurfaceTests.cs:26uses the identical phrase for the identical kind of gate, andci.ymlrunsReactor.Testsas 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.
["Grid.Padding"]restored and--filternaming 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.ContainsKey(...)clause withfalsereddens all 5 offender rows and leaves the legitimate rows green.TreatWarningsAsErrorsis Release-only, so this is what proves the new XML doc crefs resolve).Full-solution
-c Releasecouldn't complete on my machine — 4NU1301restore failures forReactor.VsExtension×3 andReactor.Compile.Analyzer.Tests, none of them touched here, all network-unreachability at restore time. CI has since covered that gap: 22 check runs against74fa680c, 19 success + 3 skipped, 0 failures — includingBuild solution,Unit Tests,Selftests,E2E Tests (winapp ui),AOT Trim ProofandDocs 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 noAnalyzerReleases.Unshipped.mdrow, nomur checkrule, 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.