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 across Lark skill docs and related drive coverage notes.

Changes

  • Updated permission, confirmation, duplicate-remote, and partial-failure guidance to match typed envelopes (missing_scopes, type=confirmation, subtype=confirmation_required, flat risk / action, and stdout ok:false partial results).
  • Replaced raw {code,msg} / backend-response examples in Base and Slides docs with the CLI success/error envelopes that agents actually see.
  • Updated Minutes recovery guidance to branch on stable error.code / error.subtype instead of human message text.
  • Clarified Slides replace failure behavior: typed stderr envelope and exit code, with no raw backend response printed to stdout.

Test Plan

  • Unit tests pass
    • Not run locally: installed Go is 1.20.14 and the module requires Go 1.23.0; this PR changes docs/skill references only.
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected
    • LARKSUITE_CLI_NO_UPDATE_NOTIFIER=1 LARKSUITE_CLI_NO_SKILLS_NOTIFIER=1 lark-cli drive +delete --file-token file_token_test --type file --as bot exits 10 and emits a typed confirmation envelope with type=confirmation, subtype=confirmation_required, flat risk, and action.
  • git diff --check origin/main...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.
  • Changed skill Markdown token scan using scripts/check-doc-tokens.sh regex; no realistic token additions found.

Related Issues

  • None

Summary by CodeRabbit

  • Documentation
    • Updated command/skill guides to use the latest CLI JSON envelopes: ok/identity for success and consistent data/error structures for failures.
    • Revised permission and missing-scope guidance to match the new missing_scopes/scope error fields and improved recovery instructions.
    • Clarified Drive workflow failure semantics (stdout-only failure envelopes, non-zero exits, and typed validation for duplicate rel_path conflicts), plus slide and minutes command examples.

@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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ae86ec88-1f49-4cb5-b845-da1eca837f68

📥 Commits

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

📒 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
✅ Files skipped from review due to trivial changes (13)
  • skills/lark-drive/references/lark-drive-member-add.md
  • skills/lark-slides/references/lark-slides-screenshot.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-get.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-slides/references/lark-slides-xml-presentation-slide-create.md
  • skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md
  • tests/cli_e2e/drive/coverage.md
  • skills/lark-base/references/lark-base-dashboard-block-get-data.md
  • skills/lark-base/SKILL.md
  • skills/lark-slides/references/examples.md
  • skills/lark-shared/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • skills/lark-apps/references/lark-apps-openapi-key.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-drive/references/lark-drive-push.md
  • skills/lark-drive/references/lark-drive-pull.md
  • skills/lark-drive/references/lark-drive-status.md
  • skills/lark-base/references/lark-base-data-query.md

📝 Walkthrough

Walkthrough

Documentation across multiple skill references and one test coverage file is updated to align with revised CLI response envelopes and error-field naming, including missing_scopes, ok/identity success payloads, typed validation failures, and updated partial-failure handling.

Changes

CLI docs alignment with new response/error contract

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, skills/lark-vc-agent/SKILL.md
References to permission_violations are renamed to missing_scopes in permission and fallback guidance.
Shared confirmation envelope
skills/lark-shared/SKILL.md
Exit-10 confirmation examples and detection steps are updated to the new confirmation schema with flattened risk and action fields.
Base and Minutes response-field docs
skills/lark-base/references/lark-base-dashboard-block-get-data.md, skills/lark-base/references/lark-base-data-query.md, skills/lark-minutes/SKILL.md, skills/lark-minutes/references/lark-minutes-todo.md
Base docs move from code/msg to ok/identity envelopes and revise query error fields; Minutes docs switch permission and no-match matching to stable error.code, error.subtype, and error.missing_scopes fields.
Slides success and failure envelopes
skills/lark-slides/references/*
Slides examples and reference docs switch success responses from code/msg to ok/identity, and slide replace now documents typed stderr failures instead of the removed failed-part fields.
Drive partial-failure and duplicate conflicts
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, tests/cli_e2e/drive/coverage.md
Drive docs change partial-failure reporting to ok:false output, reclassify duplicate rel_path conflicts as validation/failed_precondition errors, and update the drive workflow coverage note.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • larksuite/cli#374: Both PRs modify skills/lark-base/SKILL.md in the permission/error recovery guidance.
  • larksuite/cli#1598: Both PRs update skills/lark-shared/SKILL.md around missing-scope field naming and handling.
  • larksuite/cli#1730: Both PRs align documented CLI success and failure envelopes around ok and typed error fields.

Suggested labels: documentation, size/XL

Suggested reviewers: liangshuo-1, fangshuyu-768, caojie0621

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the PR’s main change: aligning skill guidance with the typed error contract.
Description check ✅ Passed The description follows the template well, covering summary, changes, test plan, and related issues.
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.
✨ Finishing Touches
🧪 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@c5e73f99eaab20721d0c3b30a11f98c32f05e8a2

🧩 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.42%. Comparing base (9413e7c) to head (c5e73f9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1786   +/-   ##
=======================================
  Coverage   74.42%   74.42%           
=======================================
  Files         860      860           
  Lines       89754    89754           
=======================================
  Hits        66797    66797           
  Misses      17779    17779           
  Partials     5178     5178           

☔ 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

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Quality Summary

CI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun.

Failed checks

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 stable error.code/error.subtype, not message text
- slides replace failures are stderr typed envelopes only; no raw backend response is printed to stdout
- slides and Base 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 d4472a1 to c5e73f9 Compare July 8, 2026 09:44
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