Skip to content

Remove abandoned BuildBundlerMinifier and fix NSubstitute 6 warnings - #1450

Open
ardalis wants to merge 11 commits into
mainfrom
remove-buildbundlerminifier
Open

Remove abandoned BuildBundlerMinifier and fix NSubstitute 6 warnings#1450
ardalis wants to merge 11 commits into
mainfrom
remove-buildbundlerminifier

Conversation

@ardalis

@ardalis ardalis commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related cleanups after the recent dependency updates:

Remove BuildBundlerMinifier (abandoned) and its generated .min assets. The package is archived upstream, and its Clean-phase output deletion races the .NET 10 StaticWebAssets pipeline: dotnet build --no-incremental failed every time with "No file exists for the asset wwwroot/css/sb-admin-2.min.css". Instead of freezing the generated .min files as hand-maintained commits — which review flagged as a silent-staleness trap (Development served site.js while Staging/Production served a site.min.js that nothing would ever regenerate, with asp-append-version hashing the stale file so caches never bust) — both layouts now serve the source files in all environments, and the four orphaned .min artifacts are deleted (site.min.css and landing-page.min.css were referenced by nothing at all).

Fix NSubstitute 6.0 nullable warnings in DevBetterWeb.Tests. CallInfo.Arg<T>() now returns T? and Arg.Is<T> predicates receive T?; suppressed with ! (NSubstitute swallows predicate exceptions into non-matches, so this is behavior-neutral — verified against the decompiled 6.0 matcher). The triplicated 9-null UserManager substitute recipe is extracted into UserManagerHelpers.CreateSubstitute() alongside the existing MemberHelpers/SubscriptionHelpers.

Review notes

An 8-angle automated review ran before commit (the /codex:review plugin required by CLAUDE.md is not installed in this environment, so the built-in review was used instead). Findings addressed: the prod-only stale-JS trap, the orphaned sb-admin-2.css/.min pair, the unreferenced min files, the BundleArtifacts/ .gitignore residue, the UserManager duplication, and inconsistent null-suppression idioms. Findings intentionally not taken:

  • "o != null in a DidNotReceive matcher weakens the assertion" — refuted: NSubstitute wraps predicates in try/catch and treats exceptions as non-matches, so the old NRE path already behaved identically; the idiom was switched to o!. anyway for consistency.
  • Shared fixture base classes for the DailyCheckPing/Stripe test files and deduplicating _billableStatuses against the production array — pre-existing structure, out of scope here.
  • Response compression (UseResponseCompression) — worth doing as a follow-up; it would save far more bytes than minification ever did (~190KB of member-page CSS compresses to ~25-30KB), which is why serving unminified sources is an acceptable trade today.

Testing

  • dotnet build --no-incremental: previously always failed; now succeeds with 0 warnings, 0 errors
  • dotnet test: all 233 tests pass (76 + 154 + 3)
  • Repo-wide grep confirms no remaining references to the deleted .min files, bundleconfig.json, or BuildBundlerMinifier

🤖 Generated with Claude Code

Copilot AI and others added 11 commits May 12, 2026 00:43
NSubstitute 6.0 added nullable annotations: CallInfo.Arg<T>() returns T?
and Arg.Is<T> predicates receive T?. Suppress with the null-forgiving
operator (matchers never actually receive null; NSubstitute swallows
predicate exceptions into non-matches either way) and pass null! for the
unused UserManager constructor dependencies.

Extract the triplicated UserManager substitute recipe into
UserManagerHelpers.CreateSubstitute(), following the existing
MemberHelpers/SubscriptionHelpers convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BuildBundlerMinifier is archived and its Clean-phase output deletion
races the .NET 10 StaticWebAssets pipeline, making dotnet build
--no-incremental fail with "No file exists for the asset
wwwroot/css/sb-admin-2.min.css".

Rather than freeze the generated .min files as hand-maintained commits
(a silent-staleness trap: Development served the sources while
Staging/Production served .min files nothing regenerates), serve the
source files directly in all environments and delete the orphaned
artifacts:

- site.min.js: was prod-only; both layouts now load site.js everywhere
- sb-admin-2.min.css: member layout now loads sb-admin-2.css
- site.min.css and landing-page.min.css: referenced by nothing
- BundleArtifacts/ .gitignore entry: bundler residue

The size cost is small and a follow-up can add response compression,
which saves far more than minification did.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.

2 participants