Commit graph

1297 commits

Author SHA1 Message Date
Daniel Roth
cc23b43f40 Amend an Abri booking only on a change to a complete booking, never when logging 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 15:51:38 +00:00
Daniel Roth
a39c008f36 Amend an Abri booking only on a change to a complete booking, never when logging 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 15:50:55 +00:00
Daniel Roth
6e9f52a540 Log an Abri job only when both survey date and surveyor complete the pair 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 15:50:00 +00:00
Daniel Roth
84822c3228 Log an Abri job only when both survey date and surveyor complete the pair 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 15:40:20 +00:00
Daniel Roth
1e38b44a9a A blank stored surveyor also counts as unset in the amendment check 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:37:33 +00:00
Daniel Roth
91dc359e0d A blank stored surveyor also counts as unset in the amendment check 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:36:50 +00:00
Daniel Roth
b4ce0ae83f An unchanged surveyor on a booked deal fires no amendment 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:36:05 +00:00
Daniel Roth
137ebd9456 Treat a blank surveyor as unset when checking for booking amendments 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:35:25 +00:00
Daniel Roth
234270a1ca Treat a blank surveyor as unset when checking for booking amendments 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:35:02 +00:00
Daniel Roth
26e2a98034 Amend the Abri booking when the deal's surveyor changes 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:34:43 +00:00
Daniel Roth
f91eb468cf Amend the Abri booking when the deal's surveyor changes 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 08:33:45 +00:00
Daniel Roth
18dfda038d tweaks 2026-07-17 13:21:47 +00:00
Daniel Roth
f32628b293 Fix stale comments referencing the removed default-resource fallback
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 13:20:47 +00:00
Daniel Roth
c8fe4585bf Send the deal's third-party surveyor as the OpenHousing resource
Carry third_party_surveyor_identifier on the Abri trigger message and
through dispatch into the log and amend flows, booking the job against
that resource. LogJobRequest gains the optional resource field
AmendJobRequest already had; the client falls back to the configured
default surveyor when the deal names no third-party resource, so
existing deals behave unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 13:00:47 +00:00
Daniel Roth
80113205c8 Sync third_party_surveyor_identifier deal field from HubSpot
Fetch the property from the HubSpot deals API, persist it on
hubspot_deal_data (column added by the frontend repo's drizzle
migration), and include it in the differ's FIELD_MAP so a change
to the field triggers a DB reload.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 12:53:26 +00:00
Jun-te Kim
bb0142d6f8 Request planning/address-profiling properties from HubSpot deal fetch
FIELD_MAP and upsert_deal already map planning_authority, designated_area,
article_pd_rights, listed_building, design_constraints, planning_comments,
planning_status, and planning_suggested_approach, but from_deal_id_get_info
never requested them from the HubSpot API. Since HubSpot only returns
explicitly requested properties, these always came back None regardless
of the deal's actual data, so refreshes never populated them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 15:49:42 +00:00
Daniel Roth
2a8878a0fb add missing reference to hubspot deal client booking reference 2026-07-09 10:32:34 +00:00
Daniel Roth
4bf85375e7 add utilities to hubspot etl dockerfile 2026-07-08 16:49:55 +00:00
Daniel Roth
2c83c977e6
Merge pull request #1519 from Hestia-Homes/feature/abri-api-integration
Add logging to logic for deciding whether abri API should be triggered
2026-07-08 17:18:13 +01:00
Daniel Roth
a065857e48 more detailed logging 2026-07-08 16:06:41 +00:00
Daniel Roth
0306b43584 logging for debug purposes 2026-07-08 16:02:33 +00:00
Jun-te Kim
8a04e9fca9
Merge pull request #1515 from Hestia-Homes/feature/hubspot-planning-fields
Add planning/address-profiling fields to HubSpot deal ETL sync
2026-07-08 16:14:01 +01:00
Jun-te Kim
04d1df1343 Add remaining planning/address-profiling fields to HubSpot ETL sync
Sync Design Constraints, Planning Comments, Planning Status, and
Planning Suggested Approach, matching the columns added in
Hestia-Homes/assessment-model#377.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 15:12:24 +00:00
Jun-te Kim
b8316418e1 Add planning-authority HubSpot deal properties to ETL sync
Sync Planning Authority, Designated Area, Article 4 PD Rights, and
Listed Building from HubSpot into hubspot_deal_data so downstream
consumers of the existing HubSpot ETL process can read them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 14:45:03 +00:00
Daniel Roth
31fc7ee115 use unsuccesseful outcoems constant directly in hubspot deal differ 🟪 2026-07-08 14:37:15 +00:00
Daniel Roth
4ac4dd8683 Collapse cancelled/no show to HubSpot's single 'Cancelled / No Show' value
'Cancelled' and 'no show' were separate strings in the outcome vocabulary,
but HubSpot only ever emits the one dropdown value 'Cancelled / No Show' -
so neither phantom string could ever match. Replace both with the real
value (mapped to NOACCESS, best-guess pending client), which also fixes the
long-standing differ mismatch: the abandonment trigger now actually fires on
Cancelled / No Show. Drops the now-unused REQT enum member.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 14:33:59 +00:00
Daniel Roth
13e3e78749 Share the unsuccessful-outcome vocabulary between differ and abandonment
Extract the abandonment outcome strings to a single UnsuccessfulOutcome
Literal + UNSUCCESSFUL_OUTCOMES tuple in domain.abri.models, alongside
SlotCode. The differ's NEGATIVE_OUTCOMES now references the tuple and the
reason-code mapping is keyed on the Literal, so the two can no longer
drift and a mistyped outcome fails type-checking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 14:23:33 +00:00
Daniel Roth
002f782905 Fire Abri flows on a test project code via an override env var 🟩
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 10:25:45 +00:00
Daniel Roth
3ff99619ac Fire Abri flows on a test project code via an override env var 🟥
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 10:24:54 +00:00
Daniel Roth
84d0e1e0d5 Date an abandonment to the deal's own dates, not now() 🟩
date_abandoned now resolves to the third failed attempt's confirmed
survey date, falling back to its last submission date, rather than the
processing date. This dates the OpenHousing cancellation to when the
job actually lapsed even if the trigger message lags or redelivers.

- domain: abandonment_date() encodes the confirmed-survey -> last-
  submission fallback
- DealAbandonment carries both dates; abandon_job raises
  AbandonmentDateUnknownError when a deal has neither
- last_submission_date now flows through the trigger message and request
- the injected clock is dropped: nothing reads now() any more

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 08:51:39 +00:00
Daniel Roth
0d69d628e8 A deal crossing into abandonment builds an abandon_job message 🟩
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:54:24 +00:00
Daniel Roth
aaa8c9763f A deal crossing into abandonment builds an abandon_job message 🟥
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:53:47 +00:00
Daniel Roth
70fb6d5735 Repair the Abri trigger-builder import after its move into HubspotDealDiffer
The move in 3934e2d3 left the trigger-builder test and local smoke script
importing the deleted etl.hubspot.abri_flow_triggers module; point them at
HubspotDealDiffer.check_abri_triggers_and_construct_message so they collect
and run again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:52:55 +00:00
Daniel Roth
c0e444fccb abri_api not abri 2026-07-07 14:40:33 +00:00
Daniel Roth
04b32b1515 minor refactor 2026-07-07 13:21:01 +00:00
Daniel Roth
7b6c7e1168 remove bad import 2026-07-07 13:19:03 +00:00
Daniel Roth
252a146cc3 remove silly comment 2026-07-07 13:17:24 +00:00
Daniel Roth
3934e2d359 move trigger check to HubspotDealDiffer 2026-07-07 13:15:40 +00:00
Daniel Roth
d9b441962f Name the Abri trigger builder for its None-or-message contract 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 13:02:25 +00:00
Daniel Roth
c016c8b754 Extract _trigger_abri_lambda for consistency with the other scraper triggers 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:58:48 +00:00
Daniel Roth
a3985389ab The deal row names the job number client_booking_reference, matching HubSpot and the schema 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:43:40 +00:00
Daniel Roth
481c01098d Real Abri portal deals fire the job-logging trigger 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:46:33 +00:00
Daniel Roth
eaedd9a63d Real Abri portal deals fire the job-logging trigger 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:44:51 +00:00
Daniel Roth
8847d06d68 A first confirmed survey date on an Abri deal reaches the abri queue 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:19:01 +00:00
Daniel Roth
d70853bfd2 The scraper sends fired Abri flows to the abri queue on each deal change 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:16:13 +00:00
Daniel Roth
28b4a8927f A scrape that fires Abri triggers builds one message naming the fired flows 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:13:48 +00:00
Daniel Roth
2e72f32d52 A scrape that fires Abri triggers builds one message naming the fired flows 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 10:12:41 +00:00
Daniel Roth
359516fa5f The deal upsert lands client_booking_reference in the job_no column 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:10:29 +00:00
Daniel Roth
62d9bbf147 The deal upsert lands client_booking_reference in the job_no column 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:08:17 +00:00
Daniel Roth
0cd4efbf83 A client_booking_reference change triggers a deal database update 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:05:20 +00:00