blob: ab1ea9fd5b510c23d366de859987797ef529ca8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# grasp-mirror Bugfix Plan
## Bugs Identified from VPS Logs
### Bug 1: `remote 'push_target' already exists`
- **Location**: `src/git_mirror.rs:137`
- **Cause**: `repo.remote("push_target", target_url)` creates a new remote every cycle. On subsequent cycles, the bare repo already has a `push_target` remote, so `git2` returns `Exists (-4)`.
- **Fix**: Use `repo.find_remote("push_target")` first. If it exists, call `repo.remote_set_url()` to update the URL. If not, create it.
### Bug 2: Single repo failure aborts entire cycle
- **Location**: `src/main.rs:mirror_cycle()` — the `mirror.mirror_repo_to_servers()` call uses `?` which propagates the error and aborts the loop.
- **Cause**: When one repo (e.g. `market`) fails to clone from any server, the `?` operator returns early, skipping the remaining ~87 repos.
- **Fix**: Replace `?` with a `match` that logs the error and continues to the next repo. Only the `discover_repos_from_relays` and `persist_discovered_repos` calls should be fatal (if relay queries fail, nothing works).
## Checklist
- [ ] Fix `push_mirror` in `src/git_mirror.rs` — reuse existing `push_target` remote
- [ ] Fix `mirror_cycle` in `src/main.rs` — make per-repo errors non-fatal
- [ ] Rebuild release binary (`cargo build --release`)
- [ ] Push updated source to all 9 GRASP servers (`git push origin master`)
- [ ] Redeploy via Ansible (`ansible-playbook playbooks/30-grasp-mirror.yml`)
- [ ] Verify: `grasp-mirror status` shows repos tracked and sync records
- [ ] Verify: `journalctl -u grasp-mirror` shows successful mirror cycles without `already exists` errors
- [ ] Verify: spot-check `git ls-remote` against a few GRASP servers for repos from all 3 npubs
- [ ] Verify: `https://git.orangesync.tech/api/mirror-health` returns `"status": "ok"`
|