Skip to content

Issue #989: the ten sidecar repair tests also pass on a case-insensitive volume (item 3, ten of eleven) - #1007

Merged
bflatastic merged 1 commit into
storytold:mainfrom
snofla:claude/fix-989-sidecar-tests-case-insensitive
Oct 13, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
snofla:claude/fix-989-sidecar-tests-case-insensitive

Conversation

@snofla

@snofla snofla commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Part of #989 (item 3, ten of its eleven tests; this PR does not close the issue). Test code only: production code is not touched.

Why the ten sidecar repair tests fail on macOS

They were written for a case-sensitive disk. sidecars() in crates/engine/src/rename.rs offers both .XMP and .xmp for each naming convention and keeps the candidates that exist. On case-insensitive APFS a.XMP "exists" for a file stored as a.xmp, so the code moves a.XMP, while the tests' fault injectors (Faults in tests_repair_companions.rs and tests_repair_provenance.rs, PartialRename in tests_repair_saves.rs) compare paths exactly with the lowercase one. The injected failure never fires, and the rename the tests expect to be refused succeeds (assertion failed: ... .is_err()).

This is a test-environment difference, but it also exposes a product quirk: on such a volume Rename Photos turns a.xmp into Trip.XMP. That is filed separately as #1006 and is not changed here.

The change

In crates/engine/src/tests_xmp.rs, three small helpers:

  • same_path_or_file(a, b): equal paths, or the same file by identity (RealFs.same_file). The three fault injectors use it, so an injected failure fires whichever spelling the code under test uses. On a case-sensitive volume only identical paths match.
  • same_path_for_volume(a, b): equal, or equal ignoring ASCII case on a case-insensitive volume. Two assertions in queued_stem_retry_preserves_shared_packet_after_batch_rollback that compared an exact spelling use it.
  • case_insensitive(dir): whether dir's upper-cased path still resolves. autowrite_repairs_partial_rename_before_merging_foreign_xmp_across_library_switch asserted that the lowercase packet is absent; on a case-insensitive volume both spellings are one file, so that assertion is skipped there.

Checked

macOS, rustc 1.99.0, Apple silicon:

Not run: Linux and FreeBSD. On a case-sensitive volume the helpers reduce to the original exact comparisons.

Not in this PR

🤖 Generated with Claude Code

…-insensitive volume (item 3, ten of eleven)

The tests were written for a case-sensitive disk. rename.rs sidecars() offers both
.XMP and .xmp per naming and keeps those that exist; on case-insensitive APFS
a.XMP "exists" for a file stored as a.xmp, so the code renames a.XMP while the
fault injectors (Faults twice, PartialRename) compared exact paths with the
lowercase one: the injected failure never fired and the rename the tests expect
to be refused succeeded.

Fault injectors now match by same_path_or_file (equal path, or the same file by
identity); two assertions that compared an exact spelling use same_path_for_volume
(equal, or equal ignoring ASCII case on a case-insensitive volume), and one that
required the lowercase packet to be absent is skipped there, where both spellings
are one file. Helpers live in tests_xmp.rs. Production code is not touched.

Run with rustc 1.99.0 on macOS: case-insensitive APFS, the ten failed before and
pass now; case-sensitive APFS (a disk image), the original tests pass and so do
these. All 13 sidecar::tests_repair tests pass on both. cargo fmt is clean and
clippy over lightcraft-engine with --all-targets is clean. Not touched: the
.xmp -> .XMP spelling change on rename, and the Lightroom folder test (its own PR).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@snofla

snofla commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Note: #1052 (opened after this PR) fixes the cause in production code, and with it the original, unmodified sidecar tests pass on macOS without these test changes (details in my comment there). So this PR is superseded if #1052 lands; I will close it then, or rebase it if #1052 changes. Leaving it open until that is decided.

🤖 Generated with Claude Code

@bflatastic

Copy link
Copy Markdown
Member

Landed on main in #1431. Thank you, @snofla!


Generated by Claude Code

clydecbrown pushed a commit to clydecbrown/lightcraft that referenced this pull request Nov 10, 2026
Manual: step-by-step masking, colour and profile coverage, Modern menu-only notes
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.

2 participants