fix(config): allow lark-channel bind source override#1154
Conversation
Change-Id: I406ea13e372e6bdd5f3d9d6210b04ebdf0354182
📝 WalkthroughWalkthroughThis PR extends ChangesLark Channel Config Path Override
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/config/binder.go`:
- Around line 395-397: The code currently returns expandHome(p) for the
environment override LARK_CHANNEL_CONFIG without validating the resulting path;
before calling binding.ReadLarkChannelConfig(...) validate the resolved override
by passing the expanded path through validate.SafeInputPath (or equivalent) and
handle validation errors (log/return) so untrusted env values are rejected;
update the branch that reads os.Getenv("LARK_CHANNEL_CONFIG") and the value
produced by expandHome to be validated via validate.SafeInputPath prior to any
file reads.
🪄 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: 027a306c-860d-4386-871b-8308dd78b627
📒 Files selected for processing (2)
cmd/config/binder.gocmd/config/binder_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1154 +/- ##
==========================================
+ Coverage 68.61% 68.64% +0.02%
==========================================
Files 625 625
Lines 58348 58391 +43
==========================================
+ Hits 40035 40081 +46
+ Misses 15029 15023 -6
- Partials 3284 3287 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@c4c9494075249f081caf7b5ac32dfebe90bb0645🧩 Skill updatenpx skills add larksuite/cli#feat/channel_profile -y -g |
Summary
Allow
lark-cli config bind --source lark-channelto read the lark-channel source config fromLARK_CHANNEL_CONFIGwhen provided, while keeping the existing~/.lark-channel/config.jsondefault unchanged.Changes
LARK_CHANNEL_CONFIGsupport to lark-channel bind source path resolution.~expansion.Test Plan
go test ./cmd/config ./internal/bindingmake buildgit diff --checkRelated Issues
Summary by CodeRabbit
New Features
LARK_CHANNEL_CONFIGenvironment variable with tilde expansion support.Tests