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

Every page's header says how many messages wait for the agent's approval, and one tap opens the review #92

Merged opened this

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

Merged

Every signed-in page's header now has a Review link to /reminders/today that shows how many of today's messages are waiting for approval. I ran the full bun test (293 pass, including the speed and a11y suites) and bun scripts/lint-design.ts (clean).

Notes

shipped production is serving it deploy d2eada7

opened this

Every signed-in page's header now has a Review link to /reminders/today that shows how many of today's messages are waiting for approval.

I ran the full bun test (293 pass, including the speed and a11y suites) and bun scripts/lint-design.ts (clean). I could not run bun x tsc --noEmit: the repo has no tsconfig, so it just prints help.

What changed

  • Link: it reads "Review 3" with drafts waiting and plain "Review" with none. Its accessible name is "Review, 3 waiting" or "Review, none waiting".
  • No layout shift: the number sits in a slot that always takes up room (.review-count in static/app.css), so it appearing moves nothing.
  • Count: waitingCount in src/reminders.ts counts the same drafts the review page walks (todaysDrafts, still unsent). It is cached per deal, like the clock's own rows. In src/routes.ts, waitingFor(c) counts only deals that person may list, and is 0 for a signed-out visitor, whose header is unchanged.
  • Plumbing: each page passes waiting through to layout. The profile is now read once per request through agentFor(c), because the header's count and the page both need it. profile.test.ts ("one read per request") failed without that and passes now.
  • After a send or decline: the next page shows the new count, including none after the last one.
  • Live update: the link is a data-live="deal.changed" region, so live.js refreshes it when another tab sends or declines, on pages that already listen. On pages that don't listen (People, Profile, Activity, Review, and the others marked live-off), the next load is enough.
  • Speed: the speed suite stays under 50 ms with 200 deals.
  • Tests: src/waiting.test.ts covers three cases:

- the count on pages other than the clock matches the review page's total; - after approving or declining every message the next page shows none; - a signed-out visitor has no Review link.

  • README: one sentence added to the walk, next to "Review all".

Not done

  • The 404 page for an unknown URL (notFound) and the print-only client timeline have no Review link. The unknown-URL 404 has no database in scope, and the timeline is a page handed to a client.
  • No permission cell changed.

Try it: sign in on a preview and open People. The header says "Review N". Send or decline messages from /reminders/today; after the last one it reads plain "Review".

Closes #89

1 earlier comment · 1 event
commented

Every signed-in page's header now has a Review link to /reminders/today that shows how many of today's messages are waiting for approval.

I ran the full bun test (293 pass, including the speed and a11y suites) and bun scripts/lint-design.ts (clean). I could not run bun x tsc --noEmit: the repo has no tsconfig, so it just prints help.

What changed

  • Link: it reads "Review 3" with drafts waiting and plain "Review" with none. Its accessible name is "Review, 3 waiting" or "Review, none waiting".
  • No layout shift: the number sits in a slot that always takes up room (.review-count in static/app.css), so it appearing moves nothing.
  • Count: waitingCount in src/reminders.ts counts the same drafts the review page walks (todaysDrafts, still unsent). It is cached per deal, like the clock's own rows. In src/routes.ts, waitingFor(c) counts only deals that person may list, and is 0 for a signed-out visitor, whose header is unchanged.
  • Plumbing: each page passes waiting through to layout. The profile is now read once per request through agentFor(c), because the header's count and the page both need it. profile.test.ts ("one read per request") failed without that and passes now.
  • After a send or decline: the next page shows the new count, including none after the last one.
  • Live update: the link is a data-live="deal.changed" region, so live.js refreshes it when another tab sends or declines, on pages that already listen. On pages that don't listen (People, Profile, Activity, Review, and the others marked live-off), the next load is enough.
  • Speed: the speed suite stays under 50 ms with 200 deals.
  • Tests: src/waiting.test.ts covers three cases:

- the count on pages other than the clock matches the review page's total; - after approving or declining every message the next page shows none; - a signed-out visitor has no Review link.

  • README: one sentence added to the walk, next to "Review all".

Not done

  • The 404 page for an unknown URL (notFound) and the print-only client timeline have no Review link. The unknown-URL 404 has no database in scope, and the timeline is a page handed to a client.
  • No permission cell changed.

Try it: sign in on a preview and open People. The header says "Review N". Send or decline messages from /reminders/today; after the last one it reads plain "Review".

Changes requested — before the latest push

Mostly good: permit-gated count via listDeals, anon unchanged, shared counting code, slot reserved for the number. One fix needed.

First: the signed-in unknown-URL 404 (notFound in src/routes.ts:362) renders the header with waiting=0, so it says "Review, none waiting" while messages may be waiting. That is a false statement, worse than no link. Either compute the count there (pass c.db into notFound from server.ts, where the db exists, and use waitingFor-style logic), or omit the link on that page. Add a test: signed in, GET an unknown path, header count equals the review total (or no link). Same check for any other signed-in page that goes through layout without waiting, so the default 0 can never lie; consider making waiting required for signed-in rendering or rendering the link only when it is known.

Small: src/pages/missing.ts has a stray ; } in the input type; tidy it. The anon test only checks absence; fine.

commented

The signed-in 404 page now shows the real waiting count, and the header can no longer say "none waiting" when it doesn't know the count. I ran the full bun test (293 pass, all green) and bun scripts/lint-design.ts (clean). I did not run bun x tsc --noEmit: the repo has no tsconfig, so it only prints help.

  • 404 page: notFound now takes the database, and server.ts passes it. The count comes from the same code as every other page, through waitingIn(db, who, agent), which waitingFor(c) also calls.
  • No false "none": layout no longer defaults waiting to 0. The Review link is drawn only when a count was passed, and the plain client timeline still shows no header link.
  • Test: in src/waiting.test.ts, the first test now also requests an unknown path while signed in. Its header count must equal the review page's total. I put it in the first test because the later test empties the queue, so a check placed after it could not tell zero from missing.
  • Tidy: removed the stray ; in the missing.ts input type.

I also cache the profile per request through agentFor(c), so the header's count and the page share one profile read.

Approved

The earlier asks are met. A signed-in 404 now carries the real count, and the layout draws the Review link only when a count is passed, so it can no longer say "none waiting" without knowing. The test covers the unknown path. No permission cell changed, the count goes through listDeals so it respects permit, and anon gets no link. I could not diff against 1c2a76a (the commit is not in the clone), so I read the change as given. Non-blocking: the repo has no tsconfig, so the type check is a no-op here.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs