Skip to content

test#1625

Closed
maojinze7-prog wants to merge 0 commit into
mainfrom
feat/whoami-identity
Closed

test#1625
maojinze7-prog wants to merge 0 commit into
mainfrom
feat/whoami-identity

Conversation

@maojinze7-prog

@maojinze7-prog maojinze7-prog commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@CLAassistant

CLAassistant commented Jun 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

coderabbitai Bot commented Jun 27, 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: f87ce950-760b-4aa6-9dc9-3d851e02ea14

📥 Commits

Reviewing files that changed from the base of the PR and between c5e0b4c and 1f9fc99.

📒 Files selected for processing (2)
  • cmd/whoami/whoami.go
  • cmd/whoami/whoami_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/whoami/whoami.go
  • cmd/whoami/whoami_test.go

📝 Walkthrough

Walkthrough

Adds a new whoami CLI command, registers it on the root command, and documents its usage. The command outputs JSON or readable text, supports --verify, and the tests cover identity resolution, verification, and formatting.

Changes

Whoami command

Layer / File(s) Summary
Command contract and wiring
cmd/whoami/whoami.go, cmd/build.go, skills/lark-shared/SKILL.md
whoami is added to the root CLI, exposes --json, --verify, and --as, and the shared identity guidance now references it.
Identity resolution and execution
cmd/whoami/whoami.go
resolveSource and whoamiRun load config, resolve the effective identity, run diagnostics, and return auth errors for unavailable or failed verification states.
Identity view and formatting
cmd/whoami/whoami.go
buildIdentityView normalizes bot and user diagnostics, and printPretty renders the human-readable identity summary.
Command tests
cmd/whoami/whoami_test.go
Tests cover source precedence, metadata, JSON snapshots, verification success and failure, pretty output, invalid --as, and a stored-user JSON snapshot.

Sequence Diagram(s)

sequenceDiagram
  participant buildInternal
  participant whoami.NewCmdWhoami
  participant whoamiRun
  participant buildIdentityView
  participant printPretty

  buildInternal->>whoami.NewCmdWhoami: register whoami subcommand
  whoami.NewCmdWhoami->>whoamiRun: execute with parsed flags
  whoamiRun->>buildIdentityView: normalize diagnostics into whoamiResult
  whoamiRun->>printPretty: render human-readable output when --json is false
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • larksuite/cli#371: Shares the root command assembly path in cmd/build.go where whoami is registered.
  • larksuite/cli#957: Uses the same bot/user identity diagnostics and verification concepts that whoami now exposes.

Suggested reviewers

  • liangshuo-1

Poem

I hopped through flags at morning light,
whoami sang the name just right.
JSON sparkled, verify glowed,
Bot and user both were showed.
🐰✨ A cozy CLI meadow!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% 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 is concise and accurately summarizes the main change: adding a top-level whoami command.
Description check ✅ Passed The description matches the template and includes Summary, Changes, Test Plan, and Related Issues with relevant details.
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 feat/whoami-identity

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.

@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: 3

🤖 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 `@cmd/whoami/whoami_test.go`:
- Around line 102-108: The failure-path tests in whoami_test.go only assert that
an error occurred, so they can miss regressions in error metadata. Update the
affected tests around runWhoami and the typed error checks to use errs.ProblemOf
for category/subtype and cause preservation, and use errors.As with
*errs.ValidationError to verify Param where the --as validation path is
involved. Keep the assertions aligned with the existing error contract so the
tests fail if category, subtype, param, or cause handling changes.

In `@cmd/whoami/whoami.go`:
- Around line 77-85: In resolveSource, the check for strict mode should take
precedence over the --as flag so identity resolution reports the actual source.
Update the ordering in whoami.go so the ForcedIdentity() path from
f.ResolveStrictMode(ctx) returns "strictMode" before the
cmd.Flags().Changed("as") branch can return "flag"; keep the defaultAs fallback
after both.
- Around line 192-207: Pretty output is dropping the resolved bot identity
because printPretty only renders the user branch and never prints bot
AppName/OpenID from buildIdentityView. Update printPretty to also handle id.As
== core.AsBot and render the bot identity details alongside the existing user
and token/verified fields, keeping the human-readable output consistent with the
JSON path.
🪄 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: 320ef62f-f41b-4b14-a1be-41046404fd4a

📥 Commits

Reviewing files that changed from the base of the PR and between 8a268aa and c5e0b4c.

📒 Files selected for processing (4)
  • cmd/build.go
  • cmd/whoami/whoami.go
  • cmd/whoami/whoami_test.go
  • skills/lark-shared/SKILL.md

Comment thread cmd/whoami/whoami_test.go Outdated
Comment thread cmd/whoami/whoami.go Outdated
Comment thread cmd/whoami/whoami.go Outdated
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.11215% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.65%. Comparing base (8a268aa) to head (1f9fc99).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/whoami/whoami.go 83.96% 8 Missing and 9 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1625      +/-   ##
==========================================
+ Coverage   74.64%   74.65%   +0.01%     
==========================================
  Files         806      807       +1     
  Lines       81386    81493     +107     
==========================================
+ Hits        60752    60842      +90     
- Misses      16101    16109       +8     
- Partials     4533     4542       +9     

☔ 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 27, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/whoami-identity -y -g

@maojinze7-prog

Copy link
Copy Markdown
Collaborator Author

Closing this PR — superseded/cleanup per author request.

@maojinze7-prog
maojinze7-prog deleted the feat/whoami-identity branch June 27, 2026 09:06
@maojinze7-prog
maojinze7-prog restored the feat/whoami-identity branch June 27, 2026 09:23
@maojinze7-prog
maojinze7-prog deleted the feat/whoami-identity branch June 27, 2026 09:24
@maojinze7-prog maojinze7-prog changed the title feat: add whoami command to show active identity test Jun 27, 2026
@larksuite larksuite deleted a comment from Roy-oss1 Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 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