[object Object]

← back to Homesonspec

fix: scope Ashton Woods Widen sweep to LD blocks only, fix stale test (TK-10382)

813a5a193b15ca02f9a4eda6dd8674ee53ad5195 · 2026-08-09 04:04:45 -0700 · steve@designerwallcoverings.com

Page-wide awh.widen.net regex was picking up gallery images from sibling
homes on the same community page. Now restricts the sweep to JSON-LD script
blocks only — cuts from 8 cross-home images to the structured-data set.
Stale 'images==[]' test assertion updated to match enabled-image behavior.

Files touched

Diff

commit 813a5a193b15ca02f9a4eda6dd8674ee53ad5195
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Sun Aug 9 04:04:45 2026 -0700

    fix: scope Ashton Woods Widen sweep to LD blocks only, fix stale test (TK-10382)
    
    Page-wide awh.widen.net regex was picking up gallery images from sibling
    homes on the same community page. Now restricts the sweep to JSON-LD script
    blocks only — cuts from 8 cross-home images to the structured-data set.
    Stale 'images==[]' test assertion updated to match enabled-image behavior.
---
 collectors/ashton-woods/src/index.test.ts |  7 +++++--
 collectors/ashton-woods/src/index.ts      | 12 ++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/collectors/ashton-woods/src/index.test.ts b/collectors/ashton-woods/src/index.test.ts
index 5e9a3ccf..c7a6c23d 100644
--- a/collectors/ashton-woods/src/index.test.ts
+++ b/collectors/ashton-woods/src/index.test.ts
@@ -61,8 +61,11 @@ describe("ashton-woods adapter", () => {
     expect((f.sqft as { value: number }).value).toBe(2260);
     expect((f.lat as { value: number }).value).toBeCloseTo(29.888184, 4);
     expect((f.constructionStatus as { value: string }).value).toBe("MOVE_IN_READY");
-    // facts-only: no images
-    expect((f.images as { value: string[] }).value).toEqual([]);
+    // images are sourced from JSON-LD blocks only (page-wide sweep removed TK-10382)
+    const imgs = (f.images as { value: string[] }).value;
+    expect(imgs.length).toBeGreaterThan(0);
+    expect(imgs.length).toBeLessThanOrEqual(8);
+    expect(imgs.every((u) => u.startsWith("https://awh.widen.net/"))).toBe(true);
   });
 
   it("returns no records for non-home HTML", () => {
diff --git a/collectors/ashton-woods/src/index.ts b/collectors/ashton-woods/src/index.ts
index 2119e714..921a7526 100644
--- a/collectors/ashton-woods/src/index.ts
+++ b/collectors/ashton-woods/src/index.ts
@@ -204,12 +204,16 @@ export const ashtonWoodsAdapter: SourceAdapter = {
 
       const cname = h.community ?? "Unknown";
 
-      // per-home Widen CDN photos: JSON-LD `image` is the primary elevation; the page
-      // also carries gallery shots on awh.widen.net. Decode &/&amp; first so query
-      // strings survive, dedup by path, cap. [images enabled 2026-07-28 per hotlink approval]
+      // per-home Widen CDN photos: JSON-LD `image` is the primary elevation.
+      // Scope the gallery sweep to JSON-LD script blocks only — the page-wide sweep
+      // leaks sibling homes' photos from community gallery sections (TK-10382).
+      // [images enabled 2026-07-28; scoped to LD blocks 2026-08-09 to fix cross-home pollution]
       const decoded = html.replace(/\\u0026/gi, "&").replace(/&amp;/g, "&");
       const ldImg = decoded.match(/"image"\s*:\s*"(https:\/\/awh\.widen\.net[^"]+)"/)?.[1];
-      const widenAll = [...decoded.matchAll(/https:\/\/awh\.widen\.net\/content\/[^\s"'<>\\)]+/gi)].map((m) => m[0]);
+      const ldText = [...decoded.matchAll(/<script[^>]*type="application\/ld\+json"[^>]*>([\s\S]*?)<\/script>/gi)]
+        .map((m) => m[1]!)
+        .join("\n");
+      const widenAll = [...ldText.matchAll(/https:\/\/awh\.widen\.net\/content\/[^\s"'<>\\)]+/gi)].map((m) => m[0]);
       // The page-wide Widen sweep also picks up brand marketing assets that are NOT this
       // home's photos — collection thumbnails, the "most-trustworthy-companies" award badge,
       // logos. Blocklist them so a home's gallery only shows the home. [Cody-gate fix 2026-07-28]

← 2831eee7 test(workers): real-Postgres integration test for TK-10240 p  ·  back to Homesonspec  ·  fix(workers): health-probe bind failure must not crash the w 7ff28c2d →