Skip to content

Default to lean case aliases and repair Blazor CSS artifacts - #7

Merged
magiccodingman merged 7 commits into
mainfrom
agent/lean-case-aliases-css-cleanup
Jul 27, 2026
Merged

Default to lean case aliases and repair Blazor CSS artifacts#7
magiccodingman merged 7 commits into
mainfrom
agent/lean-case-aliases-css-cleanup

Conversation

@magiccodingman

Copy link
Copy Markdown
Owner

What changed

  • make single-segment case aliases the default instead of generating the Cartesian product of case variants across every route segment
  • retain the previous exhaustive alias behavior as an explicit option through SnapshotCaseAliasStrategy.Exhaustive and --case-alias-strategy exhaustive
  • keep complete redirect files at each generated alias path, so static hosts and IPFS still resolve the incorrectly cased request directly
  • remove exact empty Blazor render markers (<!--!-->) from inline style content before CSS parsing
  • when cleaned CSS still fails, narrowly repair generated heading selectors h 1 through h 6, accept the repair only when the resulting CSS parses and minifies successfully, and run the existing verification pass
  • preserve arbitrary invalid CSS without guessing

Why

The prior alias implementation generated every combination of independently cased path segments. A route such as /docs/setup/path1 produced variants such as /DOCS/SETUP/PATH1, creating exponential output growth without materially improving the default fallback behavior. The new default covers one incorrectly cased segment at a time, while exhaustive behavior remains available for callers that truly need every combination.

Blazor can emit empty render markers inside serialized <style> content and can split generated heading selectors such as h1 into h 1 around Razor-rendered markup. These are renderer artifacts rather than intentional application CSS. Snapshot now handles only those known forms, validates the repaired stylesheet, and otherwise falls back safely.

User impact

Normal CLI builds now create substantially fewer case-alias redirect files for nested routes. Existing users who require the old behavior can run:

snapshot build <source> --case-alias-strategy exhaustive

Inline CSS generated by the observed Blazor MarkupString pattern should minify without producing the previous fallback diagnostic.

Validation

Added protocol tests for lean versus exhaustive alias generation and processing tests for:

  • exact Blazor marker removal
  • safe h 1 to h1 repair after parse failure
  • refusal to guess-repair unrelated invalid selectors

@magiccodingman
magiccodingman marked this pull request as ready for review July 27, 2026 04:44
@magiccodingman
magiccodingman merged commit f6630f5 into main Jul 27, 2026
4 checks passed
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