From 015075077cbfccbac8574800b974fd979dca9f3c Mon Sep 17 00:00:00 2001 From: Godopu Date: Sun, 25 Oct 2026 17:00:25 +0000 Subject: [PATCH] fix(registry): a write repairs a YAML that a failed migration left in format 1 (Issue #71) The writer commits the migrated DB before it replaces the YAML. If that replacement failed, the DB said format 2 and the next run did nothing. When the DB is current the writer now also reads the YAML's format and rewrites a YAML that is older or missing. Refs #71 Co-Authored-By: Claude Opus 5.5 --- .agents/skills/lib_py/atomic_yaml.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.agents/skills/lib_py/atomic_yaml.py b/.agents/skills/lib_py/atomic_yaml.py index 8e891ad..1233b03 100644 --- a/.agents/skills/lib_py/atomic_yaml.py +++ b/.agents/skills/lib_py/atomic_yaml.py @@ -124,6 +124,17 @@ def atomic_dump_yaml_main(): if from_version < registry_format.CURRENT: d, migrated_rows = registry_format.migrate(d) force_yaml = True + elif row: + # The DB is current; its YAML copy may not be (a migration whose + # YAML rewrite failed after the DB commit). Then rewrite it. + y = None + if os.path.exists(yaml_path): + try: + with open(yaml_path) as f: + y = yaml.safe_load(f) + except Exception: + y = None + force_yaml = registry_format.stored_version(y) < registry_format.CURRENT old_sessions = get_all_sessions_status(d) # a mutation that replaces a row the monitor registered for a pane it