From 4a680d17bae766b41d3a91ea7cb166ef08586846 Mon Sep 17 00:00:00 2001 From: Karl Von Richter Date: Mon, 2 Nov 2026 18:30:40 +0000 Subject: [PATCH] Icon review: test that a same-size edit with the same timestamp changes the revision (CI flake) (#3375) On the Blacksmith CI runners two quick same-size writes can share a modification time, and a stale review page once accepted changed art there (test_changed_art_reopens_and_requires_deliberate_current_acceptance failed intermittently). art_rev() now hashes every file by content on main (b622a466); this test keeps it that way by giving an edited SVG its old timestamp back and checking that the stale page is refused. Co-authored-by: Claude Opus 5.5 --- tests/tools/test_icon_review.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/tools/test_icon_review.py b/tests/tools/test_icon_review.py index b6e93d40b..b3d27d9b5 100644 --- a/tests/tools/test_icon_review.py +++ b/tests/tools/test_icon_review.py @@ -296,6 +296,21 @@ class IconReviewTest(unittest.TestCase): self.assertIn('box', get('/api/review')['final']) self.assertNotEqual(old_hash, json.loads((design / 'review.json').read_text(encoding='utf-8'))['final']['box']) + def test_a_same_size_edit_with_the_same_timestamp_still_changes_the_revision(self): + # CI VMs can stamp two quick same-size writes with one modification time; the stale page + # must still be refused (it once accepted changed art there). + with review_fixture() as (root, design, get, post): + box = design / 'svg/model/box.svg' + box.write_text(SVG.replace('r="20"', 'r="18"'), encoding='utf-8') + stamp = box.stat().st_mtime_ns + changed = get('/api/review') + box.write_text(SVG.replace('r="20"', 'r="17"'), encoding='utf-8') + os.utime(box, ns=(stamp, stamp)) + self.assertNotEqual(changed['rev'], get('/api/review')['rev']) + with self.assertRaises(urllib.error.HTTPError) as error: + post(changed, final=['box']) + self.assertEqual(error.exception.code, 400) + def test_missing_art_is_visible_but_cannot_be_accepted(self): with review_fixture() as (root, design, get, post): commands = root / 'crates/engine/src/cmd'