Repository navigation
fix(backup): keep the nightly job on copies with no origin remote - #27
Merged
Merged
Conversation
The 2026-11-05 change (#26) stopped deploy from scheduling the nightly job on a copy with no origin remote. That silenced the nightly "'origin' does not appear to be a git repository" error, but it also cost such a copy the job's nightly project pull and branch-gc --apply. daily-sync.sh is now the one place that decides what a copy with no origin does. It commits the day's work as always, then logs one line, "OPS: INFO no origin remote: the day's commit is kept locally; nothing pulled or pushed" (or "no local changes to commit" on a clean day), returns success, and the project and branch-gc stages run as on any copy. "No origin" is read from the local config (`git remote` lists no origin, matched in bash so pipefail cannot flip it), so an origin that exists but cannot be reached, or has only a push URL, is still a failed pull and an ERROR; a `git remote` that fails is an ERROR too. deploy.sh and deploy.ps1 schedule the job on every copy again and no longer look at the remotes. The session briefing reads the INFO line as "Backup: local only (no origin remote)", neither a failure nor quiet; an ERROR or WARN in the same run still wins. Kept from #26: its deploy test harnesses (now asserting the job is scheduled with and without an origin, and that the cron and task blocks run no git) and the deploy.sh --help fix. branch-gc-safety-test's daily-sync order case gets an origin in its fixture so it still exercises the pull. daily-sync-test.sh now names branch-gc (its fixture stub), so it starts with the sandbox guard. Docs: CHANGELOG, README ("The daily backup"), DEPLOYMENT.md (step 8, the Windows summary, the verification commands) and CONTEXT/how-i-work.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
A copy with no
originremote keeps its nightly job.daily-sync.shcommits the day's work as always, then logs one INFO line instead of an error and returns success; the project pull andbranch-gc --applyrun as on any copy.deploy.shanddeploy.ps1schedule the job on every copy again (undoing the gating from #26), and the session briefing reads the INFO line as "local only".Why
#26 stopped deploy from scheduling the job on a copy with no origin. That silenced the nightly
'origin' does not appear to be a git repositoryerror, but such a copy also lost the job's nightly project pull and branch cleanup. #26's own "Worth a look" named this alternative; this PR takes it.Behavior
git remotelists noorigin): the day's work is committed, then the OPS stage logs exactly one line and returns 0:OPS: INFO no origin remote: the day's commit is kept locally; nothing pulled or pushedOPS: INFO no origin remote: no local changes to commit; nothing pulled or pushedupstream) is still "no origin": the script pulls and pushes onlyorigin(the same rule fix(deploy): schedule the nightly backup only with an origin remote #26 used).ERROR, as is an origin with only a push URL. Agit remotethat itself fails is anERROR(could not list the git remotes). The match is done in bash, notprintf | grep -q, so pipefail cannot turn an early grep exit into "no origin".Backup: local only (no origin remote): the nightly run at <time> kept the work in local commits, nothing pulled or pushed; to back it up off this machine, add a private origin (DEPLOYMENT.md step 8). It is not shown as a failure, and it is not left quiet either, since quiet means the work was backed up off the machine. AnERRORorWARNin the same run still wins.Cron job already installed.); on Windows the task is registered with-Forceand verified, as before fix(deploy): schedule the nightly backup only with an origin remote #26.Kept from #26
tests/deploy-cron-test.shand the scheduled-task section oftests/deploy-windows-test.ps1: same harnesses and the same case set (origin,git initcopy, a remote namedupstream, no repository, an existing entry, unrelated entries,--no-system/-NoSystem). They now assert that the job is scheduled in every case, with no warning, and that the cron and task blocks run no git at all.deploy.sh --helpfix (sed -n '2,42p'); the header stays the same length.Worth a look
branch-gc-safety-test.py's daily-sync stage-order case randaily-sync.shon a fixture with no origin and expected a pull. It now gets an origin that is never contacted (its git interceptor fakes the pull), so it still checks the pull, then sync, then gc order.daily-sync-test.shnow namesbranch-gc(a stub in its fixture), so sandbox-lint requires the guard, and the suite starts with it like the other deploy and branch-gc suites. Run it by hand throughsandbox-run(the header says how). CI already runs it there.ERROR could not resolve current branch, which is loud, and the other stages still run.Tests
daily-sync-test.shdeploy-cron-test.shdeploy-windows-test.ps1session-briefing-backup-test.shbranch-gc-safety-test.pyNew daily-sync cases: no origin on a dirty day and on a clean day, a remote named
upstream, an unreachable origin, an origin with only a push URL, and a failinggit remote. Every other suite underbin/testsand every self-test passes locally insandbox-run; sandbox-lint reports no violation.Mutation checks, each run on a copy outside the checkout:
daily-sync.sh: the no-origin case fails (ERROR pull --rebase failed ... 'origin' does not appear to be a git repository)git ls-remote origin(reachability) instead of the config: the unreachable-origin cases failgit remotenot checked: the broken-config case failsdeploy.sh/deploy.ps1, or a remote check added back: the no-git assertion fails, and with that assertion disabled the no-origin case still fails (not installed exactly once,not registered once (0))CHANGELOG, README ("The daily backup"), DEPLOYMENT.md (step 8, the Windows summary, the verification commands) and CONTEXT/how-i-work.md are updated. The 2026-11-05 changelog entry gets a one-line pointer to the new one.