ref(snapshots): Key manifest entries by relative path instead of hash#3241
ref(snapshots): Key manifest entries by relative path instead of hash#3241NicoHinderling wants to merge 9 commits intomasterfrom
Conversation
Switch the snapshot manifest dictionary key from content hash to relative file path. The content hash is preserved in the image metadata extra field, enabling the backend to support both key formats during the transition. Co-Authored-By: Claude <noreply@anthropic.com>
Use path_as_url to normalize backslashes to forward slashes on Windows, ensuring manifest keys are platform-independent. Co-Authored-By: Claude <noreply@anthropic.com>
Fixes clippy::str_to_string lint. Co-Authored-By: Claude <noreply@anthropic.com>
Switch manifest key from relative path to file name (basename). When multiple images share the same file name from different directories, keep the first and warn with the full relative paths of all collisions so the user can debug and resolve duplicates. Co-Authored-By: Claude <noreply@anthropic.com>
The manifest key is now the image file name, so storing it again inside the value is redundant. Remove the field from ImageMetadata and let the backend derive it from the key instead. Co-Authored-By: Claude <noreply@anthropic.com>
Move the collision check before the file open and upload queue so colliding images are not uploaded unnecessarily. Co-Authored-By: Claude <noreply@anthropic.com>
Use manifest_entries.len() instead of the initial images count so the success and error messages reflect skipped collisions. Co-Authored-By: Claude <noreply@anthropic.com>
The collision warning now lists all paths sharing a filename (kept and excluded) on one line per group, making it clear which image was retained and which were skipped. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| .or_default() | ||
| .push(relative_path); | ||
| continue; | ||
| } |
There was a problem hiding this comment.
"Uploading" count includes collision-skipped images
Low Severity
The new collision detection in upload_images() can skip images, making the actual upload count (manifest_entries.len()) smaller than images.len(). The "Uploaded" and error messages inside upload_images() were updated to use manifest_entries.len(), but the "Uploading N image files" message in execute() (line 118) still uses images.len(). When collisions occur, users see e.g. "Uploading 5 image files" followed by "Uploaded 3 image files" — a confusing mismatch that didn't exist before this PR since hash-based keying had no collisions.


Switch the snapshot manifest dictionary key from content hash to image
file name (basename). This enables the backend to use the key directly
as the image identifier, removing the redundant
image_file_namefieldfrom manifest values.
Changes:
image_file_nameremoved fromImageMetadata— derived from keycontent_hashstored in image metadataextrafor objectstore lookupswarning listing all excluded paths
path_as_urlfor cross-platform consistencyCompanion backend PR: getsentry/sentry#111467