F6 deeper half: poll agent /disks/format/status on the 15s client timeout (slow USB mkfs runs detached) — agentapi.FormatStatus + awaitAgentFormat; then mount+register. Found on the live leg.

This commit is contained in:
2026-07-17 09:41:50 +02:00
parent 0025a3b090
commit 0515d153db
4 changed files with 142 additions and 3 deletions
+24
View File
@@ -661,6 +661,30 @@ func (c *Client) FormatDisk(ctx context.Context, device, fstype string, confirme
return out, nil
}
// FormatStatusResult mirrors GET /disks/format/status (F20-BUG3): the most-recent / in-flight format
// job on the host. Phase ∈ idle | running | done | failed. The drive-init flow polls this to follow a
// mkfs that outran the 15 s client timeout — the agent runs the mkfs DETACHED and keeps the record, so
// the client can learn the real outcome instead of assuming failure (F6).
type FormatStatusResult struct {
Phase string `json:"phase"`
Device string `json:"device"`
FSType string `json:"fstype"`
Error string `json:"error"`
}
// FormatStatus fetches the agent's most-recent format-job record.
func (c *Client) FormatStatus(ctx context.Context) (FormatStatusResult, error) {
var out FormatStatusResult
body, err := c.get(ctx, "/disks/format/status")
if err != nil {
return out, err
}
if err := json.Unmarshal(body, &out); err != nil {
return out, fmt.Errorf("agentapi: decode /disks/format/status: %w", err)
}
return out, nil
}
// ---- NAS network storage (Part A2 → agent A1 /netstorage/*) ------------------------------
//
// A NAS share is a DISTINCT storage class from a drive: the controller proxies add/list/remove to the