Operator transport: a failed registry reload after a write answers unavailable
A 200 with the union not swapped could leave a retired consumer admitted in memory. Answer 503 instead; Alta's exact replay returns the stored result and reloads again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+6
−3
internal/home/operator_http.go+6 −3
CI passed — run details
diff --git a/internal/home/operator_http.go b/internal/home/operator_http.go| index bfed46e..fb05126 100644 |
| --- a/internal/home/operator_http.go |
| +++ b/internal/home/operator_http.go |
| @@ -376,11 +376,14 @@ func (a *App) handleOperator(w http.ResponseWriter, r *http.Request) { |
| out, err = a.op.directory.ExecuteHTTP(r.Context(), body) |
| } else { |
| out, err = a.op.credential.ExecuteHTTP(r.Context(), body) |
| + // On replay too: a reload that failed after the commit is retried. |
| if err == nil && (action == "credential.register-consumer" || action == "credential.retire-consumer") { |
| - // The committed write is visible; swap the union in. |
| + // The committed write is visible; swap the union in. If that |
| + // fails, answer unavailable: Alta's exact replay returns the |
| + // stored result and reloads again, so a retired consumer never |
| + // stays admitted behind a 200. |
| if err = a.runtime.registry.load(r.Context(), a.db.Writer(), a.origins.Credential, a.runtime.keys); err != nil { |
| - a.logger.Error("operator http registry reload failed") |
| - err = nil |
| + err = operator.ErrUnavailable |
| } |
| } |
| } |