From 79fae54a0a24615424e41bff365e7dbee7a5962a Mon Sep 17 00:00:00 2001 From: Void Date: Wed, 11 Nov 2026 20:53:36 +0000 Subject: [PATCH] Desk: age parses strict RFC3339 only; a served count outside the contract shows no count line Soul found Date.parse accepting '2026-11-06', 'Nov 6 2026', '0' and 2026-02-30, and decider_count 0/65 or a missing/negative answerer_count rendering as served. Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/desk/DeskView.test.tsx | 27 ++++++++++++++++++++++++- src/app/features/desk/DeskView.tsx | 8 +++++--- src/app/features/desk/age.ts | 14 ++++++++++++- src/app/features/desk/buildDesk.ts | 13 +++++++----- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/app/features/desk/DeskView.test.tsx b/src/app/features/desk/DeskView.test.tsx index c93c5916..9c60ed53 100644 --- a/src/app/features/desk/DeskView.test.tsx +++ b/src/app/features/desk/DeskView.test.tsx @@ -145,7 +145,7 @@ describe("a question's age", () => { expect(html('2026-11-11T11:40:00Z')).toContain('raised just now'); }); it('shows no age when the card carries none, or an instant that does not parse or is ahead of the clock', () => { - ['null', 'yesterday', '2027-01-01T00:00:00Z'].forEach((v) => { + ['null', 'yesterday', '2027-01-01T00:00:00Z', '2026-11-06', 'Nov 6 2026', '0', '2026-02-30T00:00:00Z'].forEach((v) => { expect(html(v === 'null' ? null : v)).not.toContain('raised '); }); }); @@ -173,6 +173,31 @@ describe('counts when the ids are withheld', () => { ); expect(html).toContain('3 deciders · 2 answerers'); }); + it('shows no count line for a served count outside the contract', () => { + const bad = (card: object, record: object): string => { + const entry = STATES.noAnswers.forks[0]; + const list = { + ...STATES.noAnswers, + forks: [{ card: { ...entry.card, ...card }, record: { ...entry.record, ...record } }], + } as ForkList; + return renderToStaticMarkup( + + + + ); + }; + [ + [{ decider_count: 0 }, {}], + [{ decider_count: 65 }, {}], + [{ decider_count: undefined }, {}], + [{}, { answerer_count: -1 }], + [{}, { answerer_count: 1.5 }], + ].forEach(([c, r]) => { + const out = bad(c, r); + expect(out).not.toContain('undefined'); + expect(out).not.toMatch(/deciders? ·/); + }); + }); it('says the singular for one', () => { const html = view('noAnswers', ScreenSize.Desktop); expect(html).toContain('1 decider · 0 answerers'); diff --git a/src/app/features/desk/DeskView.tsx b/src/app/features/desk/DeskView.tsx index 2c73890d..f83dcd82 100644 --- a/src/app/features/desk/DeskView.tsx +++ b/src/app/features/desk/DeskView.tsx @@ -83,9 +83,11 @@ function Row({ row, now }: { row: DeskRow; now: number }) { {raisedAge(row.raisedAt, now) && (

{raisedAge(row.raisedAt, now)}

)} -

- {`${plural(row.deciderCount, 'decider')} · ${plural(row.answererCount, 'answerer')}`} -

+ {row.deciderCount !== undefined && row.answererCount !== undefined && ( +

+ {`${plural(row.deciderCount, 'decider')} · ${plural(row.answererCount, 'answerer')}`} +

+ )}

{row.context}