GeezerVison is showing github.com — github-backup: Cloudflare rehost as Workers + R2 smart-HTTP (#8584) by dezren39 · Pull Request #14321 · developing-today/code
Conversation
dezren39
commented
Nov 24, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Refs #8584 — the Cloudflare rehost leg, built on the surface Drew picked himself on 2026-11-24 ("Go with Workers + R2 smart-HTTP instead", decision recorded on #8584), over the evaluation's Tunnel recommendation.
What this lands
- Worker
infra/github-backup/rehost/worker/ — protocol-v0 git smart-HTTP: info/refs advertisement rendered from a published refs.json, git-upload-pack answered with NAK + one pre-generated self-contained pack streamed from R2. Read-only by construction (no receive-pack). Protocol decisions are pure functions in src/protocol.js with node tests.
- Publisher
bin/rehost_publish.py + bin/rehost_publish_all.py — per fleet repo: git pack-objects --all --delta-base-offset over the backup mirror + a refs index (heads/tags with peeled targets), uploaded pack-first with SHA-256 read-back, refs.json last as the commit point, byte-compared; old pack generations pruned to current + previous.
- Freshness probe —
cloudflare_rehost is verified for real now: the HEAD oid in the Worker's live advertisement must equal the local mirror HEAD per fleet repo (was "unverified by construction"). Fetch errors are normalized so a truncated read records the copy unverified instead of crashing the probe.
- Schedule —
github-backup-rehost.timer daily 03:20 + 30m delay (after fetch/R2/mirror, before the 04:10 freshness probe), wrapper + install-units wiring + doc/fleet-schedule-registry.md row.
- Docs — rehost README (design, protocol notes, ops), RUNBOOK §13, evaluation addendum recording the decision and build.
Already provisioned (authorized by Drew's pick)
- R2 bucket
fleet-git-rehost (fleet Cloudflare account, created 2026-11-24T10:35Z)
- Worker
fleet-git-rehost, R2 binding REHOST, custom domain git.security.cab (+ workers.dev), current version 5f4bcaf4-64f5-4838-a187-fb27e7c72206
Clone proof (live)
developing-today/fleet published from a fresh bare mirror clone (pack 7c58cc94a13da20f9957df81ee921295f65db931, 55 refs), then:
$ git clone https://git.security.cab/developing-today/fleet
986 objects received, deltas resolved
$ git rev-parse HEAD
b328920249fc80ec09406139e8edc3019a29a158 # == source HEAD
git fetch (up-to-date path) and git ls-remote also verified against the live endpoint; the freshness probe's own parser reads the live advertisement HEAD as the same oid.
Bugs the live drill caught (fixed in this PR)
- Publisher inherited stdin —
git pack-objects reads object names from stdin and hung forever at 0 CPU. Now DEVNULL.
- git sends larger upload-pack requests gzip-compressed — the Worker now decompresses before parsing (was HTTP 400).
- git's HTTP transport separates first-want capabilities with a space, not NUL — the parser now keeps only the oid token under either separator.
Operator remainder (not in this PR)
- Run
infra/github-backup/systemd/install-units.sh from a laptop main checkout to install the rehost timer with the others; the first scheduled publish then covers all four repos from the laptop mirrors. From this seat only developing-today/fleet is published so far (the laptop mirrors are the publisher's source; the seat published from a fresh GitHub mirror clone for the proof).
- This seat has no working rclone (the
~/tools/bin dispatcher shim is broken while nix is out), so the proof publish drove the publisher's own code with its rclone transport translated to Cloudflare REST calls. The shipped publisher uses rclone exactly like the proven bundle_r2.py; its logic is covered by hermetic tests with a fake rclone.
Verification
Remote dispatch on this head: https://github.com/developing-today-forks/fleet/actions/runs/45385726911 (publisher tests, probe tests, readout regression, argument-contract scripts, py_compile, worker node tests where node exists). Results recorded on #8584.
No new dependencies: Python stdlib + git + rclone (publisher/probe), plain JS Worker (no build deps).
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…#8584)
Drew picked option 2 (Workers + R2 smart-HTTP) on 2026-11-24 over the
evaluation's Tunnel recommendation; decision recorded on #8584.
- rehost/worker: protocol-v0 smart-HTTP Worker (fleet-git-rehost)
serving info/refs + upload-pack from a refs.json index and one
pre-generated self-contained pack per repo in R2; read-only.
- bin/rehost_publish.py + rehost_publish_all.py: build the pack
(pack-objects --all --delta-base-offset) and refs.json from the
backup mirror, upload pack-then-refs with read-back verification,
prune all but the current and previous pack generations.
- freshness_probe: cloudflare_rehost is now verified for real — the
HEAD oid in the Worker's live advertisement must equal the local
mirror HEAD per fleet repo — instead of unverified by construction.
- systemd: github-backup-rehost.timer daily 03:20 + wrapper +
install-units wiring + schedule-registry row.
- Docs: rehost README (design/protocol/ops), RUNBOOK §13, evaluation
addendum recording the decision and build.
git pack-objects reads object names from stdin once its revision
arguments are exhausted; with an inherited stdin that never reaches
EOF the publish blocks forever at 0 CPU (two live proof runs hung
exactly this way, 2026-11-24). Operator scripts get DEVNULL stdin.
git's HTTP transport gzip-compresses larger upload-pack request
bodies; parsing the raw bytes as pkt-lines answers 400 and the clone
dies with 'the remote end hung up unexpectedly'. Found by the first
live clone drill against git.security.cab (55 advertised refs make
the want list big enough for git to compress). Decompress per the
Content-Encoding header before parsing.
The gzip fix collided with the response ReadableStream declared
later in the same function; esbuild rejected the redeclaration at
deploy time.
…ker (#8584)
git's HTTP transport separates the first want line's capabilities
from the oid with a space, not the NUL the ssh/local form uses
(captured from a real clone request against git.security.cab). The
parser kept the whole tail as part of the oid, so every clone's
first want failed validation. Keep only the oid token under either
separator; the test now covers both forms.
…8584)
A truncated advertisement body raises http.client.IncompleteRead,
which is not an OSError — unnormalized it would crash the probe
instead of recording the rehost copy unverified. Seen live from the
sandbox seat (proxy-truncated read, 2049 of 4515 bytes). The fetcher
now converts every transport failure to RuntimeError, the shape
collect_outcomes already handles.
coderabbitai
Bot
commented
Nov 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 9 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ba1e3c49-eb57-475f-8f7f-dbc55d37d79d
Commits
-
Reviewing files that changed from the base of the PR and between 5e8b853 and 188546f.
Files selected for processing: 20
-
doc/fleet-schedule-registry.md
infra/github-backup/bin/freshness_probe.py
infra/github-backup/bin/rehost_publish.py
infra/github-backup/bin/rehost_publish_all.py
infra/github-backup/docs/CLOUDFLARE-REHOST-EVALUATION.md
infra/github-backup/docs/RUNBOOK.md
infra/github-backup/rehost/README.md
infra/github-backup/rehost/worker/deploy.sh
infra/github-backup/rehost/worker/package.json
infra/github-backup/rehost/worker/src/index.js
infra/github-backup/rehost/worker/src/protocol.js
infra/github-backup/rehost/worker/test/protocol.test.mjs
infra/github-backup/rehost/worker/wrangler.jsonc
infra/github-backup/systemd/github-backup-rehost.service
infra/github-backup/systemd/github-backup-rehost.timer
infra/github-backup/systemd/install-units.sh
infra/github-backup/systemd/run-rehost.sh
infra/github-backup/systemd/test-rehost-arguments.sh
infra/github-backup/tests/test_freshness_probe.py
infra/github-backup/tests/test_rehost_publish.py
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
make_mirror's two git tag calls missed cwd=src, so they ran against
whatever repo the test process was launched from and died with exit
128 where no tagger identity was configured (fleet-command executor).
Found by Felix review of PR #14321's verification run 45385726911.
…ck (#8584)
The consistency oracle ran index-pack on the bucket path, which writes
the .idx beside the bucket pack and never makes the objects visible to
the scratch repo, so cat-file on the head commit exited 128. Copy the
pack into scratch/objects/pack first. Found by Felix review of
verification run 45392907375 (errors 3 -> 1 after the cwd fix; this was
the last one).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|