refactor: add usecase layer for param and secret operations#8
Merged
Conversation
* refactor: add usecase layer for staging operations Add usecase layer that returns structured data instead of formatting output. This is the foundation for supporting both CLI and future GUI (Wails) interfaces. New usecases: - StatusUseCase: returns StatusOutput with entries - ApplyUseCase: returns ApplyOutput with results and conflicts - AddUseCase: stages new items with structured input/output - EditUseCase: stages edits with structured input/output - DeleteUseCase: stages deletions with structured input/output - ResetUseCase: unstages or restores with structured output - DiffUseCase: compares staged vs AWS with structured diff entries The existing runners are not yet modified to use these usecases. That integration will be done in a subsequent PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: improve usecase staging layer - Move DeleteStrategy and VersionFetcher interfaces to staging package - Rename GetStagedValue to Draft, GetCurrentValue to Baseline - Fix apply order: check name filter before empty check - Add comprehensive tests (91.9% coverage) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- Define StoreReader, StoreWriter, StoreReadWriter interfaces in staging package - Update usecase layer to use interfaces instead of concrete *Store type - Add mock store implementation for testing error paths - Achieve 100% test coverage for usecase/staging package 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Add usecase layer for SSM Parameter Store operations that returns structured data instead of formatting output. New usecases: - ShowUseCase: returns ShowOutput with parameter metadata - ListUseCase: returns ListOutput with entries (optionally with values) - LogUseCase: returns LogOutput with version history - DiffUseCase: returns DiffOutput with comparison data - SetUseCase: creates/updates parameters with tagging support - DeleteUseCase: deletes parameters This is Step 3 of the usecase layer architecture refactoring plan. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for all param usecase operations with 100% coverage: - delete_test.go: DeleteUseCase tests - diff_test.go: DiffUseCase tests with version/shift support - list_test.go: ListUseCase tests with filters and pagination - log_test.go: LogUseCase tests with date filters - set_test.go: SetUseCase tests with tagging operations - show_test.go: ShowUseCase tests with version/shift support Key mock patterns: - Use fresh slice copies for GetParameterHistory to avoid in-place mutation issues with slices.Reverse - Support sequential GetParameter calls for multi-spec operations - Proper AWS SDK v2 variadic options signatures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create structured use cases for Secrets Manager operations: - show.go: Display secret value with metadata - list.go: List secrets with filtering and pagination - log.go: Show version history - diff.go: Compare secret versions - create.go: Create new secrets - update.go: Update existing secrets - delete.go: Delete secrets with recovery window - restore.go: Restore deleted secrets Each usecase provides structured input/output types for clean separation between CLI and business logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for all secret usecase operations with 100% coverage: - create_test.go: CreateUseCase tests - delete_test.go: DeleteUseCase tests with force and recovery window - diff_test.go: DiffUseCase tests with version/shift support - list_test.go: ListUseCase tests with filters - log_test.go: LogUseCase tests with date filters and sorting edge cases - restore_test.go: RestoreUseCase tests - show_test.go: ShowUseCase tests with version/label/shift support - update_test.go: UpdateUseCase tests with tagging operations Key test patterns: - Sequential mock calls for multi-spec operations - Sorting edge cases (nil dates, equal dates) - Date filtering with nil CreatedDate entries - Value fetch error handling (swallowed in log) 🤖 Generated with [Claude Code](https://claude.com/claude-code) 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
Supersedes #4 and #5.
Test Coverage
Test plan
make test)make lint)🤖 Generated with Claude Code