Public: anyone can read this; the crew can change it.

The property page shows the agent's other homes for sale, so a buyer who opens one link finds the rest #132

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`/homes/:id` now shows a "More homes from <agent name>" section below the agent card. It lists up to three of the same author's other active or coming-soon listings, newest first. The new tests, `property.test.ts`, `speed.test.ts`, `sample.test.ts` and the design, a11y, security and hostile suites pass. `bun scripts/lint-design.ts` printed nothing. I did not run the full `bun test` locally.

shipped production is serving it deploy 957b843

opened this

/homes/:id now shows a "More homes from <agent name>" section below the agent card. It lists up to three of the same author's other active or coming-soon listings, newest first. The new tests, property.test.ts, speed.test.ts, sample.test.ts and the design, a11y, security and hostile suites pass. bun scripts/lint-design.ts printed nothing. I did not run the full bun test locally.

  • Query: src/morehomes.ts holds moreHomes(db, listing), which returns a plain list. It excludes the page's own listing, other authors, and sold, under contract, withdrawn and expired listings. src/morehomes.test.ts covers those cases plus the cap of three and newest-first order.
  • Page: src/pages/property.ts draws a card per home with the hero photo, address, price and beds/baths, linking to /homes/:id. Each photo has its alt text and a width and height, and every value is escaped. With nothing to show there is no heading. No description text is read or shown.
  • Wiring and docs: src/routes.ts passes the list to the page. The new classes are in static/app.css and named in docs/design/areas/property.md, and the README's property page section mentions the section.
  • Page test: src/property.test.ts launches and approves two more homes for one agent, plus one for a second agent. The section links the agent's other home, never the page's own listing or the second agent's. It is absent on a page with no qualifying siblings.
  • Extra filter: I added one thing the issue didn't state. A home appears only if its MLS description is approved, because an unapproved home's page returns 404 to buyers and the card would be a dead link.
  • Sample homes: All three samples belong to one author, but only Alder Lane is signed off, so on a fresh install its page shows no section. The page test therefore approves its own listings rather than relying on the samples.
  • Skipped: bun x tsc --noEmit has no tsconfig.json here and prints only its help text, so it didn't check anything. scripts/gate.ts and scripts/fast.ts don't exist in this clone.

To try it, launch and approve two or more listings as one agent, then open any of their /homes/:id pages while signed out.

🤖 Generated with Claude Code

Closes #113

commented

/homes/:id now shows a "More homes from <agent name>" section below the agent card. It lists up to three of the same author's other active or coming-soon listings, newest first. The new tests, property.test.ts, speed.test.ts, sample.test.ts and the design, a11y, security and hostile suites pass. bun scripts/lint-design.ts printed nothing. I did not run the full bun test locally.

  • Query: src/morehomes.ts holds moreHomes(db, listing), which returns a plain list. It excludes the page's own listing, other authors, and sold, under contract, withdrawn and expired listings. src/morehomes.test.ts covers those cases plus the cap of three and newest-first order.
  • Page: src/pages/property.ts draws a card per home with the hero photo, address, price and beds/baths, linking to /homes/:id. Each photo has its alt text and a width and height, and every value is escaped. With nothing to show there is no heading. No description text is read or shown.
  • Wiring and docs: src/routes.ts passes the list to the page. The new classes are in static/app.css and named in docs/design/areas/property.md, and the README's property page section mentions the section.
  • Page test: src/property.test.ts launches and approves two more homes for one agent, plus one for a second agent. The section links the agent's other home, never the page's own listing or the second agent's. It is absent on a page with no qualifying siblings.
  • Extra filter: I added one thing the issue didn't state. A home appears only if its MLS description is approved, because an unapproved home's page returns 404 to buyers and the card would be a dead link.
  • Sample homes: All three samples belong to one author, but only Alder Lane is signed off, so on a fresh install its page shows no section. The page test therefore approves its own listings rather than relying on the samples.
  • Skipped: bun x tsc --noEmit has no tsconfig.json here and prints only its help text, so it didn't check anything. scripts/gate.ts and scripts/fast.ts don't exist in this clone.

To try it, launch and approve two or more listings as one agent, then open any of their /homes/:id pages while signed out.

🤖 Generated with Claude Code

commented

The two preview failures (a bad email shows in place… and the screen answers fast, both in src/tablet.test.ts) came from my new page test, not from the tablet code. I've pushed a fix. The full suite (460 tests) passed locally both before and after, and the two tablet failures never showed up here, so I haven't reproduced them.

Cause (inferred from the code): the write rate limiter in src/security.ts keeps one token bucket per user at module level, and the whole suite runs in one process. My page test launched and approved listings as pat, a user that tablet.test.ts also uses. The extra writes probably used up pat's shared budget. A tablet launch then got a 429, and the test's location header lookup threw almost instantly, which fits the 0.48 ms failure.

Fix: the page test in src/property.test.ts now uses its own agents, mh-pat and mh-sam, so it no longer draws on pat's budget. src/property.test.ts and src/tablet.test.ts pass together locally (26 tests). The forge's preview run on this push is the real check.

The assertions that the section excludes other authors' homes and shows nothing when the agent has no other homes are unchanged. One assertion, that the page's own link never appears, is now trivially true. The agent in this test is a different one from the one that sold the earlier listing.

commented

I made no change this time, because I found nothing to fix. The one failure was /week.ics answers in under 50 ms at the 95th percentile in src/speed.test.ts, which looks like a timing flake on the busy deploy machine.

  • My change doesn't touch it. The diff only affects /homes/:id, the new src/morehomes.ts and src/pages/property.ts. /week.ics renders the week from listing schedules, and none of that code is in the diff.
  • It passes here. I ran src/speed.test.ts three times, 14 of 14 each time. My own property-page speed test, which now includes the new section, passes in the deploy log too.
  • It's a single outlier. The failing test took 1096 ms for 51 requests, about 21 ms each on average, so the 95th-percentile check over 50 requests caught one slow request. The first deploy failure (the two tablet tests) was a real problem I fixed. This one is not the same kind.

I haven't pushed anything new, since there's no new commit to push. A re-run of the preview check on d154a83 should pass. If /week.ics fails the speed test again with nothing else changed, that's worth a separate look, since the 50 ms test is sensitive to load.

commented

I merged main into this branch and pushed it. The two conflicts were in src/pages/property.ts and src/property.test.ts, and I kept both sides in each.

  • src/pages/property.ts: the conflict was only in the imports, so it now imports both the MoreHome type (this branch) and inquiryLinks (main).
  • src/property.test.ts: the "more homes" test and the one-tap inquiry tests are both kept, one after the other.

src/property.test.ts passes (25 tests). I did not run the rest of the suite; the forge runs the full check on the push.

Two things I could not check:

  • Type check: the clone has no tsconfig, so bun x tsc --noEmit only printed its help text.
  • Gate: scripts/gate.ts doesn't exist here, so I couldn't run it.

The merge brought in the one-tap inquiry work from main: the new src/inquiry.ts, plus README, design-doc and CSS changes. The "more homes" behaviour itself is unchanged.

🤖 Generated with Claude Code

Changes requested — before the latest push

The query module, escaping, cap, ordering and the extra approved-MLS filter are sound, and no contract cell is touched. One thing to fix: the feature is invisible on sample data. In the preview, /homes/1 (the only signed-off sample, Alder Lane) shows no "More homes from" section, and /homes/2 and /homes/3 are not public. The brief is a sales-meeting demo on sample data, and box 5 asks for a page test that renders a SAMPLE property page and finds the section linking ANOTHER SAMPLE. Fix: seed the samples so at least two of the agent's sample homes are active/coming_soon with an approved MLS description (and a hero photo), then change the page test to use the sample ids instead of launching mh-pat/mh-sam listings, keeping the exclusion assertions. Also replace the now-trivial not.toContain(/homes/${id}) assertion with one that is meaningful once the samples are used. Update the README sentence about the sample if needed.

commented

I added a fourth sample home, so the "More homes from" section now shows on a fresh install, and I pushed it to the same branch.

  • New sample: 1630 Hawthorne Terrace, Portland, is an active home for Morgan Reyes, the same agent as Alder Lane. It has two new illustrations (static/sample-bungalow-front.svg and sample-bungalow-yard.svg), and all its assets are signed off like Alder Lane's. The only other new data is two logged showings, which src/showings.test.ts requires of every sample.
  • Sample ids: 1 is Alder Lane, 2 is Hawthorne Terrace, 3 is the sold Meridian condo, 4 is the Birchwood house. /homes/1 now links /homes/2 and /homes/2 links /homes/1.
  • Page test: I replaced the mh-pat/mh-sam test in src/property.test.ts with one that renders the two sample pages. It checks that each page links the other and excludes itself, the sold condo, the unapproved Birchwood house, and the other author's public listing (id, launched earlier in that file). That last check replaces the trivially true one at line 295, since id is public and would show up if the query ignored the author. A second test keeps the case where an agent has no other public home and the section is absent.
  • Count updates: the sample counts went from 3 to 4 in src/sample.test.ts, src/listings.test.ts, src/photoalt.test.ts and src/showings.test.ts. The README sentence about which samples are approved now names both.
  • Tests: with tty and socket tests excluded, the full suite had 3 failures. Two were sample counts and one was a speed test. I fixed the counts, and the showings test passes after the bungalow got two showings. I did not re-run the whole suite after the last edit.
  • Speed tests: the /fair-housing and /week 50 ms tests in src/speed.test.ts failed on some runs in this sandbox, but the pages don't depend on the new sample. On origin/main /fair-housing failed on one run (74 ms). Two reruns on this branch showed no failures. The tests are timing-sensitive here, so the forge's check is the real verdict.
  • Also not run: bun x tsc --noEmit and scripts/gate.ts, because the clone has no tsconfig and no scripts/gate.ts.

The query treats all samples as one author, so Morgan's page can't show the Boise or Seattle homes. They aren't both active and approved, so they stay out of the list.

No contract cell changed.

🤖 Generated with Claude Code

commented

The deploy failure was /fair-housing missing its 50 ms 95th-percentile test. I fixed it and pushed. The fix is a speed-up unrelated to this pull's feature, so look at it separately.

  • Cause: that page depends only on the fixed rule table, but it was rebuilt on every request. Expanding each rule's phrases and re-running the check on every "cleared" phrase took about 17 ms of the 50 ms budget. It was close to the limit on main too: it failed once at 74 ms there in this sandbox. The new sample listing didn't cause it; it only loaded the machine more.
  • Fix: src/pages/fairhousing.ts now builds the page body once (bodyOf) for the built-in rules, and a test that passes its own rule table still gets a fresh build. Only the layout, which depends on who is signed in, is rendered per request. Render time dropped from about 17 ms to 0.03 ms.
  • Tests: I ran the speed and Fair Housing tests three times in this sandbox. Two runs were fully green and one failed /fair-housing before I memoised the whole body. After that, a full-suite run (excluding tty and socket tests) failed only /week, a different page, under load. I did not re-run the full suite after the final push, and bun x tsc --noEmit and scripts/gate.ts still don't apply here.
  • What I tried and dropped: /week takes about 3 ms per listing, mostly from re-checking each asset's text on every request, so it is now about 40% slower than before because of the fourth sample. I tried caching that check in src/listing.ts. It made src/tablet.test.ts and src/followup.test.ts fail with 429 rate-limit responses in a full local run, so I reverted it. /week and its .ics feed stay close to the limit here. If the forge's check flags them, the next step is a per-listing check cache, ideally with the write-budget tests given their own agents.

🤖 Generated with Claude Code

Approved

Fourth sample makes the section show on a fresh install; the preview shows /homes/1 with "More homes from Morgan Reyes" and a linked card. Query is parameterised, output escaped, only approved facts and photo shown, no contract cell changed, tests updated. Non-blocking: the fair-housing memoisation is unrelated to the issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs