fix(e2e): inject shared credentials by identity#1995
Conversation
📝 WalkthroughWalkthroughCLI end-to-end credential handling now preserves existing environment values, supports shared bot and user fallbacks, and avoids standard environment mutation during scoped tenant checks. ChangesCredential environment handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 `@tests/cli_e2e/core_test.go`:
- Around line 302-334: Extend the credential-precedence tests around
buildCommandEnv with equivalent cases using DefaultAs: "user". Verify standard
dry-run user credentials are preserved, and request-provided user
credentials—including an explicitly empty access token—override shared
TEST_USER_ACCESS_TOKEN values. Directly assert the relevant user credential
fields and ensure shared user credentials are absent when overridden.
🪄 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: 38b002c7-c300-42d1-80f8-6f7642bc0ba8
📒 Files selected for processing (2)
tests/cli_e2e/core.gotests/cli_e2e/core_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@21c539e12db585b50440397825df00534a0807e7🧩 Skill updatenpx skills add yxzhaao/cli#fix/e2e-credential-fallback -y -g |
Summary
Make shared live E2E credentials an identity-aware fallback for each RunCmd child process.
Root Cause
The live E2E job intentionally keeps tenant credentials in TEST_* variables so config and dry-run subprocesses do not activate the real environment credential provider. SkipWithoutTenantAccessToken previously promoted those values to standard LARKSUITE_CLI_* variables inside each test.
A newly added bot workflow omitted that helper. Its requests still declared DefaultAs: "bot", but the child process received no standard bot credentials and failed with config/not_configured.
Changes
Test Plan
Summary by CodeRabbit