Repository navigation
fix(ci): ship the corrected org-wide auto-merge engine - #12
Conversation
The auto-merge workflow had never succeeded once: no actions/checkout (gh pr merge dies 'not a git repository'), the tag computed from a future merge SHA via git log (422), an immediate exit on any pending check instead of waiting, and no CHANGELOG placeholder finalization. Add checkout@v7, compute the tag from the merge commit's committer date via the API, wait for ALL status checks to settle and verify green (success/skipped/neutral only) before merging, and finalize the CHANGELOG placeholder to the merge stamp (git mv + H1 rewrite, staged as git add <new> so the rename's deletion side survives). Logic proven against a stub gh across seven decision paths before landing. Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
Review — BLOCKHead SHA: Change class: ci/config — a workflow file ( Security screen: PASS. No scope mismatch (diff matches the described four-defect fix), no secrets/exfiltration (uses standard Blocks
Non-blocking notes (no action required)
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff matches the described four-defect fix), no secrets/exfiltration (standard Checklist: All applicable rules PASS or NA.
Comment intake: Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
- reject commit-status error state (not just failure) in verify_all_green - concurrency group keyed on PR head branch serializes runs (re-entrancy) - shared ensure_tag helper (already-closed + post-merge paths cannot drift) - remove direct-squash fallback: auto-merge is the only merge path Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
Review — BLOCKHead SHA: Change class: ci/config — workflow file ( Security screen: PASS — no secrets/exfiltration (standard Blocks
Comment intake
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no secrets/exfiltration (standard Checklist: All applicable rules PASS or NA.
Comment intake:
Non-blocking note: the stub- Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff = workflow + CHANGELOG, both accounted for in the body), no secrets/exfiltration (standard Checklist: All applicable rules PASS or NA.
Comment intake:
Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
…ists The final paragraph still listed a 'merge-fail fallback' as a proven scenario, contradicting the same entry's item 3 (the direct-squash fallback was removed). The proven scenario is auto-merge-enable failure (exit 1, no fallback). Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff = workflow + CHANGELOG, both accounted for in the body), no secrets/exfiltration (standard Checklist: All applicable rules PASS or NA.
Comment intake:
Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Bring this repo's auto-merge to the byte-identical corrected workflow proven on distro-fedora main: waits for EVERY status check green, re-runs the validator via the API when a GITHUB_TOKEN push leaves it action_required, finalizes the CHANGELOG idempotently, reconciles the PR body before the re-run (A1), merges only via GitHub auto-merge, and mints the release tag on the merged HEAD. Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff = workflow + CHANGELOG, both accounted for in the body), no secrets/exfiltration (standard Checklist: All applicable rules PASS or NA.
Comment intake: all five Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
…Ver) Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (workflow rewrite + CHANGELOG, both accounted for), no secrets beyond Checklist: All applicable rules PASS or NA (body complete incl. rule-compliance section + Comment intake (all prior Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
fix(ci): ship the corrected org-wide auto-merge engine
The
auto-mergeworkflow (byte-identical across all 13 opencharly repos) hadnever succeeded once. The corrected engine proven live on distro-fedora main
is now shipped to this repo's
main.The defects the corrected engine fixes
actions/checkout— theworkflow_runtrigger checks out nothing, butgh pr mergerunsgit statusagainst a local repo → every merge died withfailed to run git: fatal: not a git repository(observed live).git log -1 "$MS"on a merge-commit SHA the clone does not have → emptyversion → tag POST 422.
in_progresscheck aborted the runinstead of waiting.
release tag could disagree.
The corrected engine
actions/checkout@v7(fetch-depth: 0) sogh pr mergehas a git repo.wait_all_settled()polls check-runs + commit statuses until every checkcompletes;
verify_all_green()accepts onlysuccess/skipped/neutralcheck conclusions and rejects any combined commit-status state other than
success— the auto-merge runs only once ALL status checks are green,on both the initial head and the post-finalization revalidation head.
local
git log.ensure_tag()mints add-only with a local-refexistence check (
git rev-parse -q --verify refs/tags/$ver) — the priorguard read
gh api …/git/refs/tagswhose 404 response body writes to stdoutand always reads as non-empty, so every tag silently existed and was never
minted (observed live: PR merged, never tagged).
tag_ver()): the sdk contract repo tags under itsGo-module scheme
v0.<YYYYDDD>.<HHMM with all leading zeros stripped>— theplain
v<YYYY.DDD.HHMM>is not a valid Go module version (semver forbids aleading-zero segment; a major ≥ 2 would force a
/vNmodule-path suffix thatbreaks every
import github.com/opencharly/sdk). Mandatory, not anexemption. Inert on every non-sdk repo.
git mvplaceholder → merge stamp + H1 rewrite +auto-merge-finalizedmarker, push, re-validate the new head, then merge. Finalization is
idempotent via a DIRECT blob-read of the head's file for the marker
(the earlier
git log | grephistory-text proxy never evaluated true on aGitHub runner and re-finalized a stamp; the blob read tests the actual
invariant). The PR body is reconciled with an
auto-merge-finalization-notemarker BEFORE the re-run so a body still naming the placeholder does not
block the re-validation.
secrets.GITHUB_TOKEN— GitHub does not dispatch
pull_requestjobs for GITHUB_TOKEN pushes, sothe validator run it triggers ends
action_requiredwith 0 jobs. The enginere-runs the validator via
POST /actions/runs/{id}/rerun(needsactions: write) and waits for its check-run on the new head. Fullyautomatic, no secret beyond GITHUB_TOKEN.
gh pr merge --squash --auto:GitHub atomically re-checks branch protection before landing. There is
deliberately NO direct-squash fallback (a direct merge could land a head that
changed after the green verdict). A failure fails the run loudly, PR left open.
concurrency:group keyed on the PR head branch serializes runs per PR(new runs queue, never cancel), so the finalize push cannot cause overlapping
runs to rename the CHANGELOG repeatedly or merge a head still being
re-validated.
timeout-minutes: 60caps the job.How validated
The workflow logic was proven against a stub
gh+ a real local git repobefore landing: the harness runs the exact run block extracted from this
workflow (template vars substituted) with a stub
ghthat records every call,against a fresh git repo per scenario. Final run: 102 passed, 0 failed.
Scenario map (23 scenarios):
(exit 1, no merge) · s3b commit-status
errorabort · s4 already-closedidempotent tag · s4b tag-already-exists reported, not re-created · s5
same-repo CHANGELOG finalize (rename, revalidate, merge, tag) · s6
A-status narrowing (a modified CHANGELOG is not renamed) · s7 placeholderalready at stamp (skips finalize) · s8 auto-merge enable failure (no
direct-squash fallback) · s9 fork PR (skips finalize) · the wait/verify
re-validation paths · the GITHUB_TOKEN action_required API re-run ·
the local-ref tag existence check (404-body bug: s4b proves the already-exists
path, s19/s20 the mint/concurrent-mint paths) · s21/s22/s23 the sdk
tag-scheme guard (
v0.2026232.733from stamp2026.232.0733; the v0. formon a merged HEAD; tag-already-exists).
Change class
ci/config — a workflow file + its CHANGELOG entry. No code, no candies, no
beds. The R10 for a workflow change is the live run of the workflow itself,
which can only happen after this lands on
main; the stub-gh proof above isthe pre-landing gate.
Project-rulebook rule-compliance
against a stub
gh(RDD), not a skill lookup.ensure_tag+tag_verfor the tag logic.exposes no event/sync primitive for check completion), not a race workaround.
of the removed
git log -1 "$MS"pattern live inCHANGELOG/.main; PR-only landing.executes after this lands on
main; the stub-gh proof of all decision pathsis the pre-landing gate (documented above).
sdk tag-scheme conversion) was proven against a stub
ghbefore landing.Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)