POST /api/v1/repos/migrate against rithub.dev runs the clone synchronously
before answering, so a caller behind Cloudflare's edge (apps/rithub-mcp's
import_from_github tool, the rit CLI, github-backup-cli) times out on big
repos well before the clone finishes. Adds apps/rithub-async-import: a Go
sidecar that forwards the request byte-for-byte to the real engine unless
the caller opts into a new `async: true` field, in which case it creates
the destination repo empty ("[migrating] " marker), answers 202 with a
status_url immediately, then runs `git clone --mirror` + `git push --mirror`
in the background and clears the marker on success. async:true rejects
mirror:true and any issues/pull_requests/wiki/releases/milestones/labels
flag with a clear 400 (git push --mirror carries code only, not GitHub
metadata) rather than silently dropping them.
go build/vet/gofmt clean; go test ./... -race passes (request validation,
sync-passthrough proxy, async happy path, every rejection, Runner clone/
push/failure orchestration via a fake gitOps). Also hand-verified with the
real compiled binary + real `git` against a throwaway local fake-Gitea
stand-in (no railyard-box engine reachable from this sandbox): immediate
202, destination repo byte-identical to source after polling to done, bad
clone_addr fails cleanly with a sanitized error, sync passthrough relays
upstream's response verbatim.
Not deployed (out of scope for this pass) — README has the Caddy/pm2
wiring plan and the honest scope limits (no engine source fork; metadata
import still needs the sync endpoint).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 lines
70 B
Modula-2
4 lines
70 B
Modula-2
module github.com/caelum0x/railyard/apps/rithub-async-import
|
|
|
|
go 1.22
|