Skip to content

test(e2e): wait for base role update visibility - #2087

Merged
liangshuo-1 merged 2 commits into
larksuite:mainfrom
yxzhaao:fix/e2e-base-role-update-visibility
Jul 28, 2026
Merged

test(e2e): wait for base role update visibility#2087
liangshuo-1 merged 2 commits into
larksuite:mainfrom
yxzhaao:fix/e2e-base-role-update-visibility

Conversation

@yxzhaao

@yxzhaao yxzhaao commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • poll base +role-get after a successful role update until the updated name is visible
  • bound eventual-consistency handling to 30 seconds with a 3-second polling interval
  • keep API-level retry behavior in RunCmd unchanged

Why

The role update can be acknowledged before a subsequent read observes the new name. This exact stale-read assertion appeared in 6 independent failed e2e-live jobs over the last 7 days across unrelated PRs. Example: https://github.com/larksuite/cli/actions/runs/30353306511/job/90257011797

Testing

  • go test ./tests/cli_e2e/base -run '^TestBase_RoleWorkflow$' -count=1\n- make quality-gate

Summary by CodeRabbit

  • Bug Fixes
    • Improved role updates to reliably show up in subsequent role lookups, reducing failures caused by eventual consistency.
  • Tests
    • Updated end-to-end role workflow coverage to poll until updated role data is available before asserting results.

@coderabbitai

coderabbitai Bot commented Jul 28, 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: d7059d83-64a0-4e91-a9a2-38a6de096bf1

📥 Commits

Reviewing files that changed from the base of the PR and between 95eed3b and 175ac96.

📒 Files selected for processing (1)
  • tests/cli_e2e/base/base_role_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/cli_e2e/base/base_role_workflow_test.go

📝 Walkthrough

Walkthrough

The role workflow test now waits up to 30 seconds, retrying every 3 seconds, for +role-get to return valid JSON containing the updated role name after a bot role update.

Changes

Role workflow validation

Layer / File(s) Summary
Poll updated role state
tests/cli_e2e/base/base_role_workflow_test.go
Replaces the immediate role assertion with a WaitForCondition loop that retries retrieval and validates the updated role_name.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 describes the main behavior change in the e2e role workflow test.
Description check ✅ Passed It covers summary, motivation, and testing with enough detail, though the template's Changes and Related Issues sections are not explicit.
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.

@github-actions github-actions Bot added the size/S Low-risk docs, CI, test, or chore only changes label Jul 28, 2026

@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 `@tests/cli_e2e/base/base_role_workflow_test.go`:
- Around line 114-132: Update the polling block around WaitForCondition so it
uses a 30-second child context, and pass that same child context to RunCmd
inside the callback. Ensure both the wait deadline and each command attempt are
bounded by the 30-second timeout while preserving the existing role convergence
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 Plus

Run ID: a4b09022-a06a-4906-be66-362cb62bb677

📥 Commits

Reviewing files that changed from the base of the PR and between 781d188 and 95eed3b.

📒 Files selected for processing (1)
  • tests/cli_e2e/base/base_role_workflow_test.go

Comment thread tests/cli_e2e/base/base_role_workflow_test.go Outdated
liangshuo-1
liangshuo-1 previously approved these changes Jul 28, 2026
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@175ac96bbd391c8b6080c8110f89ba5716f0c0e3

🧩 Skill update

npx skills add yxzhaao/cli#fix/e2e-base-role-update-visibility -y -g

@github-actions

Copy link
Copy Markdown

PR Quality Summary

CI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun.

CI status

  • Workflow conclusion: cancelled.

@liangshuo-1
liangshuo-1 merged commit b0b1ca4 into larksuite:main Jul 28, 2026
22 checks passed
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 29, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Low-risk docs, CI, test, or chore only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants