Crash Recovery & Operation Inspection CLI #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement startup crash recovery scanning to detect in-flight or unconfirmed operations, classify uncertain external states using evidence-based readback rules, provide the
GET /v1/operations/{id}API route, and build thelife operation get <ID>CLI command with exit code 6 pending/uncertainty semantics.Background & Technical Rationale
Distributed state mutations are susceptible to process termination, host crashes, network timeouts, and power failures at distinct execution boundaries. The Life service must never blindly replay an operation or fabricate completion without observable evidence:
prepared, but the process crashed before emitting the HTTP request.needs_reconciliationif unverified. Blind replay is prohibited.needs_reconciliation.operations, and recovery marks the uncertainty.operations.state = 'applied'and appendedlife_events. However, the process crashed before transmitting the HTTP response to the client.appliedoutcome without dispatching any secondary remote mutation.life operation get <ID> --jsonmaps toGET /v1/operations/{id}.unknown,needs_reconciliation, orprepared, the CLI exits with code 6 (partial/ pending), signaling to agents and operators that recovery investigation is required before any further action.Exact Technical References & Specifications
Crash Recovery Rules Table
From
docs/technical/timeline-consistency.md#crash-recovery:Verification Scenarios (R05, R06, R07, R08)
From
docs/technical/verification.md#recovery-scenarios:Illustrative Pending / Unknown Response Envelope
From
docs/technical/verification.md#recovery-scenarios:Command and Route Specifications
From
docs/technical/cli-api.md#command-to-route-table:| life operation get ID | GET /v1/operations/{id} | read |From
docs/technical/cli-api.md#command-payloads-and-results:| Operation get | ID | state, intended target, recorded result, steps, recovery requirement and context delivery |From
docs/technical/cli-api.md#error-identifiers:| operation_unknown, needs_reconciliation | Recover by operation ID; no blind replay |From
docs/technical/cli-api.md#transport-and-common-contract:Formal Section Citations
docs/technical/timeline-consistency.md#operation-state-machine: Defines the operation lifecycle states and transitions.docs/technical/timeline-consistency.md#crash-recovery: Normative table of evidence classes and recovery actions.docs/technical/cli-api.md#command-to-route-table: Defineslife operation get IDroute mapping.docs/technical/cli-api.md#command-payloads-and-results: Specifies payload schema for operation get.docs/technical/cli-api.md#transport-and-common-contract: Governs exit code 6 for pending/unknown outcomes.docs/technical/verification.md#recovery-scenarios: Formulates normative test scenarios R05, R06, R07, and R08.What to Build (Step-by-Step)
Implement Recovery Scanner (
src/history/recovery.rs):life serve, queryoperationswherestate IN ('prepared', 'unknown').baseline_jsonand intendedintent_json:life_eventsobservation row withevidence_class = 'observed_external'and updateoperations.state = 'needs_reconciliation'(attribution uncertainty).operations.state = 'needs_reconciliation'.operations.state = 'needs_reconciliation'.Implement Operation API Route in Axum (
src/api.rs):GET /v1/operations/{id}.operationstable byoperation_id.not_found.OperationDetails:operation_id: Stringstate:prepared|applied|failed|unknown|needs_reconciliationactor: Stringprepared_at: RFC3339 UTC timestampupdated_at: RFC3339 UTC timestampintent: JSON valuebaseline: Optionresult: Optionrecovery_requirement: String description of required operator/agent review if state isneeds_reconciliationorunknown.Implement
life operation getCLI Command (src/cli.rs):life operation get <ID> [--json]./v1/operations/{id}.ResponseEnvelope.state == "applied"orstate == "failed": exit 0.state == "unknown"orstate == "needs_reconciliation"orstate == "prepared": exit 6 (partial/ pending).not_found.Integration Fault-Injection Tests (
tests/crash_recovery.rs):needs_reconciliationwith attribution uncertainty.life operation get <ID>exits with code 6 for all unresolved operations.Acceptance Criteria
needs_reconciliationon restart without issuing a blind duplicate write (verifying Scenario R05).needs_reconciliationon restart (verifying Scenario R06).life operation get <ID> --jsonreturns envelope with current operation state and recovery requirements.life operation getexits with code 6 when an operation is inunknown,needs_reconciliation, orpreparedstate.docs/technical/verification.md.Notes
MAX_RECOVERY_OPERATIONS = 25,RECOVERY_BUDGET = 30s, leftovers reported asdeferredand retried on the next start.not_foundexit-code divergence fromlife item getis tracked in #49.Blocked by
Issue #006: Crash Recovery & Operation Inspection CLIto Crash Recovery & Operation Inspection CLInot_foundCLI exit code to 2 across commands #49