Commit graph

22 commits

Author SHA1 Message Date
Khalim Conn-Kowlessar
3c9b75cbce Hand-pick selection by landlord_property_id, not property.id
uploaded_files has no property_id — matching is on landlord_property_id — so the
property_ids path was pointless indirection (look property.id up in property just
to translate back to landlord_property_id). The FE holds landlord_property_id per
row anyway.

task.inputs hand-pick key is now landlord_property_ids: str[] (was property_ids:
int[]). resolve_selection unions two landlord_property_id sources — project_codes
expanded via hubspot_deal_data, and the hand-picked ids taken as given — and no
longer queries the property table at all. Trigger-only change; the domain plan,
orchestrator and matching already work in landlord_property_id.

ADR-0060, CONTEXT.md and the request schema updated to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 12:04:35 +00:00
Khalim Conn-Kowlessar
90fe2914e0 Select documents by HubSpot project_code(s), unioned with hand-picked property_ids
The 'all properties' selection resolved against property.portfolio_id, but a
portfolio spans multiple HubSpot projects — so 'all' pulled the whole portfolio,
not the project the user was looking at. The project↔property grain lives on
hubspot_deal_data, not property.

task.inputs is now {project_codes?: str[], property_ids?: int[], portfolio_id?}:
the route resolves the distinct landlord_property_id set as the union of every
property in the named project_codes (from hubspot_deal_data) and the hand-picked
property_ids; portfolio_id is optional and only names the package. Drops the
portfolio-scoped select_all. Cap now applies to the resolved set size.

ADR-0060, CONTEXT.md and the request schema updated to match. New router tests
cover project-code resolution, the union+dedup, null landlord_property_id drop,
and the empty-project rejection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 11:42:17 +00:00
Khalim Conn-Kowlessar
0b52a28808 Read the property selection from task.inputs; route takes only task_id 🟩
Per PR review: the FE writes the selection config
({portfolio_id, property_ids?, select_all?}) into the FE-owned task.inputs and
passes only task_id, so a large hand-picked selection never travels in an HTTP
body. The route reads task.inputs, resolves to landlord_property_ids, caps, and
pins the recipe onto sub_task.inputs as before. Declares the FE-owned inputs
column on the TaskRow mirror so the backend can read it and the test schema
builds it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 10:41:14 +00:00
Khalim Conn-Kowlessar
3c00e0ef00 FastAPI trigger route: POST /v1/documents/bulk-download 🟩
Resolves the authenticated requester's email (ADR-0059), resolves + caps the
property selection, pins the recipe (landlord_property_ids, recipient_email,
package_name) onto one pre-created sub_task (raw SQL, dodging the mirror
double-registration), and enqueues one message to the worker. Refuses
double-submits (409) and oversized selections (400).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 09:59:02 +00:00
Jun-te Kim
269aade481 test(address2uprn): cover ambiguity withholding + override dedup; add ADR-0057
- unit tests for resolve_group_ambiguity (distinct addresses withheld,
  same-address re-listing kept, order preserved)
- Postgres integration tests for upsert_all's backstop dedup
- ADR-0057 recording the "confirm UPRNs before finalise" decision

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 15:21:04 +00:00
Khalim Conn-Kowlessar
ddd64a9297 Legacy property columns no longer resolve type or built form 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:49:19 +00:00
Khalim Conn-Kowlessar
ca799cc5e5 Scenarios outside the portfolio refuse the run 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:06:02 +00:00
Khalim Conn-Kowlessar
e9b39df322 Filters that match no properties refuse the run 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:05:03 +00:00
Khalim Conn-Kowlessar
dade7a3a5f A task that already has sub_tasks refuses re-distribution 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:04:05 +00:00
Khalim Conn-Kowlessar
489e2b5d47 Trigger-run fans out one sub_task and message per scenario batch 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:02:12 +00:00
Khalim Conn-Kowlessar
7606480338 An oversized postcode becomes its own batch 🟩
Behavior emerged from the packing rule — pinned straight to green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:00:07 +00:00
Khalim Conn-Kowlessar
80c474b37b Batches never split a postcode 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:58:41 +00:00
Khalim Conn-Kowlessar
513977a6fd Filters combine with AND 🟩
Behavior emerged from filter composition — pinned straight to green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:43:51 +00:00
Khalim Conn-Kowlessar
d56079a1d4 Built-form filter resolves with the same precedence as property type 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:42:14 +00:00
Khalim Conn-Kowlessar
4d0af87d5a Unknown is a selectable property-type bucket 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:40:46 +00:00
Khalim Conn-Kowlessar
faea3209b2 A property without override or EPC falls back to the legacy column 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:39:54 +00:00
Khalim Conn-Kowlessar
9b146dfaf4 An EPC without property_type falls back to its dwelling_type 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:39:10 +00:00
Khalim Conn-Kowlessar
302861309c Numeric RdSAP property-type codes map to their labels 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:38:18 +00:00
Khalim Conn-Kowlessar
45dab78f4e EPC-derived property type prefers lodged over predicted 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:37:18 +00:00
Khalim Conn-Kowlessar
f40abcedeb Property-type override beats the lodged EPC 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:36:13 +00:00
Khalim Conn-Kowlessar
b865e89195 Postcode filter matches the canonical postcode exactly 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:33:29 +00:00
Khalim Conn-Kowlessar
84fb9884d6 No filters resolves the whole portfolio minus deletions 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:32:10 +00:00