Skip to content

fix(skills): align skill guidance with the typed error contract#1786

Open
evandance wants to merge 1 commit into
mainfrom
fix/skills-typed-error-contract
Open

fix(skills): align skill guidance with the typed error contract#1786
evandance wants to merge 1 commit into
mainfrom
fix/skills-typed-error-contract

Conversation

@evandance

@evandance evandance commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Align skill/reference guidance with the current typed error contract so agents do not follow retired raw OpenAPI or legacy envelope shapes. This is a docs-only fix scoped to error-contract corrections; sections that document upstream API responses are left unchanged.

Changes

  • Updated permission, confirmation, duplicate-remote, and partial-failure guidance to match typed envelopes (missing_scopes, type=confirmation / subtype=confirmation_required with flat risk / action, typed validation envelopes with params[], and stdout ok:false partial results).
  • Replaced retired {code,msg} success-envelope examples in Slides docs with the ok / identity / data envelope the CLI actually emits.
  • Updated Minutes recovery guidance to branch on error.subtype instead of retired error.type values.
  • Clarified Slides replace failures: typed stderr envelope and non-zero exit, with no raw backend response printed to stdout.

Test Plan

  • go test ./... passes locally on the PR head.
  • node scripts/skill-format-check/index.js
  • bash scripts/check-skill-wire-vocab.sh
  • All json fences in changed Markdown files parse as JSON.
  • Added-line scans for retired envelope terms and sensitive material; no problematic additions found.
  • Confirmation envelope wire shape (type=confirmation, subtype=confirmation_required, flat risk / action) matches the pins in errs/marshal_test.go.

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes
    • Clarified several CLI error and success response formats so command output is easier to interpret across drive, minutes, slides, and lark shared workflows.
    • Updated permission-related guidance and missing-scope handling to reflect the latest error fields.
    • Improved documentation for duplicate path conflicts and partial failures, including where results appear and when commands exit with a non-zero status.

@github-actions github-actions Bot added domain/base PR touches the base domain domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths labels Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates documentation across multiple lark-cli skill reference files to align with a revised CLI error/response contract: permission_violations is renamed to missing_scopes, success responses use ok/identity instead of code/msg, Drive duplicate-path conflicts become typed validation/failed_precondition errors, partial failures use ok:false stdout envelopes, and Minutes/confirmation error checks switch to error.subtype/typed fields.

Changes

CLI documentation contract alignment

Layer / File(s) Summary
Missing-scope field rename
skills/lark-apps/references/lark-apps-openapi-key.md, skills/lark-base/SKILL.md, skills/lark-shared/SKILL.md (line 72), skills/lark-vc-agent/SKILL.md
Replaces permission_violations with missing_scopes across permission/fallback guidance.
Shared confirmation envelope
skills/lark-shared/SKILL.md (lines 181-196)
Updates the exit-10 confirmation example to the new schema: error.type/subtype, string error.risk, top-level error.action, and identity: "bot".
Minutes error subtype matching
skills/lark-minutes/SKILL.md, skills/lark-minutes/references/lark-minutes-todo.md
Switches permission-denial and no-match detection from error.type to error.subtype/error.missing_scopes.
Slides success and failure envelopes
skills/lark-slides/references/examples.md, lark-slides-screenshot.md, lark-slides-xml-presentation-slide-create.md, -delete.md, -get.md, -replace.md, lark-slides-xml-presentations-get.md
Switches success responses from code/msg to ok/identity; slide replace documents typed stderr failures replacing removed data.failed_part_index/data.failed_reason fields.
Drive partial-failure and duplicate conflicts
skills/lark-drive/references/lark-drive-member-add.md, lark-drive-pull.md, lark-drive-push.md, lark-drive-status.md, tests/cli_e2e/drive/coverage.md
Changes partial-failure reporting to ok:false stdout envelopes and reclassifies duplicate rel_path conflicts as validation/failed_precondition errors with error.params[].

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • larksuite/cli#505: Updates the same skills/lark-base/SKILL.md permission-degradation guidance tied to identity/scope error fields.
  • larksuite/cli#824: Introduces lark-vc-agent guidance referencing the same missing required scope(s)/permission_violations matching logic.
  • larksuite/cli#1598: Modifies skills/lark-shared/SKILL.md around the same missing-scope/auth JSON contract.

Suggested reviewers: liangshuo-1, wittam-01, syh-cpdsss, zhaoleibd

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: aligning skill guidance with the typed error contract.
Description check ✅ Passed The PR description matches the template with Summary, Changes, Test Plan, and Related Issues sections filled in.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/skills-typed-error-contract

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@evandance evandance force-pushed the fix/skills-typed-error-contract branch from e20db5a to d4472a1 Compare July 7, 2026 13:46
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@a3faf36809c6dba6564f34f16bdc893d383e3ada

🧩 Skill update

npx skills add larksuite/cli#fix/skills-typed-error-contract -y -g

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.44%. Comparing base (c04da47) to head (a3faf36).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1786   +/-   ##
=======================================
  Coverage   74.44%   74.44%           
=======================================
  Files         860      860           
  Lines       89855    89859    +4     
=======================================
+ Hits        66891    66897    +6     
+ Misses      17780    17778    -2     
  Partials     5184     5184           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md`:
- Around line 159-164: The response-field table is missing the documented
error.message field, so update the table in the slide-replace reference to
include a row for error.message alongside error.code, error.subtype, and
error.hint. Keep the wording consistent with the existing typed-envelope
contract and failure example so the schema docs stay aligned.
🪄 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: 0e0e70c4-7858-464a-b5c7-38c68dd4dcd2

📥 Commits

Reviewing files that changed from the base of the PR and between f495cbb and d4472a1.

📒 Files selected for processing (20)
  • skills/lark-apps/references/lark-apps-openapi-key.md
  • skills/lark-base/SKILL.md
  • skills/lark-base/references/lark-base-dashboard-block-get-data.md
  • skills/lark-base/references/lark-base-data-query.md
  • skills/lark-drive/references/lark-drive-member-add.md
  • skills/lark-drive/references/lark-drive-pull.md
  • skills/lark-drive/references/lark-drive-push.md
  • skills/lark-drive/references/lark-drive-status.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-todo.md
  • skills/lark-shared/SKILL.md
  • skills/lark-slides/references/examples.md
  • skills/lark-slides/references/lark-slides-screenshot.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md
  • skills/lark-slides/references/lark-slides-xml-presentations-get.md
  • skills/lark-vc-agent/SKILL.md
  • tests/cli_e2e/drive/coverage.md

Comment thread skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md Outdated
@evandance evandance force-pushed the fix/skills-typed-error-contract branch 2 times, most recently from c5e73f9 to b28b848 Compare July 9, 2026 03:27
Skill references written before the typed-error refactor still taught retired envelope shapes. AI agents following them now read what the CLI actually emits:

- permission recovery reads error.missing_scopes instead of the upstream permission_violations detail
- confirmation gates use type=confirmation, subtype=confirmation_required, and flat risk/action fields
- drive duplicate-remote failures are typed validation envelopes (failed_precondition with params[]), not duplicate_remote_path with error.detail
- drive batch partial failures are ok:false results on stdout, not an error.type=partial_failure stderr envelope
- minutes edit-permission and word-replace misses branch on error.subtype, not retired error.type values
- slides replace failures are stderr typed envelopes only; no raw backend response is printed to stdout
- slides command outputs show the ok/identity/data success envelope instead of the raw {code,msg} OpenAPI wrapper
@evandance evandance force-pushed the fix/skills-typed-error-contract branch from b28b848 to a3faf36 Compare July 9, 2026 11:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@skills/lark-vc-agent/SKILL.md`:
- Line 21: The scope-error handling in the skill guide is conflating `missing
required scope(s)` / `missing_scopes` with the graylist path. Update the
guidance near the `lark-cli` error handling so `missing_scopes` goes directly to
the “应用身份权限配置检查” flow for app permissions, installation, and data scope, and
keep the early-bird group step reserved only for the graylist case
(`ErrNotInGray` / `20017`).
🪄 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: f310e04d-0766-4fb6-b966-062725b97e0b

📥 Commits

Reviewing files that changed from the base of the PR and between b28b848 and a3faf36.

📒 Files selected for processing (18)
  • skills/lark-apps/references/lark-apps-openapi-key.md
  • skills/lark-base/SKILL.md
  • skills/lark-drive/references/lark-drive-member-add.md
  • skills/lark-drive/references/lark-drive-pull.md
  • skills/lark-drive/references/lark-drive-push.md
  • skills/lark-drive/references/lark-drive-status.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-minutes/references/lark-minutes-todo.md
  • skills/lark-shared/SKILL.md
  • skills/lark-slides/references/examples.md
  • skills/lark-slides/references/lark-slides-screenshot.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md
  • skills/lark-slides/references/lark-slides-xml-presentations-get.md
  • skills/lark-vc-agent/SKILL.md
  • tests/cli_e2e/drive/coverage.md
✅ Files skipped from review due to trivial changes (12)
  • skills/lark-apps/references/lark-apps-openapi-key.md
  • skills/lark-base/SKILL.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md
  • tests/cli_e2e/drive/coverage.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md
  • skills/lark-minutes/references/lark-minutes-todo.md
  • skills/lark-slides/references/lark-slides-xml-presentations-get.md
  • skills/lark-drive/references/lark-drive-push.md
  • skills/lark-slides/references/lark-slides-screenshot.md
  • skills/lark-drive/references/lark-drive-member-add.md
  • skills/lark-slides/references/examples.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • skills/lark-drive/references/lark-drive-pull.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md
  • skills/lark-shared/SKILL.md
  • skills/lark-drive/references/lark-drive-status.md

Comment thread skills/lark-vc-agent/SKILL.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant