backup: the crown-jewel key read conflates a transient store error with "never seeded" #294

Closed
opened 2026-08-05 23:10:38 +00:00 by ben · 1 comment
Owner

internal/backup/keys_crownjewel.go:106 — a transient clan/secret-store error and "the root was never seeded" both map to key-unavailable. Downstream refuses loudly (internal/backupengine/movement.go:73), so nothing silently passes — but replication stops with a message blaming a missing seed, sending the operator to re-seed when the store hiccuped.

Acceptance

  • The read distinguishes not-found from read-failure; the refusal message names which.
  • Test both paths.

Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code).

`internal/backup/keys_crownjewel.go:106` — a transient clan/secret-store error and "the root was never seeded" both map to key-unavailable. Downstream refuses loudly (`internal/backupengine/movement.go:73`), so nothing silently passes — but replication stops with a message blaming a missing seed, sending the operator to re-seed when the store hiccuped. **Acceptance** - The read distinguishes not-found from read-failure; the refusal message names which. - Test both paths. --- _Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code)._
Author
Owner

Fixed in fc16fb2 (on origin/main).

The CrownJewelKeys seam changed from Key(ref) (Key, bool) to Key(ref) (Key, error) so the two unavailable shapes are no longer collapsed. New sentinel backup.ErrRootNotSeeded: the reader maps a clan.FailMissingVar read (var genuinely not generated), a nil store, and an empty revealed root to it; any other store error is surfaced wrapped and uncached (retry posture unchanged).

All three callers now name which — replicate / SealedInventoryFor / rebuildDataset say "not in the store (backup root not seeded)" vs "could not be read from the store … this is transient — retry".

Both paths tested red-first: internal/backup/keys_crownjewel_test.go (TestCrownJewelKeyReader_DistinguishesNotSeededFromReadFailure) at the reader seam, and internal/backupengine/movement_test.go (TestReplicate_RefusalNamesNotSeededVsReadFailure) asserting the two refusal messages are distinct and neither leaks the others wording. go test / go vet / golangci-lint green across backup, backupengine, control-plane.

Fixed in fc16fb2 (on origin/main). The `CrownJewelKeys` seam changed from `Key(ref) (Key, bool)` to `Key(ref) (Key, error)` so the two unavailable shapes are no longer collapsed. New sentinel `backup.ErrRootNotSeeded`: the reader maps a `clan.FailMissingVar` read (var genuinely not generated), a nil store, and an empty revealed root to it; any other store error is surfaced wrapped and uncached (retry posture unchanged). All three callers now name which — replicate / `SealedInventoryFor` / `rebuildDataset` say "not in the store (backup root not seeded)" vs "could not be read from the store … this is transient — retry". Both paths tested red-first: `internal/backup/keys_crownjewel_test.go` (`TestCrownJewelKeyReader_DistinguishesNotSeededFromReadFailure`) at the reader seam, and `internal/backupengine/movement_test.go` (`TestReplicate_RefusalNamesNotSeededVsReadFailure`) asserting the two refusal messages are distinct and neither leaks the others wording. go test / go vet / golangci-lint green across backup, backupengine, control-plane.
ben closed this issue 2026-08-06 01:22:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#294
No description provided.