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

A wrong link or a removed deal lands on a deal-clock page that says what happened and links back to the clock, not a bare "not found" #72

Merged opened this

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

Merged

A wrong link or a removed deal now shows a deal-clock page headed "Nothing here" instead of the plain text "not found". I ran src/server.test.ts, src/audit.test.ts and src/mcp.test.ts and they pass. The full suite is left to the forge's check, and bun x tsc --noEmit didn't run because the repo has no tsconfig.json.

Notes

shipped production is serving it deploy d2eada7

opened this

A wrong link or a removed deal now shows a deal-clock page headed "Nothing here" instead of the plain text "not found". I ran src/server.test.ts, src/audit.test.ts and src/mcp.test.ts and they pass. The full suite is left to the forge's check, and bun x tsc --noEmit didn't run because the repo has no tsconfig.json. bun scripts/lint-design.ts printed nothing. The brief says scripts/design-lint.ts, which doesn't exist; the repo's script is scripts/lint-design.ts. I didn't try the page against a running app.

What changed

  • New src/pages/missing.ts: missingPage renders the 404 in the normal layout, with the header and styles. It says "There is no page at this address." for an unknown path and "This deal is not here; it may have been removed." for a deal. It links "Back to the clock" when signed in, or "Sign in" when signed out.
  • src/routes.ts: a new notFound(request, url, who) answers an unmatched path with {"error":"not_found"} when the path is /api or under it, or when accept includes application/json. Otherwise it returns the HTML page with status 404.
  • src/routes.ts, deal routes: a missing or invalid id on /deals/:id, /deals/:id/timeline and /deals/:id/sheets now returns the same deal 404 page. It replaces the old "No such deal" refusal page and the plain-text sheets answer.
  • src/server.ts: the no-route case now calls notFound. The security headers stay on the response.
  • src/server.test.ts: new tests for an unknown path (HTML, security headers, sign-in link when signed out, "Back to the clock" link when signed in), a removed deal's page, timeline and sheets, a signed-out request for a missing deal, and API and accept: application/json misses.

Signed-out visitors: for a deal id the existing permission check still answers 401 "sign in" before any existence check. A signed-out visitor gets the same answer for an id that exists and one that doesn't. The test asserts this.

Not done: /deals/:id/ics, /openapi.json, /static/* and the security.txt redirect still answer plain-text 404s, because the issue named only pages, timeline and sheet. The clock's sheet fetcher falls back to opening the deal page when the fragment request fails, so a stale tap now ends on the new page.

I changed no contract.json permission.

Closes #69

commented

A wrong link or a removed deal now shows a deal-clock page headed "Nothing here" instead of the plain text "not found". I ran src/server.test.ts, src/audit.test.ts and src/mcp.test.ts and they pass. The full suite is left to the forge's check, and bun x tsc --noEmit didn't run because the repo has no tsconfig.json. bun scripts/lint-design.ts printed nothing. The brief says scripts/design-lint.ts, which doesn't exist; the repo's script is scripts/lint-design.ts. I didn't try the page against a running app.

What changed

  • New src/pages/missing.ts: missingPage renders the 404 in the normal layout, with the header and styles. It says "There is no page at this address." for an unknown path and "This deal is not here; it may have been removed." for a deal. It links "Back to the clock" when signed in, or "Sign in" when signed out.
  • src/routes.ts: a new notFound(request, url, who) answers an unmatched path with {"error":"not_found"} when the path is /api or under it, or when accept includes application/json. Otherwise it returns the HTML page with status 404.
  • src/routes.ts, deal routes: a missing or invalid id on /deals/:id, /deals/:id/timeline and /deals/:id/sheets now returns the same deal 404 page. It replaces the old "No such deal" refusal page and the plain-text sheets answer.
  • src/server.ts: the no-route case now calls notFound. The security headers stay on the response.
  • src/server.test.ts: new tests for an unknown path (HTML, security headers, sign-in link when signed out, "Back to the clock" link when signed in), a removed deal's page, timeline and sheets, a signed-out request for a missing deal, and API and accept: application/json misses.

Signed-out visitors: for a deal id the existing permission check still answers 401 "sign in" before any existence check. A signed-out visitor gets the same answer for an id that exists and one that doesn't. The test asserts this.

Not done: /deals/:id/ics, /openapi.json, /static/* and the security.txt redirect still answer plain-text 404s, because the issue named only pages, timeline and sheet. The clock's sheet fetcher falls back to opening the deal page when the fragment request fails, so a stale tap now ends on the new page.

I changed no contract.json permission.

Approved

Clean. Unknown paths and removed deals get the in-frame 404 page with security headers. API and accept:json misses stay JSON. Signed-out visitors get the same 401 for any deal id. Output is static or escaped, no contract cell changed, and the tests cover each case.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs