Repository navigation
Close three ways verify could pass a folder it should not - #40
Conversation
A later manifest for the same root used to answer an earlier one's unhashed entry by path alone, so card A002's clip cleared card A001's failed clip at the same relative path and the tree read VERIFIED. A file entry now also needs the same recorded source size and modification date (compared as instants), and a folder marker needs the same job name, ignoring case and the taken-name suffix. ASC MHL records no job name, so its folder markers are never superseded.
Only the newest generation was checked, and a generation lists only what its own run handled. A clip an earlier card's run recorded as failed passed once a second card wrote its own generation into the same root, and files a --skip-existing rerun skipped were never re-hashed. Each path is now judged by the latest generation that lists it, each file is hashed once, directory hashes stay the newest generation's, and an earlier generation that cannot be read is an error rather than skipped.
Manifest paths were never confined, so a manifest under D2 listing D1's files by absolute path or .. made verify D2 hash D1 and pass. Given a folder, an entry resolving outside it now fails as OUTSIDE and is not read; a manifest named directly stays unconfined. An ASC MHL path must always stay inside its history's root, the folder holding ascmhl/.
A never-reached file is listed with no hash, size or date, so requiring a
matching size and date left a cancelled job's manifest failing verify on the
folder for good, after the rerun had copied everything. An entry that
records neither is now answered by a matching file in a newer manifest that
names the same job, the rule a folder marker already gets.
The rerun suffix is only recognised without a leading zero, which is how
the queue writes it, so two jobs from an {index} template (Shoot-003,
Shoot-004) are not taken for one job.
owenpkent
left a comment
There was a problem hiding this comment.
A repaired clip can start failing folder verification after a later job copies an unrelated file. The inline finding concerns the dates used to order evidence across classic MHL and ASC MHL.
I compared a three-job archive on the merge base and 381f5d6 using the real copy engine and both manifest writers. Five focused Windows tests passed, covering same-format recovery, inherited clips, and the reports folder’s relative paths. All nine GitHub checks passed.
| key = _entry_key(verdict.path) | ||
| if key in matched or _folder_answered(key, newer): | ||
| answer = matched.get(key) | ||
| if answer is not None and _same_source(verdict, answer): |
There was a problem hiding this comment.
[P1] Order verification evidence by the manifest that recorded each entry
_is_newer() compares the two reports before this loop. Each inherited verdict carries recorded_in, so the newest ASC report can have a different date from the entry whose evidence is being compared. I repaired a generation 1 read failure with a classic MHL rerun and verified the archive successfully. Adding an unrelated clip in ASC generation 2 made the repaired clip revert to no hash. The merge base continued to pass the same archive.
Compare the recording manifests for both the failed entry and its candidate match, using their own timestamps and numbering fallback. Store the actual answering manifest in superseded_by and cover both chronological directions in a mixed-format regression test.
An ASC MHL report carries the entries of every generation of its history but was dated by the newest one. A checksum from generation 1 could then answer a failure written after it, and a repair written between two generations stopped answering generation 1's failure once any later generation existed. Each entry is now compared by the manifest that recorded it, and superseded_by names that manifest. Two source-identity gaps are closed with it. Merging a history dropped an earlier failure for any later record of the same path; it is now dropped only for a later hashed record with the same size and modification date. The folder-marker rule applied to any unhashed entry; it now applies only to one that records no size or date.
owenpkent
left a comment
There was a problem hiding this comment.
The prior review finding about manifest dates is fixed at 42e26c6. The revised verifier also retains different-source ASC failures and restricts the folder fallback to entries with no source facts. Five focused Windows tests passed for those cases.
I found two further recovery regressions. Both passed on the merge base and failed on this head using the real writers. The inline comments cover the directory-hash comparison after a classic MHL repair and the queue names generated for a card that already has a numeric suffix. All nine GitHub checks passed.
| "folder it describes, or pass the manifest file " | ||
| "itself") | ||
| report = VerifyReport(manifest=manifest, | ||
| algorithm=next((e.algorithm for i, e in enumerate(entries) |
There was a problem hiding this comment.
[P2] Choose the directory-check algorithm from the generation being checked
This search includes inherited entries. When ASC generation 1 recorded a healthy file and generation 2 recorded only an unreadable file under Clips, the inherited checksum enabled generation 2’s directory checks. I repaired the file with a later classic MHL. The verifier accepted that repair and reported zero file failures, but it still marked both the archive root and Clips changed. The same archive passed on the merge base.
Use the newest generation’s own entries when deciding whether its directory hashes can be recomputed, or reproduce the writer’s directory structure for entries without usable hashes. A regression should verify the whole archive after this mixed-format repair.
| in the name can tell the two apart. | ||
| """ | ||
| match = _TAKEN_SUFFIX.match(name) | ||
| if match and int(match.group("number")) >= 2: |
There was a problem hiding this comment.
[P2] Preserve the original job identity when the card name already ends in a number
For a real card named A001-2, naming.build() returns A001-2 for the first queue entry and A001-2-2 for its rerun. Stripping one suffix from each yields different identities. With those generated names, a cancelled classic MHL offload followed by a successful retry still reported the clip as no hash. The same recovery passed on the merge base.
Persist the job identity from before queue disambiguation and use that when available. Cover both this literal card name and ordinary numbered queue entries so repairing one case preserves the other.
…ory hashes A manifest recorded the queue's name for a job, and verify took a trailing number back off to find the job. That made Shoot-100 and Shoot-101 one job, and kept a card really called A001-2 from matching its own retry, A001-2-2. The queue now keeps the name from before it added a suffix, the manifest records that, and names are compared whole. An ASC MHL generation that hashed nothing of its own has directory hashes over no files. An entry inherited from an earlier generation switched the recheck on for it, so a tree a later manifest had repaired was reported with its directories changed. The recheck now goes by what the generation itself hashed.
owenpkent
left a comment
There was a problem hiding this comment.
The previous findings on chronology, directory checks, and queue naming are addressed at a9aaa6e. I found one positional-argument regression in the library API and an upgrade caveat worth documenting. All 22 focused Windows tests passed, including the GUI queue collision test. I also compared the library call and legacy-manifest retry against the PR base.
| job_name: str | None = None | ||
| #: The job's own name when `job_name` was made unique by the queue; see | ||
| #: `Job.identity`. Leave unset when `job_name` is the name as given. | ||
| job_identity: str | None = None |
There was a problem hiding this comment.
[P2] Preserve the positional arguments of OffloadOptions
The existing tenth argument was thumbnail_dir. With the same ten-argument call, the base used my directory for thumbnails and wrote A001 as the MHL job name. This head leaves thumbnail_dir unset and writes the directory as creatorinfo/name. Every later positional argument shifts too. Job.identity introduces the same signature change before selection_relatives in models.py. Make both new identity fields keyword-only or append them after the existing fields. A regression test can use the old positional call and check the thumbnail directory and recorded job name.
| card. Only an entry that records neither is treated as a marker: a failed | ||
| file records both, and files a later run lists under its path never answer | ||
| it. Names are compared whole, ignoring case. A manifest records the job's | ||
| own name: when the app's queue renames a second entry for a card `A001-2` |
There was a problem hiding this comment.
Nonblocking suggestion to document the upgrade limit for older queue names
Older GUI releases recorded the queue's display name. I verified that a classic manifest stored as A001-2 in that situation keeps its folder marker unresolved after a successful A001 retry on this version. A literal card named A001-2 produces the same old metadata. A sentence here would explain the conservative result for existing archives.
job_identity sat between job_name and thumbnail_dir, so a caller passing ten positional arguments had its thumbnail folder taken for the job's identity and written into the manifest as its name. Both new fields are keyword-only now, and every existing position is what it was.
owenpkent
left a comment
There was a problem hiding this comment.
No actionable findings at 83ece81. The positional parameters of OffloadOptions and Job match the merge base in full, and both new identity fields are keyword-only. The former ten-argument library call now uses its thumbnail directory and records the correct job name. The safety guide also explains why an older queue-suffixed manifest can remain unresolved after a retry.
All 20 focused Windows tests passed, including the positional call, GUI queue naming, and verification against the generation that recorded the evidence.
What
Three ways
offloader verifycould pass a folder it should not have, each fixed in its own commit, plus one follow-up commit from review.verifyis given a folder, an entry that resolves outside that folder fails asOUTSIDEand is not read. A manifest file named directly stays unconfined. An ASC MHL path must always stay inside its history's root.Behaviour changes to know about
verifyon a folder with an ASC MHL history now re-hashes files that only an earlier generation lists. That is more reading than before, and it is the point.verify <name>_Reports(the reports folder itself, not the destination holding it) now fails asOUTSIDE. Verify the destination, or name the.mhlfile.verifyeven after a rerun copied the folder. Documented indocs/data-safety.md; fixing it needs a job identity in the ASC MHL generation.Tests
New tests in
tests/test_verdict_integrity.py,tests/test_ascmhl.pyandtests/test_naming.py. Each was run against the unfixed code and failed there.Existing tests changed, because they asserted the behaviour being fixed:
test_a_second_card_in_the_same_root_leaves_both_verifiedasserted that the first card's clip was unlisted; it is now checked as part of the history.test_verify_uses_only_the_newest_generationis renamed, with a corrected docstring._classic_manifesttest helper now writes size and modification date, as the real writer does.Checked
ruff check src tests: clean--fuzz) were run on the first three commits: 95 passed, 1 skipped