feat(dolt): persist beads_global to GitHub on every dolt commit - #1800
Conversation
|
📝 WalkthroughWalkthroughThe Dolt service module in Home Manager is updated to enforce a minimum version constraint of 1.86 for the ChangesDolt service version enforcement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces a version check for the Dolt package in the Home Manager service configuration. It adds a minimum version requirement of 1.86 to support the git+https remote scheme used for backups and includes an assertion to ensure the installed version meets this requirement. I have no feedback to provide.
| mv issues.jsonl.tmp issues.jsonl | ||
|
|
||
| if "${GIT}" diff --quiet -- issues.jsonl; then | ||
| echo "no JSONL changes; skipping commit" |
There was a problem hiding this comment.
First-run bug: bootstrap commit is silently skipped.
At this point issues.jsonl is still untracked in the mirror — we've only mv'd it into the working tree. git diff --quiet -- issues.jsonl only reports differences for tracked files, so on an untracked file it returns 0 (no diff). The script logs no JSONL changes; skipping commit and exits 0 without ever running git add / git commit / git push, so the mirror never gets seeded.
Reproducer:
cd $(mktemp -d) && git init -q && git commit --allow-empty -m init -q
echo hi > issues.jsonl
git diff --quiet -- issues.jsonl; echo $? # prints 0
Since the script's first effective run on any fresh machine starts with a mirror that doesn't yet contain issues.jsonl (we just reset --hard origin/main), this is the case that always hits. Subsequent runs are also stuck because git add never runs.
Fix: stage first, then check the index:
"${GIT}" add issues.jsonl
if "${GIT}" diff --cached --quiet -- issues.jsonl; then
echo "no JSONL changes; skipping commit"
exit 0
fiVerified: after git add on the untracked file, git diff --cached --quiet -- issues.jsonl exits 1, so the commit/push path runs.
| echo "no JSONL changes; skipping commit" | |
| "${GIT}" add issues.jsonl | |
| if "${GIT}" diff --cached --quiet -- issues.jsonl; then | |
| echo "no JSONL changes; skipping commit" | |
| exit 0 | |
| fi | |
| "${GIT}" \ |
|
|
||
| if [ ! -d "${MIRROR}/.git" ]; then | ||
| "${GIT}" clone --depth 1 "${REMOTE}" "${MIRROR}" | ||
| fi |
There was a problem hiding this comment.
Latent: mirror never picks up a changed remoteUrl.
The git clone is gated by [ ! -d "${MIRROR}/.git" ], and nothing later calls git remote set-url. Because the mirror lives in ~/.cache/beads-jsonl-mirror (persisted across home-manager rebuilds), any future change to remoteUrl in default.nix (rename, fork, switch to SSH) will be silently ignored — fetch/push keep hitting whatever URL is baked into the existing .git/config.
Trigger condition: changing remoteUrl in home-manager/services/dolt/default.nix while the cache directory already exists.
Consequence: push silently goes to the wrong repo or fails with a 404/permission error until the user manually rm -rf ~/.cache/beads-jsonl-mirror.
Fix: make it idempotent by always reconciling the URL after the clone gate, e.g.:
"${GIT}" -C "${MIRROR}" remote set-url origin "${REMOTE}"| fi | |
| if [ ! -d "${MIRROR}/.git" ]; then | |
| "${GIT}" clone --depth 1 "${REMOTE}" "${MIRROR}" | |
| fi | |
| "${GIT}" -C "${MIRROR}" remote set-url origin "${REMOTE}" |
Summary
pkgs.dolt >= 1.86so the home-manager dolt service can use the git+https remote scheme that backs upbeads_globalto refs/dolt/data.dolt-backup-main) that watches the dolt manifest and pushes a JSONL snapshot of the live DB torefs/heads/mainof the beads repo, so the data renders in the GitHub UI (the native dolt push only writesrefs/dolt/data, which GitHub does not render).WatchPathson~/dotfiles/.beads/beads_global/.dolt/noms/manifestwithThrottleInterval = 60; systemdpathunit withPathChangedfor the Linux equivalent.bd --global export --all > issues.jsonl, thengit diff --quiet-gated commit and push.~/.cache/beads-jsonl-mirror.Test plan
shellcheckclean forhome-manager/services/dolt/backup-dolt-main.shandspec/backup_dolt_main_spec.shshellspecfull suite: 1520 examples, 0 failures (new spec adds 17 examples; coverage spec updated)nix fmtno changesdolt push origin mainreturns "Everything up-to-date" against the existingrefs/dolt/dataremotemake switchthatdolt-backup-mainagent loads and produces anissues.jsonlpush on the next dolt commit