Skip to content

ci: deduplicate PR runs and serialize live E2E#1888

Open
luozhixiong01 wants to merge 5 commits into
mainfrom
ci/serialize-live-e2e
Open

ci: deduplicate PR runs and serialize live E2E#1888
luozhixiong01 wants to merge 5 commits into
mainfrom
ci/serialize-live-e2e

Conversation

@luozhixiong01

@luozhixiong01 luozhixiong01 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Pull request updates can overlap CI runs, while live E2E uses repository-wide shared resources that require exclusive execution. This PR cancels superseded PR work, keeps no-op live jobs out of the exclusive queue, and lets an already-started live test continue toward normal cleanup before the next live job starts, subject to its timeout and runner availability.

Changes

  • Add PR-scoped workflow concurrency in .github/workflows/ci.yml; push and manual runs remain independent, and non-PR runs retain GitHub's default title.
  • Make e2e-dry-run the live planning gate. It validates and publishes mode/package outputs with a 20-minute timeout; failed or skip-mode plans do not enter the live queue, while the required results job still reports dry-run failure.
  • Make dry and live consume outputs from the same domain-resolution step. Live therefore waits for the complete dry job outside the exclusive queue: typically about 1.5 minutes in current runs, while full-fallback changes may take longer.
  • Serialize e2e-live with queue: max, no in-progress cancellation, and a 30-minute timeout. Under ordinary PR supersession, an active Go test can continue so t.Cleanup has an opportunity to finish. The timeout bounds how long a started live job can hold the exclusive slot; pending queue time is not covered.
  • Reject a queued superseded run before gotestsum starts. The fail-closed lookup is scoped to the current head branch and GitHub-reported head repository, preventing cross-PR spoofing and avoiding repository-wide workflow-history scans. An Actions API failure may reject a valid live start rather than risk running an unverified stale job.
  • Preserve explicit safety limits: force-cancel remains the immediate operator escape hatch; timeout or runner loss can still interrupt cleanup; and a newer run appearing just after the lookup may waste time, but the repository-wide queue still prevents concurrent live tests.
  • Extend scripts/ci-workflow.test.sh to lock the scheduling, output-validation, permissions, cleanup, timeout, and supersession contracts.

Test Plan

  • make script-test passed (103 tests)
  • bash -n scripts/ci-workflow.test.sh, workflow YAML parsing, and git diff --check passed
  • go mod tidy -diff produced no module changes
  • Full CI, including dry-run, live E2E, results, and golangci-lint, passed on the dry/live gating commit (run 29432206219)

Related Issues

N/A

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6cc96d2a-7767-4894-88cc-d37fcf3467c6

📥 Commits

Reviewing files that changed from the base of the PR and between 0e39dd7 and ceb5da9.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • scripts/ci-workflow.test.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/ci-workflow.test.sh

📝 Walkthrough

Walkthrough

The CI workflow deduplicates pull request runs, validates E2E domain outputs, and serializes live E2E execution. Live runs consume dry-run outputs, reject superseded pull request runs before testing, and are covered by expanded workflow assertions.

Changes

CI and live E2E gating

Layer / File(s) Summary
Workflow concurrency policies
.github/workflows/ci.yml, scripts/ci-workflow.test.sh
Adds pull request-specific run naming and concurrency, plus queued, non-cancelling concurrency for live E2E jobs and corresponding assertions.
Dry-run domain output contract
.github/workflows/ci.yml, scripts/ci-workflow.test.sh
Publishes and validates mode, reason, and live_packages, ensuring skip/full/subset combinations are consistent before building.
Live E2E startup and validation
.github/workflows/ci.yml, scripts/ci-workflow.test.sh
Uses dry-run outputs, requires successful setup, checks for superseded runs before tests, updates report gating, and validates the resulting workflow structure.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • larksuite/cli#510: Both changes modify the consolidated CI workflow and its E2E gate structure.
  • larksuite/cli#1709: Both changes use E2E domain outputs to drive e2e-dry-run and e2e-live.

Suggested reviewers: evandance, hanshaoshuai-k

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as GitHub Actions workflow
  participant DryRun as e2e-dry-run
  participant LiveE2E as e2e-live
  participant API as GitHub Actions API
  Workflow->>DryRun: Resolve and validate E2E domains
  DryRun-->>Workflow: Publish mode, reason, and live_packages
  Workflow->>LiveE2E: Start when prerequisites and outputs allow live testing
  LiveE2E->>API: Check for newer pull request workflow runs
  API-->>LiveE2E: Return workflow run data
  LiveE2E->>LiveE2E: Run tests only when the run is not superseded
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: PR run deduplication and live E2E serialization.
Description check ✅ Passed The description matches the required template with Summary, Changes, Test Plan, and Related Issues sections filled in.
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 ci/serialize-live-e2e

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 commented Jul 14, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#ci/serialize-live-e2e -y -g

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

🤖 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 @.github/workflows/ci.yml:
- Around line 13-15: Update the workflow concurrency configuration around the
top-level concurrency group so the e2e-live job is not governed by the
pull_request cancellation group. Exclude that job from the shared group or move
it into a separate workflow, while preserving cancellation for other pull
request jobs.
- Around line 321-325: Update the actionlint version or its configuration used
for the CI workflow so the valid concurrency.queue setting under the
lark-cli-e2e-live-shared-bot group is accepted. If upgrading is not feasible,
add a narrowly scoped ignore targeting this workflow’s concurrency.queue
diagnostic without suppressing unrelated actionlint errors.
🪄 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: 74d4493b-1852-4a03-85a5-e789c67e30ed

📥 Commits

Reviewing files that changed from the base of the PR and between ac2508d and 0058700.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • scripts/ci-workflow.test.sh

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.73%. Comparing base (ac2508d) to head (50c254a).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1888      +/-   ##
==========================================
+ Coverage   74.66%   74.73%   +0.06%     
==========================================
  Files         878      887       +9     
  Lines       91764    92644     +880     
==========================================
+ Hits        68520    69235     +715     
- Misses      17930    18050     +120     
- Partials     5314     5359      +45     

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

@luozhixiong01

Copy link
Copy Markdown
Collaborator Author

Controlled runtime validation completed on the PR head:

  • PR-run deduplication: three rapid pull_request.edited events produced runs 29332388260, 29332389362, and 29332391514. The two superseded runs were cancelled and only the latest run continued. An earlier CodeRabbit body edit also cancelled the original run as intended. The PR body was restored unchanged after the check.
  • Live E2E serialization: while PR run 29332391514 / e2e-live was in_progress, an independent manual run 29332433625 / e2e-live remained pending in the shared concurrency group. No overlap occurred.
  • No execution regression: the retained live E2E job completed successfully. The extra manual run was cancelled immediately after the queue state was captured.

This proves the scheduler behavior and one successful serialized execution. It does not yet constitute a statistically significant before/after failure-rate comparison; that requires post-merge observation across multiple runs.

@luozhixiong01 luozhixiong01 added size/S Low-risk docs, CI, test, or chore only changes and removed size/M Single-domain feat or fix with limited business impact labels Jul 15, 2026
@github-actions github-actions Bot added size/M Single-domain feat or fix with limited business impact and removed size/S Low-risk docs, CI, test, or chore only changes labels Jul 15, 2026
Make the dry-run result a hard prerequisite for live E2E so skip-mode changes never acquire the repository-wide slot. This intentionally trades one full dry-run duration of live startup latency for lower contention on the exclusive queue.
The dry-run job is now a hard prerequisite for live E2E. Bound its
execution so a stalled planning job cannot delay a PR verdict for the
default six-hour job limit.
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