From 9632c6addba4ad1946769f6606798c20a5c3c4b4 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 23 Nov 2026 12:28:51 -0700 Subject: [PATCH] Item 6: plain sisi update on an installed copy runs the post step. done / next: item 8 --- sisi/lifecycle.py | 6 +++--- tests/test_personal.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sisi/lifecycle.py b/sisi/lifecycle.py index 7df7729..7c545d4 100644 --- a/sisi/lifecycle.py +++ b/sisi/lifecycle.py @@ -444,9 +444,9 @@ def cmd_update(args): try: top = _pgit("rev-parse", "--show-toplevel") if top.returncode != 0 or os.path.realpath(top.stdout.strip()) != os.path.realpath(paths.REPO): - say("sisi update: %s is not a git clone, so there is nothing to fetch. Replace it with a newer copy and run " - "`sisi update --post` to rebuild." % paths.REPO) - return 1 + say("sisi update: %s is not a git clone, so the product itself is updated by a release; " + "backing up, migrating and rebuilding your data now." % paths.REPO) + return post_update() if _pgit("rev-parse", "--verify", "-q", "HEAD").returncode != 0: say("sisi update: the product repository has no commits yet; nothing to update.") return 1 diff --git a/tests/test_personal.py b/tests/test_personal.py index 875f98a..d570aba 100644 --- a/tests/test_personal.py +++ b/tests/test_personal.py @@ -377,10 +377,14 @@ class UpdateTests(PersonalCase): self.assertIn("already up to date", r.stdout) self.assertEqual(len([l for l in open(os.path.join(self.data, "retest.jsonl"))]), 1) - def test_update_refuses_outside_a_git_clone(self): + def test_update_outside_a_git_clone_runs_the_post_step(self): + """R-14.4-1, R-3.2-4: an installed copy is updated by a release, but plain `sisi update` still + backs up, migrates and rebuilds the user's data and exits 0.""" r = self.sisi("update") - self.assertEqual(r.returncode, 1) + self.assertEqual(r.returncode, 0, r.stdout + r.stderr) self.assertIn("not a git clone", r.stdout) + self.assertIn("backup:", r.stdout) + self.assertIn("rulebook rebuilt", r.stdout) def _seed_legacy_db(path, lessons, proj):