Skip to content

feat: split note domain#1418

Closed
Ren1104 wants to merge 2 commits into
mainfrom
codex/reapply-note-domain-split
Closed

feat: split note domain#1418
Ren1104 wants to merge 2 commits into
mainfrom
codex/reapply-note-domain-split

Conversation

@Ren1104

@Ren1104 Ren1104 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reintroduce the Note domain split after #1417 consolidated the logic back into vc. This restores note +detail and note +transcript as the canonical known-note_id entry points while keeping vc +notes responsible for locating notes from meeting context.

Changes

  • Add shortcuts/note with note +detail and note +transcript, including unified transcript pagination, cursor-cycle protection, typed errors, and dry-run E2E coverage.
  • Update vc +notes to delegate note-detail parsing to the note domain and surface note_id / note_display_type for downstream routing.
  • Restore auth/login metadata, typed-error lint coverage, and lark skill routing docs for lark-note, lark-vc, lark-minutes, and the vc-transcribe-tab doc boundary.

Test Plan

  • Unit tests pass: go test ./shortcuts/note ./shortcuts/vc ./cmd/auth ./tests/cli_e2e/note
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected: git diff --cached --check before commit and dry-run E2E coverage for note +detail / note +transcript

Related Issues

Summary by CodeRabbit

  • New Features

    • Added note domain: detail and transcript commands; CLI surfaces note_id and note_display_type and can fetch unified transcripts (with safe default output path, overwrite protection, pagination and empty/loop detection).
    • Note shortcuts registered and discoverable in the CLI.
  • Behavior

    • Note read-permission errors are mapped to clearer permission-denied messages/hints; vc notes routing now defers to note detail mapping.
  • Documentation

    • New/updated skill and reference docs describing routing, display types, and transcript rules.
  • Tests

    • Added unit tests and CLI dry-run tests for parsing, transcript fetching, error mapping, and integration.

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

coderabbitai Bot commented Jun 11, 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: f93ce8ca-2db9-48dd-9409-1d9df5953211

📥 Commits

Reviewing files that changed from the base of the PR and between 24a9f1e and 417bf4c.

📒 Files selected for processing (3)
  • shortcuts/note/note_transcript.go
  • shortcuts/note/note_transcript_test.go
  • skills/lark-vc/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/lark-vc/SKILL.md

📝 Walkthrough

Walkthrough

Adds a new note shortcut domain with two commands (note +detail, note +transcript), delegates VC note-detail parsing to the shared note package, updates auth/registry/lint/tests, and revises cross-skill routing/docs to use note_display_type and vc-node-id→note_id rules.

Changes

Note Domain Feature & Integration

Layer / File(s) Summary
Auth, Registry, and Lint Infrastructure
cmd/auth/login_messages.go, cmd/auth/login_test.go, internal/registry/service_descriptions.json, lint/errscontract/rule_no_legacy_common_helper_call.go, lint/errscontract/rule_no_legacy_envelope_literal.go, lint/errscontract/rules_test.go
note is added to shortcut-only auth domains and service descriptions; lint migrated-path lists and tests updated to include shortcuts/im/ and cross-validate migrated envelope/common-helper path coverage.
Core Note Fetching and Parsing API
shortcuts/note/note.go, shortcuts/note/note_test.go
Introduces Detail, FetchDetail(), display-type decoding, artifact/doc token extraction, loose-number and cursor parsing helpers, and unit tests covering parsing, mapping, and error normalization.
Note Detail Shortcut Command
shortcuts/note/note_detail.go
note +detail validates --note-id, performs dry-run plan, executes FetchDetail, emits {"note": detail.ToMap()}, and maps specific permission errors to standardized PermissionError with hint.
Note Transcript Shortcut Command
shortcuts/note/note_transcript.go, shortcuts/note/note_transcript_test.go
note +transcript validates inputs, ensures the note is unified, fetches unified transcript via cursor-based pagination with loop detection/throttling and page limits, enforces file overwrite semantics, writes .md/.txt output, and emits structured JSON output; tests cover success and multiple failure modes.
Shortcut Aggregation and Registration
shortcuts/note/shortcuts.go, shortcuts/register.go
Adds Shortcuts() and registers note shortcuts into the global allShortcuts during init so commands are discoverable.
VC Domain Refactoring and Integration
shortcuts/vc/vc_notes.go, shortcuts/vc/vc_notes_test.go
vc +notes delegates note-detail retrieval to note.FetchDetail().ToMap(), removes duplicated parsing/constants, treats note_id as a payload key for success detection, adjusts calendar merge logic to require note_id, and exposes note_id/note_display_type in outputs; tests and stubs updated accordingly.
Skills Specification and Cross-Domain Documentation
skills/lark-note/SKILL.md, skills/lark-note/references/*, skills/lark-doc/SKILL.md, skills/lark-minutes/SKILL.md, skills/lark-vc/SKILL.md, skills/lark-vc/references/*, skills/lark-workflow-meeting-summary/SKILL.md
Adds a lark-note skill spec and multiple reference docs; updates other skill docs to route transcript/detail requests by note_display_type, and to extract note_id from vc-node-id when present.
E2E Test Coverage Documentation and Dry-Run Tests
tests/cli_e2e/note/coverage.md, tests/cli_e2e/note/note_dryrun_test.go
Adds dry-run E2E tests verifying planned API calls for note +detail and note +transcript, and a coverage report documenting dry-run metrics.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as note +transcript
  participant NoteDetail as FetchDetail
  participant TranscriptAPI as unified_note_transcript API
  participant FS as File output

  CLI->>NoteDetail: verify note_display_type by note_id
  NoteDetail-->>CLI: Detail(normal/unified/unknown)
  CLI->>TranscriptAPI: GET page with cursor/format/locale
  TranscriptAPI-->>CLI: content + has_more + next_cursor
  CLI->>CLI: repeat until done with cursor checks
  CLI->>FS: write unified transcript file
  FS-->>CLI: saved path and size
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • larksuite/cli#1417: Overlapping changes that add/remove the note domain and registration entries.
  • larksuite/cli#1345: Similar split of note handling into a dedicated domain and routing by note_display_type.
  • larksuite/cli#1172: Related edits to vc +notes fetch/detail and payload detection logic.

Suggested reviewers

  • zhaoleibd
  • calendar-assistant
  • liangshuo-1

"🐰 I hopped in to add a note domain bright,
Two shortcuts now ready to fetch and write.
Unified transcripts page by page,
Cursor-safe and tested at each stage.
Cheers from a rabbit, tiny and light!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: split note domain' directly describes the main change—reintroducing the Note domain as a separate service with dedicated shortcuts.
Description check ✅ Passed The description follows the repository template with all required sections: Summary, Changes, Test Plan, and Related Issues. All sections are filled out with specific details and clear explanations.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 codex/reapply-note-domain-split

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 and usage tips.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.72789% with 89 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.84%. Comparing base (510545f) to head (417bf4c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/note/note_transcript.go 64.39% 35 Missing and 12 partials ⚠️
shortcuts/note/note_detail.go 47.61% 20 Missing and 2 partials ⚠️
shortcuts/note/note.go 84.15% 13 Missing and 3 partials ⚠️
shortcuts/vc/vc_notes.go 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1418      +/-   ##
==========================================
+ Coverage   72.83%   72.84%   +0.01%     
==========================================
  Files         732      737       +5     
  Lines       69140    69704     +564     
==========================================
+ Hits        50356    50777     +421     
- Misses      15003    15118     +115     
- Partials     3781     3809      +28     

☔ 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.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#codex/reapply-note-domain-split -y -g

@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

🧹 Nitpick comments (1)
shortcuts/note/note_transcript_test.go (1)

198-234: ⚡ Quick win

Add a positive --overwrite behavior test.

Current coverage validates rejection when the file exists without --overwrite, but it does not assert that --overwrite successfully replaces existing output. Please add one happy-path test to lock that contract.

As per coding guidelines, “Every behavior change needs a test alongside the change.”

🤖 Prompt for 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.

In `@shortcuts/note/note_transcript_test.go` around lines 198 - 234, Add a new
happy-path test (e.g., TestNoteTranscriptAllowsOverwrite) mirroring
TestNoteTranscriptRejectsExistingOutputBeforeFetch: create the same existing
outPath file, invoke runNoteShortcut with NoteTranscript and include the
"--overwrite" flag, assert no error is returned, assert the output file was
replaced (read file and check it contains the new transcript content), and
ensure no ValidationError is produced; reuse the same helpers
(noteShortcutTestFactory, runNoteShortcut, NoteTranscript, stdout) and verify
stdout remains as expected.

Source: Coding guidelines

🤖 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 `@shortcuts/note/note_transcript.go`:
- Around line 174-176: Replace the raw returns of ctx.Err() in this file with
typed errs.* errors that preserve the original cause: capture err := ctx.Err()
and if err != nil return a specific typed error (e.g.,
errs.Canceled.WithCause(err) when err == context.Canceled, or
errs.DeadlineExceeded.WithCause(err) when err == context.DeadlineExceeded)
instead of returning ctx.Err() directly; do this for each occurrence that
currently returns ctx.Err() (the ctx.Err() return paths in note_transcript.go)
so command-facing code always receives the typed errs.* envelope with the
underlying cause attached.

---

Nitpick comments:
In `@shortcuts/note/note_transcript_test.go`:
- Around line 198-234: Add a new happy-path test (e.g.,
TestNoteTranscriptAllowsOverwrite) mirroring
TestNoteTranscriptRejectsExistingOutputBeforeFetch: create the same existing
outPath file, invoke runNoteShortcut with NoteTranscript and include the
"--overwrite" flag, assert no error is returned, assert the output file was
replaced (read file and check it contains the new transcript content), and
ensure no ValidationError is produced; reuse the same helpers
(noteShortcutTestFactory, runNoteShortcut, NoteTranscript, stdout) and verify
stdout remains as expected.
🪄 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: f84f5690-ffcb-43ce-af80-be4be802b240

📥 Commits

Reviewing files that changed from the base of the PR and between 510545f and de45647.

📒 Files selected for processing (26)
  • cmd/auth/login_messages.go
  • cmd/auth/login_test.go
  • internal/registry/service_descriptions.json
  • lint/errscontract/rule_no_legacy_common_helper_call.go
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • lint/errscontract/rules_test.go
  • shortcuts/note/note.go
  • shortcuts/note/note_detail.go
  • shortcuts/note/note_test.go
  • shortcuts/note/note_transcript.go
  • shortcuts/note/note_transcript_test.go
  • shortcuts/note/shortcuts.go
  • shortcuts/register.go
  • shortcuts/vc/vc_notes.go
  • shortcuts/vc/vc_notes_test.go
  • skills/lark-doc/SKILL.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-note/SKILL.md
  • skills/lark-note/references/lark-note-detail.md
  • skills/lark-note/references/lark-note-transcript.md
  • skills/lark-vc/SKILL.md
  • skills/lark-vc/references/lark-vc-notes.md
  • skills/lark-vc/references/vc-domain-boundaries.md
  • skills/lark-workflow-meeting-summary/SKILL.md
  • tests/cli_e2e/note/coverage.md
  • tests/cli_e2e/note/note_dryrun_test.go

Comment thread shortcuts/note/note_transcript.go
@Ren1104 Ren1104 force-pushed the codex/reapply-note-domain-split branch from de45647 to 24a9f1e Compare June 11, 2026 20:07

@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/SKILL.md`:
- Line 50: Update the routing row that currently lists "lark-drive /
lark-doc,必要时再到 lark-note" so it clarifies that lark-note is only a fallback when
an explicit note id/VC node id is available: change the wording to instruct
agents to search lark-doc (and lark-drive) first and only call lark-note after
the docs +fetch step returns a concrete note_id / vc-node-id; reference the
services by name (lark-doc, lark-drive, lark-note) and explicitly require the
note_id/vc-node-id before routing to lark-note so agents won’t attempt an
impossible direct hop.
🪄 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: 4b1b95aa-cac9-4b19-9ac3-ab6f0dbb6f97

📥 Commits

Reviewing files that changed from the base of the PR and between de45647 and 24a9f1e.

📒 Files selected for processing (26)
  • cmd/auth/login_messages.go
  • cmd/auth/login_test.go
  • internal/registry/service_descriptions.json
  • lint/errscontract/rule_no_legacy_common_helper_call.go
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • lint/errscontract/rules_test.go
  • shortcuts/note/note.go
  • shortcuts/note/note_detail.go
  • shortcuts/note/note_test.go
  • shortcuts/note/note_transcript.go
  • shortcuts/note/note_transcript_test.go
  • shortcuts/note/shortcuts.go
  • shortcuts/register.go
  • shortcuts/vc/vc_notes.go
  • shortcuts/vc/vc_notes_test.go
  • skills/lark-doc/SKILL.md
  • skills/lark-minutes/SKILL.md
  • skills/lark-note/SKILL.md
  • skills/lark-note/references/lark-note-detail.md
  • skills/lark-note/references/lark-note-transcript.md
  • skills/lark-vc/SKILL.md
  • skills/lark-vc/references/lark-vc-notes.md
  • skills/lark-vc/references/vc-domain-boundaries.md
  • skills/lark-workflow-meeting-summary/SKILL.md
  • tests/cli_e2e/note/coverage.md
  • tests/cli_e2e/note/note_dryrun_test.go
✅ Files skipped from review due to trivial changes (4)
  • tests/cli_e2e/note/coverage.md
  • skills/lark-note/references/lark-note-detail.md
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • skills/lark-vc/references/lark-vc-notes.md
🚧 Files skipped from review as they are similar to previous changes (16)
  • cmd/auth/login_test.go
  • skills/lark-doc/SKILL.md
  • shortcuts/note/shortcuts.go
  • cmd/auth/login_messages.go
  • lint/errscontract/rule_no_legacy_common_helper_call.go
  • tests/cli_e2e/note/note_dryrun_test.go
  • internal/registry/service_descriptions.json
  • shortcuts/register.go
  • lint/errscontract/rules_test.go
  • shortcuts/note/note_detail.go
  • shortcuts/note/note_test.go
  • shortcuts/note/note_transcript.go
  • shortcuts/vc/vc_notes.go
  • shortcuts/note/note.go
  • shortcuts/note/note_transcript_test.go
  • shortcuts/vc/vc_notes_test.go

Comment thread skills/lark-vc/SKILL.md Outdated
@Ren1104 Ren1104 requested review from liangshuo-1 and zhaoleibd June 12, 2026 02:41
@Ren1104

Ren1104 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

Replaced by #1435 using branch feat/note-domain-split so the PR branch no longer contains codex.

@Ren1104 Ren1104 closed this Jun 12, 2026
@Ren1104 Ren1104 deleted the codex/reapply-note-domain-split branch June 12, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain domain/vc PR touches the vc 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.

2 participants