feat: add attendance user_task.query#405
Conversation
|
chengyiming seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📝 WalkthroughWalkthroughAdded a new skill specification Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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 unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms Comment |
Greptile SummaryThis PR introduces a new
Confidence Score: 2/5Not safe to merge — three P1 issues mean every invocation of this skill will fail at runtime with no useful results. Two P1s from prior review rounds (empty user_ids, missing identity type) remain unaddressed, and a third P1 (missing required date-range parameters) was found in this round. All three will cause the API call to fail or silently return empty data. skills/lark-attendance/SKILL.md — requires fixes to user_ids resolution, --as user identity guidance, and date-range parameter documentation before this skill is functional. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Agent
participant LarkShared as lark-shared/SKILL.md
participant LarkCLI as lark-cli
participant LarkAPI as attendance/v1/user_tasks/query
User->>Agent: "查询我的考勤打卡记录"
Agent->>LarkShared: Read (auth / identity rules)
Note over Agent: ❌ Missing: resolve current user's employee_no
Note over Agent: ❌ Missing: ensure --as user identity
Note over Agent: ❌ Missing: collect check_date_from / check_date_to
Agent->>LarkCLI: lark-cli schema attendance.user_tasks.query
LarkCLI-->>Agent: schema (employee_type, user_ids, check_date_from, check_date_to)
Agent->>LarkAPI: POST user_ids=[] employee_type="employee_no" (no dates, no real user ID)
LarkAPI-->>Agent: ❌ Validation error or empty result set
Agent-->>User: No attendance records found
Reviews (2): Last reviewed commit: "feat: add attendance user_task.query" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
skills/lark-attendance/SKILL.md (1)
48-56: Consider documenting additional attendance API methods if they exist in the Feishu API.The skill currently exposes only
user_tasks.querywith read-only permissions. Verify against the Feishu API documentation whether other attendance operations (e.g., creating attendance records, retrieving configurations, etc.) exist and should be included. The codebase search found no evidence of other exposed methods, suggesting the minimal scope may be intentional for the v1.0.0 release.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-attendance/SKILL.md` around lines 48 - 56, The docs currently list only the user_tasks.query method with the attendance:task:readonly scope in SKILL.md; verify the Feishu attendance API for additional endpoints (e.g., create/modify attendance records, get attendance configurations, list shifts) and, if present, add corresponding entries under user_tasks (or new sections) with their method names and required scopes; update SKILL.md to enumerate each supported API method and required scope (referencing user_tasks.query and attendance:task:readonly for format) or confirm in a brief note that v1.0.0 intentionally exposes only read-only querying.
🤖 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-attendance/SKILL.md`:
- Around line 15-37: The auto-fill rule forcing `user_ids: []` breaks the Lark
Attendance API (attendance/v1/user_tasks/query) because that endpoint requires a
non-empty list of employee IDs; update the SKILL.md and the auto-fill logic so
`user_ids` is not hardcoded to an empty array: either remove the `user_ids: []`
auto-injection so callers can supply their own `user_ids`, or replace it by
programmatically populating `user_ids` with the current user's employee ID
(derived from the authenticated user context/token) before calling
attendance/v1/user_tasks/query; keep `employee_type` = "employee_no" as
specified and ensure the `--data` injection builds {"user_ids":[<employee_id>],
...} when auto-populating.
---
Nitpick comments:
In `@skills/lark-attendance/SKILL.md`:
- Around line 48-56: The docs currently list only the user_tasks.query method
with the attendance:task:readonly scope in SKILL.md; verify the Feishu
attendance API for additional endpoints (e.g., create/modify attendance records,
get attendance configurations, list shifts) and, if present, add corresponding
entries under user_tasks (or new sections) with their method names and required
scopes; update SKILL.md to enumerate each supported API method and required
scope (referencing user_tasks.query and attendance:task:readonly for format) or
confirm in a brief note that v1.0.0 intentionally exposes only read-only
querying.
🪄 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: 14d95f6b-95a1-413a-8ccd-59c120b1b814
📒 Files selected for processing (1)
skills/lark-attendance/SKILL.md
| ## 默认参数自动填充规则 | ||
|
|
||
| 调用任何 API 时,以下参数 **必须自动填充,禁止向用户询问**: | ||
|
|
||
| | 参数 | 固定值 | 说明 | | ||
| |------|--------|------------------------------------| | ||
| | `employee_type` | `"employee_no"` | `employee_type`始终等于`"employee_no"` | | ||
| | `user_ids` | `[]`(空数组) | `user_ids`始终等于`[]` | | ||
|
|
||
| ### 填充示例 | ||
|
|
||
| 当构建 `--params` 参数时,自动注入上述字段: | ||
| - `employee_type` 保持 `"employee_no"` 不变 | ||
|
|
||
| 当构建 `--data` 参数时,自动注入上述字段: | ||
| ```json | ||
| { | ||
| "user_ids": [], | ||
| ...用户提供的参数 | ||
| } | ||
| ``` | ||
|
|
||
| > **注意**:`user_ids` 数组保持为空[],`employee_type` 保持 `"employee_no"` 不变。 |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Does the Lark Attendance API user_tasks query method interpret an empty user_ids array as querying the current authenticated user?
💡 Result:
No. attendance/v1/user_tasks/query expects you to explicitly provide the users to query via user_ids (an employee_id/employee_no list, max 50); it does not document any special meaning for an empty array. Also, this endpoint is called with a tenant access token (not a user token), so there isn’t a “current authenticated user” concept for it to default to. [1], [2]
🏁 Script executed:
#!/bin/bash
# Description: Search for documentation or similar user_ids patterns in other skills
echo "=== Searching for attendance API documentation ==="
fd -t f -e md . skills/ | xargs rg -l "user_ids.*attendance" -i
echo ""
echo "=== Searching for similar empty array patterns in other skills ==="
rg -A2 -B2 'user_ids.*\[\]' skills/
echo ""
echo "=== Searching for lark-shared documentation that might explain this ==="
if [ -f "skills/lark-shared/SKILL.md" ]; then
rg -C3 "user_ids|employee_type" skills/lark-shared/SKILL.md
fiRepository: larksuite/cli
Length of output: 1071
Critical bug: user_ids: [] breaks the Lark Attendance API call.
The auto-fill rules mandate user_ids must always be an empty array [], but the Lark Attendance API attendance/v1/user_tasks/query endpoint explicitly requires user_ids to be a non-empty list of employee IDs (max 50). The API does not document any special behavior for empty arrays and will return no results when user_ids is empty.
Since this skill's purpose is to query "one's own attendance records" (自己的考勤打卡记录), the auto-fill rules are incorrect. Either:
- Remove the hardcoded empty array and allow the user to specify their employee ID in
user_ids, or - Obtain the current user's employee ID and populate
user_idswith that value instead of leaving it empty.
Fix the auto-fill logic before this skill can function correctly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/lark-attendance/SKILL.md` around lines 15 - 37, The auto-fill rule
forcing `user_ids: []` breaks the Lark Attendance API
(attendance/v1/user_tasks/query) because that endpoint requires a non-empty list
of employee IDs; update the SKILL.md and the auto-fill logic so `user_ids` is
not hardcoded to an empty array: either remove the `user_ids: []` auto-injection
so callers can supply their own `user_ids`, or replace it by programmatically
populating `user_ids` with the current user's employee ID (derived from the
authenticated user context/token) before calling attendance/v1/user_tasks/query;
keep `employee_type` = "employee_no" as specified and ensure the `--data`
injection builds {"user_ids":[<employee_id>], ...} when auto-populating.
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@63c65b9bf4200f7558685bae6c1f71a96adcba80🧩 Skill updatenpx skills add chengyiming/cli#fix/leave_attendance_cli -y -g |
Change-Id: Ie34b9b98859942ff368a9808fc2efab4d2bf27fa
63c65b9 to
62f79a9
Compare
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
Change-Id: I0c99b2178dd874f2a9f0e30ed8145b888c3a9965
Summary
Add a new Lark attendance skill (
lark-attendance) that enables querying user clock-in/attendance records vialark-cli. This skill provides theuser_tasks.queryAPI with built-in default parameter auto-fill rules to simplify usage.Changes
lark-attendance/SKILL.mdemployee_typeis always set to"employee_no"(in--params)user_idsis always set to[](in--data)user_tasks.queryattendance:task:readonlyscope../lark-shared/SKILL.md)Test Plan
lark-cli schema attendance.user_tasks.queryand verify the parameter structure is returned correctlylark-cli attendance user_tasks querywithemployee_type="employee_no"anduser_ids=[], verify it returns the current user's attendance records../lark-shared/SKILL.mdreference path resolves correctlyattendance:task:readonlypermissionRelated Issues
Summary by CodeRabbit
lark-attendanceskill for querying user attendance and clock-in records through thelark-clitool.SKILL.mdwith complete API usage instructions, including default parameter auto-fill rules (employee_type="employee_no",user_ids=[]), API resource reference (user_tasks.query), and required permission scope (attendance:task:readonly).