Skip to content

fix: split docker-build.yml concurrency group by event_name to eliminate push/pull_request race - #1239

Merged
Wikid82 merged 2 commits into
mainfrom
fix/docker-build-concurrency-group-split
Aug 11, 2026
Merged

fix: split docker-build.yml concurrency group by event_name to eliminate push/pull_request race#1239
Wikid82 merged 2 commits into
mainfrom
fix/docker-build-concurrency-group-split

Conversation

@Wikid82

@Wikid82 Wikid82 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #1235.

Why (production incident)

#1236 added a job-level if: skip so a pull_request run for a main/development-head PR self-resolves to a clean skipped conclusion instead of a misleading cancelled red X. But that fix can only clean up the reported status of whichever run loses the concurrency slot — GitHub decides which run to cancel at workflow-run registration time, before any job's if: is evaluated, so it cannot influence which run wins.

This was proven in production within minutes of #1236 merging to main (merge commit 6ed08db3):

Run ID Event Conclusion Created
31429516203 push cancelled 2026-08-10T20:32:22Z
31429519329 pull_request skipped 2026-08-10T20:32:24Z

The push run — the one supposed to do the real build — was cancelled, not the pull_request run. Net effect: zero real builds for the commit that landed on main, and the published image tag went stale until a manual workflow_dispatch rebuild was run as a stopgap.

Research summary (full detail in docs/plans/current_spec.md §3)

Before merging this, every workflow that consumes docker-build.yml's workflow_run completion event was re-checked, since splitting the concurrency group means each race commit now produces two workflow_run completion events instead of (at best) one — one from push (real build outcome) and one from pull_request (always skipped, structurally guaranteed by #1236's unchanged job-level gate).

Verdict: safe to change only this file. All nine workflow_run: workflows: ["Docker Build, Publish & Test"] consumers were read in full:

# File Gate Verdict
1 auto-changelog.yml conclusion == 'success' Safe
2 auto-versioning.yml conclusion == 'success' Safe
3 docs-to-issues.yml conclusion == 'success' Safe
4 docs.yml (build) conclusion == 'success' Safe. (deploy job has a pre-existing, unrelated gap — not caused/worsened by this PR — tracked separately as #1237)
5 dry-run-history-rewrite.yml conclusion == 'success' Safe
6 history-rewrite-tests.yml conclusion == 'success' Safe
7 propagate-changes.yml conclusion == 'success' Safe
8 security-pr.yml event == 'pull_request' && conclusion == 'success' Safe (double-gated)
9 supply-chain-verify.yml excludes any workflow_run.event == 'pull_request' outright Safe (most explicit)

Every consumer gates on conclusion == 'success' (directly or transitively), and the pull_request-sourced race event is structurally guaranteed to conclude skipped — so none of the nine treat it as actionable. No other file requires a change.

Also confirmed:

  • fix: skip redundant pull_request docker-build run for main/development-head PRs #1236's job-level skip (setup job if:, unchanged by this PR) gates purely on event_name/head_ref, not on concurrency grouping — so it continues to correctly prevent a redundant real build on the pull_request side regardless of which group it's in.
  • scan-pr-image's if: depends only on intra-run needs: outputs, never on the concurrency group.
  • No branch protection or ruleset on main/development depends on docker-build.yml reporting exactly one conclusion per commit (verified live via gh api repos/Wikid82/Charon/branches/main/protection → 404, and the one active ruleset has no required_status_checks rule).

Follow-up issues filed

Validation

  • actionlint .github/workflows/docker-build.yml — zero errors
  • actionlint .github/workflows/*.yml — zero errors (full-directory check, since actionlint validates cross-file workflow_run references)
  • lefthook run pre-commit — zero errors (all fast hooks, including actionlint and semgrep)
  • Manual diff review — confirmed only the group: line and the one comment block changed, nothing else in the 1340-line file
  • Live: this PR's own pull_request run watched end-to-end on the feature branch head (see PR checks) — confirms the new concurrency group value doesn't break an ordinary feature-branch PR run
  • Not achievable pre-merge: a true simultaneous push + pull_request race against main/development requires either unsafely pushing directly to a real production branch, or standing up disproportionate scratch infrastructure — both explicitly rejected. Full confirmation deferred to Post-merge monitoring: verify docker-build.yml push/pull_request race is actually eliminated (GH #1235 follow-up) #1238 (next organic race event, checked via gh run list --workflow=docker-build.yml).

Do not merge yet — pending final review.

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

✅ Supply Chain Verification Results

PASSED

📦 SBOM Summary

  • Components: 1495

🔍 Vulnerability Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 5
🟢 Low 2
Total 14

📎 Artifacts

  • SBOM (CycloneDX JSON) and Grype results available in workflow artifacts

Generated by Supply Chain Verification workflow • View Details

@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@Wikid82 Wikid82 closed this Aug 10, 2026
@Wikid82 Wikid82 reopened this Aug 10, 2026
… CI comment

docker-build.yml's new "See GH #1235 / docs/plans/current_spec.md for the
full rationale" comment (added by this PR) pointed to a plan that only ever
existed uncommitted, locally stashed on this branch — docs/plans/current_spec.md
is shared scratch state and has since been overwritten by an unrelated plan
on every branch, so the comment's cross-reference resolved to the wrong
document. Recovers the #1235 plan from that stash and commits it permanently
under docs/plans/archive/, per this repo's established convention (e.g.
b23e449, 6562a64) of preserving finalized plans there once current_spec.md
moves on to the next piece of work.
@Wikid82
Wikid82 merged commit 67b4f2d into main Aug 11, 2026
46 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants