Repository navigation
Fix messageRetention losing the retention value on Windows - #1946
Merged
Merged
Conversation
The artifact declared two paths patterns differing only in case:
'*/mobile/Library/Preferences/com.apple.MobileSMS.plist'
'*/mobile/Library/Preferences/com.apple.mobileSMS.plist'
and searched each separately with return_on_first_hit, labelling rows by
which spelling it used. os.path.normcase folds case on Windows, so both
patterns compile to the same thing and both searches return the same
first match.
Both files really do exist. iOS APFS is case-sensitive, and 6 of the 20
local corpora that carry this plist hold both spellings as different
files, from iOS 14.3 through 26.5.2. The lowercase one holds iMessage
CloudKit backup keys, not a retention key.
So on Windows the artifact read one file twice and never read the other,
and which one it read depended on directory order. Demonstrated against
dexter_ios18's two plists by patching normcase and running a real
FileSeekerDir:
only the uppercase file present
before macOS 2 rows, Windows 4 rows, every row duplicated and
half labelled with a filename not on the device
after 2 rows on both
both files present
before macOS 3 rows correct, Windows 2 rows both "No value",
the "Forever" setting lost entirely
after macOS 3 rows, Windows reports the one file the
extraction preserved
One bracket class replaces the two patterns, and each spelling found is
searched for and read before the next is looked up. That ordering
matters: the seeker copies every match into the report data folder,
where the two spellings collide on a case-insensitive volume and the
second copy overwrites the first, so reading after all the copying
loses a file that reading between them keeps. Rows name the file
actually read rather than a hardcoded spelling.
Two smaller things in the same function: a non-scalar value under either
retention key went through dict.get and would raise on an unhashable
value, so it is now matched only when it can be a key; and rows are
emitted in a fixed iOS <=16 then iOS 17+ order rather than the plist's
own key order, which was never stable.
Validated with real ileapp.py profile runs against all 20 corpora that
hold the plist, extracted to a case-sensitive APFS volume so both files
survive. All 15 previously recorded sample_data counts reproduce
exactly, 0 disagreements. Five corpora that had no recorded count are
added.
Co-Authored-By: Claude Opus 5 <[email protected]>
abrignoni
force-pushed
the
fix/messageretention-case-variant
branch
from
August 13, 2026 20:36
0e2c563 to
58ccf7f
Compare
This was referenced Aug 13, 2026
abrignoni
added a commit
that referenced
this pull request
Aug 13, 2026
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
added a commit
that referenced
this pull request
Aug 19, 2026
--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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
messageRetentiondeclared twopathspatterns differing only in case, and searched eachone separately with
return_on_first_hit, labelling rows by which spelling it used:os.path.normcasefolds case on Windows, so both patterns compile to the same thing andboth searches return the same first match. One file gets read twice and the other is
never read.
Both files really exist. This directory can hold
com.apple.MobileSMS.plistandcom.apple.mobileSMS.plistas two different files, and 6 of the 20 local corpora thatcarry this plist have both, from iOS 14.3 to 26.5.2. On all six the lowercase file held the
same three
IMDCKBackupController*keys and no retention key.Measured, before and after
Rows produced under each
normcaseregime, by patchingscripts.search_files.normcaseandos.path.normcaseand driving a realFileSeekerDir. AFTER is the pinned commit0e2c563f.The bolded Windows numbers are the bug:
com.apple.mobileSMS.plist, a filename not on the device. That is what a Windowsvalidation sweep across 21 extractions was showing.
Keep Messagessettingof "Forever" was lost outright, because both searches returned the 630-byte lowercase
file and the 15 KB file holding the setting was never read. Which file wins depends on
directory order.
macOS output is unchanged in all three configurations, so there is no regression on the
platform where it already worked.
The fix
One bracket class replaces the two patterns, and each spelling found is searched for and
read before the next is looked up. That ordering is load-bearing: the seeker copies
every match into the report's
data/folder, where the two spellings collide on acase-insensitive volume and the second copy overwrites the first. Reading after all the
copying loses a file that reading between them keeps. Rows name the file actually read
rather than a hardcoded spelling.
Two smaller things in the same function:
dict.get, which raises on anunhashable value. It is now looked up only when it can be a key.
iOS <=16theniOS 17+order instead of the plist's own keyorder, which was never stable. Same rows, deterministic order.
Validation
Real
ileapp.pyprofile runs against all 20 corpora that hold this plist, extracted to acase-sensitive APFS volume so both files survive, run from a worktree pinned to the commit.
All 20 recorded
sample_datacounts reproduce exactly, 0 disagreements. Five corporathat previously had no recorded count are added, and the six carrying both spellings are
annotated.
pylint --disable=C,R10.00/10 (was 8.28),check_claim_language.pyclean,validate_sample_data.py0 errors.Known limitation, pre-existing and not fixed here
On a case-insensitive report volume the two copies collide under
data/, so for one row thepreserved copy at the path shown holds the other file's bytes. The reported value is
correct, because each file is read before the next copy overwrites it, but an examiner
opening that path sees a file that does not support the row. Verified against unmodified
mainas well: it behaves identically, so this is the seeker collision, not something thischange introduces. The artifact
notesnow say so explicitly.An independent adversarial review of an earlier revision of this branch (
aac07eec) flaggedthe read-after-copy ordering as blocking, which is what prompted the current implementation;
its remaining findings were re-checked against
58ccf7f7and either fixed or not reproduced.Related
An AST sweep of
__artifacts_v2__pathstuples across all five LEAPP cores found exactlytwo case-variant tuples: this one, and
setupapiSectionsin DLEAPP'swindowsSystem.py(
*/Windows/INF/setupapi.dev.logand*/WINDOWS/INF/setupapi.dev.log). Independentper-core review agents returned the same two. The DLEAPP one is left alone here.
Not fixed, and not an artifact-level problem:
scripts/search_files.pycopies each matchinto
data/keyed by its path, so any two evidence files differing only in case collidethere and one silently overwrites the other. This artifact now works around it by reading
between copies; the general case would need a seeker change, which is opt-in in this repo.
Reported by Mattia Epifani.
Co-Authored-By: Claude Opus 5 [email protected]