From a9e1cddba7c7b541d18ed1858c58ee22f5c3fbcc Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 20 Aug 2026 20:23:12 -0400 Subject: [PATCH] fix(tests): provisional ledger rows carry the empty seen-marker default, not NULL Co-Authored-By: Claude Fable 5 --- src/scribe/services/shape_ledger.py | 2 +- tests/test_integration_shape_classify.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scribe/services/shape_ledger.py b/src/scribe/services/shape_ledger.py index 4830d44..2f7db0d 100644 --- a/src/scribe/services/shape_ledger.py +++ b/src/scribe/services/shape_ledger.py @@ -512,7 +512,7 @@ async def stamp_write_path_instances( {path, symbol, kind, snippet_id, reason} — empty in the common case. A shape the ledger has no live row for yet (it is being written right - now) gets a PROVISIONAL row under ``repo_key`` — first/last-seen unset — + now) gets a PROVISIONAL row under ``repo_key`` — first/last-seen empty — so the stamp is not lost to the next sync, which either confirms the shape (sets its seen marker) or stamps it vanished. No repo key → only existing rows are stamped. diff --git a/tests/test_integration_shape_classify.py b/tests/test_integration_shape_classify.py index b8f348d..f96aefa 100644 --- a/tests/test_integration_shape_classify.py +++ b/tests/test_integration_shape_classify.py @@ -284,7 +284,7 @@ async def test_write_path_stamp_is_evidence_that_yields_to_judgment(seeded): @pytest.mark.integration async def test_a_brand_new_shape_gets_a_provisional_row_the_sync_settles(seeded): """The shape being written right now has no ledger row yet. With the - hook's repo key it gets a provisional one — seen markers unset — so the + hook's repo key it gets a provisional one — seen markers empty — so the stamp survives until the next sync, which confirms it (sets the marker) or stamps it vanished. Without a repo key only existing rows are touched.""" from datetime import datetime, timezone @@ -309,7 +309,9 @@ async def test_a_brand_new_shape_gets_a_provisional_row_the_sync_settles(seeded) CodeShape.project_id == pid, CodeShape.path == "src/new.py", ))).scalar_one() assert row.status == "instance" and row.classified_by == "hook" - assert row.first_seen_commit is None and row.last_seen_commit is None + # "Unset" is the column's empty default — the markers are non-null + # Text, and the sync is what first fills them. + assert row.first_seen_commit == "" and row.last_seen_commit == "" # The sync sees the shape in the tree → confirmed, stamp intact. await sync_repo_shapes(