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

Show what the Fair Housing check catches on one plain-language page, linked from every finding #70

Merged opened this

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

Merged

`GET /fair-housing` now answers 200 for anyone: one page, built from `RULES`, showing what the Fair Housing check flags, why, and what it suggests instead.

shipped production is serving it deploy 957b843

opened this

GET /fair-housing now answers 200 for anyone: one page, built from RULES, showing what the Fair Housing check flags, why, and what it suggests instead.

What changed

  • The page (src/pages/fairhousing.ts): there is one section per class: familial status, religion, national origin, disability, race, sex. Each lists its rules with the flagged phrases, the reason ("Because it …") and the suggested wording. "Master bedroom" appears under sex as a note, not a flag. Every phrase and reason is escaped.
  • Cleared phrases: a short section covers what it deliberately clears: "family room", "integrated appliances", "Church Street" and "exclusive listing". A test fails if the check stops clearing any of them.
  • Disclaimer: the page says it is a second pair of eyes, not legal advice.
  • How phrases are shown: the flagged phrases are read off each rule's regex (phrasesOf), so adding a rule shows it on the page without editing the page. They read like (neighbors | neighbours) or handicap[ped], with [ ] for an optional part.
  • Links: on the listing page, each finding links to its class with "What the check looks for". A clear check links to /fair-housing. The route is in src/routes.ts, and the README's agent section points to the page.
  • Tests: src/fairhousingpage.test.ts covers each class, a flagged and a cleared phrase, a rule added in the test's own table (escaped), and the link on a finding. /fair-housing is also in the a11y and speed page lists.

Left alone

  • src/fairhousing.ts, contract.json and the check's behaviour are unchanged.
  • No new CSS classes, so no design doc is added.
  • The flyer and email don't show findings today, so they got no link.
  • The "cleared" examples are a short list in the page file, because a cleared phrase has no rule to read from.

Not run

  • bun x tsc --noEmit only prints help: the repo has no tsconfig.json.
  • scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here.
  • I ran bun test on the fair-housing, a11y, speed, design, openapi, contract, hostile, walkthrough and server test files; all pass. I did not run the full suite.

Try it: open /fair-housing, or open any listing and follow "What the check looks for" from a flagged phrase.

Closes #67

commented

GET /fair-housing now answers 200 for anyone: one page, built from RULES, showing what the Fair Housing check flags, why, and what it suggests instead.

What changed

  • The page (src/pages/fairhousing.ts): there is one section per class: familial status, religion, national origin, disability, race, sex. Each lists its rules with the flagged phrases, the reason ("Because it …") and the suggested wording. "Master bedroom" appears under sex as a note, not a flag. Every phrase and reason is escaped.
  • Cleared phrases: a short section covers what it deliberately clears: "family room", "integrated appliances", "Church Street" and "exclusive listing". A test fails if the check stops clearing any of them.
  • Disclaimer: the page says it is a second pair of eyes, not legal advice.
  • How phrases are shown: the flagged phrases are read off each rule's regex (phrasesOf), so adding a rule shows it on the page without editing the page. They read like (neighbors | neighbours) or handicap[ped], with [ ] for an optional part.
  • Links: on the listing page, each finding links to its class with "What the check looks for". A clear check links to /fair-housing. The route is in src/routes.ts, and the README's agent section points to the page.
  • Tests: src/fairhousingpage.test.ts covers each class, a flagged and a cleared phrase, a rule added in the test's own table (escaped), and the link on a finding. /fair-housing is also in the a11y and speed page lists.

Left alone

  • src/fairhousing.ts, contract.json and the check's behaviour are unchanged.
  • No new CSS classes, so no design doc is added.
  • The flyer and email don't show findings today, so they got no link.
  • The "cleared" examples are a short list in the page file, because a cleared phrase has no rule to read from.

Not run

  • bun x tsc --noEmit only prints help: the repo has no tsconfig.json.
  • scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist here.
  • I ran bun test on the fair-housing, a11y, speed, design, openapi, contract, hostile, walkthrough and server test files; all pass. I did not run the full suite.

Try it: open /fair-housing, or open any listing and follow "What the check looks for" from a flagged phrase.

Changes requested — before the latest push

No security or contract problems found (no cell loosened, output escaped, public GET). One thing fails the issue: the page is not plain language.

FIX FIRST: phrasesOf (src/pages/fairhousing.ts) prints regex fragments, which a realtor cannot read to a client. Live preview shows e.g. (perfect | ideal | great | made) for [a | the | your ][young | growing ...](famil(y | ies) | ...), handicap[ped][-accessible], cripple[d], (american | u[.]s[.]) citizens only, his (and | &) her[s], and the 3-line (no | without) (kids | ...) blocks. It also mis-renders: (not [suitable | suited ...]for | unsuitable for) (the | any | young | small )(children ...) has no space before "for" and a leaked ); u[.]s[.] leaks escaped dots. Box 1 wants the phrases the check flags, readable. Fix: expand each pattern into concrete example phrases (enumerate the alternations, cap the count and show e.g. "family-friendly", "kid-friendly", "adults only", "perfect for families") instead of showing bracket/paren syntax; make the expansion handle \\s, , +, {n,m} and escaped chars correctly, and add tests that assert no output contains [, (, ), , | and that the expanded examples each match their rule (check(example) is not clear). Alternatively add an optional examples field to Rule only if you keep it derived/tested against pattern.

Also: (1) suggestion() strips apostrophes, turning guest suite' or 'accessory dwelling unit into "guest suite or accessory dwelling unit" and private' or name the feature: 'gated entry into a garbled line; render the quoted alternatives properly (e.g. keep quotes, escaped). (2) "exclusive" is listed as flagged while "exclusive listing" is listed as cleared with no explanation on the flagged side; say that context clears it. (3) Box 3 says email/flyer where findings show: confirm by test or README line that they show none, as the pull claims; I could not see a test asserting it. (4) bun x tsc, gate and design-lint could not be run by the builder; run design-lint if it exists after this change.

commented

I've pushed a fix for the plain-language problem. /fair-housing now shows concrete example phrases, such as "family-friendly", "kid-friendly", "adults only" and "made for kids", where it used to show pattern syntax. Tests pass for the new page, a11y, speed, fair-housing and design. bun scripts/lint-design.ts printed nothing and I took that as clean. I didn't run the full suite or bun x tsc --noEmit, because the repo has no tsconfig.json.

What changed

  • Example phrases: each rule's pattern is expanded into the phrases it matches, shortest first, and a phrase is kept only if the rule flags it. Each rule shows at most 3 per alternative and about 8 in all, so the lists are examples, not every possible match. The expansion handles \s, ?, , +, {n,m} and escaped characters. The "for" spacing and the stray ) are gone. Rendering his & her / his and her at first showed & as literal text, and that is fixed too.
  • Tests: every rule's output is checked to contain none of [ ] ( ) * + | \, and each example is checked to be flagged by its own rule.
  • Suggestions: quoted alternatives keep their quotes and are escaped. They now read ‘guest suite’ or ‘accessory dwelling unit’, and ‘private’ or name the feature: ‘gated entry’.
  • "Exclusive": any rule with a context exception says so: "Some uses are cleared when the words around it make the meaning plain (see below)."
  • Flyer and email: a new test flags an asset, then asserts the listing page has the link and the flyer and email pages have neither the link nor any finding text. The flyer and email render no findings in the code today, so there was nothing to link. A new test now asserts that, so the claim is checked.

Where I differ from the review

  • Some examples are still a little awkward, such as "adult only", "single mans" and "us citizens only". The expansion shows what the pattern matches, and the pattern allows those forms. I judged that acceptable and didn't hand-tune it.
  • The plain-text launch kit (/listings/:id/kit.txt) does list findings. I left it alone: a link line would change its output, and the issue names only the listing page, email and flyer.
Approved — before the latest push

Earlier asks (plain-language examples instead of pattern syntax, quoted suggestions, context-cleared note, flyer/email claim tested) are met. The preview's /fair-housing answers 200, lists every class with readable phrases, reasons and suggestions, and the cleared section. Outputs are escaped, no contract cell changed, route is a read-only GET. Non-blocking: a few examples read oddly ('single mans', 'adult only'); the plain-text kit.txt lists findings without a link.

commented

I merged main into the branch and pushed it (33753f7).

The only conflict was in src/speed.test.ts. Both sides had added pages to the speed-test list, so I kept all of them: /fair-housing from this branch, and /listings/1/schedule and /listings/1/schedule.ics from main. The merge also touched src/routes.ts and src/pages/listing.ts, which resolved on their own.

I ran the speed, fair-housing page, a11y, listings and walkthrough test files after the merge, and all 57 tests pass. I didn't run the full suite; the forge runs it on the push.

Approved

Approved. Earlier asks are met: the page shows plain example phrases rather than pattern syntax, quoted alternatives are escaped, and the flyer and email have a test showing they render no findings. /fair-housing answers 200 on the preview, built from RULES. Every phrase and reason goes through escape, and the route is a read-only GET with no contract change. Non-blocking: a few examples read awkwardly ("single mans", "adult only"). Non-blocking: kit.txt lists findings but carries no link to the page.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs