From 18b6fd53aaa321bfce87ddab5e06e2b46a2712c3 Mon Sep 17 00:00:00 2001 From: Simon Pinfold Date: Thu, 27 Aug 2026 18:57:17 -0700 Subject: [PATCH] test(assets): move M3 mismatch docstrings onto their assertion messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comment-gate walk (M3): the docstrings on the two mismatch tests stated what each test is evidence for. Under the gate's test rubric there is no keep for tests — that claim belongs on the assertion it backs, where it surfaces on a red build instead of only to someone already reading the source. The metadata-swap test's docstring also claimed the row "stays a candidate for the next enrichment pass"; dropped rather than moved, since this test never exercises a retry and so is not evidence it provides. --- .../assets_test/services/test_enrichment_snapshot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests-unit/assets_test/services/test_enrichment_snapshot.py b/tests-unit/assets_test/services/test_enrichment_snapshot.py index 59f4eb914..89e1c1163 100644 --- a/tests-unit/assets_test/services/test_enrichment_snapshot.py +++ b/tests-unit/assets_test/services/test_enrichment_snapshot.py @@ -87,7 +87,10 @@ def test_enrichment_discards_metadata_read_from_a_different_file_than_the_hash( assert enriched is False session.expire_all() assert session.get(AssetContent, content.id).hash is None - assert session.get(Asset, record.id).system_metadata is None + assert session.get(Asset, record.id).system_metadata is None, ( + "a mismatched hash observation must discard already-computed metadata too, " + "not just the hash" + ) def test_enrichment_discards_result_when_only_the_hashed_mtime_disagrees( @@ -115,7 +118,10 @@ def test_enrichment_discards_result_when_only_the_hashed_mtime_disagrees( assert enriched is False session.expire_all() assert session.get(AssetContent, content.id).hash is None - assert session.get(Asset, record.id).system_metadata is None + assert session.get(Asset, record.id).system_metadata is None, ( + "size matching alone is not proof the file is unchanged; an mtime " + "disagreement alone must also discard the result" + ) def test_enrichment_lands_metadata_and_hash_from_one_stable_observation(