fix: restore CLI flag wording in shared validation errors#65
Merged
Conversation
The list, review, comment, and create CLI paths previously surfaced flag-aware messages such as "--repo and --pr-id flags" and "--region flag" before their pipelines were extracted to internal/app. After the extraction, the CLI inherited generic wording from the shared use cases, which is appropriate for MCP callers but a small UX regression for CLI users. Introduce two sentinel errors in internal/app -- ErrMissingPRRef and ErrMissingRegion -- and have the CLI translate them at the boundary via translateAppError. The shared use cases now return surface- neutral messages, the MCP server keeps that wording, and the CLI restores the original flag-aware messages.
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
internal/app—ErrMissingPRRef(no PR URL or repo + prId) andErrMissingRegion— and have the affected use cases (list,review,comment,create) return them instead of formatted strings.cmd/ccpr/errors.gowith atranslateAppErrorhelper that converts those sentinels to the original CLI flag-aware messages (provide a PR URL or --repo and --pr-id flags,region is required: use --region flag, ...). Each CLI command wraps the use-case call so its returned errors pass through the translator.internal/app/list.gopreviously returned the CLI-flavored--repo is required for list commandeven though the CLI pre-checks--repoitself. The use case now returns a neutralrepo is required; the CLI's pre-check is unchanged so end-user wording is unaffected.internal/app/{review,comment}_test.gouseerrors.Isagainst the new sentinels for robustness, andcmd/ccpr/errors_test.gocovers the translator (matched cases, passthrough, nil).Verification
CLI:
MCP (same condition, via JSON-RPC tools/call):
Type of change
fix:)feat:)docs:)refactor:/chore:)test:)Test plan
make build/make build-mcp/make test/make vet/make lintall passErrMissingPRRefandErrMissingRegionSpec-driven checklist
docs/use-cases.md,docs/requirements.md,docs/spec.mdupdated before code (or N/A for non-feature changes) — N/A; spec already describes errors abstractly without pinning string content.docs/versioning.md); only CLI/MCP error message wording changes, no JSON payload schema changes.Related issues
Closes #63.