Skip to content

fix(tag-comparison): compare values per source file, not across the corpus - #436

Merged
swackhamer merged 1 commit into
mainfrom
fix/tag-comparison-same-file-values
Aug 2, 2026
Merged

fix(tag-comparison): compare values per source file, not across the corpus#436
swackhamer merged 1 commit into
mainfrom
fix/tag-comparison-same-file-values

Conversation

@swackhamer

Copy link
Copy Markdown
Collaborator

Summary

value_differences compared each side's corpus-wide canonical TagInfo — the first file the extractor happened to visit for that family:name key. A tag name that recurs across files with legitimately different per-file values (Sony's AFStatus* binary-data tags across camera bodies) was therefore reported as a same-file mismatch built from two unrelated files' real values: A65 won oxidex's canonical slot, A580 won ExifTool's, and the report blamed A580 for a "wrong" value that was actually A65's correct one. The effect was batch-size dependent — it needed a corpus large enough to contain two cameras sharing tag names — which made it look like an in-process parser state leak.

The engine now records every (file, value) instance (ExtractionResult::all_instances, #[serde(default)] for cache compat) and requires both sides' values to come from the same source file before reporting a value difference. Keys that never co-occur on a file stay matched-by-presence. Empty instance maps reproduce the old canonical comparison exactly — pinned by the existing test suite through the now test-only compare wrapper.

The state-leak hypothesis was tested directly and ruled out: isolated vs batched read_metadata of SonyDSLR-A580.jpg (after 9 CLIE files in-process) produces identical AFStatus tags on current main.

Salvaged from an interrupted session's worktree (base was 45 commits stale; rebased clean onto current main).

Test plan

  • cargo test --bin tag-comparison --features tag-comparison-binary — 71 passed
  • cargo clippy --features tag-comparison-binary --bin tag-comparison -- -D warnings — clean

🤖 Generated with Claude Code

…orpus

value_differences compared each side's corpus-wide canonical TagInfo (first
file the extractor happened to visit), so a tag name recurring across files
with legitimately different values -- Sony AFStatus* across camera bodies --
was reported as a same-file mismatch built from two unrelated files' real
values. The engine now records every (file, value) instance and requires
both sides' values to come from the SAME source file before reporting a
value difference; keys that never co-occur on a file stay matched-by-
presence, and empty instance maps preserve the old semantics exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@swackhamer
swackhamer merged commit cba7834 into main Aug 2, 2026
5 checks passed
@swackhamer
swackhamer deleted the fix/tag-comparison-same-file-values branch August 2, 2026 17:35
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