Skip to content

test: stabilize live e2e auth retries#1904

Open
yxzhaao wants to merge 1 commit into
larksuite:mainfrom
yxzhaao:fix/e2e-invalid-response-retry
Open

test: stabilize live e2e auth retries#1904
yxzhaao wants to merge 1 commit into
larksuite:mainfrom
yxzhaao:fix/e2e-invalid-response-retry

Conversation

@yxzhaao

@yxzhaao yxzhaao commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Change-Id: I330517f0cb9b1349962c086a71f2793db149d0fa

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes

    • Improved live end-to-end test authentication by preparing and validating tenant access credentials before execution.
    • Added clearer failures when required authentication setup cannot be completed.
  • Tests

    • Live end-to-end tests now skip cleanly when tenant access credentials are unavailable, preventing misleading failures across calendar, Drive, messaging, documents, spreadsheets, tasks, and wiki workflows.
    • Added validation to confirm authenticated test access is valid before running workflows.

@yxzhaao yxzhaao requested a review from liangshuo-1 as a code owner July 15, 2026 12:29
@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 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: 59b8fd6b-7bde-4af3-89bf-16d13f016c49

📥 Commits

Reviewing files that changed from the base of the PR and between a9e21a3 and df471b2.

📒 Files selected for processing (39)
  • .github/workflows/ci.yml
  • scripts/ci-workflow.test.sh
  • tests/cli_e2e/base/base_basic_workflow_test.go
  • tests/cli_e2e/base/base_role_workflow_test.go
  • tests/cli_e2e/calendar/calendar_create_event_test.go
  • tests/cli_e2e/calendar/calendar_manage_calendar_test.go
  • tests/cli_e2e/calendar/calendar_rsvp_workflow_test.go
  • tests/cli_e2e/calendar/calendar_update_event_test.go
  • tests/cli_e2e/contact/contact_lookup_workflow_test.go
  • tests/cli_e2e/core.go
  • tests/cli_e2e/core_test.go
  • tests/cli_e2e/docs/docs_create_fetch_test.go
  • tests/cli_e2e/docs/docs_update_test.go
  • tests/cli_e2e/drive/drive_add_comment_workflow_test.go
  • tests/cli_e2e/drive/drive_duplicate_sync_workflow_test.go
  • tests/cli_e2e/drive/drive_files_workflow_test.go
  • tests/cli_e2e/drive/drive_preview_workflow_test.go
  • tests/cli_e2e/drive/drive_status_workflow_test.go
  • tests/cli_e2e/drive/drive_sync_workflow_test.go
  • tests/cli_e2e/drive/drive_upload_workflow_test.go
  • tests/cli_e2e/drive/drive_version_workflow_test.go
  • tests/cli_e2e/im/chat_workflow_test.go
  • tests/cli_e2e/im/message_forward_workflow_test.go
  • tests/cli_e2e/im/message_reply_workflow_test.go
  • tests/cli_e2e/markdown/markdown_workflow_test.go
  • tests/cli_e2e/sheets/sheets_crud_workflow_test.go
  • tests/cli_e2e/sheets/sheets_filter_workflow_test.go
  • tests/cli_e2e/sheets/sheets_gridline_workflow_test.go
  • tests/cli_e2e/sheets/sheets_sheet_shortcuts_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_get_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_put_typed_workflow_test.go
  • tests/cli_e2e/sheets/sheets_workbook_import_workflow_test.go
  • tests/cli_e2e/task/task_comment_workflow_test.go
  • tests/cli_e2e/task/task_reminder_workflow_test.go
  • tests/cli_e2e/task/task_status_workflow_test.go
  • tests/cli_e2e/task/tasklist_add_task_workflow_test.go
  • tests/cli_e2e/task/tasklist_workflow_test.go
  • tests/cli_e2e/wiki/wiki_shortcut_workflow_test.go
  • tests/cli_e2e/wiki/wiki_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (36)
  • tests/cli_e2e/docs/docs_update_test.go
  • tests/cli_e2e/drive/drive_upload_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_get_workflow_test.go
  • tests/cli_e2e/im/message_reply_workflow_test.go
  • tests/cli_e2e/drive/drive_version_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_put_typed_workflow_test.go
  • tests/cli_e2e/drive/drive_files_workflow_test.go
  • tests/cli_e2e/markdown/markdown_workflow_test.go
  • tests/cli_e2e/sheets/sheets_filter_workflow_test.go
  • tests/cli_e2e/sheets/sheets_gridline_workflow_test.go
  • tests/cli_e2e/task/task_status_workflow_test.go
  • tests/cli_e2e/calendar/calendar_create_event_test.go
  • tests/cli_e2e/task/task_reminder_workflow_test.go
  • tests/cli_e2e/calendar/calendar_update_event_test.go
  • tests/cli_e2e/base/base_role_workflow_test.go
  • tests/cli_e2e/contact/contact_lookup_workflow_test.go
  • tests/cli_e2e/sheets/sheets_crud_workflow_test.go
  • tests/cli_e2e/drive/drive_add_comment_workflow_test.go
  • tests/cli_e2e/sheets/sheets_workbook_import_workflow_test.go
  • tests/cli_e2e/calendar/calendar_manage_calendar_test.go
  • tests/cli_e2e/sheets/sheets_sheet_shortcuts_workflow_test.go
  • tests/cli_e2e/drive/drive_duplicate_sync_workflow_test.go
  • tests/cli_e2e/im/chat_workflow_test.go
  • tests/cli_e2e/task/tasklist_add_task_workflow_test.go
  • tests/cli_e2e/wiki/wiki_workflow_test.go
  • tests/cli_e2e/docs/docs_create_fetch_test.go
  • tests/cli_e2e/task/tasklist_workflow_test.go
  • tests/cli_e2e/calendar/calendar_rsvp_workflow_test.go
  • scripts/ci-workflow.test.sh
  • tests/cli_e2e/base/base_basic_workflow_test.go
  • tests/cli_e2e/drive/drive_sync_workflow_test.go
  • tests/cli_e2e/core_test.go
  • tests/cli_e2e/drive/drive_status_workflow_test.go
  • .github/workflows/ci.yml
  • tests/cli_e2e/core.go
  • tests/cli_e2e/task/task_comment_workflow_test.go

📝 Walkthrough

Walkthrough

Live E2E CI now provisions a shared Feishu tenant access token and exports CLI identity variables. A shared test helper verifies tenant authentication, while tenant-dependent Base, Calendar, Contact, Docs, Drive, IM, Markdown, Sheets, Task, and Wiki workflows skip when credentials are unavailable.

Changes

Live E2E tenant authentication

Layer / File(s) Summary
Shared live tenant token provisioning
.github/workflows/ci.yml, scripts/ci-workflow.test.sh
The e2e-live job exports CLI identity values, retrieves and masks a tenant token with retries, writes it to GITHUB_ENV, and validates the required workflow structure.
Tenant token verification helper
tests/cli_e2e/core.go, tests/cli_e2e/core_test.go
SkipWithoutTenantAccessToken skips tests without a token and verifies bot identity and authentication status when a token exists; helper tests cover both paths.
Live E2E entry-point guards
tests/cli_e2e/base/*, tests/cli_e2e/calendar/*, tests/cli_e2e/contact/*, tests/cli_e2e/docs/*, tests/cli_e2e/drive/*, tests/cli_e2e/im/*, tests/cli_e2e/markdown/*, tests/cli_e2e/sheets/*, tests/cli_e2e/task/*, tests/cli_e2e/wiki/*
Tenant-dependent workflows invoke the shared authentication guard before setup or CLI execution.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant FeishuOAuth
  participant LarkCLI
  participant LiveE2ETests
  GitHubActions->>FeishuOAuth: Request tenant token
  FeishuOAuth-->>GitHubActions: Return token
  GitHubActions->>LarkCLI: Export token and CLI identity
  LiveE2ETests->>LarkCLI: Verify bot authentication
  LarkCLI-->>LiveE2ETests: Return verified status
  LiveE2ETests->>LiveE2ETests: Run or skip workflow
Loading

Possibly related PRs

  • larksuite/cli#236: Introduces the shared CLI E2E harness extended by this tenant-token guard.
  • larksuite/cli#401: Adds E2E workflows that are updated here to require tenant authentication.
  • larksuite/cli#510: Modifies the CI pipeline and e2e-live workflow structure changed here.

Suggested reviewers: liangshuo-1, zhicong666-bytedance

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description mostly repeats the template and lacks actual summary, changes, test plan, and issue details. Replace the template placeholders with a real Summary, Changes, Test Plan, and Related Issues section that describes the implemented auth retry updates.
Docstring Coverage ⚠️ Warning Docstring coverage is 46.81% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: stabilizing live E2E auth retries and related test gating.
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

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.

@yxzhaao yxzhaao force-pushed the fix/e2e-invalid-response-retry branch from 477052f to a9e21a3 Compare July 15, 2026 12:30

@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 `@scripts/ci-workflow.test.sh`:
- Around line 312-324: Strengthen the workflow assertions in the test section
around the “Prepare shared live E2E tenant token” step: require the exact
LARKSUITE_CLI_BRAND: feishu environment entry and verify that
LARKSUITE_CLI_TENANT_ACCESS_TOKEN is written to GITHUB_ENV, not merely
referenced. Preserve the existing step-condition and job-scope checks.
🪄 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: bde452c3-4683-4681-a59f-0bed8ea40de3

📥 Commits

Reviewing files that changed from the base of the PR and between 64caef1 and a9e21a3.

📒 Files selected for processing (41)
  • .github/workflows/ci.yml
  • internal/client/api_errors.go
  • internal/client/api_errors_test.go
  • scripts/ci-workflow.test.sh
  • tests/cli_e2e/base/base_basic_workflow_test.go
  • tests/cli_e2e/base/base_role_workflow_test.go
  • tests/cli_e2e/calendar/calendar_create_event_test.go
  • tests/cli_e2e/calendar/calendar_manage_calendar_test.go
  • tests/cli_e2e/calendar/calendar_rsvp_workflow_test.go
  • tests/cli_e2e/calendar/calendar_update_event_test.go
  • tests/cli_e2e/contact/contact_lookup_workflow_test.go
  • tests/cli_e2e/core.go
  • tests/cli_e2e/core_test.go
  • tests/cli_e2e/docs/docs_create_fetch_test.go
  • tests/cli_e2e/docs/docs_update_test.go
  • tests/cli_e2e/drive/drive_add_comment_workflow_test.go
  • tests/cli_e2e/drive/drive_duplicate_sync_workflow_test.go
  • tests/cli_e2e/drive/drive_files_workflow_test.go
  • tests/cli_e2e/drive/drive_preview_workflow_test.go
  • tests/cli_e2e/drive/drive_status_workflow_test.go
  • tests/cli_e2e/drive/drive_sync_workflow_test.go
  • tests/cli_e2e/drive/drive_upload_workflow_test.go
  • tests/cli_e2e/drive/drive_version_workflow_test.go
  • tests/cli_e2e/im/chat_workflow_test.go
  • tests/cli_e2e/im/message_forward_workflow_test.go
  • tests/cli_e2e/im/message_reply_workflow_test.go
  • tests/cli_e2e/markdown/markdown_workflow_test.go
  • tests/cli_e2e/sheets/sheets_crud_workflow_test.go
  • tests/cli_e2e/sheets/sheets_filter_workflow_test.go
  • tests/cli_e2e/sheets/sheets_gridline_workflow_test.go
  • tests/cli_e2e/sheets/sheets_sheet_shortcuts_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_get_workflow_test.go
  • tests/cli_e2e/sheets/sheets_table_put_typed_workflow_test.go
  • tests/cli_e2e/sheets/sheets_workbook_import_workflow_test.go
  • tests/cli_e2e/task/task_comment_workflow_test.go
  • tests/cli_e2e/task/task_reminder_workflow_test.go
  • tests/cli_e2e/task/task_status_workflow_test.go
  • tests/cli_e2e/task/tasklist_add_task_workflow_test.go
  • tests/cli_e2e/task/tasklist_workflow_test.go
  • tests/cli_e2e/wiki/wiki_shortcut_workflow_test.go
  • tests/cli_e2e/wiki/wiki_workflow_test.go

Comment on lines +312 to +324
if ! grep -Fq "LARKSUITE_CLI_APP_ID: \${{ secrets.TEST_BOT1_APP_ID }}" <<<"$section"; then
echo "e2e-live should expose the bot app id through job env"
exit 1
fi

if ! awk '
/^ - name: Configure bot credentials/ { in_step = 1 }
in_step && /if: \$\{\{ steps\.e2e_domains\.outputs\.mode != '\''skip'\'' \}\}/ { found = 1 }
in_step && /^ - name:/ && !/Configure bot credentials/ { in_step = 0 }
END { exit found ? 0 : 1 }
/^ - name: Prepare shared live E2E tenant token/ { in_step = 1 }
in_step && /if: \$\{\{ steps\.e2e_domains\.outputs\.mode != '\''skip'\'' \}\}/ { has_if = 1 }
in_step && /LARKSUITE_CLI_TENANT_ACCESS_TOKEN/ { has_tat = 1 }
in_step && /^ - name:/ && !/Prepare shared live E2E tenant token/ { in_step = 0 }
END { exit has_if && has_tat ? 0 : 1 }
' <<<"$section"; then
echo "e2e-live should only configure bot credentials when domain mode is not skip"
echo "e2e-live should prepare one shared tenant token for all live CLI child processes"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Assert the complete tenant-token environment contract.

This test can still pass if LARKSUITE_CLI_BRAND: feishu is removed or if the token variable is merely mentioned without being written to GITHUB_ENV. Check both the exact brand entry and the persistence statement directly.

As per coding guidelines, “contract tests must assert the new field or behavior directly.”

🤖 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 `@scripts/ci-workflow.test.sh` around lines 312 - 324, Strengthen the workflow
assertions in the test section around the “Prepare shared live E2E tenant token”
step: require the exact LARKSUITE_CLI_BRAND: feishu environment entry and verify
that LARKSUITE_CLI_TENANT_ACCESS_TOKEN is written to GITHUB_ENV, not merely
referenced. Preserve the existing step-condition and job-scope checks.

Source: Coding guidelines

Change-Id: I330517f0cb9b1349962c086a71f2793db149d0fa
@yxzhaao yxzhaao force-pushed the fix/e2e-invalid-response-retry branch from a9e21a3 to df471b2 Compare July 15, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant