Skip to content

test(mudblazor): allowlist the record-item model the shape guard flags (#297) - #346

Merged
phmatray merged 1 commit into
devfrom
fix/dev-collection-item-shape-guard
Aug 13, 2026
Merged

test(mudblazor): allowlist the record-item model the shape guard flags (#297)#346
phmatray merged 1 commit into
devfrom
fix/dev-collection-item-shape-guard

Conversation

@phmatray

Copy link
Copy Markdown
Owner

dev is red — this unblocks it.

Two PRs that never saw each other landed on dev and are individually fine but collectively red:

Each was green against the dev it branched from. Together:

CollectionItemShapeGuardTests.No_Suite_Should_Re_Declare_A_Collection_Item_Shape_The_Fixture_Provides
  offenders should be empty but had 2 items:
    FieldConfigurationRefreshTests.EqualityItemModel holds List<EqualityItem>, whose shape (String)
      is already a CollectionItemFixture item type
    FieldConfigurationRefreshTests.EqualityItemModel is a collection root whose composition (String)
      is already modelled by CollectionItemFixture.NamedOrderModel or OrderModel

The fix: the allowlist, not the fixture

This is a true positive with a legitimate exception, not a guard bug — so the guard is not
weakened and the suite is not migrated.

EqualityItem is a record, and that is the entire test. FieldConfigurationRefreshTests reproduces
the duplicate-key render error a keyed collection loop raises for two rows comparing equal by
value
— the hazard #298's README entry documents as the reason collection rows are deliberately not
keyed. Every CollectionItemFixture model is a plain class with reference equality, so adopting
the fixture would not share code, it would make the test vacuous: it would stop reproducing the
error at all. The suite's own comment already said so:

The item type here is a record precisely because the shared fixture's models are all plain classes
with reference equality, which is why the original suite stayed green.

The guard compares member types, which here are identical (String). The salient difference is the
type's equality semantics, which a shape signature deliberately does not encode — widening the
signature to capture it would make the guard miss the real copies it was built for (#258's
CredentialsModel / VaultModel). So the escape hatch #306 shipped is the right tool, used as its
own failure message directs.

Changes

  • EqualityItem / EqualityItemModel: privateinternal so the guard test can name them, with
    a ⛔ comment on each saying why they must not be folded into the fixture. Visibility is not part of
    the guard's ownership rule (IsSharedShape tests DeclaringType is null), so this changes no
    behaviour — they remain nested, remain candidates, and are suppressed only by the allowlist.
  • A DeliberateLocalCopies allowlist on CollectionItemShapeGuardTests, carrying the reason inline.
  • Every_Allowlisted_Type_Should_Still_Be_An_Offender_Without_The_Allowlist — new. An allowlist
    entry stops suppressing anything the day its suite adopts the fixture, and a stale entry is worse
    than none: it would silently absolve a future re-declaration of that same type. This re-runs the
    assembly-wide scan without the allowlist and requires every entry to still be a real offender,
    naming any that is not. It is the same principle the guard's own header states — a check that has
    quietly stopped checking still reports green.

Verification

  • dotnet build -c Release — clean.
  • dotnet test -c Release1,616 passing, 1 skipped, 0 failing (158 Fluent / 874 core / 584 MudBlazor).
    MudBlazor goes 583→584: the previously-failing test passes and the new one is added.
  • Reproduced the failure first on a clean checkout of dev at 65944e5, so this is verified against
    the real break rather than an assumed one.

@phmatray
phmatray merged commit a68cf29 into dev Aug 13, 2026
3 checks passed
@phmatray
phmatray deleted the fix/dev-collection-item-shape-guard branch August 13, 2026 13:31
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.

1 participant