Repository navigation
ci: cancel superseded pull request validation runs - #69
Conversation
## What's going on (plain English) A newer commit makes the old pull request build obsolete. Stop that old build while keeping each workflow isolated from the others.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe standard CI and Unslop workflows now cancel superseded runs within the same pull request or run group. A new contract test validates group resolution, workflow integrity, and test-runner selection. ChangesWorkflow concurrency controls
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🔵 Low · up to CI and Unslop validation now cancel superseded pull-request runs while keeping unrelated workflows and non-pull-request runs independent. The change is mergeable with owner awareness that required-check results after cancellation and replacement should be validated on a live pull request. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Add the changed-code Unslop ratchet for pushes and pull requests. Expose portable serial shard estimates and fail when their modeled work approaches the root's CI cap. Refs #6 Refs #23 Refs #69 ## What I walked I used scratch home `/Users/evanagee/.treehouse/firstmate-df5ff1/11/firstmate/.fm-c7-walk.qZO8LO/home` and a scratch Git repository beneath the same run directory. `FM_HOME="$walk_home" BASE_SHA="$base_sha" HEAD_SHA="$head_sha" RUNNER_TEMP="$walk_runner" GITHUB_OUTPUT="$walk_root/github-output" bash "$walk_root/find.sh"` Output: Supported code changed; unslop will run. `FM_HOME="$walk_home" npm_config_prefix="$walk_home/npm" PATH="$walk_home/npm/bin:$PATH" bash "$walk_root/install.sh"` Output: added 4 packages in 3s unslop 0.1.7 Version: 1.50.0 `FM_HOME="$walk_home" PATH="$walk_home/npm/bin:$PATH" BASE_SHA="$base_sha" HEAD_SHA="$head_sha" RUNNER_TEMP="$walk_runner" GITHUB_WORKSPACE="$walk_repo" bash "$walk_root/gate.sh"` Output: Scanning 1 changed code file(s): ./src/math.ts Findings in changed files at head (all severities): [] No newly introduced error-tier gateable findings; pre-existing findings stay report-only. `actionlint -no-color -shellcheck= -pyflakes= .github/workflows/unslop.yml` exited 0. `bin/fm-test-run.sh --check-coverage` Output: FM_TEST_COVERAGE ok total=236 parallel=24 parallel_max_ms=417163 parallel_imbalance_ms=2894 parallel_unhinted=0 serial=196 serial_shards=9 serial_unhinted=20 herdr=16 `bin/fm-test-run.sh --serial-shard-budget` Output: FM_TEST_SERIAL_BUDGET shard=1of9 estimated_ms=703017 FM_TEST_SERIAL_BUDGET shard=2of9 estimated_ms=703010 FM_TEST_SERIAL_BUDGET shard=3of9 estimated_ms=703027 FM_TEST_SERIAL_BUDGET shard=4of9 estimated_ms=703027 FM_TEST_SERIAL_BUDGET shard=5of9 estimated_ms=703028 FM_TEST_SERIAL_BUDGET shard=6of9 estimated_ms=703008 FM_TEST_SERIAL_BUDGET shard=7of9 estimated_ms=703017 FM_TEST_SERIAL_BUDGET shard=8of9 estimated_ms=703010 FM_TEST_SERIAL_BUDGET shard=9of9 estimated_ms=703035 `PATH="$PWD/.fm-c7-tools:$PATH" bin/fm-test-run.sh --lane portable-parallel-1 --fail-on-gate-skip 'Pi extension typecheck prerequisite not found'` Output: FM_TEST_SUMMARY total=11 failed=0 skipped_gate=0 duration_ms=1240073 After rebasing onto the latest `origin/c/main`, I reran the runner, Unslop workflow, CI policy, and captain-hold fixture tests individually. All four passed. The changed Unslop test also passed inside `portable-serial-7of9`; that lane retained only the documented macOS baseline failures in `fm-remote-herdr-guard.test.sh` and `fm-documentation-audiences.test.sh`. The changed captain-hold fixture passed inside `portable-parallel-2`; that lane retained the documented root baseline failure in `fm-arm-pretool-check.test.sh`. The GitHub-hosted workflow run remains proven only by the `c/main` CI run after Firstmate lands this branch. ## Port record The root already had two portable parallel lanes, nine portable serial shards, the Herdr family, matrix-to-runner coverage checks, finite timeout tiers, and pull-request supersession that preserves every main push. I adopted the root's job names, nine-shard count, current timing hints, 30-minute normal-job cap, and event-specific concurrency policy. I ported the changed-code Unslop ratchet, including renamed-file baselines and push event refs, plus the serial budget report and cap guard. I dropped the fork's eight-shard layout, 15-minute serial cap, and unconditional cancellation spelling because the root's current layout and push-preserving policy are newer. After C4 landed, I adapted the captain-hold merge fixture to its required review-thread read by returning the root's zero-thread response. The separate preceding commit repairs the pre-existing SC1010 baseline in the captain-hold fixture, as approved outside C7's scope.
Intent
Stop old builds from running against code nobody will ship. Add GitHub Actions concurrency cancellation to Firstmate pull-request validation workflows. Use github.workflow plus github.head_ref, with github.run_id as the fallback, so only a newer run of the same workflow on the same branch cancels the older run and push, schedule, or manual events remain independent. Do not change what any check does or which checks are required. Do not add cancellation to deployment or release workflows. Leave risky workflows alone and list them in the pull-request body. Preserve the specialized no-mistakes-required body-event grouping because it protects opened and edited events. Acceptance requires proof on a real pull request that a second commit cancels a still-running older run, proof that a mixed-event workflow fallback still runs, and proof that unrelated workflows do not share groups.
What Changed
no-mistakes-required.ymlandwindows-herdr-spike.ymlunchanged, preserving the body-event grouping and manual Windows automation workflow.Risk Assessment
✅ Low: Captain, the change is limited to two validation workflows, keeps unrelated events independent, and leaves the specialized no-mistakes grouping unchanged.
Testing
No baseline commands were supplied. The focused regression failed against the base and passed against the target, proving same-PR grouping, independent non-PR fallbacks, unrelated workflow isolation, and unchanged workflow behavior outside concurrency. The runner test also passed. Evidence logs were captured, but no screenshot or live cancellation artifact was possible because no pull request or Actions run exists yet.
Evidence: Concurrency behavior transcript
Source: Concurrency behavior transcript
Evidence: Live GitHub availability check
Source: Live GitHub availability check
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
.github/workflows/ci.yml:13- The criterion says “only a newer run of the same workflow on the same branch cancels the older run,” butgithub.head_refcontains only the short branch name. Two contributors usingpatch-1in separate forks both computeCI-patch-1, so the newer run cancels the unrelated pull request’s checks. The same collision exists in.github/workflows/unslop.yml:11. If fork isolation is required, include the pull request head repository identity while retaining the workflow, head-ref, and run-ID fallback behavior.🔧 Fix: Captain, isolate validation concurrency groups by fork
1 error still open:
.github/workflows/ci.yml:13- GitHub treats concurrency groups as case-insensitive, while branch names may differ by case. Pull requests from the same repository onFeatureandfeaturetherefore share a group, allowing one PR to cancel the other's checks. This violates the requirement that only runs from the same branch cancel each other. Add the pull request number, withgithub.run_idas its non-PR fallback, as another group component in both workflows while retaining the required workflow, repository, and branch components. GitHub concurrency documentation and branch-name guidance confirm the conflicting case behavior. The same defect appears in.github/workflows/unslop.yml:11.🔧 Fix: Captain, use PR numbers for case-safe validation concurrency
✅ Re-checked - no issues remain.
git archive 494c72d039a3161b6a2985ba94d99171f88a8789 .github/workflows | tar -x -C /tmp/fm-workflow-concurrency-01M1C0T2MQFS6RYYXA02QHY5CAbash tests/fm-workflow-concurrency.test.sh /tmp/fm-workflow-concurrency-01M1C0T2MQFS6RYYXA02QHY5CA/.github/workflows(expected base failure)bash tests/fm-workflow-concurrency.test.sh .github/workflows /tmp/fm-workflow-concurrency-01M1C0T2MQFS6RYYXA02QHY5CA/.github/workflowsbin/fm-test-run.sh tests/fm-workflow-concurrency.test.shbin/fm-test-run.sh tests/fm-test-run.test.shgh-axi pr list --head fm/fm-cancel-superseded-ci --state all --limit 20gh-axi run list --commit df3c8592d35671a2d38ee3b4a8b96a67fa7eae3f --limit 20gh-axi run list --branch fm/fm-cancel-superseded-ci --limit 20✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Summary by CodeRabbit
CI Improvements
Tests