Skip to content

fix(registry): describe the attendance and mindnotes domains - #2210

Merged
sang-neo03 merged 1 commit into
mainfrom
fix/service-descriptions-missing-domains
Aug 6, 2026
Merged

fix(registry): describe the attendance and mindnotes domains#2210
sang-neo03 merged 1 commit into
mainfrom
fix/service-descriptions-missing-domains

Conversation

@sang-neo03

@sang-neo03 sang-neo03 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

internal/registry/service_descriptions.json is the description table for every business domain the CLI exposes, but two registered domains were missing from it: attendance and mindnotes. Both are reachable today — lark-cli attendance user_tasks query and lark-cli mindnotes nodes create run, and both are offered by auth login --domain — so the omission surfaced directly in help output.

With no entry, registry.GetServiceTitle/GetServiceDescription return "" and buildDomainMeta (cmd/auth/login_interactive.go:95) falls back to the typed service spec, which carries a single string for both languages:

$ lark-cli --help            # before
  attendance  attendance record query
  mindnotes   思维笔记节点列表查看、节点创建/更新
$ lark-cli --help            # after
  attendance  Attendance check-in result query
  mindnotes   Mindnote node listing, creation, and update

A full two-way reconciliation found nothing else: the 21 pre-existing keys all map to live registered domains, so nothing is removed.

Changes

  • internal/registry/service_descriptions.json: add bilingual attendance and mindnotes entries, inserted in the file's existing alphabetical positions.

    Neither gets an auth_domain. Both own a top-level scope namespace (attendance:task:readonly, mindnote:node:create/mindnote:node:read), and folding a domain in removes it from the auth login domain picker, so they stay independently selectable. whiteboard remains the only domain folded into docs.

  • cmd/auth/login_test.go: add TestEveryRegisteredDomain_HasBilingualDescription, which walks registry.EmbeddedServicesTyped() plus shortcuts.AllShortcuts() and asserts both languages resolve for every registered domain.

    The pre-existing TestGetDomainMetadata_HasTitleAndDescription could not catch this class of bug: it asserts on buildDomainMeta's output, and the spec fallback had already made that non-empty. The new test asserts on the registry getters, i.e. the config itself, before any fallback can paper over the gap. Failures name the domain and where it is registered.

    It reads EmbeddedServicesTyped (the overlay-free parse) rather than ServicesTyped, so the result does not depend on whatever ~/.lark-cli/cache/remote_meta.json holds on the machine — otherwise CI and a developer box could disagree. The stated cost is that a domain arriving only via remote overlay is out of its reach; that is recorded in the test comment rather than left implicit.

No production code paths change — this is a data entry plus a test.

Test Plan

  • go test -count=1 ./cmd/... ./internal/... ./shortcuts/... — all green

  • Confirmed the new test is not vacuous: with the JSON change stashed it fails, naming exactly the two domains across all four assertions

    --- FAIL: TestEveryRegisteredDomain_HasBilingualDescription
        domain "attendance" (registered via embedded API meta) has no en title in service_descriptions.json
        domain "mindnotes"  (registered via embedded API meta) has no zh description in service_descriptions.json
        ...
    
  • Rebuilt and checked lark-cli --help renders English for both domains (output above)

  • lark-cli auth login --help still lists attendance and mindnotes as independent selectable domains, confirming no accidental fold

  • Two-way set diff of --help domains against the JSON keys: 23 vs 23, both directions empty

  • gofmt and go vet clean on touched packages; JSON validates

Related Issues

  • None. Follow-up worth considering separately: the buildDomainMeta fallback itself is what let a Chinese description render in English help. This PR fixes the two affected domains but leaves that mechanism in place, so the same failure mode returns if a future domain ships without an entry — the new test guards the embedded set, not the remote-overlay set.

Summary by CodeRabbit

  • Documentation

    • Added English and Chinese titles and descriptions for the Attendance and Mindnotes services.
    • Expanded service metadata coverage to support clearer bilingual service information.
  • Tests

    • Added validation ensuring all registered services provide both English and Chinese titles and descriptions.

Both are registered, reachable business domains — `lark-cli attendance
user_tasks query` and `lark-cli mindnotes nodes create` run, and both appear in
`auth login --domain` — but neither had an entry in
service_descriptions.json. GetServiceTitle/GetServiceDescription returned "",
so buildDomainMeta fell back to the typed service spec, which carries one
string for both languages. The result was visible in `--help`: mindnotes
rendered its Chinese description in the English domain list, and attendance
rendered "attendance record query", a lowercase fragment shown in both locales.

Both keep their own scope namespaces (attendance:task:readonly,
mindnote:node:create/read) and stay independent auth domains, so no
auth_domain is set. whiteboard remains the only domain folded into docs.

TestGetDomainMetadata_HasTitleAndDescription could not catch this: it asserts
on buildDomainMeta's output, which the fallback had already made non-empty.
The new reconciliation test walks EmbeddedServicesTyped plus AllShortcuts and
asserts both languages resolve from the config itself, before any fallback.
EmbeddedServicesTyped is the overlay-free parse, so the test does not depend on
what remote_meta.json happens to hold on the machine — a domain that only ever
arrives via remote overlay stays out of its reach.
@sang-neo03
sang-neo03 requested a review from liangshuo-1 as a code owner August 6, 2026 08:20
@coderabbitai

coderabbitai Bot commented Aug 6, 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 Plus

Run ID: 2ced2a4e-05f5-48b0-87e0-fc6b9e7a1887

📥 Commits

Reviewing files that changed from the base of the PR and between 9759167 and 5824114.

📒 Files selected for processing (2)
  • cmd/auth/login_test.go
  • internal/registry/service_descriptions.json

📝 Walkthrough

Walkthrough

The registry adds bilingual descriptions for attendance and mindnotes. A reconciliation test checks bilingual coverage for all embedded services and registered shortcuts.

Changes

Service description coverage

Layer / File(s) Summary
Add localized service descriptions
internal/registry/service_descriptions.json
Adds English and Chinese titles and descriptions for attendance and mindnotes.
Validate registered domain coverage
cmd/auth/login_test.go
Adds a test that combines embedded services and registered shortcuts, sorts domains, and reports missing bilingual metadata.

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

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding registry descriptions for the attendance and mindnotes domains.
Description check ✅ Passed The description includes the required summary, changes, test plan, and related issues sections with detailed, relevant information.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/service-descriptions-missing-domains

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.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/service-descriptions-missing-domains -y -g

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.07%. Comparing base (9759167) to head (5824114).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2210      +/-   ##
==========================================
- Coverage   76.08%   76.07%   -0.01%     
==========================================
  Files         983      983              
  Lines      103429   103429              
==========================================
- Hits        78692    78686       -6     
- Misses      18752    18758       +6     
  Partials     5985     5985              

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

@sang-neo03
sang-neo03 merged commit 164d3cc into main Aug 6, 2026
52 of 68 checks passed
@sang-neo03
sang-neo03 deleted the fix/service-descriptions-missing-domains branch August 6, 2026 11:02
zkh-bytedance pushed a commit that referenced this pull request Aug 6, 2026
Both are registered, reachable business domains — `lark-cli attendance
user_tasks query` and `lark-cli mindnotes nodes create` run, and both appear in
`auth login --domain` — but neither had an entry in
service_descriptions.json. GetServiceTitle/GetServiceDescription returned "",
so buildDomainMeta fell back to the typed service spec, which carries one
string for both languages. The result was visible in `--help`: mindnotes
rendered its Chinese description in the English domain list, and attendance
rendered "attendance record query", a lowercase fragment shown in both locales.

Both keep their own scope namespaces (attendance:task:readonly,
mindnote:node:create/read) and stay independent auth domains, so no
auth_domain is set. whiteboard remains the only domain folded into docs.

TestGetDomainMetadata_HasTitleAndDescription could not catch this: it asserts
on buildDomainMeta's output, which the fallback had already made non-empty.
The new reconciliation test walks EmbeddedServicesTyped plus AllShortcuts and
asserts both languages resolve from the config itself, before any fallback.
EmbeddedServicesTyped is the overlay-free parse, so the test does not depend on
what remote_meta.json happens to hold on the machine — a domain that only ever
arrives via remote overlay stays out of its reach.

Co-authored-by: TRAE CLI <traecli@bytedance.com>
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 7, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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