Skip to content

Refactor: give the stats widget one base-URL rule - #15

Merged
SandObserver merged 1 commit into
mainfrom
refactor/stats-normalize-base
Aug 9, 2026
Merged

SandObserver merged 1 commit into
mainfrom
refactor/stats-normalize-base

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Delete diskBase from ui/widgets/stats/data.js and replace it, plus the two inline copies in diskHealthScrutiny and diskHealthTrueNas, with ctx.normalizeBase.
  • The copies had drifted: diskBase and the inline form stripped a single trailing slash, ctx.normalizeBase strips several and trims whitespace. Which spelling a URL met decided whether a value entered with a trailing space or a double slash reached the service.
  • Add a scan asserting no widget rebuilds the normalisation ctx already provides. connections is exempt with the reason recorded: its normBase deliberately leaves a trailing slash in place, and one of its three call sites strips slashes itself.

Testing
All green. Added 1 test; mutation-checked by restoring a hand-rolled scheme check, which fails it.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

The widget normalised an upstream base URL three ways: a local diskBase helper
and two inline copies, one of which stripped a single trailing slash where
ctx.normalizeBase strips several and also trims. All four call sites use
ctx.normalizeBase now, so a URL entered with a trailing space or two slashes
behaves the same wherever it is used.

A scan keeps the rule. connections is exempt and says why: its normBase leaves
a trailing slash in place, which is a different rule rather than a copy.
@SandObserver SandObserver added the refractor Code improvement / cleanup, no behavior change label Aug 9, 2026
@SandObserver
SandObserver merged commit a9ca41a into main Aug 9, 2026
4 checks passed
@SandObserver
SandObserver deleted the refactor/stats-normalize-base branch August 9, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refractor Code improvement / cleanup, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant