Skip to content

feat(go): config + supervise SDK - #6

Merged
keskad merged 8 commits into
mainfrom
feat/go-sdk-config-supervise
Aug 5, 2026
Merged

feat(go): config + supervise SDK#6
keskad merged 8 commits into
mainfrom
feat/go-sdk-config-supervise

Conversation

@keskad

@keskad keskad commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add go/config (ServiceDef, drop-ins, BaseConfigServiceNames).
  • Add go/supervise (join/spawn Host; Shutdown only if spawned).
  • Docs: docs/sdk/golang.md, docs/developer.md, index updates.
  • Tag go/v0.2.0.

Test plan

  • cd go && go test ./...

Made with Cursor

keskad and others added 6 commits August 5, 2026 09:40
Provide github.com/dcc-bigfred/microinit/go/client so bigfred and
bigfred-os-ui can share one length-prefixed JSON Unix socket client.

Co-authored-by: Cursor <[email protected]>
Expose ServiceDef/drop-in helpers and a process-only Host
(EnsureRunning/Shutdown). Document the Go SDK under docs/sdk and
docs/developer.md. Product policies (owned services) stay in callers.

Co-authored-by: Cursor <[email protected]>
Add config/IPC labels, list --show-labels and -l key=value (AND),
describe Labels section, and Go WithCreatedBy/MatchLabels for SDK v0.3.0.

Co-authored-by: Cursor <[email protected]>
- readFrame: stream-decode via LimitReader+json.Decoder instead of
  pre-allocating the full declared frame (DoS on a 16MiB header).
- Response: add stable `code` field; map on it in responseError instead
  of substring-matching the human message (not_found/disabled).
  Rust side populates code for Error::UnknownService/Disabled/Cycle
  and IPC permission/busy errors.
- FollowLogs: add Client.ReadTimeout + ReadFrame enforcing a per-frame
  idle read-deadline so a silent server is detected, not blocked forever.
- supervise.Host: use exec.Command (not CommandContext) so ctx cancel
  sends SIGTERM (soft-kill) letting microinit stop its services, then
  escalates to SIGKILL after ShutdownTimeout. Drop the redundant double
  List() in EnsureRunning. Bound the spawn log buffer to 256KiB.
- config: drop-ins now 0o600; add config.ShellQuote/BuildStartCmd
  helpers to dedupe shell quoting across callers.
- tests: readFrame too-large, code mapping (+legacy fallback),
  read-deadline, streaming decode; EnsureRunning spawn-fail,
  pre-ready exit, ready-timeout, ConfigPath-required, ctx-cancel SIGTERM.

Co-authored-by: Cursor <[email protected]>
Replace restart bool with restartPolicy (always/onError/none), add log
stream heartbeats, fix boundedBuffer short writes, use process-group
signals with a 15s shutdown budget, write pid+starttime for embedders,
and harden Go IPC framing (writeFull + exact frame reads).

Co-authored-by: Cursor <[email protected]>
@keskad
keskad force-pushed the feat/go-sdk-config-supervise branch from 54e4a09 to 4e4a007 Compare August 5, 2026 07:58
@keskad
keskad merged commit 78b10ff into main Aug 5, 2026
9 checks passed
@keskad
keskad deleted the feat/go-sdk-config-supervise branch August 5, 2026 08:08
@keskad keskad mentioned this pull request Aug 5, 2026
2 tasks
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