Repository navigation
Handle dashboard promises and stop shadowing min/max builtins - #169
Conversation
The dashboard called its async poll functions and main() as bare statements, dropping their promises: a rejection outside the functions' own try/catch (e.g. a render bug) surfaced only as an anonymous unhandled rejection. The visibilitychange refreshes are now explicitly fire-and-forget via void, and main() gets a .catch that logs the failure. A guard test fails if any of app.js's async functions is again called as a bare statement. handleHealthz and eventReaches named locals max and min, shadowing the Go 1.21 builtins; rename them to maxStale and minLevel. No behavior change. Resolves the six open SonarCloud findings (javascript:S9383, go:S978). Closes #168 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BvX6eSR4d9QW6L7vbDSVXK
|
Proposed fix, a one-line toolchain bump: -go 1.26.7
+go 1.26.9
|
govulncheck reports ten reachable standard-library vulnerabilities in crypto/tls, net/http and net/textproto (GO-2026-6603 through GO-2026-6617) for go1.26.7, the version go.mod pinned. All are fixed in go1.26.9. This was failing the Vulnerability scan job on main as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BvX6eSR4d9QW6L7vbDSVXK
|



Pull Request
📖 Description
This PR clears the six open SonarCloud findings without changing behavior, and bumps the Go toolchain to fix the failing vulnerability scan.
javascript:S9383, 4×).internal/web/assets/app.jscalled its async poll functions andmain()as bare statements, so their promises were dropped. A failure outside each function's owntry/catch(for example a render error inreloadAll→renderVersion()/startPolling()) only showed up as an anonymous unhandled rejection.visibilitychangehandler are independent and each handles its own fetch errors, so they are now marked fire-and-forget withvoid.main()now has a.catchthat logs the failure withconsole.error.go:S978, 2×).handleHealthzused a local namedmax, andeventReachestook a parameter namedmin. Both names shadow the builtins added in Go 1.21. They are renamed tomaxStaleandminLevel.crypto/tls,net/httpandnet/textproto(GO-2026-6603 … GO-2026-6617). This also fails theVulnerability scanjob onmain.go.modnow pins that version.go mod tidyleavesgo.sumunchanged. The README and CONTRIBUTING say "Go 1.26+" and stay accurate.🎫 Issues
Closes #168
👩💻 Reviewer Notes
internal/web/assets/app.js)GET /healthz(internal/httpapi/handlers.go)internal/alert/notify.go)go.mod/api/v1response shape changes.Uncaught (in promise)errors.📑 Test Plan
TestAppJS_AsyncCallsAreNotFloating(internal/web/polling_test.go). It finds everyasync functiondeclared inapp.jsand fails if any of them is called as a bare statement. Run against the oldapp.js, it reports exactly the four Sonar lines; against the fixed file it passes.handleHealthzstaleness tests and theeventReachestable test ininternal/alert/notify_test.go. They change no behavior, so they get no new Go tests.Vulnerability scan(govulncheck). The local environment cannot reachvuln.go.dev.go build ./...,go vet ./...andgo test ./... -race -coverpass, andgolangci-lint runat v2.13.1 (the CI pin) reports 0 issues.✅ Checklist
General
go test ./... -race -coverpasses locally).go vet ./...andgolangci-lint runare clean.ARCHITECTURE.mdif this changes a documented design decision. (not applicable: no design decision changes)REST API / configuration / packaging
docs/API.mdto reflect a REST API change. (not applicable: no API change)/api/v1/...response shapes, or a new API version(
/api/v2/...) was introduced instead.README.md/packaging/pimonitor.example.yamlto reflect a new orchanged configuration option. (not applicable)
packaging/install.shor the systemd units if this changesinstallation/packaging, and kept the unprivileged/privileged service split intact
(see
SECURITY.md). (not applicable)⏭ Next Steps
After merge, check that the SonarCloud analysis on
mainshows 0 open issues.