mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A live test returned 'no documents could be packaged' for 91 correctly-resolved properties. Root cause: no upload source populates uploaded_files.landlord_property_id (pashub/magic-plan/audit set hubspot_deal_id; ECMK sets hubspot_listing_id), so matching on landlord_property_id found zero rows. Match fix: the worker now joins uploaded_files -> hubspot_deal_data (on deal_id) -> landlord_property_id, taking the property identity from the bridge. The repository returns a small PropertyDocument read-model instead of the infra ORM row, so the orchestrator no longer names infrastructure.postgres.* (resolves the leak dancafc flagged) and the s3_upload_timestamp cast is gone. Coverage is limited to deal-id-linked sources; listing_id/uprn-only files are a noted follow-up. Observability: the empty-selection failure now carries stage counts (selected/matched/planned/skipped) in both the message (-> the worker WARNING log) and details (-> sub_task.outputs), and the run logs those counts. The next failure says 'matched 0 documents' instead of failing opaquely. ADR-0060 + CONTEXT.md updated (matching decision + considered options). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
771 B
Python
24 lines
771 B
Python
"""The repository's read-model for a property's uploaded document (ADR-0060).
|
|
|
|
A small domain type the uploaded-file repository hands back, so the orchestrator
|
|
never names ``infrastructure.postgres.*``. Carries the property's
|
|
``landlord_property_id`` (resolved through the ``hubspot_deal_data`` bridge — see
|
|
the repository) alongside just the fields the Download Package needs.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PropertyDocument:
|
|
"""One uploaded file matched to a property, ready to resolve into the plan."""
|
|
|
|
landlord_property_id: str
|
|
document_type: Optional[str]
|
|
s3_bucket: str
|
|
s3_key: str
|
|
uploaded_at: datetime
|