Skip to content

Add a CI guard against colliding artifact paths patterns - #1947

Merged
abrignoni merged 3 commits into
mainfrom
chore/check-artifact-paths
Aug 19, 2026
Merged

abrignoni merged 3 commits into
mainfrom
chore/check-artifact-paths

Conversation

@abrignoni

@abrignoni abrignoni commented Aug 13, 2026 •

Copy link
Copy Markdown
Owner

Adds a CI guard that fails when one artifact's paths tuple holds two patterns differing only in case. os.path.normcase folds case on Windows, so those are one pattern there: the artifact reads one file twice and never opens the other. That shipped in messageRetention until #1946.

  • admin/scripts/check_artifact_paths.py, discovery recursive over scripts/ so alternate_artifacts and test_artifacts are covered too
  • --self-test proves the check still fires, --list prints every tuple checked
  • Wired into the lint workflow, with the rule written into admin/docs/artifact_info_block.md

The fix it asks for is always a single bracket class, never a second pattern. Current main is clean: 884 tuples across 389 modules, none unchecked. iLEAPP only for now, since DLEAPP's setupapiSections declares both spellings of the setupapi path and has to be fixed before the guard can go there.

Two patterns in one `paths` tuple that differ only in case are two
patterns on macOS and Linux and one pattern on Windows, because
`os.path.normcase` folds case there. The entry point extends
`files_found` once per declared pattern with no dedup, and an artifact
that calls `seeker.search()` once per spelling gets the same first match
back from both calls, so one file is reported twice.

The worse outcome is that the second file, the one the duplicate pattern
was added for, is never read at all. That shipped in `messageRetention`
until #1946: both spellings of com.apple.MobileSMS.plist exist as
different files on 6 of the 20 local corpora carrying it, iOS 14.3
through 26.5.2, and on Windows the artifact read the 630-byte wrong one
twice and reported "No value" for a device whose Keep Messages setting
was "Forever". Nothing errored, rows were produced, and macOS output was
correct, so no sweep flagged it.

`check_artifact_paths.py` parses each module's `__artifacts_v2__`
literal, groups every `paths` entry by its Windows-folded form, and
fails on any group holding more than one spelling. It also fails on a
pattern repeated verbatim, which double-counts on every platform.

Discovery is recursive over `scripts/` rather than a
`scripts/artifacts/*.py` glob. Artifact modules also live in
`scripts/alternate_artifacts/`, which `--custom_artifacts_path` loads,
and in `scripts/test_artifacts/`; a directory-pinned glob misses those
today and would silently stop covering any directory added later.
Recursive discovery finds 843 tuples across 380 modules where the pinned
glob found 841 across 375. Modules whose block is not a static literal
are reported NOT CHECKED so the coverage hole stays visible, matching
check_claim_language.py.

`--self-test` runs the check against six known-bad and known-good
tuples, including the two real shapes this came from, so a checker that
silently stops matching cannot pass as a clean repo. Verified in both
directions against real code: restoring the pre-#1946 messageRetention
exits 1 and names both patterns; current main exits 0.

Wired into the existing lint workflow beside the other artifact guards,
and the rule is written into admin/docs/artifact_info_block.md next to
the normcase paragraph that already describes the mechanism.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abrignoni
abrignoni force-pushed the chore/check-artifact-paths branch from 95b71e7 to 5d44d7b Compare August 13, 2026 20:56
abrignoni and others added 2 commits August 19, 2026 00:10
…aths

# Conflicts:
#	.github/workflows/python_lint.yml
--list documented "print every paths tuple checked" and printed only a count
line that duplicated the summary. It now prints each module, artifact key and
its patterns. The count is derived from that same list, so the number reported
and the tuples printed cannot disagree.

Violations rendered an absolute path while the NOT CHECKED block used
os.path.relpath, so CI output carried the runner's directory. Both are
relative now.

Verified no verdict changed: the checker was run against iLEAPP and all four
sibling cores before and after, and the only difference in the output is the
DLEAPP violation path becoming relative. The self-test still passes, and
restoring the pre-#1946 messageRetention.py still exits 1.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abrignoni
abrignoni merged commit 51d7f61 into main Aug 19, 2026
2 checks passed
@abrignoni
abrignoni deleted the chore/check-artifact-paths branch August 19, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant