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}
{row.options.map((o) => (
diff --git a/src/app/features/desk/age.ts b/src/app/features/desk/age.ts
index a8473f01..52853032 100644
--- a/src/app/features/desk/age.ts
+++ b/src/app/features/desk/age.ts
@@ -7,8 +7,20 @@ const DAY = 24 * HOUR;
* holds. Nothing when there is no instant, it does not parse, or it is ahead of the clock: the desk shows no age
* rather than a wrong one.
*/
+const RFC3339 = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
+
+/** Date.parse is lenient ("2026-11-06", "Nov 6 2026", "0"); the card's instant is RFC3339 and a real calendar day. */
+const parseRfc3339 = (s: string): number => {
+ const m = RFC3339.exec(s);
+ if (!m) return NaN;
+ const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
+ const day = new Date(Date.UTC(y, mo - 1, d));
+ if (day.getUTCMonth() !== mo - 1 || day.getUTCDate() !== d) return NaN;
+ return Date.parse(s);
+};
+
export const raisedAge = (raisedAt: string | undefined, now: number): string | undefined => {
- const then = raisedAt === undefined ? NaN : Date.parse(raisedAt);
+ const then = raisedAt === undefined ? NaN : parseRfc3339(raisedAt);
const ms = now - then;
if (Number.isNaN(ms) || ms < 0) return undefined;
if (ms < HOUR) return 'raised just now';
diff --git a/src/app/features/desk/buildDesk.ts b/src/app/features/desk/buildDesk.ts
index 0b18794c..fbe2caaf 100644
--- a/src/app/features/desk/buildDesk.ts
+++ b/src/app/features/desk/buildDesk.ts
@@ -30,9 +30,9 @@ export type DeskRow =
depends: string[];
/** When the question was first admitted, as served; absent when the card carries none. */
raisedAt?: string;
- /** Counts as served: the same in the decider and the withheld view, so they show either way. */
- deciderCount: number;
- answererCount: number;
+ /** Counts as served: the same in the decider and the withheld view, so they show either way. Absent when the served number is outside the contract's range or not an integer. */
+ deciderCount?: number;
+ answererCount?: number;
/** In admission order, as served. */
answers: AnswerRow[];
};
@@ -62,6 +62,9 @@ const answerRow = (a: DeskAnswer, entry: ForkEntry): AnswerRow => ({
counted: entry.record.counted_answer_id === a.answer_id,
});
+const validCount = (n: number, min: number, max: number): number | undefined =>
+ Number.isInteger(n) && n >= min && n <= max ? n : undefined;
+
export const buildDesk = (
list: ForkList | undefined,
unverified: ReadonlySet = new Set()
@@ -89,8 +92,8 @@ export const buildDesk = (
recommended: card.options.find((o) => o.id === card.recommendation)?.text,
depends: card.depends,
raisedAt: card.raised_at ?? undefined,
- deciderCount: card.decider_count,
- answererCount: record.answerer_count,
+ deciderCount: validCount(card.decider_count, 1, 64),
+ answererCount: validCount(record.answerer_count, 0, Infinity),
answers: record.answers.map((a) => answerRow(a, entry)),
});
});