fix(staging): avoid unnecessary daemon start and AWS fetch in edit/add commands#123
Merged
fix(staging): avoid unnecessary daemon start and AWS fetch in edit/add commands#123
Conversation
…d commands ## Problem When editing or adding staged parameters, the edit command would auto-start the daemon and make unnecessary AWS requests even when nothing was staged. This was caused by GetEntry calls that auto-start the daemon. ## Solution Implement "Ping-first" pattern in EditUseCase and AddUseCase: - Check Pinger interface before accessing staged state - If daemon not running (Ping fails), skip staged check and proceed to AWS - If daemon running, check staged state first ## Changes - Move Pinger/Starter interfaces from lifecycle package to store layer - Update AgentStore to embed Pinger/Starter interfaces - Update lifecycle executors to use store.Pinger/store.Starter - Implement Ping-first pattern in EditUseCase.Baseline() and Execute() - Implement Ping-first pattern in AddUseCase.Draft() - Add comprehensive unit tests for all Ping-first cases - Update CLAUDE.md documentation for affected packages ## Test Coverage usecase/staging package: 97.9% (up from 85% target) Fixes #122 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #123 +/- ##
==========================================
+ Coverage 90.29% 90.35% +0.05%
==========================================
Files 132 132
Lines 7701 7745 +44
==========================================
+ Hits 6954 6998 +44
Misses 503 503
Partials 244 244
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add missing test coverage for the Ping-first pattern: - Non-Pinger store behavior (FileStore simulation) - GetEntry error propagation when Ping succeeds - Edge case: Ping fails but staged entry exists - Fix lint issues (wsl_v5, nilerr) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing tests for Non-Pinger store (FileStore simulation): - Execute/Baseline/Draft with ErrNotStaged - Execute/Baseline/Draft with GetEntry error propagation This completes the Ping-first pattern test matrix covering: - Pinger + Ping success/fail combinations - Non-Pinger + all GetEntry result patterns Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for additional edge cases: - UnstageEntry error during auto-unstage (revert to AWS value) - Ping failure with staged CREATE (resource not found on AWS) These tests ensure proper error propagation in unusual scenarios. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EditUseCaseandAddUseCaseto avoid unnecessary daemon auto-start and AWS requestsPinger/Starterinterfaces from lifecycle package to store layer for correct dependency directionAgentStoreinterface to embedPinger/StarterProblem
When editing or adding staged parameters, the edit command would auto-start the daemon and make unnecessary AWS requests even when nothing was staged. This was caused by
GetEntrycalls that auto-start the daemon.Solution
Check if daemon is running (via
Pinger.Ping()) before accessing staged state:This pattern is applied to:
EditUseCase.Baseline()- Returns AWS value if daemon not runningEditUseCase.Execute()- Skips staged check if daemon not runningAddUseCase.Draft()- Returns "not staged" if daemon not runningTest plan
usecase/stagingat 97.9%go build ./...succeedsgo test ./...passesFixes #122
🤖 Generated with Claude Code