Repository navigation
Description
Wider than the title: deletion is only one way in
Raised by the #967 session, which hit the identical shape from the opposite direction. The underlying rule is not about guards or about reviews:
A value oracle whose two branches can coincide proves nothing at the point they coincide — and nothing in the test's appearance tells you where that point is.
Deleting a guard and citing the wrong oracle are two ways to end up standing on that point.
The citation instance (PR #967,
tests/Reactor.Tests/FlyoutPlacementGuardTests.cs).CbfAuto_OpenedWithoutFailFastwas cited as the mount-arm oracle. It asserts the flyout opens without fail-fast — a behavioural/value claim. But anAutomount clears the DP to WinUI's defaultTop, so the observable state is identical whether the mountApplyruns or is deleted outright. The oracle passes on broken code, for exactly the reason in the summary below: both branches land on the same observable value. Fixed in38600269("…fix a vacuous oracle citation") by re-citingCbfReset_ExplicitPlacementApplied, which is differential — two variants differing only by the setter — and therefore self-guarding. The fixture now records the trap in place, at:185:
// CbfAuto_OpenedWithoutFailFast is *not* the mount oracle: an Auto mount clears the …So the practice is broader than "don't accept guard deletions":
Ask Not Where do this oracle's two branches coincide? Is this assertion present? Is the cited check differential, or does it restate a value both paths produce? Does the cited check pass? Corollary — noisiness is often the load-bearing property. A guard that fails when a theme gives
Buttonzero padding is a tripwire on its own precondition, firing precisely when the fallback stops testing anything. Same structure as the exact== 30asserts in #994/#685: the property that makes it noisy is the property that makes it discriminating, and in both cases the proposed cleanup was to remove exactly that.
Summary
AGENTS.md currently warns that Copilot review does not catch vacuous assertions:
Copilot review does not catch vacuous assertions — run the
.github/skills/pr-review/multi-model dimension (different model family, high reasoning) on the final commit and fix every finding.
There is a strictly worse inverse that isn't documented: review can propose deleting an anti-vacuity guard, with a correct premise and a wrong conclusion. Silence is a missed catch; a plausible deletion suggestion is an active push in the wrong direction, arriving with the authority of a review and costing a one-line diff to accept. The suite still passes, looks unchanged, and has quietly lost the thing keeping an oracle honest.
Observed on PR #970. Filing because the fix is a field note, not code.
The concrete instance
Copilot review 4826257469 (commit 0f79ac62), suppressed comment on tests/Reactor.AppTests.Host/SelfTest/Fixtures/Issue950TextBlockPaddingFixture.cs:260:
The
Issue950_Unset_ThemedPaddingIsNonZerocheck is redundant (and potentially brittle across theme/style changes). The test already distinguishesClearValuevs "localThickness(0)" viaReadLocalValue(...) == UnsetValue, so requiring the themed padding to be non-zero can fail even when the behavior under test is correct.
The targeted guard, with its rationale inline and adjacent:
// Guards the fallback check below from being vacuous: if the Button style supplied
// zero padding, "cleared" and "written as a local zero" would be indistinguishable.
var themed = reference.Padding;
H.Check("Issue950_Unset_ThemedPaddingIsNonZero", themed != new Thickness(0)); // :260The fixture then makes two assertions about the reset:
// :272 — PRIMARY, structural
H.Check("Issue950_Unset_ControlLocalValueCleared",
ReferenceEquals(DependencyProperty.UnsetValue,
btn.ReadLocalValue(WinUI.Control.PaddingProperty)));
// :280 — FALLBACK, value comparison
H.Check("Issue950_Unset_ControlFallsBackToThemedPadding", btn.Padding == themed);The premise is true and the conclusion is false. ReadLocalValue(...) == UnsetValue really does distinguish the two resets, and the guard really is redundant against that check. But the guard's own comment says it protects the fallback check below — line 280, not line 272. If the Button style supplied zero padding, then under the buggy local-zero write btn.Padding is Thickness(0), themed is Thickness(0), and btn.Padding == themed passes on broken code. That is exactly the vacuity the guard exists to prevent.
The review evaluated the guard against the strongest oracle in the test, found it redundant there, and recommended deletion without checking the weaker assertion three lines further down that names the guard in its comment.
Why this generalises
It is the same boundary established in #970/#984 review discussion:
- Structural oracles restate the bug (
ReadLocalValue == UnsetValueliterally answers "was a local value written?"). They are self-guarding. - Value-comparison oracles can pass in both directions (
btn.Padding == themed). They are exactly what a guard is for.
So: a guard that is redundant against the structural oracle may be load-bearing for the value oracle sitting beside it. "Redundant" is a claim about one assertion; deletion affects all downstream ones.
The secondary concern — "potentially brittle across theme/style changes" — is legitimate but backwards in consequence. If a future theme gives Button zero padding, the guard should fail loudly, because that is precisely the moment Issue950_Unset_ControlFallsBackToThemedPadding silently stops testing anything. Here, brittleness is the feature: the guard is a tripwire on its own precondition.
Proposed field note
Add alongside the existing vacuous-assertion warning in AGENTS.md:
Treat any review suggestion to delete or simplify a test guard as suspect. Review can flag a guard as "redundant" with a correct premise and a wrong conclusion — redundant against the test's strongest oracle, while load-bearing for a weaker one below it. Before accepting, identify every assertion downstream of the guard and ask which of them goes vacuous without it. A structural oracle (
ReadLocalValue == UnsetValue) is self-guarding; a value comparison (actual == expected) is not. A guard that fails when its own precondition stops holding is doing its job, not being brittle.
Notes
- The rationale was already inline and adjacent to the guard, and the suggestion was made anyway — so "document why the guard exists" is necessary but demonstrably not sufficient.
- It arrived as a suppressed comment, which creates no review thread and therefore has no resolution state — see [pr-review] Require fix-a-finding commits to cite the in-repo source for factual claims #993. It is visible only in the review body.
- Related: [Docs] Mutation testing can silently lie: seven variants, five of them silent and one that inflates confidence #992 (mutation testing can silently lie), [pr-review] Require fix-a-finding commits to cite the in-repo source for factual claims #993 (pr-review should cite in-repo source for factual claims).
Activity
[-][Docs] AGENTS.md: treat a review suggestion to delete a test guard as suspect — check what goes vacuous if you accept it[/-][+][Docs] AGENTS.md: a value oracle whose branches coincide proves nothing — guard deletions and oracle citations both land there[/+]