Conversation
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- missing_subpremise / confirm_subpremise / confirm_street_number / confirm_components now use the terser, action-oriented copy - confirm_components banner dynamically names the unconfirmed component (street name, city, state, ZIP code) with proper singular/plural form Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- parseAddress / parseGoogleAddressComponents accept { cityFallback } and
apply it when Places omits a locality (e.g. CDPs like Cypress, TX)
- shared resolveCity + indexByType helpers between the two parsers
- useAddressAutocomplete.resolveSelection now returns the raw Place instead
of pre-parsed shapes — lets the flow parse after validation completes so
the fallback is available
- AddressSearchFlow parses with validation's locality in one shot; removes
the inline patch blocks on resolved.selection.address.city and
resolved.googleAddressComponents.city
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- drop unused requiresSubpremise convenience flag (Issue 5) - collapse 5 parallel edited* booleans into a single editedFields: string[] emitted on address_validation_override (Issue 6). Centralized diff logic in a diffFields helper shared with handleContinue. - extract <ConfirmField> component from AddressConfirmModal; 5 inputs become 5 one-liners with warn/error visual states encapsulated (Issue 7) - split validateAddress into fetchValidation + interpretValidation so the classifier is testable without mocking fetch (Issue 8) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Typing "938 Ramblewood" without debouncing fires ~13 API requests (one per keystroke). Add a 200ms debounce before the searchQuery drives the fetch — the controlled input keeps updating immediately; only the fetch lags. Saves Places API quota + client bandwidth with no perceptible suggestion lag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Issue 1 — classify() now only returns confirm_components when at least one unconfirmed type maps to a form field. Prevents the modal from rendering "the highlighted fields" with nothing actually highlighted (e.g. when unconfirmedComponentTypes contains only point_of_interest or country). Defensive fallback in joinLabels updated to "this address" for safety. Issue 2 — modal's address_validation_result PostHog event now carries confirmation_path: "modal" so analytics can distinguish silent submits from modal-shown paths. Issue 3 — edit detection (diffFields) now compares against a snapshot of the form's initial values captured at modal mount, not against googleAddressComponents directly. The form pre-fills with a fallback (selection.address.X) when Google's component is empty, so the old comparison falsely reported user_action="edited" when the user actually confirmed as-is. Issue 4 — clarified the AddressValidationKind docstring for `block`. The intent is "warn aggressively but still allow override" per design principle #3 (override always one click away). Updated the comment to match observed behavior — Continue still submits, backend treats as confirmed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
much better address validation interface
unify battery + energyonly into a single component
What changed
Validation classifier (
src/address-search/addressValidation.ts)AddressValidationKind:accept | missing_subpremise | confirm_subpremise | confirm_street_number | confirm_components | blockdpvConfirmation,dpvFootnote,validatedLocalityfor UX + loggingunconfirmedFieldsmaps Google component types (locality,route,postal_code,administrative_area_level_1) to form-field names for amber highlightingCity backfill for CDPs (
src/address-search/utils.ts, flow components)administrative_area_level_2from the city fallback chain — Places Autocomplete omitslocalityfor Census Designated Places like Cypress/Santa Fe/Pine Island, so the old fallback silently leaked county names ("Harris County") into the city field.localitywhen Places doesn't return one.Flow merge (new
src/address-search/AddressSearchFlow.tsx)BatteryAddressSearchFlow+EnergyOnlyAddressEntryFlow(~95% duplicated, ~320 combined LOC) merged into a singleAddressSearchFlow. Parent supplies variant-specific placeholder.AddressSearchAppso modal edits sync back into the input display (previously stale until redirect).Confirm modal (
src/address-search/modal/AddressConfirmModal.tsx+.copy.tssibling)missing_subpremiseblockkind uses red tone but stays overridable (no dead-end)AddressConfirmModal.copy.ts— kind → partial override shallow-merged ontoDEFAULT_COPY;confirm_componentsbanner dynamically names the unconfirmed component(s) ("this city" / "the street name and ZIP code")Observability
PostHog events fire at every fork:
address_validation_result(silent or modal shown),address_validation_override(Confirm / SFH / edited),address_validation_dismiss. Each event carries raw validation signals for queryable analysis.Design doc (
docs/address-entry-design-principles.md)7 principles: submit in one motion; warnings answer what we saw / why it matters / what to do; override always one click away; defer to the strongest signal; one modal kind-aware; observable; rural / new-build / meter-per-structure first-class.
Why
L7D (TX, non-homebuilder): 92.9% confirmed vs 95% SLA. 759 failures broken down:
The old frontend only prompted when
possibleNextAction === CONFIRM_ADD_SUBPREMISES. The backend then marked the rest as UNCONFIRMED without the user ever seeing a warning. This PR closes that gap.Test plan
tsc --noEmit)locality / route / postal_code / administrative_area_level_1Testing
🤖 Generated with Claude Code