Skip to content

Phase 6d: copy, register and open a re-pull pull request - #1951

Merged
neuromechanist merged 19 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1912-phase6d-copy-pr
Oct 25, 2026
Merged

neuromechanist merged 19 commits into
feature/issue-1046-epic-upstream-freshnessfrom
feature/issue-1912-phase6d-copy-pr

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Copies a prepared re-pull's upstream objects into NEMAR's prefix, registers and pushes the release/vN.0.0 branch, and opens its pull request (ADR 0111, dated 2026-10-24 for this slice). A write guard refuses any S3 write outside the prepared record's prefix and any push outside the release branch. Each copy is one server-side copy-object pinned to the source's versionId and its ETag, or a multipart copy of the same version above 5 GiB, aborted on any failed part. nemar admin repull execute runs through pr_open and never further: it never merges, and the merge stays with the owner. The registration publishes no upstream holder: the presence lines adopted during preparation stay in the working clone, which is removed afterward. Before a push, NEMAR's main must be the base the record names or a descendant of it by the three enrichment commit shapes. nemar admin repull canary checks on the real bucket, under a scratch prefix only, what the copy believes about the source versions. No mail from any new route.

Phase 6d of epic #1046, part of #1912 (which stays open until 6g). It builds on 6c (prepare, merged as 119bd82) and the 6e screen and cap.

What is in it

  • src/lib/repull/execute/: the write guard, the pinned copy, register and push, the pull request step; src/commands/admin-repull.ts (the execute command and the canary command); src/lib/api/repull.ts client calls for the record's copy and pull request transitions.
  • Tests: test/repull-write-guard.unit.test.ts, test/repull-copy.test.ts (copies by version through the S3 stand-in), test/repull-execute-cli.test.ts, test/repull-canary-cli.test.ts, and the extended test/repull-execute-prepare.test.ts and backend/test/upstream-repulls-route.test.ts.
  • ADR 0111 amendment slice for 6d, including the decision on the adopted upstream holders and the squash trailer rule that 6f enforces.

Test plan

  • Typecheck and lint clean on the rebased head 7ca9fac (on the epic head aa7234d).
  • The nine touched suites plus the ADR index test: 255 pass, 0 fail.
  • Full bun test run by CI on this head (lead runs through the Tests workflow).
  • Only the canary or the first production runs can check: that a signed cross-account copy-object and upload-part-copy of a public versioned object honor ?versionId= and --copy-source-if-match and name the copied version, as the stand-in does; the S3 stand-in is not the real bucket. Whether a default retention lock on the bucket makes the canary's deletes fail, which is the owner's signal before the orphans are counted.

Every push and aws s3api call execution makes after prepared is checked against a closed list of forms: origin only, release branches and git-annex by commit id, copies only from upstream's bucket at a version id. Unit-tested.
copyPinned heads each upstream object at its pinned version, copies it server side with ?versionId= and the version's ETag as condition (multipart above 5 GiB, aborted on failure), and heads the destination. The S3 stand-in gains cross-bucket CopyObject and a hold. Tested with the real aws CLI against the stand-in; five mutations killed.
registerCopied gates the N.0.0 tree against a fresh bucket listing and pushes one git-annex commit written from facts: nemar-s3 present for every tree key, dead marks for replaced keys, never the working clone's adopted holders or its own uuid. head.ts accepts only enrichment-shaped commits on a moved head; push.ts pushes through the write guard. copied and registered gain error-only self-edges. Unit and route tests pass.
pushRelease checks main (enrichment-shaped moves only) and pushes or reuses release/vN.0.0; openRelease finds the open pull request by its head before opening one with the administrator's token, refuses another open release pull request, and writes a body of counts, the digest and the trailer guidance. The GitHub stand-in now opens pull requests on branches it reads from the bare origin.
executeRepull now walks prepared to copied, registered and pr_open (advance.ts) and stops there: it never merges. A record past prepared is taken up from the working clone or its checkpoint without planning again; every run refuses an anonymous dataset first. Step failures are recorded with [copy:, [register: or [pr: and exit 3. Tested end to end through the real binary: 17 cases, including resume at each --until, SIGKILL mid-copy, lost and failed pull request answers, foreign and enrichment heads, a moved main and tag, and a missing held key.
nemar admin repull canary copies a small and a multipart upstream object into a scratch prefix by version id through the write guard, checks sizes, the single copy's ETag and the source version S3 names, writes and deletes a staging-shaped key, deletes the copies by version and lists the prefix empty. Dry run by default; never locks or bypasses. Tested against the stand-in, including endpoints that ignore the version id or the copy condition and a locked copy.
Appends the Phase 6d slice: the command and its resume past prepared, the pinned copy, the write guard, the registration that publishes no holder NEMAR does not control (deciding the Phase 6c open point), the release branch and pull request with the trailer guidance, the canary, and what only the canary and production runs can check. Annotates the header and three earlier sentences it decides or corrects.
@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@PR1951

Version: 0.10.24-PR1951.3614d2a
Commit: 3614d2a


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit bae5e03 into feature/issue-1046-epic-upstream-freshness Oct 25, 2026
24 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-1912-phase6d-copy-pr branch October 25, 2026 19:22

This branch was previously deployed

1 inactive deployment
npm — 3614d2a2 Deployed Oct 25, 2026 by neuromechanist via publish #3967
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