fix: improve error hints for sandbox and initialization issues#384
fix: improve error hints for sandbox and initialization issues#384JackZhao10086 merged 4 commits intomainfrom
Conversation
Clarify the error message for uninitialized keychain by combining both possible scenarios (sandbox/CI environment and normal usage) into a single hint to avoid confusion.
Add suggestion to try running outside sandbox when keychain access fails. Also update hint for uninitialized keychain case to include same suggestion.
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdjusted the troubleshooting hint text in the keychain error wrapper ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR updates two error hint strings in Confidence Score: 5/5Safe to merge — changes are limited to user-facing hint strings with no logic impact. No new logic, security, or correctness issues introduced. The only open items (comma splice and missing backticks around No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[keychain op: Get / Set / Remove] --> B{err == nil or ErrNotFound?}
B -- yes --> C[return err as-is]
B -- no --> D{errors.Is errNotInitialized?}
D -- yes --> E["hint: master key missing\n+ sandbox/CI advice\n+ suggest lark-cli config init"]
D -- no --> F["hint: keychain locked/inaccessible\n+ sandbox/CI advice"]
E --> G[output.ErrWithHint → ExitAPI]
F --> G
Reviews (3): Last reviewed commit: "docs(keychain): fix typo in error messag..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/keychain/keychain.go`:
- Around line 39-42: The two hint string assignments (the default hint and the
one inside the errors.Is(err, errNotInitialized) branch) contain comma splices
and inconsistent capitalization; update those literal strings (the variable hint
and the branch where errors.Is(err, errNotInitialized) sets hint) to use
grammatically correct sentences, remove comma splices, fix capitalization (e.g.,
"you" not "You" after commas), and standardize punctuation and phrasing so each
hint reads as clear, separate sentences (mention checking sandbox/CI permissions
and, in the not-initialized case, instruct to reconfigure with "lark-cli config
init" as a separate sentence).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3fab4d05-f800-45ba-89b3-2d18700e8ffd
📒 Files selected for processing (1)
internal/keychain/keychain.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@f4ad03517e3da5d024bab1747c5337a1c971a433🧩 Skill updatenpx skills add larksuite/cli#feat/tweak_keychain_sandbox_prompt -y -g |
Summary
Improve keychain-related error hints to make common failure scenarios easier to diagnose.
This update clarifies what users should do when keychain access fails in sandbox or CI environments, and when the keychain has not been initialized properly.
Changes
lark-cli config initTest Plan
larkcommands work locallyRelated Issues
Summary by CodeRabbit