Skip to content

fix ci port allocated - #17109

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
myf-bee:fix-ci-port-allocated
Jul 20, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
myf-bee:fix-ci-port-allocated

Conversation

@myf-bee

@myf-bee myf-bee commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  1. fix the issue of ci failures under specific circumstances.
  2. fix ci port allocated
  3. modified unit_test file only run on python

2. modified unit_test file only run on python
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 20, 2026
@myf-bee myf-bee added the ci Continue Integration label Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The CI workflow now distinguishes Python-only unit-test changes from broader test changes. Infinity and Elasticsearch test setup steps use labeled per-port Docker guard networks with atomic reservation, rollback, stale cleanup, bounded retries, and matching teardown.

Changes

CI test infrastructure

Layer / File(s) Summary
Test change detection
.github/workflows/sep-tests.yml
Unit-test paths select Python tests without marking Go changes, while broader test paths retain Go and Python selection.
Per-port guard reservation and teardown
.github/workflows/sep-tests.yml
Infinity and Elasticsearch setup steps reserve ports through labeled per-port networks with snapshots, rollback, retries, and stale cleanup; teardown removes all claimed networks.

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

Possibly related PRs

Suggested labels: 🧪 test

Suggested reviewers: qinling0210, yuzhichang

Poem

I guarded each port with a network so neat,
And sorted the tests by their language fleet.
Stale claims hop away, failed claims roll back,
Teardown cleans every guard from the stack.
CI bunnies now sprint without fright—
Hop, hop, tests all night! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the CI port allocation fix in the changeset.
Description check ✅ Passed The summary covers the CI failure fix, port allocation issue, and Python-only unit test selection, though background context is minimal.
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.

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
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/sep-tests.yml (2)

405-514: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Extract the duplicated cleanup_stale_port_locks/reserve_port_offset logic into one shared source. This ~110-line, non-trivial port-guard algorithm is duplicated byte-for-byte between the Infinity and Elasticsearch jobs. Any future fix (e.g. the create_fail_streak change above) must be applied in two places, and the copies will inevitably drift. Move it into a single checked-in script (sourced by both steps) or a local composite action, parameterized by DOC_ENGINE/PARTITION_BASE.

  • .github/workflows/sep-tests.yml#L405-L514: replace the inline Infinity block with a call into the shared script/action.
  • .github/workflows/sep-tests.yml#L978-L1085: replace the inline Elasticsearch block with the same shared call.
🤖 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 @.github/workflows/sep-tests.yml around lines 405 - 514, Extract the
duplicated cleanup_stale_port_locks and reserve_port_offset logic into one
checked-in shared script or local composite action, parameterized by DOC_ENGINE
and PARTITION_BASE while preserving the existing behavior. Replace the inline
Infinity block in .github/workflows/sep-tests.yml lines 405-514 and the inline
Elasticsearch block in .github/workflows/sep-tests.yml lines 978-1085 with calls
to that shared implementation; both sites require direct changes.

501-508: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

create_fail_streak conflates contention with hard failures and can abort reservation prematurely. The streak increments on any docker network create failure, including a name conflict when a competing runner legitimately claimed the port between snapshot and create. Under high parallel contention 10 consecutive such races will trip the abort at line ~505/1078 even though free offsets remain, turning recoverable contention into a hard CI failure. Consider distinguishing a name-conflict error (contention → keep retrying / don't count toward abort) from a genuinely hard error (daemon unreachable, subnet exhausted → abort), e.g. by inspecting create_err.

  • .github/workflows/sep-tests.yml#L501-L508: in the Infinity reserve_port_offset, only count non-name-conflict create_err toward create_fail_streak (or reset it after any fast-path-clean attempt).
  • .github/workflows/sep-tests.yml#L1074-L1081: apply the identical change to the Elasticsearch reserve_port_offset copy.
🤖 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 @.github/workflows/sep-tests.yml around lines 501 - 508, The
reserve_port_offset logic currently counts recoverable Docker network name
conflicts as hard failures, allowing contention to trigger premature aborts. In
both .github/workflows/sep-tests.yml:501-508 (Infinity) and
.github/workflows/sep-tests.yml:1074-1081 (Elasticsearch), update the
create_fail_streak handling to inspect create_err and count only
non-name-conflict failures; continue retrying without incrementing the streak
for name conflicts while preserving the existing abort threshold for genuine
Docker errors.
🤖 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.

Nitpick comments:
In @.github/workflows/sep-tests.yml:
- Around line 405-514: Extract the duplicated cleanup_stale_port_locks and
reserve_port_offset logic into one checked-in shared script or local composite
action, parameterized by DOC_ENGINE and PARTITION_BASE while preserving the
existing behavior. Replace the inline Infinity block in
.github/workflows/sep-tests.yml lines 405-514 and the inline Elasticsearch block
in .github/workflows/sep-tests.yml lines 978-1085 with calls to that shared
implementation; both sites require direct changes.
- Around line 501-508: The reserve_port_offset logic currently counts
recoverable Docker network name conflicts as hard failures, allowing contention
to trigger premature aborts. In both .github/workflows/sep-tests.yml:501-508
(Infinity) and .github/workflows/sep-tests.yml:1074-1081 (Elasticsearch), update
the create_fail_streak handling to inspect create_err and count only
non-name-conflict failures; continue retrying without incrementing the streak
for name conflicts while preserving the existing abort threshold for genuine
Docker errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f670c62-5cfe-4662-bcc0-e71d8a7b0b7f

📥 Commits

Reviewing files that changed from the base of the PR and between 3fa8902 and 0c570b8.

📒 Files selected for processing (1)
  • .github/workflows/sep-tests.yml

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (3da2425) to head (0c570b8).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17109   +/-   ##
=======================================
  Coverage   90.65%   90.65%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          650      650           
  Misses         39       39           
  Partials       28       28           

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

@JinHai-CN
JinHai-CN merged commit a150db6 into infiniflow:main Jul 20, 2026
8 checks passed
@myf-bee
myf-bee deleted the fix-ci-port-allocated branch August 5, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants