Never undo settings applied on the page: sync from NA Ingest, rebase stale drafts, guard the installer
- config.json is NA Ingest's live settings: the READY hours (Tue 14-22, Wed 9-19, Sun 5-14) and the auto-fix hours (Tue 14-22, Wed 9-21, Sun 6:30-14) set on the settings page. - Settings page: a draft carries what its page started from. A tab that loaded the settings before they changed (an Apply elsewhere, a program update) now has only its own edits put on top of the live settings; before, it saved its whole older copy and Apply quietly undid the newer values (it took ready.prop_host out twice today). - install.sh refuses (exit 4) to replace live settings that came from an Apply (their fingerprint is a history entry's sha_after) unless --replace-config; --keep-config still updates code only. - Tests pin their own auto-fix and READY hours, so the campus can change its own; the exit-timeout test expects 310 s (the Tascam outlet power-cycle). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -291,6 +291,27 @@ class TestServer(unittest.TestCase):
|
||||
self.assertEqual(len(v["changes"]), 1); self.assertTrue(v["changes"][0]["text"].startswith("computer Lighting PC › notes"))
|
||||
self.put("/api/draft", {}, method="DELETE")
|
||||
|
||||
def test_a_page_that_loaded_before_a_change_never_undoes_it(self):
|
||||
"""2026-10-15: a tab loaded the settings, a program update then added ready.prop_host, the tab
|
||||
changed one window and saved its whole (older) copy - Apply took prop_host out again. Now the
|
||||
page says what it started from and only its own change goes on top of the live settings."""
|
||||
import hashlib
|
||||
before = self.site.load(); base_sha = self.site.cfg_sha
|
||||
newer = json.loads(json.dumps(before)); newer["debounce_seconds"] = (before.get("debounce_seconds") or 3) + 2
|
||||
sp.write_json(self.site.config_path, newer) # changed under the page
|
||||
self.site.load()
|
||||
page = json.loads(json.dumps(before)); page["flap"] = dict(before.get("flap") or {}, count=7) # the page's own edit
|
||||
st, r = self.put("/api/draft", {"config": page, "base": base_sha, "base_config": before}, who="christian")
|
||||
self.assertTrue(r["rebased"])
|
||||
d = self.site.draft.read()["config"]
|
||||
self.assertEqual(d["flap"]["count"], 7) # the page's change
|
||||
self.assertEqual(d["debounce_seconds"], newer["debounce_seconds"]) # the newer value kept
|
||||
st, r = self.put("/api/draft", {"config": d, "base": self.site.cfg_sha, "base_config": d}, who="christian")
|
||||
self.assertFalse(r["rebased"]) # up to date: nothing to do
|
||||
self.put("/api/draft", {}, method="DELETE")
|
||||
sp.write_json(self.site.config_path, before)
|
||||
self.site.load()
|
||||
|
||||
def test_probe_is_refused_while_a_fix_runs(self):
|
||||
json.dump({"fix-x": {"key": "hd2"}}, open(os.path.join(self.data, "fixes-running.json"), "w"))
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user