[object Object]

← back to Homesonspec

fix(dr-horton,tri-pointe): use real parsed state instead of hardcoded CA

6612fe5a19930a9002382e494e2bd186ddf80120 · 2026-07-23 07:57:29 -0700 · Steve Abrams

Same class of bug as the Pulte fix: both adapters PARSED the true state
(DRH parseCityStateZip → geo.state; TriPointe state_alpha_2_code) then
discarded it and wrote fv("CA" as const, …). On the national drain this
mislabeled every TX/FL/etc. home as California — corrupting search-by-state.
Now the parsed 2-letter code becomes the published value. state is not in
canonicalKey, so a re-drain UPDATES existing rows in place (no dupes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 6612fe5a19930a9002382e494e2bd186ddf80120
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Jul 23 07:57:29 2026 -0700

    fix(dr-horton,tri-pointe): use real parsed state instead of hardcoded CA
    
    Same class of bug as the Pulte fix: both adapters PARSED the true state
    (DRH parseCityStateZip → geo.state; TriPointe state_alpha_2_code) then
    discarded it and wrote fv("CA" as const, …). On the national drain this
    mislabeled every TX/FL/etc. home as California — corrupting search-by-state.
    Now the parsed 2-letter code becomes the published value. state is not in
    canonicalKey, so a re-drain UPDATES existing rows in place (no dupes).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 collectors/dr-horton/src/index.ts  | 4 ++--
 collectors/tri-pointe/src/index.ts | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/collectors/dr-horton/src/index.ts b/collectors/dr-horton/src/index.ts
index 312e6ab..3bd5331 100644
--- a/collectors/dr-horton/src/index.ts
+++ b/collectors/dr-horton/src/index.ts
@@ -141,7 +141,7 @@ export const drHortonAdapter: SourceAdapter = {
           name: fv(communityName, communityName, page.url),
           street: fv<string>(null, null, page.url),
           city: fv(geo.city ?? urlCity, geo.city, page.url),
-          state: fv("CA" as const, geo.state, page.url),
+          state: fv(geo.state, geo.state, page.url), // real parsed state, not hardcoded CA
           zip: fv(geo.zip, geo.zip, page.url),
           county: fv<string>(null, null, page.url),
           metro: fv(seg[1] ? titleCase(seg[1]) : null, seg[1] ?? null, page.url),
@@ -179,7 +179,7 @@ export const drHortonAdapter: SourceAdapter = {
           fields: {
             street: fv(address, address, page.url),
             city: fv(g.city ?? geo.city ?? urlCity, g.city, page.url),
-            state: fv("CA" as const, g.state, page.url),
+            state: fv(g.state, g.state, page.url), // real parsed state, not hardcoded CA
             zip: fv(g.zip ?? geo.zip, g.zip, page.url),
             price: fv(num(it.Price), it.Price === undefined ? null : String(it.Price), page.url,
               it.Price ? `price ${String(it.Price)}` : null),
diff --git a/collectors/tri-pointe/src/index.ts b/collectors/tri-pointe/src/index.ts
index 102649f..2fb90a3 100644
--- a/collectors/tri-pointe/src/index.ts
+++ b/collectors/tri-pointe/src/index.ts
@@ -114,7 +114,7 @@ export const triPointeAdapter: SourceAdapter = {
           name: fv(communityName, communityName, page.url),
           street: fv<string>(null, null, page.url),
           city: fv(city0(first.cities), null, page.url),
-          state: fv("CA" as const, str(first.state_alpha_2_code), page.url),
+          state: fv(str(first.state_alpha_2_code)?.toUpperCase() ?? null, str(first.state_alpha_2_code), page.url), // real state, not hardcoded CA
           zip: fv(str(first.zip_code), str(first.zip_code), page.url),
           county: fv(str(first.submarket), str(first.submarket), page.url),
           metro: fv<string>(null, null, page.url),
@@ -142,7 +142,7 @@ export const triPointeAdapter: SourceAdapter = {
           fields: {
             street: fv(address, address, page.url),
             city: fv(city0(h.cities), null, page.url),
-            state: fv("CA" as const, str(h.state_alpha_2_code), page.url),
+            state: fv(str(h.state_alpha_2_code)?.toUpperCase() ?? null, str(h.state_alpha_2_code), page.url), // real state, not hardcoded CA
             zip: fv(str(h.zip_code), str(h.zip_code), page.url),
             price: fv(num(h.display_price) ?? num(h.min_price), null, page.url, h.display_price ? `display_price ${String(h.display_price)}` : null),
             beds: fv(num(h.min_bedrooms), null, page.url),

← 55372bc fix(pulte): use real state code instead of hardcoded CA (ena  ·  back to Homesonspec  ·  chore: v0.2.0 (session close) — Taylor Morrison adapter + na 4acc9f1 →