From f0eb2bc918f939616dc9704a205b4a19a4e14b87 Mon Sep 17 00:00:00 2001 From: Dustin Date: Tue, 1 Sep 2026 14:39:13 +0000 Subject: [PATCH] fix(contract): let the reviewed item catalog resync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second blocker in the same pipeline as #112. 005_item_catalog test 5 asserted an exact 265 rows and a frozen source_updated_at = '2026-07-29T15:19:05.553Z' across every row. A reviewed sync restamps that provenance by design, so the assertion fails on every content PR — sal-database#83 carries 265 items with provenance at 2026-08-07 and 2026-08-17 and fails here even though the catalog did not change size. That failure was invisible until now: database-contract is gated on repository-state, which had been failing first on the hard-coded god count, so this suite had not actually run against a synced catalog. The assertion now requires the catalog to be whole, active, source-attributed, and carrying provenance on every row, with a floor rather than an exact count. CI's verify-seed-growth step is what stops the catalog shrinking. The description also claimed 260 while asserting 265, so it had already drifted. Verified on PostgreSQL against PR #83's shape: 265 rows with two distinct provenance timestamps pass where the frozen assertion fails, growth to 266 passes, and a null source_updated_at or an inactive row still fails. --- supabase/tests/005_item_catalog.test.sql | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/supabase/tests/005_item_catalog.test.sql b/supabase/tests/005_item_catalog.test.sql index 4833ffb..b0bc103 100644 --- a/supabase/tests/005_item_catalog.test.sql +++ b/supabase/tests/005_item_catalog.test.sql @@ -66,15 +66,21 @@ SELECT ok( 'items reject malformed identifiers, names, URLs, and metadata' ); +-- The catalog grows and its provenance is restamped as diese-tech/smite-content-sync +-- discovers items, so an exact row count and a frozen source_updated_at both +-- fail on every reviewed sync. (The count here had already drifted from the +-- description, which still said 260.) What matters is that the seed is whole, +-- active, source-attributed, and carries provenance for every row; CI's +-- verify-seed-growth step is what stops the catalog shrinking. SELECT ok( ( - SELECT count(*) = 265 - AND count(*) FILTER (WHERE active) = 265 - AND count(*) FILTER (WHERE source_url ~ '^https://www[.]smitefire[.]com/smite/item/') = 265 - AND count(*) FILTER (WHERE source_updated_at = '2026-07-29T15:19:05.553Z'::timestamptz) = 265 + SELECT count(*) >= 265 + AND count(*) FILTER (WHERE active) = count(*) + AND count(*) FILTER (WHERE source_url ~ '^https://www[.]smitefire[.]com/smite/item/') = count(*) + AND count(*) FILTER (WHERE source_updated_at IS NOT NULL) = count(*) FROM public.items ), - 'the deterministic seed contains the 260-item active catalog' + 'the deterministic seed contains the whole active, source-attributed item catalog' ); SELECT * FROM finish();