Skip to content

feat: admin system power control via microinit - #53

Merged
keskad merged 2 commits into
masterfrom
feat/admin-system-power
Aug 6, 2026
Merged

feat: admin system power control via microinit#53
keskad merged 2 commits into
masterfrom
feat/admin-system-power

Conversation

@keskad

@keskad keskad commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Dependencies

Test plan

  • go test ./pkgs/bigfred/server/http/... -run System
  • On BigFredOS (init mode): dialog allows shutdown and restart
  • On dev laptop (supervise mode): dialog shows unavailable message

Made with Cursor

Expose GET/POST /api/v1/admin/system for init-mode shutdown and restart,
and add an administrator menu dialog with Cancel, Shutdown, and Restart.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the admin system power control feature is well-structured and robust, covering both backend and frontend aspects effectively. The error handling, especially the "fire-and-forget" mechanism for shutdown requests on the frontend, is well-considered for the nature of the operation.

"fmt"
)

var (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✨ [POSITIVE] The explicit error types (ErrSystemUnavailable, ErrSystemNotInit, ErrInvalidShutdownMode) and their consistent usage throughout the service and HTTP layers provide excellent clarity and allow for precise error handling on the client side. Additionally, the design of NewSystemControl to gracefully handle nil ServiceManager implementations (e.g., for tests or --no-supervisor mode) is a good practice for robustness.

Comment thread web/src/api/system.ts Outdated
return apiFetch<SystemInfo>("/api/v1/admin/system");
}

/** Fire-and-forget host shutdown. Network errors after send are treated as success. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✨ [POSITIVE] The error handling in requestSystemShutdown is well-implemented. Specifically, treating TypeError and network-related ApiError (status undefined or 0) as success for fire-and-forget shutdown operations is crucial for a good user experience, as the server might stop before a full response can be received. This demonstrates a thoughtful approach to handling the inherent challenges of system shutdown via API.

Inject MicroinitPower instead of holding *manager; treat empty daemon
mode as supervise; surface API errors in the UI; add 409/empty-mode tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@keskad
keskad merged commit 22ff8b4 into master Aug 6, 2026
4 checks passed
@keskad
keskad deleted the feat/admin-system-power branch August 6, 2026 07:43
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