mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 02:25:55 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user