feat(sync): auto-register as replica with origin after successful mirror#56
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe sync worker gains post-mirror replica registration. ChangesReplica Registration After Sync
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
The sync worker mirrored repos from peers but never told the origin, so
replica_count (repo_replicas table, GET /api/v1/repos/:owner/:repo/replicas)
stayed at 0 network-wide — the dashboard showed 0 replication even for
repos that were actually mirrored.
After each successful clone/fetch the worker now sends a signed
PUT /api/v1/repos/{owner}/{repo}/replicas to the origin with our
public_url, using the same HTTP-Signature scheme as push notifies.
Best-effort by design: skipped when public_url is unset, failures are
logged without failing the sync, and the PUT is idempotent on the origin
(201 first, 200 after) so re-registering every sync is self-healing.
Nodes need this build before their mirrors are counted: a new node's
repos show replication once its peers upgrade.
Co-Authored-By: OpenClaude <openclaude@gitlawb.com>
93b36ce to
eb2a939
Compare
The sync worker mirrored repos from peers but never told the origin, so replica_count (repo_replicas table, GET /api/v1/repos/:owner/:repo/replicas) stayed at 0 network-wide — the dashboard showed 0 replication even for repos that were actually mirrored.
After each successful clone/fetch the worker now sends a signed PUT /api/v1/repos/{owner}/{repo}/replicas to the origin with our public_url, using the same HTTP-Signature scheme as push notifies. Best-effort by design: skipped when public_url is unset, failures are logged without failing the sync, and the PUT is idempotent on the origin (201 first, 200 after) so re-registering every sync is self-healing.
Nodes need this build before their mirrors are counted: a new node's repos show replication once its peers upgrade.
Summary by CodeRabbit