Persist lifecycle state before shell and skill post-processing#29
Conversation
Save state.json immediately after install, update, and uninstall plan execution completes, before shell-hook prompting and skill generation. This prevents receipt loss when post-processing steps fail after the machine state has already changed. Extracts postInstallWorkflow to keep runInstall within cyclomatic complexity limits. Closes #23 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes move state persistence earlier in the install/update/uninstall workflows by saving state immediately after plan execution, before shell-hook prompting and skill generation. This prevents receipt loss when post-processing steps fail. Changes
Sequence DiagramsequenceDiagram
participant Client as Install/Update/Uninstall Handler
participant Plan as Execute Plan
participant StateSave as Save State
participant PostProc as Post-Processing<br/>(Shell Hooks/Skills)
participant Summary as Render Summary
Client->>Plan: Execute lifecycle plan
Plan-->>Client: Plan completed
Client->>StateSave: Save state immediately
activate StateSave
Note over StateSave: Receipts persisted durably<br/>before post-processing
StateSave-->>Client: State saved
deactivate StateSave
Client->>PostProc: Apply shell integration<br/>& select targets
alt Post-processing succeeds
PostProc-->>Client: Complete
Client->>Summary: Render install summary
else Post-processing fails
PostProc-->>Client: Error
Note over StateSave: Receipts already saved<br/>Loss prevented ✓
Client->>Summary: Handle error gracefully
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
state.jsonimmediately after install/update/uninstall plan execution, before shell-hook prompting and skill generation, preventing receipt loss when post-processing steps failpostInstallWorkflowto keeprunInstallwithin cyclomatic complexity limitsCloses #23
Test plan
TestEarlySavePreservesReceiptsOnShellHookFailure— broken stdin during shell-hook prompting does not lose install receiptsTestEarlySavePreservesReceiptsOnSkillOutputWriteFailure— failing stdout during skill generation does not lose update receiptsTestEarlySavePreservesRemovalsOnSkillOutputWriteFailure— failing stdout during skill generation does not lose uninstall removalsgolangci-lint runreports 0 issues🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests