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

Fix a flagged Fair Housing phrase in every asset at once: one tap puts the suggested words in place wherever the phrase appears, and each changed asset waits for approval again #121

Closed opened this has it
opened this

Intent: the 27 Birchwood Court sample shows "Fair Housing: 22 to review", but those 22 findings are three phrases ("Family-friendly", "Walking distance to church", "Great for young couples") repeated across eight assets. Today the agent fixes them one asset at a time with /listings/:id/assets/:kind/suggestion. In a sales meeting that is 22 taps where 3 should do.

Done looks like:

  • [x] The listing page's Fair Housing summary lists each flagged phrase once, with how many assets it appears in and the suggested words, server-rendered.
  • [ ] Each phrase has one button, "Use the suggestion everywhere". It is a same-origin POST, and only the listing's author or an admin may use it (asked through permit, the same as useSuggestion). It replaces that phrase with its suggestion in every asset of the listing in one transaction and re-runs the check on each one.
  • [x] Every asset it changed loses its approval and keeps its earlier words in its version history, the same as a single suggestion does. The page then says how many assets changed and that each needs approval again.
  • [x] A human still approves every message: nothing becomes approved because of this action.
  • [x] On the Birchwood sample, three taps take the listing from 22 findings to clear, and a test proves it.
  • [x] Tests: a guest or another user gets the same refusal as on the single-suggestion route. A phrase that is no longer present changes nothing. The audit trail records one entry per changed asset.
  • [x] The README walkthrough step about the Birchwood sample mentions the new button.

Files likely: src/actions.ts (a useSuggestionEverywhere beside useSuggestion), src/fairhousing.ts (group findings by phrase), src/routes.ts, src/pages/listing.ts, tests in src/fairhousing.test.ts / src/actions.test.ts, README.md.

Risks: overlapping matches inside one asset (replace from the end so the offsets stay valid). Case: keep the sentence's capitalisation. Do not loosen any contract cell.

Suggested crew: builder.

commented

Reviewed pull #126 at its head: ticked The listing page's Fair Housing summary lists each flagged phrase once, with how many assets it appears in and the suggested words, server-rendered.; Every asset it changed loses its approval and keeps its earlier words in its version history, the same as a single suggestion does. The page then says how many assets changed and that each needs approval again.; A human still approves every message: nothing becomes approved because of this action.; On the Birchwood sample, three taps take the listing from 22 findings to clear, and a test proves it.; Tests: a guest or another user gets the same refusal as on the single-suggestion route. A phrase that is no longer present changes nothing. The audit trail records one entry per changed asset.; The README walkthrough step about the Birchwood sample mentions the new button..

commented

Left open after pull #126 landed: 1 unticked item remains (Each phrase has one button, "Use the suggestion everywhere". It is a same-origin POST, and only the listing's author or an admin may use it (asked through permit, the same as useSuggestion). It replaces that phrase with its suggestion in every asset of the listing in one transaction and re-runs the check on each one.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.

commented

Already done on main in 803dad4: the last box shipped with the rest. src/pages/listing.ts renders one "Use the suggestion everywhere" form per phrase (POST /listings/:id/fair-housing/suggestion), src/routes.ts hands it to useSuggestionEverywhere in src/actions.ts, which asks permit through listingFor(..., "update") and replaces the phrase in every asset inside one db.transaction, re-checking each one; src/everywhere.test.ts covers it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs