Skip to content

Merge each push to a release line forward (forward.yml) - #543

Merged
afflom merged 10 commits into
release/v0.4from
ci/forward-merge-workflow
Nov 16, 2026
Merged

afflom merged 10 commits into
release/v0.4from
ci/forward-merge-workflow

Conversation

@afflom

@afflom afflom commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

This adds forward.yml, which carries each push to a release line into the next line automatically (SPEC.md §9.4). On a push to release/vX.Y, when release/vX.(Y+1) exists and doesn't already contain the pushed commit, .github/scripts/forward-merge.sh does the following:

  1. Cuts forward/vXY-to-vX(Y+1)-<head8> from the next line's head and merges the pushed head into it with a merge commit.
  2. Resolves conflicts in generated outputs only, by taking the next line's side: SPEC.md, the five projected model/ files, CONFORMANCE.md, ERRORS.md, Cargo.lock, lexlean.lock, expected/ oracles, tests/golden/*.txt, and tests/production-export/*/packages/. Regeneration writes those files again. Authored writer inputs are listed as conflicts like any other file. Examples are an export's roots.json and a measured row of tests/stack-bounds.json.
  3. If the pushed line has no spec/ directory, three-way merges its SPEC.md and model/ids.toml changes and carries them into the next line's modules with cargo xtask spec port --merged … --register ….
  4. Commits any other conflict, a hunk changed on both lines, a change to another model file, or a refused port as the next line's side. It then opens the PR as a draft listing those paths, to be finished by hand and pushed to regenerate/<name>.
  5. Otherwise opens the PR ready and calls regenerate.yml with branch set to the forward branch, so deliver commits the regenerated tree there and dispatches ci.yml.

If the workflow token isn't allowed to open PRs, the job summary shows a compare link instead, as cut.yml does. A newer push to the line cancels a merge job still in progress. Its concurrency group is forward-<line>, set on the job, so a newer push never cancels a caller's run. The older forward PR is closed and its branch deleted only if both of these hold:

  • the branch holds no commit beyond the next line and the pushed head except the bot's merge and the regeneration delivered on it;
  • the new PR actually opened.

Any other older forward PR stays open and is linked from the new one.

The change also updates SPEC.md §9.4 and the RP-14 case, which now checks the trigger, the concurrency setting, the call to regenerate and the key steps of the script. AGENTS.md and CHANGELOG.md are updated to match.

How this fits #519 and #468

End-to-end run of the real merge path

I ran the script unchanged in a separate clone against a local bare origin, with gh stubbed, so nothing reached GitHub and the shared clone's origin was never touched.

Setup

  • release/v0.4 was set to 0a9891ea, the real v0.4 head.
  • release/v0.5 was set to the v0.5 head 6c36829 plus Forward-merge release/v0.4 (0a9891ea) into release/v0.5 #541's spec port --register change.
  • Two throwaway older forward branches were added. forward/v04-to-v05-aaaaaaaa held only a bot merge commit. forward/v04-to-v05-bbbbbbbb held that merge plus a hand-authored commit on top.

Result: exit 0, clean=true

What the gate has to catch: the only tree differences from #541 are its CHANGELOG entry and #541's hand resolution of #498. Git merged #498's sha2 dependency into crates/lexlean/{Cargo.toml,build.rs} with no textual conflict, but v0.5 forbids that dependency (SL-05). The workflow cannot see a semantic conflict like this. It would open that PR ready, the gate would fail on SL-05, and the PR would need a hand repair before landing. So a ready forward PR is a candidate, not an acceptance.

Before this goes ready


Generated by Claude Code

github-actions Bot and others added 2 commits November 14, 2026 22:06
forward.yml merges every push to release/vX.Y into release/vX.(Y+1),
when that line exists, on forward/vXY-to-vX(Y+1)-<head8>, and opens the
pull request. Conflicts in generated projections and locks take the next
line's side and regenerate.yml, called with the branch named, writes
them again and dispatches the gate. While the line has no spec/, its
SPEC.md and register changes are carried into the next line's modules
by `cargo xtask spec port --merged --register`. Any other conflict is
committed as the next line's side and the pull request is a draft
naming the paths. A newer push cancels the run and closes the older
forward pull request. SPEC.md §9.4, RP-14, AGENTS.md, CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

P1 — Narrow generated-conflict classification in .github/scripts/forward-merge.sh:64. tests/production-export/* includes authored export requests such as bootstrap/roots.json. When both lines change those inputs, the script silently takes the next line's version and can mark the result clean/ready. Regeneration consumes those requests; it cannot reconstruct the ones discarded. Preserve authored-input conflicts as draft work and classify actual generated outputs narrowly. The retained#532 missing-root repair provides a concrete example of why this input matters.

P1 — Preserve unique work before superseding branches (script:154). The prefix-only loop closes older forward PRs with --delete-branch even when a draft contains manual conflict repairs not merged into the next line. The replacement starts from the next line plus the new source push, so it does not carry those repairs. The loop also runs when replacement PR creation failed. Keep owner-edited/unmerged branches and evidence until their unique changes have been carried or explicitly dispositioned; a newer source SHA alone is insufficient.

Source credit: explicit pushed SHA, merge-commit construction, unresolved-path draft reporting, reuse of the existing regeneration workflow and no auto-merge remain. The real merge path is untested per the body; source-string checks are not end-to-end evidence. Reconcile the existing#519 control owner and required#468 factory integration, and retain#541's STOP hold. No script, test, writer or CI action was run. Receipt pr543-forward-source-review/receipt.json; its repository-spelling finding is excluded because Actions expression string equality is case-insensitive.

@afflom afflom mentioned this pull request Nov 14, 2026
Review of #543 (two P1s):

- A conflict takes the next line's side only in what a writer or
  `cargo metadata` writes: the projections, CONFORMANCE.md, ERRORS.md, the
  locks, `expected/` oracles, the golden files and the packages under
  `tests/production-export/*/packages/`. An export's `roots.json` and a
  measured row of `tests/stack-bounds.json` are authored writer inputs, so
  their conflict is listed and opens a draft.
- An older forward pull request is closed, with its branch, only when the
  branch holds no commit beyond the next line and the pushed head but the
  bot's merge and the regeneration delivered on it, and only once the new
  pull request is open. Any other is left open and linked from the new one.

`forward.yml` also takes a `workflow_call` with the line, since a merge made
with the workflow token (#519's `land`) starts no push run, and its
concurrency moves to the merge job so a newer push never cancels a caller's
run. SPEC.md §9.4, CHANGELOG.md and the RP-14 case follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX

afflom commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Both P1s are fixed in c3cb736.

  • Generated-conflict class. The script now takes the next line's side only for files a writer or cargo metadata writes: the projections, CONFORMANCE.md, ERRORS.md, the locks, expected/ oracles, tests/golden/*.txt and tests/production-export/*/packages/. A conflict in roots.json, in tests/stack-bounds.json, or in any other authored writer input is listed and opens a draft. RP-14 now fails if the broad tests/production-export/* or tests/stack-bounds.json patterns come back.
  • Superseding. An older forward PR is closed, and its branch deleted, only when its branch holds no commit beyond the next line and the pushed head except the bot's merge and its delivered regeneration. It is also closed only after the replacement PR has opened. Any other older forward PR stays open and is named in the new PR's body.

I also changed two things this raised:

The PR body explains how this fits #519 and #468. It also records one end-to-end run of the real merge path, done in a separate clone against a local origin. That run produced the same spec/, SPEC.md and model/ as #541's hand merge. It also showed the limit: #498's sha2 merges with no textual conflict and only the gate catches it, so a ready forward PR is a candidate, not an acceptance. #541 stays held, and this PR stays a draft until its CI passes.


Generated by Claude Code

Takes #535's Intel rules of SPEC.md §9.4 and its changelog entry beside
the forward-merge text; the RP-14 sentence keeps both the push triggers
of ci.yml and reproducibility.yml and the forward merge's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX
@afflom
afflom marked this pull request as ready for review November 14, 2026 23:30

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Bounded source follow-up at b1fcf7c: both original P1 repairs are credited. The classifier now preserves authored roots.json/stack-bounds conflicts for manual resolution, ordinary unique manual commits keep their older PR open, and replacement-PR creation failure clears the closure list. No producer or completed gate was repeated.

Remaining P2 — .github/scripts/forward-merge.sh:185–187: deletion is not bound to the old head inspected at lines148–155. An owner can push a manual repair after that fetch/classification and before replacement creation/closure; gh pr close --delete-branch then deletes the moved branch although its new commit was never inspected or carried. Preserve a branch whose head moved, and bind any deletion to the inspected SHA (an expected-head lease), retaining the PR when preservation fails.

The workflow_call path addresses token-triggered landings, with caller integration still belonging to #519. Moving concurrency onto the merge job avoids canceling the caller, but prior regeneration can continue because distinct merge SHAs have different regenerate concurrency groups. Coordinate the existing producers and their output disposition; this is not evidence that a second identical-input run is needed or that cross-run acceptance is valid. #468 remains required.

The local clone/stubbed-gh account remains owner-reported evidence; the new RP-14 string assertions do not cover concurrent head movement. This is source review, not final-head acceptance. #541's stopped #431 dependency remains held.

The head each candidate had when the run read it is recorded, and its
branch is deleted with --force-with-lease to that head, so a push since
then refuses the delete. The older pull request is closed only after
the delete succeeded; one whose branch moved or whose delete failed
stays open with its branch and is named on the new pull request.
SPEC.md §9.4 says so and RP-14 asserts the lease.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX

afflom commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Fixed the P2 in 3dadb24.

  • What the lease covers: the script records each candidate's head SHA when it inspects it.
  • Delete: it deletes the branch with git push --force-with-lease="refs/heads/$ref:$sha" origin ":refs/heads/$ref". If anyone pushed to the branch after that inspection, the delete is refused.
  • Close: the older PR is closed only after the delete succeeds.
  • Moved head or failed delete: the PR and its branch stay open, and they are named on the new PR in a comment and in the step summary.
  • Spec and test: SPEC.md §9.4 now says this, and RP-14 asserts the lease.
  • Checked locally: cargo fmt --check and cargo check -p repo-conformance --tests both pass. The full gate restarts on the new head.

Generated by Claude Code

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Source follow-up at 2c39d3b: the inspected-head deletion P2 is resolved. The script carries the fetched SHA into an explicit deletion lease, leaves the branch/PR when deletion fails, and closes the older PR only after successful deletion. Both earlier authored-input/manual-work repairs remain credited; no new blocker found in this three-file delta.

No completed check or producer was repeated. RP-14's string assertions and owner-reported checks are not a concurrent behavioral run or final-head acceptance. #519 caller integration, scheduling of producers across distinct forward heads, #468 model integration, and #541's stopped #431 dependency remain separate obligations.

Carries #519 (a cut lands, tags, publishes and reaches main with no
hand step). SPEC.md §9.4 keeps both the forward-merge paragraph and
#519's cutting paragraph; AGENTS.md keeps #519's cut text and the
forward.yml sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3M8ULnzEQwLLngyBBX

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Bounded integration follow-up at03d67: the six incoming release-control source blobs match the already-reviewed #519 control source. The forward workflow/script and prior authored-input, manual-work and deletion-lease repairs remain unchanged. No new source blocker found in this delta; no completed checks were repeated.

Concrete remaining integration: the carried cut.yml still has no post-land call to forward.yml. Its workflow-token landing does not emit the push event that would invoke forwarding, so accepting workflow_call alone does not deliver the automatic cut-to-next-line path. #519 has now landed; the existing cut/forward owner should wire that caller in the coordinated change, or explicitly track the remaining delivery slice before claiming that path complete. Preserve exact-head gate/actual-tree checks and the existing regeneration owner.

Final-head CI/repro remain incomplete at this review. Distinct-head producer coordination, #468 model-controlled routing and #541's stopped #431 dependency are unchanged; no stopped source/runtime adoption or new producer is admitted.

afflom commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

The cut.yml caller is tracked and will land as its own change once #543 merges. The plan is a forward job after land that calls forward.yml with line: needs.land.outputs.line, owned by the #519 release-automation lane. Until that lands, the next push to the line carries a self-landed cut forward.


Generated by Claude Code

github-actions Bot and others added 2 commits November 15, 2026 06:43
@afflom
afflom merged commit 0541025 into release/v0.4 Nov 16, 2026
75 checks passed
@afflom
afflom deleted the ci/forward-merge-workflow branch November 16, 2026 08:21

afflom commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

Merged after the gate on 1f4edb6 went all-green: CI 43807856651 and repro 43807856588. The merge commit's tree equals the gated head tree.


Generated by Claude Code

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

External landing 0541025 has the same tree as reviewed 1f4edb6 and plan-checked synthetic c2823e1: tree 9132e02d, with actual parents dfc179 + 1f4. CI 43807856651 attempt 1 completed 71 successful jobs / 831 successful steps, with three Intel jobs skipped; repro 43807856588 passed one job / seven steps. This credits the selected gate and actual-tree equality, not full-platform acceptance.

The first actual forward run 43830530487 failed in merge job 133174514776: after conflict reporting, Git refused to create .git/index.lock at 08:24:57Z and exited 128. Regeneration was skipped. The retained log establishes this immediate blocker, but not the lock's owner, whether it was stale, or the underlying cause.

The existing #405/forward owner retains the next step: establish the index lifecycle and any concurrent Git writer before deciding how to continue. No automatic retry, lock removal or competing forward operation is requested. The cut-caller slice, #468 integration, #541/#431/old TC-03 STOP and all #316 boundaries remain unchanged.

Receipt: /workspace/work/pr543-0541-actual-forward-review-20261116.json; SHA256 800ba8617109a58c809ad39e5e320ab04c9355cf8c7815571d02af1153c2b712.

humuhumu33 added a commit that referenced this pull request Nov 16, 2026
…arrays branch

PF-26 and the arrays both move the language-1.2 identity from the 0.4.3 base;
the combined tree's ID, b78cb38d…, replaces each side's in the constant, the
locks and the records, and the register is 499 IDs: PF-26 joined the line as
its 498th, SM-39 is the 499th. A conflicted generated projection takes the
line's side, and one only this branch named is dropped, for regeneration to
write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The new actual v0.4 push2e1ff2f5 repeats the forward-delivery failure: run43871322204/job133312966008 reaches merge conflicts, then fails at13:01:08Z with .git/index.lock already present and exit128. Regeneration is skipped. This is a second preserved occurrence after0541/run43830530487, not a successful forward landing.

One concrete place for the existing forward owner to inspect is .github/scripts/forward-merge.sh: the conflict loop consumes git diff --name-only --diff-filter=U through process substitution while running index-writing git checkout/git rm. That is a source-level overlap candidate, not a proven diagnosis—the log does not identify the lock holder or failing command. Establish that lifecycle and serialize any overlapping index access in the existing lane; do not blindly remove the lock or repeat the writer. Keep the required merge history and #431/oldTC03/#541 STOP disposition separate.

New log preserved once at /workspace/work/pr493-forward-job133312966008-20261116.log, SHA256 b40a0a7f94a626816f3e947bdbbf121c55e93b6fa9a4802435c637adc31f3597. No cleanup, execution, retry or competing patch was performed.

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