Skip to content

test(optools): accept a KILL-escalated drain in the publication latch test - #33188

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
fengttt:fix-optools-cancel-grace
Nov 25, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
fengttt:fix-optools-cancel-grace

Conversation

@fengttt

@fengttt fengttt commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #33187

What this PR does / why we need it:

optools / TestEmbeddedPrebuiltPublicationCancellationLatch/test_pids failed the UT Coverage job of #33144 with PUBLICATION_CANCELLED 90 (expected 143). That also blocked the coverage merge, so the PR got no coverage verdict. (run)

Cause

The test checks the publication latch: every admitted process group is drained before cancellation is acknowledged. It also required the mock test process to stop on TERM, and write stopped-execute-a (otherwise status 90).

The drain (terminate_ut_process_groups) gives TERM a fixed grace of 20 ticks (5 s), then sends KILL.

  • On CI the subtest took 8.24 s, against 0.55 s locally. The grace ran out, and the log shows the mock being Killed.
  • A killed process runs no trap, so the marker was missing, although the drain had completed.

Change

Test only; no runner script changes. The latch test now requires that the test process was started (its PID file exists) and is gone (the existing status-91 check), whether it stopped on TERM or was killed after the grace.

The graceful TERM path is still checked, deterministically, by the execution-cancellation test (MOCK_TERM / TERM_ACK).

I did not make the 20-tick child grace configurable. The parent's helper grace (UT_HELPER_TERM_GRACE_TICKS, validated to 41–240) is sized against it, so changing it touches about 15 call sites and that rule.

Testing

  • Normal runs: go test -count=3 -run 'TestEmbeddedPrebuiltPublicationCancellationLatch$' ./optools/ passes.
  • Forced KILL escalation: with the execute-cancel mock changed to ignore TERM, the drain escalates to KILL.
    • Before this change, all three subtests fail with PUBLICATION_CANCELLED 90 after about 5.8 s, the CI failure.
    • After it, all three pass.
  • Full ./optools/ package: passes, except TestUTIncrementalActiveCases (test_invalid_deep_json_does_not_hide_later_failure). That one fails identically on unmodified main locally (Python 3.15) and is unrelated.

🤖 Generated with Claude Code

… test

TestEmbeddedPrebuiltPublicationCancellationLatch checks that every admitted
process group is drained before cancellation is acknowledged. It also
required the mock to stop on TERM (status 90), but the drain gives TERM a
fixed 20-tick (5 s) grace and then sends KILL. On a loaded CI runner the
grace ran out (subtest 8.24 s vs 0.55 s locally), the mock was killed
before its trap ran, and the test failed although the drain completed.

Require instead that the test process was started and is gone (status 91
already checks it is not alive). The graceful TERM path stays covered by
the execution-cancellation test (MOCK_TERM / TERM_ACK).

With a mock that ignores TERM (forcing the KILL escalation), the old test
fails all three subtests with PUBLICATION_CANCELLED 90; the new one passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fengttt
fengttt requested a review from XuPeng-SH as a code owner November 24, 2026 22:58
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 0439f0c77e4489fb1ade49a8f8bf586a48535857

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: 0439f0c77e4489fb1ade49a8f8bf586a48535857

Assessment: approve

The revised assertion accepts either graceful termination or KILL escalation while still checking that the mock started and its PID is gone before cancellation is acknowledged. The existing execution-cancellation and process-group tests retain the distinct graceful-TERM and descendant-drain coverage. No actionable defects remain in the assigned change.

Model: gpt-6.1-terra / max

Session: 01a20eeb-75f7-7401-b423-95568690acce · slot 1 · generation 7

Validation:

  • Private /tmp and loopback preflight passed (preflight.log; checks/1795565722760640960-2.json).

  • The changed publication-latch test, graceful execution-cancellation test and process-group escalation test passed in normal mode (focused-normal-retry.log; checks/1795565793919810567-2.json).

  • The exact changed test passed a race measurement and 18 race-enabled repetitions, including each of the three publication boundaries (focused-race-measure.jsonl and focused-race-stress.jsonl; checks/1795565946917377469-2.json and checks/1795566022940136860-2.json).

  • With a test-only overlay making the mock ignore TERM, all three candidate subtests passed after KILL escalation. The merge-base test with the same mock failed all three with status 90, as expected. The only changed source file was overlaid for the base control (resistant-probe.log, base-resistant-probe.log, probe-inputs.sha256; checks/1795565909389776171-2.json, checks/1795565945221604481-2.json, checks/1795566058259468633-2.json and checks/1795566065236788457-2.json).

  • The frozen CI snapshot records successful Ubuntu unit and Coverage jobs (evidence.json:eligibility_snapshot.statusCheckRollup). The diff passed git diff --check and all three discussion keys were reconciled (diff-check.log, discussion-check.log; checks/1795566065236940048-2.json and checks/1795566065249076464-2.json).

Limitations:

  • The full optools package was not rerun locally; the assessment reuses the frozen CI results for broader coverage. The author reports a separate Python 3.15-specific package failure also present on main, which was not independently reproduced.

  • The first local test invocation stopped before compilation because GOTOOLCHAIN=local selected Go 1.26.6. The required Go 1.27.1 toolchain was obtained in the assigned cache and the reported checks were rerun successfully.

@mergify mergify Bot added the queued label Nov 25, 2026
@mergify

mergify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as ca5325c at 01:33 UTC

1 h 9 min in the queue, 1 h 8 min of it CI.

So far

  • ✅ Entered the queue Wed 25 Nov, 00:23 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged 01:33 · ca5325c · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — 15c3b8a3 Deployed Nov 25, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants