idip stewards: a refused steward rotation (the 502 rotation_unavailable, and the 409) writes no journal line #1981

Closed
opened 2026-09-28 23:20:20 +00:00 by matou-build-agent · 1 comment

Symptom

On the Whakatōhea Demo (2026-09-28, 22:40:40Z and 22:40:45Z), POST /api/v1/idip/stewards/rotation answered 502 twice and the control-plane journal carried no line for either — the operator had no way to see why. Seen while diagnosing #1979.

Cause (traced offline, not the live root cause)

The rotation route refuses in two shapes and logs neither:

  • internal/controlapi/idip_stewards.go logs log.Info("idip steward-set rotation started", ...) only on success. On a refused start/co-sign/cancel it calls writeRotationError, which words a keriawire.ErrConflict as 409 and everything else as 502 rotation_unavailable — with no log line.
  • writeProblem → writeJSON (internal/controlapi/backups.go:362) does not log at 4xx/5xx (only on a marshal error).
  • Known refusals (pending / none-pending / no-such-member / last-steward) are mapped to 409 by rotationConflictOf (internal/keria/adapter.go:1154), so a 502 is always a genuine store/engine failure (keria agent unreachable, or a mint that failed) — precisely the case an operator most needs a journal line for.

The live 502 root cause is undiagnosed (needs the demo's control-plane logs / a repro); this ticket is only about closing the observability gap so the next 502 says why.

What to build

Log every refused rotation act with its reason, the same way #1962 landed "a refused sign-in logs WHY" — one line per refused start/co-sign/cancel naming the route, the direction/member where relevant, the HTTP status and the underlying error, at the level the failure warrants (a 502 store/engine failure at Error, a 409 conflict at Info/Warn). No secret material in the line.

Proof

Red-first at the internal/controlapi rotation seam: a start whose store returns a non-conflict error emits an Error line naming the reason and answers 502; a conflict emits its line and answers 409; success is unchanged. Offline, revertible.

#1979 (where this was seen), #1962 (the sign-in-refusal precedent), ADR 0197.

## Symptom On the Whakatōhea Demo (2026-09-28, 22:40:40Z and 22:40:45Z), `POST /api/v1/idip/stewards/rotation` answered **502 twice** and the control-plane journal carried **no line for either** — the operator had no way to see why. Seen while diagnosing #1979. ## Cause (traced offline, not the live root cause) The rotation route refuses in two shapes and logs neither: - `internal/controlapi/idip_stewards.go` logs `log.Info("idip steward-set rotation started", ...)` only on **success**. On a refused start/co-sign/cancel it calls `writeRotationError`, which words a `keriawire.ErrConflict` as 409 and everything else as **502 `rotation_unavailable`** — with no log line. - `writeProblem` → `writeJSON` (`internal/controlapi/backups.go:362`) does not log at 4xx/5xx (only on a marshal error). - Known refusals (pending / none-pending / no-such-member / last-steward) are mapped to 409 by `rotationConflictOf` (`internal/keria/adapter.go:1154`), so a **502 is always a genuine store/engine failure** (keria agent unreachable, or a mint that failed) — precisely the case an operator most needs a journal line for. The live 502 root cause is undiagnosed (needs the demo's control-plane logs / a repro); this ticket is only about closing the observability gap so the *next* 502 says why. ## What to build Log every refused rotation act with its reason, the same way #1962 landed "a refused sign-in logs WHY" — one line per refused start/co-sign/cancel naming the route, the direction/member where relevant, the HTTP status and the underlying error, at the level the failure warrants (a 502 store/engine failure at Error, a 409 conflict at Info/Warn). No secret material in the line. ## Proof Red-first at the `internal/controlapi` rotation seam: a start whose store returns a non-conflict error emits an Error line naming the reason and answers 502; a conflict emits its line and answers 409; success is unchanged. Offline, revertible. ## Related #1979 (where this was seen), #1962 (the sign-in-refusal precedent), ADR 0197.
Author
Member

Close-report — advances #1981 (landed)

What landed: every refused steward-set rotation act now writes ONE journal line saying WHY, closing the observability gap behind the silent 502s on Whakatōhea Demo. Following the #1962 sign-in-refusal precedent, writeRotationError (internal/controlapi/idip_stewards.go) emits one line per refused start / co-sign / cancel (and the GET read) naming the act, the HTTP status and the underlying reason, plus the direction/member/steward where relevant:

  • a 502 store/engine failure (a keria agent unreachable, a mint that failed) at Error — the case an operator most needs a line for, since rotationConflictOf maps every KNOWN refusal to 409, so a 502 is always a genuine store/engine failure;
  • a 409 conflict at Warn.

No secret material is logged — only the same non-secret fields the existing success line already carries.

Proof (red-first, at the internal/controlapi rotation seam, idip_stewards_test.go):

  • TestStewardRotation_StoreFailureLogsAndReturns502 — a start over a down store emits an Error line naming the reason/act/direction/member and answers 502;
  • TestStewardRotation_ConflictLogsAndReturns409 — a second rotation while one waits emits a Warn line and answers 409;
  • TestStewardRotation_CosignAndCancelFailuresLog — co-sign and cancel failures each log their own act at Error/502;
  • TestStewardRotation_SuccessLogsNoRefusal — a successful start logs no refusal line (success unchanged).

All four fail on main and pass after the fix. Full internal/controlapi suite + go build ./... + go vet clean; offline, revertible.

Commit: 2ac01fb954060935a05a65f1168cb4c3adf0f1a4 (on main). STATUS.md updated in the same commit.

Note on the live root cause: this ticket only closes the observability gap. The demo's live 502 root cause remains undiagnosed — the next 502 will now say why in the control-plane journal (referred back to #1979).

Ruled by agent under ADR 0174 — two-way (revertible code, proven by the offline seam) — veto anytime.

## Close-report — advances #1981 (landed) **What landed:** every refused steward-set rotation act now writes ONE journal line saying WHY, closing the observability gap behind the silent 502s on Whakatōhea Demo. Following the #1962 sign-in-refusal precedent, `writeRotationError` (`internal/controlapi/idip_stewards.go`) emits one line per refused **start / co-sign / cancel** (and the GET **read**) naming the act, the HTTP status and the underlying reason, plus the direction/member/steward where relevant: - a **502** store/engine failure (a keria agent unreachable, a mint that failed) at **Error** — the case an operator most needs a line for, since `rotationConflictOf` maps every KNOWN refusal to 409, so a 502 is always a genuine store/engine failure; - a **409** conflict at **Warn**. No secret material is logged — only the same non-secret fields the existing success line already carries. **Proof (red-first, at the `internal/controlapi` rotation seam, `idip_stewards_test.go`):** - `TestStewardRotation_StoreFailureLogsAndReturns502` — a start over a down store emits an Error line naming the reason/act/direction/member and answers 502; - `TestStewardRotation_ConflictLogsAndReturns409` — a second rotation while one waits emits a Warn line and answers 409; - `TestStewardRotation_CosignAndCancelFailuresLog` — co-sign and cancel failures each log their own act at Error/502; - `TestStewardRotation_SuccessLogsNoRefusal` — a successful start logs no refusal line (success unchanged). All four fail on `main` and pass after the fix. Full `internal/controlapi` suite + `go build ./...` + `go vet` clean; offline, revertible. **Commit:** `2ac01fb954060935a05a65f1168cb4c3adf0f1a4` (on `main`). STATUS.md updated in the same commit. **Note on the live root cause:** this ticket only closes the observability gap. The demo's live 502 root cause remains undiagnosed — the *next* 502 will now say why in the control-plane journal (referred back to #1979). Ruled by agent under ADR 0174 — two-way (revertible code, proven by the offline seam) — veto anytime.
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#1981
No description provided.