Skip to content

Phase 6f: status, resume, the merge gate and the release - #1958

Merged
neuromechanist merged 17 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1912-phase6f-gates-merge
Oct 25, 2026
Merged

neuromechanist merged 17 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1912-phase6f-gates-merge

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Builds the gates, resume and merge of a re-pull through released (ADR 0111, dated 2026-10-25 for this slice). nemar admin repull status reports a record and what it waits on; nemar admin repull resume carries a record from where it stopped through released, re-synthesizing the release commit onto a moved main and handling a pull request merged while it was still pr_open. nemar admin repull merge is the one merge gate, shared with nemar admin pr-reviews: it checks the head, the screen, the review, the trailers and the cap, merges with the head's sha, and writes the squash message's two trailers as its last paragraph. The release records the locked object count and locks the copied objects; a lock that fails leaves the record resumable. A claim whose pull request is still open for thirty minutes is expired only when GitHub confirms it is not merged. Nothing here sends mail.

Phase 6f of epic #1046, part of #1912 (which stays open until 6g). It builds on 6a to 6e. The N.0.1 replay, abandon and supersede are 6g.

What is in it

  • Worker side: shared/repull-state.ts (the new edges and their words), backend/src/services/upstream-repull.ts, upstream-repull-verified.ts (the verified merged route, the expired release, the released count), and the resume routes with their tests.
  • CLI side: the status and resume commands and their helpers, the single gate in src/lib/repull/merge.ts, the trailer check in trailers.ts, the release and the object lock, and the pr-reviews approve --merge path delegated to the gate.
  • Test stand-ins: a GitHub stand-in with the merge, pull request and tag reads, an S3 stand-in that answers PutObjectRetention, and the shared fixture repull-pr-world.ts.
  • ADR 0111 slice for 6f, with dated annotations on earlier sentences, and the ADR 0093 line in AGENTS.md.

Owner notes

  • A failed row that holds a claim stays unreconciled and the dataset stays blocked; no 6f path writes failed.
  • "Orphan objects are locked" in the ADR is true only once a later release locks the whole prefix.

Test plan

  • Typecheck and lint clean.
  • Full bun test on the implementer's run: 20642 pass, 242 skip, 8 fail. Six were its own test headers and one API export pin, now fixed; the other two are the website parity test against a drifted sibling checkout and a route-skew test that passes alone.
  • The 6f suites: 126 pass; the backend re-pull suites: 483 pass.
  • Mutation log: 23 mutants, all killed.
  • CI on this head (the lead runs the Tests workflow).
  • Only a canary or the production runs can check: that GitHub refuses a moved head when given sha (409); its mergeable_state words and how fast head.sha follows a push; that a leased force push to a release branch is accepted; that the dataset workflows tag a squash-merged re-pull the way they tag other merges; that the tag read resolves an annotated tag; that the real bucket answers PutObjectRetention on copied objects (the existing s3-lock route counts a 403 as already locked).

The verified merge route records a pull request found merged while
the row is pr_open (outside the tools, at an unscreened head); merged
repeats to record why the release is not recorded yet; every step past
prepared that keeps a record open re-reads the dataset fences; a
released N.0.0 must record its locked objects before complete or N.0.1
(lock-unrecorded), and the released self-edge carries the count or the
lock's error; a stuck claim expires (outcome expired) once 30 minutes
old and GitHub says it did not merge.

Tested: backend/test/upstream-repull* and the state unit test pass;
seven mutants of the new guards each fail a test.
resume takes an open re-pull past its pull request: a merge found on
GitHub is recorded through the verified route, a closed one ends the
record abandoned, a head moved by enrichment is recorded and any other
is head-foreign, main must be the base or moved by enrichment only
(re-synthesized onto it with a lease when GitHub says dirty or behind),
the identifier screen is dispatched and acknowledged when asked, and
gates_clear is recorded once it passes and GitHub says clean. A held
claim is resolved from GitHub and expires once old enough. status shows
the record, its screens and the next command. Never merges.

Tested: test/repull-gates-cli.test.ts (14 pass) against a re-pull
executed to pr_open by the real execute; pr-review-approve tests pass.
nemar admin repull merge <id> merges a gates_clear re-pull only after
reading, before anything is written: the open pull request at the
screened head, main moved by enrichment only, the automated review of
that head (failed, running or unread needs --force), the identifier
screen, GitHub clean, and a squash message whose last paragraph is the
commit's two trailers as git reads them. Then it confirms (one DOI),
claims a unit of the daily cap, squash-merges at the screened sha, and
records the merge; a held claim is reused, a lost answer keeps it. The
pull request body and the execute help now name resume and merge.

Tested: test/repull-merge-cli.test.ts (10 pass), the trailers unit
test, the command-text test and the execute CLI suite.
approve --merge and y in next ask, for a release/* pull request,
whether a re-pull record names it; a re-pull's pull request runs the
re-pull gate's checks before the approval is written (a refusal writes
nothing), is squash-merged by the gate after it (claim, sha, trailers,
record), and an explicit --method other than squash is refused. A NEMAR
API that cannot say refuses the merge; an ordinary release pull request
is merged as before.

Tested: test/admin-pr-reviews-repull.test.ts (6 pass) and the existing
admin-pr-reviews CLI suite.
From merged, resume waits (bounded) for the v<N.0.0> tag on origin and
the version row, verifies the tagged tree against the synthesized one
outside .nemar/ and .github/, and records the release through the
Worker's verified route (lineage only when verified; the sweep stamps
are re-armed there). Then it locks the dataset's objects through the
existing s3-lock route, records the count only when every object was
locked (else the error, and the row stays released for the next run),
and completes a record with no corrections. The object lock batch
honors the test-only S3 endpoint override; the S3 stand-in answers
PutObjectRetention.

Tested: test/repull-release-cli.test.ts (5 pass) through the real
s3-lock route against the S3 stand-in.
Append the Phase 6f slice: resume past the pull request, the
re-synthesis onto a moved main, the merge gate shared by repull merge
and pr-reviews, a stuck claim's expiry, the fences on every step past
prepared, the release and the lock, and what only stand-ins answered;
annotate the earlier sentences it builds. AGENTS.md's ADR 0093 line
names the re-pull's one gate, as decision 7 asks.

Tested: the ADR index and docs link tests pass.
The scratch repository that reads origin is now per purpose and per
process (repull/<id>/{resume,merge}/<digest8>-<pid>), so a merge from
pr-reviews and a resume of one record never remove each other's; and a
pull request that moves while resume reads its state waits a turn
instead of reading again at once.

Tested: the four Phase 6f CLI suites pass (126 with the unit tests).
The four CLI suites name TEST_API_URL in their headers, so the
workflow routes them to the integration tier their headers claim; the
trailers test claims unit-pure; the API export surface pins the six
new /admin/repulls client functions.

Tested: ci-tier-routing and api-export-surface pass.
The Phase 6f slice now names the per-purpose, per-process scratch repository resume and the merge gate read origin through. Not tested (text only).
The s3-lock route reads retention back before it counts a 403 as locked, and locks an explicit list of annex keys at their current versions. The Worker refuses a released count below the record's copied, skipped and local uploads. Shared dispatch codes and lock docs updated. Tested: backend upstream-repull suites.
POST /admin/repulls/:id/merge-claim/check re-reads what the claim's statement read (dataset fences, the screen for this administrator, the live head) and refuses a claim 25 minutes old or more. It writes nothing. Route inventory pinned. Tested: backend upstream-repull suites.
The merge gate holds the record's plan lock from claim to record, checks a held claim with the Worker before sending under it, treats a lost claim answer as a claim that may be held, keeps its claim when GitHub did not merge, and refuses a head branch GitHub does not name. An unrecorded merge exits 3. Help and token wording match the code. Tested: repull-merge-cli and admin-pr-reviews-repull suites.
The release reads the staging manifest the copy wrote (digest checked against the record), locks those keys by name through the s3-lock route, and records the count only when every key is confirmed. Before the tag it reads the squash commit on main and refuses one whose last paragraph lacks both trailers (merge-trailers). Export pins updated. Tested: repull-release-cli and api-export-surface suites.
The re-synthesized commit applies what enrichment did on main (the .bidsignore line on the recorded file, a participants placeholder when N.0.0 has none) instead of undoing it. A re-synthesis pushed and not recorded is recognized from the head and recorded by the next resume. Tested: repull-resynthesize and repull-gates-cli suites.
Resume help and headers name what it does and does not do; the trailers docblock and AGENTS.md's ADR 0093 summary name the merge paths. ADR 0111 gains dated annotations where Phase 6f built, changed or did not build what earlier text promised, and its Phase 6f slice is rewritten to match the code. Tested: adr-index and repull-command-text suites.
Biome's noUnusedTemplateLiteral. Tested: repull-resynthesize suite.
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1958

Version: 0.10.24-PR1958.73134fe
Commit: 73134fe


🤖 Updated on each push.

approve --merge exits 3 and next stops, counting it unknown, when GitHub merged a re-pull pull request and the record write failed; both name nemar admin repull resume. Neither prints a green Merged. Tested: admin-pr-reviews-repull suite, both checks mutated and killed.
@neuromechanist
neuromechanist merged commit 895fa5a into feature/issue-1046-epic-upstream-freshness Oct 25, 2026
24 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-1912-phase6f-gates-merge branch October 25, 2026 23:51

This branch was previously deployed

1 inactive deployment
npm — 73134fe3 Deployed Oct 25, 2026 by neuromechanist via publish #3987
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.

1 participant