v0.83.0: observability pass — always-DEBUG capture ring + GET /debug/logs + heartbeat log-pull + gap-fill sweep

Capture layer: applog.New returns (logger, Ring) — slog fan-out, stderr at the
configured level, ~1000-entry ring fixed at LevelDebug (remote diagnostics
without a config flip). GET /debug/logs (token-authed, ?raw=1) + request-level
DEBUG middleware. Heartbeat log-pull mirrors the report logtail pattern:
envelope log_tail_requested -> next heartbeat carries log_tail (128KB cap,
consume-once, failed-push retry proven). Gap-fill sweep over netverify/
netstorage/netmount/signedjobs/selfupdate/disks/controller-swap/desired/loop.
Red-proofs: ring-at-emit-level FAILs capture test; drain removed FAILs
consume-once; dropped phase line FAILs the S7 log-sequence smoke.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
This commit is contained in:
2026-07-11 16:24:07 +02:00
parent 461eaf42c1
commit cb692f8788
20 changed files with 902 additions and 29 deletions
+13 -3
View File
@@ -366,9 +366,12 @@ func (h *SudoHostOps) EnsureNetworkMount(ctx context.Context, spec NetworkMountS
if err := h.installUnit(ctx, mountUnit, renderNetworkMountUnit(spec)); err != nil {
return err
}
h.logger.Debug("netmount: mount unit installed", "unit", mountUnit)
if err := h.installUnit(ctx, automountUnit, renderNetworkAutomountUnit(spec)); err != nil {
return err
}
h.logger.Debug("netmount: automount unit installed", "unit", automountUnit,
"idle_timeout_s", spec.idleTimeout())
if err := h.run(ctx, h.bins.Systemctl, "daemon-reload"); err != nil {
return fmt.Errorf("netmount: daemon-reload: %w", err)
}
@@ -376,6 +379,7 @@ func (h *SudoHostOps) EnsureNetworkMount(ctx context.Context, spec NetworkMountS
if err := h.run(ctx, h.bins.Systemctl, "enable", "--now", "--", automountUnit); err != nil {
return fmt.Errorf("netmount: enabling automount %s: %w", automountUnit, err)
}
h.logger.Debug("netmount: automount enabled + started", "unit", automountUnit)
h.logger.Info("netmount: ensured network mount", "name", spec.Name, "proto", spec.Protocol,
"server", spec.Server, "export", spec.Export, "where", spec.Where(), "host_uid", spec.HostUID())
return nil
@@ -414,9 +418,15 @@ func (h *SudoHostOps) RemoveNetworkMount(ctx context.Context, name string) error
automountUnit := strings.TrimSuffix(mountUnit, ".mount") + ".automount"
// Stop the automount first (so it can't re-trigger the mount), then the mount. Tolerate "not loaded".
_ = h.run(ctx, h.bins.Systemctl, "stop", "--", automountUnit)
_ = h.run(ctx, h.bins.Systemctl, "disable", "--", automountUnit)
_ = h.run(ctx, h.bins.Systemctl, "stop", "--", mountUnit)
for _, step := range [][]string{
{"stop", "--", automountUnit},
{"disable", "--", automountUnit},
{"stop", "--", mountUnit},
} {
err := h.run(ctx, h.bins.Systemctl, step...)
h.logger.Debug("netmount: remove step", "verb", step[0], "unit", step[len(step)-1],
"ok", err == nil) // a "not loaded" failure here is expected + tolerated
}
destAuto := filepath.Join(h.unitDir, automountUnit)
destMount := filepath.Join(h.unitDir, mountUnit)