From af7f0078bcf2140cd29fe30a27a7505b28218bc2 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 21 Jun 2026 22:28:21 -0400 Subject: [PATCH] fix(importer): guard _stamp_member_archive against a sidecar-less archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A filesystem-imported archive with no adjacent sidecar has no Post, so _post_for_sidecar returns None — and the milestone-#87 stamp call dereferenced post.id. _stamp_member_archive already no-ops on a None post_id (no post → no provenance to stamp); pass None instead of crashing. Caught by the existing test_reimport_archive_is_idempotent (no-sidecar zip). Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/app/services/importer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/services/importer.py b/backend/app/services/importer.py index ccfef94..5634928 100644 --- a/backend/app/services/importer.py +++ b/backend/app/services/importer.py @@ -534,7 +534,9 @@ class Importer: # branches stay untouched. NULL-only so a re-extract never re-stamps and # the backfill (reextract task → this same path) is idempotent. Nested # members link to this OUTER archive — the only one stored as a blob. - self._stamp_member_archive(post.id, source, member_record_ids) + self._stamp_member_archive( + post.id if post is not None else None, source, member_record_ids, + ) if member_ids: return ImportResult( status="imported", image_id=member_ids[0],