Repository navigation
fix(web): reject invalid dashboard periods without exiting - #554
Merged
iamtoruk merged 2 commits intoJun 28, 2026
Merged
Conversation
ozymandiashh
force-pushed
the
fix/web-period-validation
branch
from
June 22, 2026 03:26
4b39fcd to
537b1a4
Compare
Collaborator
Author
|
Updated and re-verified after rebasing on current Final validation:
I also checked the dashboard visually with screenshots for each period after the rebase. I do not have a second Mac available, so I could not physically validate mDNS discovery between two machines; local pairing/transport/API behavior was exercised. PR is mergeable and current checks are green. |
…dundant /api/devices re-parse - Add tests/web-dashboard.test.ts: boots the dashboard on an ephemeral port and asserts /api/usage and /api/devices answer 400 (not process.exit) for a bad period, and that the server keeps serving afterward. runWebDashboard now returns the http.Server so it can be exercised in-process; callers that ignore the return value are unaffected. - /api/devices: resolve periodInfo once instead of validating then re-parsing it inside localGetUsage (pullDevices invokes localGetUsage with the same already-validated query).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up from the dashboard/devices release check.
A bad
periodquery should not be able to terminate a long-running web/share server. The CLI should still fail loudly for invalid--period, but HTTP handlers need to return an error response and keep serving.What changed:
/api/usageand/api/devicesnow return JSON 400 for invalid period/date query params instead of exiting the process.--periodstill prints the error and exits non-zero.Validation:
npm test -- tests/cli-date.test.ts tests/dashboard.test.ts tests/sharing --run— 57 passingnpx tsc --noEmitnpm run build/api/usageand/api/devicesperiods returned 400 JSON;/api/identitystill returned 200 afterwards.