Scope latest-per-Document-Type per property, each in its own folder 🟩

Pins behavior delivered with the tracer slice (the group key is
(landlord_property_id, document_type)) — no red phase; discriminating: a
global-by-type dedupe would drop one property's file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-08 09:15:44 +00:00
parent b89b9fe944
commit e906c8fc98

View file

@ -76,3 +76,19 @@ def test_packaged_filename_is_the_document_type_with_the_original_extension() ->
# Assert
assert plan.entries[0].zip_path == "12 Oak Street (LP1)/photo_pack.zip"
def test_latest_per_type_is_scoped_per_property_each_gets_its_own_folder() -> None:
# Arrange — two DIFFERENT properties, each with a site_note. Latest-per-type
# must not dedupe across properties: both survive, in their own folders.
first = _doc(landlord_property_id="LP1", address="12 Oak Street", s3_key="a.pdf")
second = _doc(landlord_property_id="LP2", address="9 Elm Road", s3_key="b.pdf")
# Act
plan = plan_download_package([first, second])
# Assert
assert {e.zip_path for e in plan.entries} == {
"12 Oak Street (LP1)/site_note.pdf",
"9 Elm Road (LP2)/site_note.pdf",
}