R-734: the update test ignores an app's listed marker files, each with its reason
`09` §3 decision 145. MARKER_IGNORE in upgrade-test.py: per app, the files the
files_may_change mark does not count — first immich's six 13-byte
{encoded-video,library,backups,profile,thumbs,upload}/.immich folder markers,
rewritten at every start (bench measurement 2026-09-30). A listed file is
ignored only when changed/added and still <= 64 bytes; a removed or grown
marker, any unlisted file, and a moved tree the file walk cannot name still
mark the step. The verdict records files_ignored with the reasons.
HARNESS_VERSION 5. Tests: test_upgrade_bench.py MarkerIgnore (red-proved).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -81,5 +81,70 @@ class ChangedFiles(unittest.TestCase):
|
||||
self.assertEqual(ut.changed_files(before, before), [])
|
||||
|
||||
|
||||
class MarkerIgnore(unittest.TestCase):
|
||||
"""R-734 (`09` §3 decision 145): app-owned marker files do not make the `files_may_change` mark; any other
|
||||
changed file still does. The data is the bench's own measurement (audits/more-night-apps-2026-09-30/D/evidence/
|
||||
D-immich-0b82-768/files-{before,after}-detail.json). RED-PROOF (REPORT): make classify_changes ignore every
|
||||
changed file of an app with a list — test_an_unlisted_changed_file_still_marks fails."""
|
||||
|
||||
SRC = "/srv/felhom-gate/hdd/appdata/immich"
|
||||
BEFORE = {SRC: {"profile/.immich": "13:7cb1f8a19d944d7e", "upload/.immich": "13:67848ba791bd7ef6",
|
||||
"encoded-video/.immich": "13:68bdf71e87fabadc", "backups/.immich": "13:7cb1f8a19d944d7e",
|
||||
"thumbs/.immich": "13:7cb1f8a19d944d7e", "library/.immich": "13:67848ba791bd7ef6"},
|
||||
"/srv/felhom-gate/hdd/userdata/media/photos": {}}
|
||||
AFTER = {SRC: {"profile/.immich": "13:0bacc6528e07d8cb", "upload/.immich": "13:a68db79a3fbe6725",
|
||||
"encoded-video/.immich": "13:2cb994a10bfe243c", "backups/.immich": "13:648fe4b9664fadff",
|
||||
"thumbs/.immich": "13:0bacc6528e07d8cb", "library/.immich": "13:a68db79a3fbe6725"},
|
||||
"/srv/felhom-gate/hdd/userdata/media/photos": {}}
|
||||
|
||||
def mark(self, app, before, after):
|
||||
counted, ignored = ut.classify_changes(app, before, after)
|
||||
tree = sorted({c.split(" (")[0].rsplit("/", 2)[0] for c in counted + [i["file"] for i in ignored]})
|
||||
return ut.files_may_change(tree, counted, ignored), counted, ignored
|
||||
|
||||
def test_the_six_measured_markers_do_not_mark_and_each_carries_a_reason(self):
|
||||
marked, counted, ignored = self.mark("immich", self.BEFORE, self.AFTER)
|
||||
self.assertFalse(marked)
|
||||
self.assertEqual(counted, [])
|
||||
self.assertEqual(len(ignored), 6)
|
||||
self.assertTrue(all(i["reason"] for i in ignored))
|
||||
|
||||
def test_an_unlisted_changed_file_still_marks(self):
|
||||
after = {k: dict(v) for k, v in self.AFTER.items()}
|
||||
after[self.SRC]["library/admin/2026/IMG_0001.jpg"] = "2048:abcd" # added: a household photo
|
||||
before = {k: dict(v) for k, v in self.BEFORE.items()}
|
||||
before[self.SRC]["upload/upload/x.jpg"] = "10:aa"
|
||||
after[self.SRC]["upload/upload/x.jpg"] = "10:bb" # changed, same size as a marker
|
||||
marked, counted, ignored = self.mark("immich", before, after)
|
||||
self.assertTrue(marked)
|
||||
self.assertIn(self.SRC + "/library/admin/2026/IMG_0001.jpg (added)", counted)
|
||||
self.assertIn(self.SRC + "/upload/upload/x.jpg (changed)", counted)
|
||||
self.assertEqual(len(ignored), 6)
|
||||
|
||||
def test_a_listed_name_that_grew_or_vanished_still_marks(self):
|
||||
after = {k: dict(v) for k, v in self.AFTER.items()}
|
||||
after[self.SRC]["thumbs/.immich"] = "4096:ffff" # no longer a 13-byte marker
|
||||
del after[self.SRC]["upload/.immich"] # removed
|
||||
marked, counted, _ = self.mark("immich", self.BEFORE, after)
|
||||
self.assertTrue(marked)
|
||||
self.assertIn(self.SRC + "/thumbs/.immich (changed)", counted)
|
||||
self.assertIn(self.SRC + "/upload/.immich (removed)", counted)
|
||||
|
||||
def test_the_list_belongs_to_its_app(self):
|
||||
# the same files under another app (and another bind) count: the list is per app
|
||||
marked, counted, ignored = self.mark("calibre-web", self.BEFORE, self.AFTER)
|
||||
self.assertTrue(marked)
|
||||
self.assertEqual((len(counted), ignored), (6, []))
|
||||
|
||||
def test_a_moved_tree_the_file_walk_cannot_name_keeps_the_mark(self):
|
||||
self.assertTrue(ut.files_may_change(["/d"], [], []))
|
||||
self.assertFalse(ut.files_may_change([], [], []))
|
||||
|
||||
def test_every_entry_has_a_reason(self):
|
||||
for app, rules in ut.MARKER_IGNORE.items():
|
||||
for suffix, path, max_size, reason in rules:
|
||||
self.assertTrue(suffix and path and max_size > 0 and len(reason) > 40, (app, path))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user