Public: anyone can read this; the crew can change it.
Open house visitors say whether they already work with an agent, and the agent sees it on the visitor list and the CSV #142
Check · Review · Land · Live — Changes were asked on this head.
Open house visitors can now say whether they work with an agent. The agent sees the answer on the visitor list and in the CSV. The tests I ran pass: tablet, followup, db, sample, walkthrough, tty and photo-alt. I did not run the full suite; the forge runs it on push. `bun x tsc --noEmit` only printed tsc's help text in this sandbox, so I have no type-check result. `scripts/gate.ts` and `scripts/fa…
13 files · +129 −35
look green — its tests passed, ready for a look deploy 0c75115
Check passeddeploy 0c75115
Website spec: 3 findings, 4 the edge owns (report only)
- / no <link rel="canonical"> — canonical
- / missing og:image — open-graph
- / a 13800-byte body was sent without br or gzip though Accept-Encoding: br, gzip — https://specification.website/ (the edge owns this)
- / http://127.0.0.1:45397/tokens.css?v=6bbacb4a: a 2873-byte body was sent without br or gzip though Accept-Encoding: br, gzip — https://specification.website/ (the edge owns this)
- / http://127.0.0.1:45397/static/app.css?v=ef85484f: a 31340-byte body was sent without br or gzip though Accept-Encoding: br, gzip — https://specification.website/ (the edge owns this)
- / no Cross-Origin-Opener-Policy — coop (the edge owns this)
- / no ETag on the HTML — caching
Look
Open house visitors can now say whether they work with an agent. The agent sees the answer on the visitor list and in the CSV. The tests I ran pass: tablet, followup, db, sample, walkthrough, tty and photo-alt. I did not run the full suite; the forge runs it on push. bun x tsc --noEmit only printed tsc's help text in this sandbox, so I have no type-check result. scripts/gate.ts and scripts/fast.ts don't exist in this repo, and I ran scripts/lint-design.ts (the repo's name for the design lint), which printed nothing.
What changed
- Tablet page:
/listings/:id/open-houseasks "Are you working with an agent? (optional)" with Yes / No radios. The server acceptsyes,noor nothing. Any other value is refused with a 422 and "Working with an agent is Yes or No." - Visitor list: the follow-up page's list shows "Has an agent" or "No agent" next to each visitor. It shows nothing for a visitor with no answer.
- CSV:
visitors.csvhas a new last column, "Working with an agent", reading Yes, No or blank. I appended it at the end so the existing columns keep their positions. The existing CSV tests had to change to expect the new header and column. - Migration: a new final migration,
ALTER TABLE visitor ADD COLUMN with_agent TEXT CHECK (with_agent IN ('yes','no')). The table is not rebuilt, and old visitors keep a NULL value that reads as blank. Re-running it is safe, becausemigrateskips the step when the column already exists. - Sample listing: the sample listing 412 Alder Lane gets three visitors, one each with answers No, Yes and blank. They are planted once, including on databases where the sample already exists.
- Thank-you screen: unchanged, and a test checks that it still shows no earlier visitor.
- Styling: two small CSS rules for the radios, noted in
docs/design/areas/open-house.md.
Tests
- A tablet test covers the field on the form, yes, no and blank answers, a refused bad value, the list, the CSV and the thank-you screen. It fails without the field on the form, the list or the CSV.
- A db test checks an old visitor survives the migration as NULL and that the column rejects other values.
- A sample test checks both answers are present.
Not done
- The terminal tool and the staff "add visitor" form on the follow-up page don't ask the question, so their visitors stay blank.
contract.jsonis untouched, so no permission cell is loosened.
The preview failure was my own new tablet test. I've fixed it and pushed 412aac3. I can't be sure that was the only failure, because the deploy log you sent showed a failing /week timing test instead.
The failing test posted five visitors as the same user pat that the rest of src/tablet.test.ts uses. That user hit the per-user rate limit and got a 429 where the test expected a 303. I moved the test to its own user, ava. No application code changed.
The full bun test passes locally: 474 pass, 0 fail. Before the fix it had exactly one failure here, my tablet test, and that matches the single failure in the deploy's final summary. The /week timing failure didn't reproduce:
- Isolated:
src/speed.test.tspasses three times out of three, and/weektakes about 12 ms per request. - In the full suite: it passes in the same full run that once failed.
- Cause:
/weekdoesn't read visitors, and my change adds only three rows to one sample listing. I take that failure to be CI load pushing it over the 50 ms p95 limit. I did not loosen the test.
If the forge's run still fails on /week, I'll look at that next.
Visitors at an open house now say whether they already work with an agent. The tablet asks, the answer shows on the visitor list, and it goes into the CSV. Anything other than a valid answer is refused.
The deploy failed on "the screen answers fast". That test launched its listing as the shared test agent tablet-pat. By then the other tablet tests had used up that agent's per-user rate limit, so the launch failed and the test failed with it. The fix gives the speed test its own agent, tablet-fay, and moves the other tablet tests from pat to tablet-pat. It is a test-only change and no app code changed.
src/tablet.test.ts passes locally: 7 tests, 0 failures. I did not run the full suite here, since the forge runs it on the push. bun x tsc --noEmit printed tsc's help text instead of type-checking, so the type check did not run. The changed file is a test.
I chose not to loosen any contract.json cell.
To try it, open /listings/<id>/open-house as the listing's agent and submit a visitor with an answer to "Are you working with an agent?". The visitor list and /listings/<id>/visitors.csv then show it.
Works as described on the tablet, CSV and list, but three things need fixing in one round:
- Terminal door (fix first).
src/tty.tslists visitors (line ~196) without the answer and cannot record it, while the page shows and stores it. Show "Has an agent" / "No agent" in the tty visitor list, and let theaadd-visitor entry take an optional third field (yes/no) passed aswith_agent. Add a tty test for both. The README must also say how to use the new question (tablet, list, CSV, terminal); the diff changes no README. - Migration special-case in
migrate.sql.includes("ADD COLUMN with_agent") && hasColumn(...)is a string-sniffing hack inside the generic loop. Follow the existing photo_alt pattern (guard by index, as done forphotoAlt) instead. - SQL built by concatenation in
sample.ts. Use a bound parameter for the address instead of'...' + SAMPLE.address.replace(...). The value is a constant, but the rule is no SQL built from strings.
Also: the staff add-visitor form on the follow-up page does not ask the question; add the same optional Yes/No there so both doors match. Add a tty test and keep bun x tsc --noEmit clean (it was not run).
Open house visitors can now say whether they work with an agent. The agent sees the answer on the visitor list and in the CSV. The tests I ran pass: tablet, followup, db, sample, walkthrough, tty and photo-alt. I did not run the full suite; the forge runs it on push.
bun x tsc --noEmitonly printed tsc's help text in this sandbox, so I have no type-check result.scripts/gate.tsandscripts/fast.tsdon't exist in this repo, and I ranscripts/lint-design.ts(the repo's name for the design lint), which printed nothing.What changed
/listings/:id/open-houseasks "Are you working with an agent? (optional)" with Yes / No radios. The server acceptsyes,noor nothing. Any other value is refused with a 422 and "Working with an agent is Yes or No."visitors.csvhas a new last column, "Working with an agent", reading Yes, No or blank. I appended it at the end so the existing columns keep their positions. The existing CSV tests had to change to expect the new header and column.ALTER TABLE visitor ADD COLUMN with_agent TEXT CHECK (with_agent IN ('yes','no')). The table is not rebuilt, and old visitors keep a NULL value that reads as blank. Re-running it is safe, becausemigrateskips the step when the column already exists.docs/design/areas/open-house.md.Tests
Not done
contract.jsonis untouched, so no permission cell is loosened.Closes #138