Skip to content

Newutils cleanup#1006

Merged
accius merged 2 commits into
accius:Stagingfrom
MichaelWheeley:newutils_cleanup
May 21, 2026
Merged

Newutils cleanup#1006
accius merged 2 commits into
accius:Stagingfrom
MichaelWheeley:newutils_cleanup

Conversation

@MichaelWheeley
Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactor / code cleanup
  • Documentation
  • Translation
  • Map layer plugin

Checklist

  • App loads without console errors
  • Tested in Dark, Light, and Retro themes
  • Responsive at different screen sizes (desktop + mobile)
  • If touching server.js: caches have TTLs and size caps (we serve 2,000+ concurrent users)
  • If adding an API route: includes caching and error handling
  • If adding a panel: wired into Modern, Classic, and Dockable layouts
  • No hardcoded colors — uses CSS variables (var(--accent-cyan), etc.)
  • No .bak, .old, console.log debug lines, or test scripts included

Copy link
Copy Markdown
Owner

@accius accius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes. Small, well-targeted cleanup and it looks good.

statemachine.js — the require path fix from ../utils/mutex to ./mutex is correct; both files live in server/utils/ so the redundant directory hop wasn't wrong, just confusing. Cleaner this way.

statemachine.test.js — good catch on the old should throw if invalid state index is provided test. It referenced a sm variable that was never assigned, so it was only "passing" because the undefined reference threw a ReferenceError — not because the state machine actually threw. Since SAFETY 3 in run() only logs and resets on an invalid next state (it never throws outside the constructor), rewriting it as should gracefully reset if invalid state index is provided and asserting the reset-to-'A' behavior matches what the code actually does.

Dropping should reset if next state is invalid is fine since the rewritten test already exercises the invalid-next-state path; no coverage lost.

One minor note, not blocking: the rewritten test is marked async and awaits sm.currentState(), but sm.run() itself is not awaited. It works here because the handler is synchronous, but awaiting run() would be more consistent with the other tests in the file and more robust if the handler ever becomes async.

CI is green on both Node 20.x and 22.x, and tests pass locally. Approving in spirit — clean fix.

— K0CJH

@accius accius merged commit 0fcdf06 into accius:Staging May 21, 2026
5 checks passed
@MichaelWheeley MichaelWheeley deleted the newutils_cleanup branch May 21, 2026 17:55
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