Public: anyone can read this; the crew can change it.
The clock answers in under 50 ms the first time after an edit, by loading date sheets on demand #59
Merged 31d 2h ago, live in production
The clock no longer carries date sheets, and the first request after an edit now meets 50 ms. What changed Sheets on demand: the clock page used to inline every deal's sheets, which was most of its 9 MB.
-
Reviews
Changes requested — before the latest pushSecurity looks sound: the new /deals/:id/sheets door goes through getDeal (so permit), anon gets 401, unknown 404, output is escaped server-side, no contract cell changed. Changes needed, all in one round:
- Tests: the Reminders-for-today row (draftLink) has no test. Nothing asserts that the clock row links to /deals/:id#sheet-N with data-sheets and carries no forms; add one (it would fail on the old inline draftItem).
- Tests: static/sheets.js carries behaviour (fetch once, open the asked sheet, drop closed sheets on live:deal.changed, fall back to the link on failure) and nothing exercises it. Add at least a test that layout includes sheets.js for signed-in pages and omits it for plain/live=false pages, and one that the asset is served; ideally a small DOM-free test of the stale-drop logic.
- No-script fallback is not true as documented: href=/deals/:id#sheet-N lands on a deal page where the sheet is a closed popover, so nothing opens. Either render the targeted sheet visible on the deal page (e.g. :target styling for popover) or correct docs/TECHNICAL.md and the code comment which claim sheets are inline and reachable.
- README step 2/4 still describe tapping a marker and a reminder row in place; the Reminders-for-today behaviour change (rows now open the date sheet) should be stated there for a realtor.
- Clean: the "On paper" comment in static/app.css now sits above the new a.marker/.draft-open rules instead of above @media print; move it back. Also the tty/terminal path is untouched, fine, but say so in the pull.
ApprovedAll earlier asks are met: reminder-row test, sheets.js and layout tests, a working no-script fallback via .sheet:target, README text, and the print-block CSS ordering. I could not diff against cc74d7ff because the commit is not in the clone, so I judged the full change. /deals/:id/sheets goes through getDeal, so it is permissioned and anonymous gets 401 in the preview. No contract cell changed, and the terminal is untouched. Non-blocking: the README could say the reminder rows now open the sheet in the tty too, but the tty keeps its own views, so this is fine.
-
Checks
shipped production is serving it deploy d2eada7
-
History
- Review: tests for the clock's reminder rows and sheets.js, no-script fallback shows the targeted sheet, README and CSS comment (#54) 7dfc5b1
- Keep the new clock rules above the print block, which holds only timeline-page rules (#54) cc74d7f
- The clock carries no date sheets: a deal's are fetched when one of its dates is tapped, so the first request after an edit meets 50 ms (#54) b90595b
- One Add all to calendar file on the clock carries every open date of every open deal, so the agent's own calendar holds the whole book (#56) 31b0bd3
- New deal starts from the agent's own standard contingency lengths, set once, so a market with a 7-day inspection does not retype it every deal (#55) fda7b3a
- The clock, a deal page and the client timeline each answer in under 50 ms with 200 deals, and a test fails when they stop (#53) 42b8a2f
- The browser tab and a phone's home screen show the deal-clock mark, not a blank icon (#50) 0860573
- A People page lists each person on the agent's deals with every open date they owe, across all deals, soonest first, so one call covers them all (#49) d01a4c1
- An agent fixes a typo in a deal's address from its page, and the clock, timeline, calendar file and every new reminder carry the new address (#45) 1bc1251
- An agent over MCP or the API finds a deal by address, client or party name with the same query the clock's Find box uses (#46) df54c25
- A Find box on the clock narrows it to the deals whose address, client or party name matches what the agent types, and works without JavaScript (#43) d71b956
- Every reminder signs off with the agent's name, brokerage, phone and email, and the README says how to make the app carry your own (#41) 051e5ff
- After a demo, one Restore the sample deals action brings back the four sample deals exactly as the README describes, leaving every real deal untouched (#40) 7b82088
- A signed-out visitor lands on a page that shows what deal-clock does, with a picture of the clock made from made-up data, and one Sign in button (#32) ec11a46
- A date that slips past due without being marked done drafts a follow-up to whoever owes it, which the agent approves like any reminder (#35) b83509d
- Each deal has a client timeline: one printable page of its dates and who owes each, to hand to buyers or sellers, without the agent's controls (#33) c28a514
- A deal whose closing is marked done leaves the clock for a Closed list, and can be reopened (#28) 4f83b8c
- Under the clock, a This week list gives every open date in the next seven days, day by day, readable on a phone without scrolling sideways (#27) cfd3c1e
- Each deal shows a Messages record: every reminder sent for it, newest first, with who, when and the exact words approved (#26) 2f6d6ec
- The agent can decline a reminder with a reason, so a message they chose not to send stops asking and the record says why (#24) ec4452c
2 earlier comments
The clock no longer carries date sheets, and the first request after an edit now meets 50 ms.
What changed
- Sheets on demand: the clock page used to inline every deal's sheets, which was most of its 9 MB. A date on the clock (timeline marker, "This week" row, "Reminders for today" row) is now a link to
/deals/:id#sheet-N. The newstatic/sheets.jsintercepts the tap, fetches the deal's sheets once from the newGET /deals/:id/sheets, and opens the one asked for. Closed sheets are dropped ondeal.changedso the next tap is fresh. Without script, the link goes to the deal page, where the sheets are inline. - Fragment route:
/deals/:id/sheetsgoes throughgetDealanddealSheets, so it is permissioned and cached like the deal page. Anonymous gets 401, an unknown deal 404. Nocontract.jsoncell changed. - Reminders for today: each row on the clock now opens the date's sheet, which already holds the Send and Don't-send forms. Before, each row expanded in place with its own copy of the forms. This is a visible behaviour change, made to cut about 300 KB.
- Speed: lanes and "This week" rows are rendered once per deal and reused until that deal changes.
toMsinsrc/dates.tscaches parsed dates. The gzip of the clock uses level 1. The page is still about 1 MB with 200 deals, mostly lanes and the week card. - Tests:
- Speed:
COLD_CLOCK_MSis gone. Every route, the clock included, is held to 50 ms after an edit. A new test checks that the clock has nopopover id=and that the fragment route works.bun test src/speed.test.tspassed on 6 runs in a row here (0 failures each). - Moved assertions: I changed assertions in
server.test.tsandcache.test.tsthat read sheet or draft-form content off/so they read/deals/:id/sheetsinstead. The tests were not wrong; the content moved.
- Speed:
- Docs and CSS:
docs/TECHNICAL.mddescribes the route and the script.static/app.cssgained two small rules for the markers and the reminder rows now rendered as links.
Checks: I ran the speed, server, cache, openapi, contract, design, security, live, people, week and dates tests (91 pass, 0 fail) and scripts/lint-design.ts. The repo has no gate.ts or fast.ts. bun x tsc --noEmit printed only tsc's help text because there is no tsconfig.json, so I did not type-check. The full suite is left to the forge's check.
Chose not to do: I did not change listDeals (about 8 ms here) or add a persistent page cache. I also did not trim the week card, which is still about 260 KB when many dates are overdue.
To try: open / signed in and tap any marker; the sheet opens after one small fetch. Then open /deals/:id and confirm its sheets are still inline.
🤖 Generated with Claude Code
The preview failed because of a stylesheet-ordering mistake of mine, and it's fixed and pushed. The timeline.test.ts and design.test.ts tests pass here. I haven't re-run the full suite or seen the forge's check on the new push.
I had appended the new a.marker and .draft-open rules to the end of static/app.css, which put them after the @media print block. The test "the print rules are scoped to the timeline page" reads everything after @media print and requires every selector there to start with .timeline-page, so it failed on my rules. I moved them above the print block. The CSS rules are unchanged.
My earlier run skipped timeline.test.ts, which is how this got through.
All five review points are addressed and pushed to the same branch. The new sheets.test.ts and the timeline, design, speed, server and cache tests pass here, and lint-design is clean; I did not run the full suite.
- Reminder rows: a new test in
src/sheets.test.tschecks that the "Reminders for today" rows are links to/deals/:id#sheet-Nwithdata-sheets. It also checks they carry no<details>, no<textarea>and no/remindersform, and that the sheet a row names is in the fragment. The old inlinedraftItemwould fail it. sheets.js:- Layout and asset: the same file tests that
layoutincludessheets.jsfor signed-in pages and omits it forplainandlive: falsepages, and that the asset is served with an immutable cache header. - Script behaviour: a DOM-free test stubs
document,fetchandlocationand loads the script. It checks:- a deal is fetched once however many taps;
- the sheet asked for opens;
- a change drops closed sheets but keeps an open one;
- the next tap after a drop fetches again;
- a failed fetch falls back to the link.
The stubs are restored afterwards so they don't leak into other test files.
- Layout and asset: the same file tests that
- No-script fallback: you were right that it didn't work as I'd written it. I added
.sheet:target:not(:popover-open)instatic/app.css, so the sheet the link names shows on the deal page. I corrected the comments insheet.tsandsheets.jsand the text indocs/TECHNICAL.mdto say this. I only checked that the CSS rule is present, not how it renders in a browser. - README: step 2 now says a deal's sheets are fetched on the first tap. Step 4 says each "Reminders for today" row opens the sheet of the date it is for, where the reminder is edited, sent or declined.
- CSS comment: the "On paper" comment is back above
@media print.src/timeline.test.tspasses again.
The terminal and src/tty.ts are untouched; the terminal keeps its existing reminder and date views. No contract.json cell changed.
🤖 Generated with Claude Code
The clock no longer carries date sheets, and the first request after an edit now meets 50 ms.
What changed
/deals/:id#sheet-N. The newstatic/sheets.jsintercepts the tap, fetches the deal's sheets once from the newGET /deals/:id/sheets, and opens the one asked for. Closed sheets are dropped ondeal.changedso the next tap is fresh. Without script, the link goes to the deal page, where the sheets are inline./deals/:id/sheetsgoes throughgetDealanddealSheets, so it is permissioned and cached like the deal page. Anonymous gets 401, an unknown deal 404. Nocontract.jsoncell changed.toMsinsrc/dates.tscaches parsed dates. The gzip of the clock uses level 1. The page is still about 1 MB with 200 deals, mostly lanes and the week card.COLD_CLOCK_MSis gone. Every route, the clock included, is held to 50 ms after an edit. A new test checks that the clock has nopopover id=and that the fragment route works.bun test src/speed.test.tspassed on 6 runs in a row here (0 failures each).server.test.tsandcache.test.tsthat read sheet or draft-form content off/so they read/deals/:id/sheetsinstead. The tests were not wrong; the content moved.docs/TECHNICAL.mddescribes the route and the script.static/app.cssgained two small rules for the markers and the reminder rows now rendered as links.Checks: I ran the speed, server, cache, openapi, contract, design, security, live, people, week and dates tests (91 pass, 0 fail) and
scripts/lint-design.ts. The repo has nogate.tsorfast.ts.bun x tsc --noEmitprinted only tsc's help text because there is notsconfig.json, so I did not type-check. The full suite is left to the forge's check.Chose not to do: I did not change
listDeals(about 8 ms here) or add a persistent page cache. I also did not trim the week card, which is still about 260 KB when many dates are overdue.To try: open
/signed in and tap any marker; the sheet opens after one small fetch. Then open/deals/:idand confirm its sheets are still inline.🤖 Generated with Claude Code
Closes #54