fix(calendar): block auto bot fallback without user login#245
fix(calendar): block auto bot fallback without user login#245calendar-assistant merged 1 commit intomainfrom
Conversation
|
|
📝 WalkthroughWalkthroughAdds a pre-validation guard that rejects automatic bot fallback for calendar shortcuts by calling Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 adds Confidence Score: 5/5Safe to merge — the guard logic is correct for all identity resolution paths and all five shortcuts are covered with regression tests. No new P0 or P1 findings. The only open concerns are from prior threads (redundant No files require special attention beyond the previously flagged items in helpers.go and lark-calendar-agenda.md. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Calendar shortcut invoked] --> B{runtime.IsBot?}
B -- No --> Z[✅ Allow — user identity]
B -- Yes --> C{hasExplicitBotFlag\n--as bot on CLI?}
C -- Yes --> Z2[✅ Allow — intentional bot]
C -- No --> D{Factory.\nIdentityAutoDetected?}
D -- No --> Z3[✅ Allow — DefaultAs: bot\nor config-driven]
D -- Yes --> E[❌ Block — auto-fallback\nfrom missing user login]
E --> F[Return ErrWithHint:\nlark-cli auth login --domain calendar\nor rerun with --as bot]
Reviews (2): Last reviewed commit: "fix(calendar): block auto bot fallback w..." | Re-trigger Greptile |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3f848df12dd54e79de0bccde3384416e8c5276c0🧩 Skill updatenpx skills add larksuite/cli#fix/calendar-auto-bot-fallback -y -g |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
skills/lark-calendar/SKILL.md (1)
153-153: 建议优化语句以避免“的/得”歧义。当前“确保转换的绝对准确”表达略拗口,建议改为“确保转换结果绝对准确”或“确保转换得绝对准确”,可读性更高。
✍️ 建议文案修改
-- 涉及日期(时间)字符串与时间戳的相互转换时,务必调用系统命令或脚本代码等外部工具进行处理,以确保转换的绝对准确。违者将导致严重的逻辑错误! +- 涉及日期(时间)字符串与时间戳的相互转换时,务必调用系统命令或脚本代码等外部工具进行处理,以确保转换结果绝对准确。违者将导致严重的逻辑错误!🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-calendar/SKILL.md` at line 153, The sentence "涉及日期(时间)字符串与时间戳的相互转换时,务必调用系统命令或脚本代码等外部工具进行处理,以确保转换的绝对准确。违者将导致严重的逻辑错误!" is awkward; replace the phrase "确保转换的绝对准确" with a clearer form such as "确保转换结果绝对准确" (preferred) or "确保转换得绝对准确" to remove the 的/得 ambiguity and improve readability while keeping the rest of the warning intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/lark-calendar/references/lark-calendar-agenda.md`:
- Line 66: The implementation for the +agenda shortcut is emitting extra fields
(event_id, start, end, free_busy_status, self_rsvp_status) in
shortcuts/calendar/calendar_agenda.go (around the agenda formatting logic) while
the docs require output grouped by date and strictly sorted by start time,
showing only title and duration; fix by changing the agenda formatter to remove
those extra fields and only output title and duration per event, keep the
existing date-grouping and start-time ascending sort, and update any unit/test
expectations and the documentation string to reflect the chosen contract if you
instead decide to keep the extra fields.
---
Nitpick comments:
In `@skills/lark-calendar/SKILL.md`:
- Line 153: The sentence
"涉及日期(时间)字符串与时间戳的相互转换时,务必调用系统命令或脚本代码等外部工具进行处理,以确保转换的绝对准确。违者将导致严重的逻辑错误!" is
awkward; replace the phrase "确保转换的绝对准确" with a clearer form such as "确保转换结果绝对准确"
(preferred) or "确保转换得绝对准确" to remove the 的/得 ambiguity and improve readability
while keeping the rest of the warning intact.
🪄 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: 8f37ea59-80e1-4c60-8c0e-1e1b1523483d
📒 Files selected for processing (10)
shortcuts/calendar/calendar_agenda.goshortcuts/calendar/calendar_create.goshortcuts/calendar/calendar_freebusy.goshortcuts/calendar/calendar_rsvp.goshortcuts/calendar/calendar_suggestion.goshortcuts/calendar/calendar_test.goshortcuts/calendar/helpers.goskills/lark-calendar/SKILL.mdskills/lark-calendar/references/lark-calendar-agenda.mdskills/lark-calendar/references/lark-calendar-suggestion.md
Change-Id: If0e4c9fc99b465014de936a41d5e49fc6a414db4
53388c0 to
3f848df
Compare
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 `@skills/lark-calendar/SKILL.md`:
- Line 153: Edit the sentence that currently reads
“涉及日期(时间)字符串与时间戳的相互转换时,务必调用系统命令或脚本代码等外部工具进行处理,以确保转换的绝对准确。” and change
“以确保转换的绝对准确” to “以确保转换结果绝对准确” so the phrase is more natural and unambiguous;
update the exact line in SKILL.md where that sentence appears (search for the
original sentence text) and make only this wording tweak.
🪄 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: c470479f-4bba-44ea-a093-b6efc5339aa1
📒 Files selected for processing (10)
shortcuts/calendar/calendar_agenda.goshortcuts/calendar/calendar_create.goshortcuts/calendar/calendar_freebusy.goshortcuts/calendar/calendar_rsvp.goshortcuts/calendar/calendar_suggestion.goshortcuts/calendar/calendar_test.goshortcuts/calendar/helpers.goskills/lark-calendar/SKILL.mdskills/lark-calendar/references/lark-calendar-agenda.mdskills/lark-calendar/references/lark-calendar-suggestion.md
✅ Files skipped from review due to trivial changes (3)
- skills/lark-calendar/references/lark-calendar-suggestion.md
- skills/lark-calendar/references/lark-calendar-agenda.md
- shortcuts/calendar/calendar_create.go
🚧 Files skipped from review as they are similar to previous changes (4)
- shortcuts/calendar/calendar_rsvp.go
- shortcuts/calendar/calendar_freebusy.go
- shortcuts/calendar/helpers.go
- shortcuts/calendar/calendar_test.go
Summary
Prevent calendar shortcuts from silently operating on the bot calendar when user login is missing and identity auto-detection falls back to bot.
Changes
+agenda,+create,+freebusy,+rsvp, and+suggestionTest Plan
make unit-testgo mod tidy(no changes togo.modorgo.sum)go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/mainlark-cli calendar ...command works as expectedRelated Issues
Summary by CodeRabbit
Bug Fixes
--as bot; automatic bot fallback is blocked.Tests
Documentation