From 2cc9e1380e5ec44b12e9fb58f328bc0fd762039d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 31 Jul 2026 23:13:16 -0400 Subject: [PATCH] test(backup): assert the version constant, not a copy of it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The export test pinned `out["version"] == 4`, so bumping BACKUP_VERSION broke a test that was only ever checking the payload carries the version — which it still did. Asserts against backup.BACKUP_VERSION now, and covers the six v5 sections alongside the v3 ones. The guard itself passed on the first run: every table in Base.metadata was accounted for, in both directions. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01UaYUaouG9jjhATyuxCKrQs --- tests/test_services_backup.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_services_backup.py b/tests/test_services_backup.py index fb5c64d..6908c32 100644 --- a/tests/test_services_backup.py +++ b/tests/test_services_backup.py @@ -95,16 +95,18 @@ class _CM: @pytest.mark.asyncio -async def test_export_full_backup_contains_v3_sections(): +async def test_export_full_backup_contains_every_declared_section(): with patch("scribe.services.backup.async_session", lambda: _CM()): out = await backup.export_full_backup() - assert out["version"] == 4 + assert out["version"] == backup.BACKUP_VERSION assert out["scope"] == "full" assert "api_keys" in out["_not_included"] - # The sections v2 silently dropped must now be present (empty here). + # The sections v2 silently dropped, plus the six v5 added (empty here). for key in ("rulebooks", "rulebook_topics", "rules", "rulebook_subscriptions", "rule_suppressions", - "topic_suppressions"): - assert key in out, f"missing v3 section: {key}" + "topic_suppressions", + "systems", "record_systems", "design_systems", + "design_tokens", "note_usage_events", "repo_bindings"): + assert key in out, f"missing export section: {key}" assert out[key] == []