From be843c579720553648dfcdccdad371631be19a9f Mon Sep 17 00:00:00 2001 From: Francis Li Date: Mon, 30 Nov 2026 10:24:22 -0800 Subject: [PATCH] feat(scaling): group the work log by category in an accordion Each category (Execution, DA, Disk, Infra) is a collapsible group with a status bar and counts; groups with entries start open. Infra replaces the Proving and Latency categories, and a discarded status shows abandoned work struck through, after completed work. --- app/scaling/components/Work.tsx | 102 ++++++++++++---------- app/scaling/components/scorecard.test.tsx | 28 ++++-- app/scaling/snapshot.mjs | 6 +- app/scaling/snapshot.test.ts | 2 +- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/app/scaling/components/Work.tsx b/app/scaling/components/Work.tsx index 5ce2a37..df0fa30 100644 --- a/app/scaling/components/Work.tsx +++ b/app/scaling/components/Work.tsx @@ -1,17 +1,15 @@ -import { Card } from '../../components/ui/Card'; import { cn } from '../../components/ui/cn'; import { EmptyState } from '../../components/ui/EmptyState'; import { Text } from '../../components/ui/Text'; -import { WORK_STATUSES } from '../snapshot.mjs'; +import { WORK_CATEGORIES, WORK_STATUSES } from '../snapshot.mjs'; import type { Area, Link, WorkCategory, WorkItem } from '../snapshot.mjs'; import { Info } from './Info'; // Status labels follow Linear's project states. -const STATUS: Record = { 'in-progress': 'In Progress', planned: 'Planned', done: 'Completed' }; +const STATUS: Record = { 'in-progress': 'In progress', planned: 'Planned', done: 'Completed', discarded: 'Discarded' }; +const DOT: Record = { 'in-progress': 'bg-bds-blue-60', planned: 'bg-bds-yellow-50', done: 'bg-bds-green-60', discarded: 'bg-bds-gray-40' }; // Older entries name an area instead of a category. -const CATEGORY: Record = { da: 'DA', execution: 'Execution', state: 'Disk', networking: 'Latency' }; -const TH = 'px-3 py-2 text-left text-[11px] font-[600] uppercase tracking-wide text-bds-gray-60'; -const TD = 'px-3 py-2.5 align-top'; +const CATEGORY: Record = { da: 'DA', execution: 'Execution', state: 'Disk', networking: 'Infra' }; // Links in the entry's order, then its Linear project and evidence when an older entry carries them. const linksOf = (w: WorkItem): Link[] => { @@ -21,54 +19,62 @@ const linksOf = (w: WorkItem): Link[] => { return links; }; -// In progress first, then planned, then done; entries with any other status are not shown. +function Item({ w }: { w: WorkItem }) { + const effect = w.effect ?? w.expected ?? null; + const about = [w.hypothesis && `Hypothesis: ${w.hypothesis}`, w.change && `Change: ${w.change}`, `Owner: ${w.owner ?? 'none assigned'}`].filter(Boolean); + const links = linksOf(w); + return ( +
  • + + + {w.title} + {about.join(' ')} + {w.owner ? · {w.owner} : null} + + + {links.map((l, i) => ( + + {i > 0 ? ' · ' : null} + {l.label} + + ))} + + {effect ?? 'not measured yet'} +
  • + ); +} + +// One collapsible group per category, in WORK_CATEGORIES order; groups with entries start open. +// Within a group: in progress, then planned, done and discarded; entries with any other status are not shown. export function Work({ work }: { work: WorkItem[] }) { - const rows = work.filter((w) => WORK_STATUSES.includes(w.status)).toSorted((a, b) => WORK_STATUSES.indexOf(a.status) - WORK_STATUSES.indexOf(b.status)); + const shown = work.filter((w) => WORK_STATUSES.includes(w.status)).toSorted((a, b) => WORK_STATUSES.indexOf(a.status) - WORK_STATUSES.indexOf(b.status)); + const categoryOf = (w: WorkItem) => w.category ?? (w.area ? CATEGORY[w.area] : undefined); + const groups = WORK_CATEGORIES.map((c) => ({ category: c, items: shown.filter((w) => categoryOf(w) === c) })); return (
    Work log - {rows.length === 0 ? ( + {shown.length === 0 ? ( ) : ( - - - - - {['Status', 'Work', 'Impact category', 'Effect', 'Links'].map((h) => )} - - - - {rows.map((w) => { - const effect = w.effect ?? w.expected ?? null; - const about = [w.hypothesis && `Hypothesis: ${w.hypothesis}`, w.change && `Change: ${w.change}`, `Owner: ${w.owner ?? 'none assigned'}`].filter(Boolean); - const links = linksOf(w); - return ( - - - - - - - - ); - })} - -
    {h}
    - {STATUS[w.status]} - - - {w.title} - {about.join(' ')} - - {w.category ?? (w.area ? CATEGORY[w.area] : '—')}{effect ?? 'not measured yet'} - {links.length === 0 ? — : links.map((l, i) => ( - - {i > 0 ? ' · ' : null} - {l.label} - - ))} -
    -
    +
    + {groups.map(({ category, items }) => { + const counts = WORK_STATUSES.map((s) => [s, items.filter((w) => w.status === s).length] as const).filter(([, n]) => n > 0); + return ( +
    0} className="rounded-lg border border-bds-gray-10 dark:border-white/10"> + + {category} + +
    + {items.length ?
      {items.map((w) => )}
    :

    No {category} work logged yet.

    } +
    +
    + ); + })} +
    )}
    ); diff --git a/app/scaling/components/scorecard.test.tsx b/app/scaling/components/scorecard.test.tsx index d3e4dba..3aefe44 100644 --- a/app/scaling/components/scorecard.test.tsx +++ b/app/scaling/components/scorecard.test.tsx @@ -712,15 +712,22 @@ describe('guardrails summary and work', () => { expect(text(guardrails(BENCH))).toContain('Met 5'); }); - it('logs work in progress, then planned, then done, hiding other statuses', () => { + // Category summaries and items of the work log, without the mocked help popovers. + const groups = (html: string) => html.split(' text(`')[0]}`)); + const items = (html: string) => html.replace(/ ?[^<]*<\/span>/g, '').split(' text(`')[0]}`)); + + it('groups work by category, in progress before planned before done, hiding other statuses', () => { const work = render({}).work; - expect(text(work.split('')[0])).toContain('StatusWorkImpact categoryEffectLinks'); + expect(groups(work)).toEqual(['Execution1 in progress', 'DA1 planned', 'Diskno entries', 'Infrano entries']); + // Groups with entries start open; empty ones start closed. + expect(work.match(/]*open=""/g)).toHaveLength(2); // The legacy "Research-derived proposal" entry is not shown; the Linear project and evidence of an older entry become links. - expect(rows(work)).toEqual([ - 'In ProgressSynthetic unified binaryExecutionabout 20% faster block processing (synthetic demo)Linear · Synthetic run', - 'PlannedSynthetic blob batching changeDAnot measured yetSynthetic doc', + expect(items(work)).toEqual([ + 'Synthetic unified binary· Synthetic ownerLinear · Synthetic runabout 20% faster block processing (synthetic demo)', + 'Synthetic blob batching changeSynthetic docnot measured yet', ]); expect(work).toContain('Linear'); + expect(text(work)).toContain('No Disk work logged yet.'); expect(text(work)).not.toMatch(/legacy proposal|Expected effects are not summed/); }); @@ -729,12 +736,15 @@ describe('guardrails summary and work', () => { const [first, second] = snapshot.work; snapshot.work = [ { ...second, status: 'done', category: undefined, links: [{ label: 'Doc', url: 'https://example.com/doc' }, { label: 'Linear', url: 'https://example.com/linear' }] }, - { ...first, effect: undefined, expected: 'about 10% faster' }, + { ...first, effect: undefined, expected: 'about 10% faster', status: 'discarded' }, ]; - expect(rows(render({}, snapshot).work)).toEqual([ - 'In ProgressSynthetic unified binaryExecutionabout 10% fasterLinear · Synthetic run', - 'CompletedSynthetic blob batching changeDAnot measured yetDoc · Linear', + const work = render({}, snapshot).work; + expect(groups(work)).toEqual(['Execution1 discarded', 'DA1 completed', 'Diskno entries', 'Infrano entries']); + expect(items(work)).toEqual([ + 'Synthetic unified binary· Synthetic ownerLinear · Synthetic runabout 10% faster', + 'Synthetic blob batching changeDoc · Linearnot measured yet', ]); + expect(work).toContain('line-through">Synthetic unified binary'); snapshot.work = [{ ...first, status: 'Proposed' }]; expect(text(render({}, snapshot).work)).toContain('No work in progress or planned for this snapshot.'); }); diff --git a/app/scaling/snapshot.mjs b/app/scaling/snapshot.mjs index a1ecefe..1df7d0d 100644 --- a/app/scaling/snapshot.mjs +++ b/app/scaling/snapshot.mjs @@ -36,7 +36,7 @@ * projectId: string, issueId?: string, state: string, progress: number, scopeDone: number, * scopeTotal: number, targetDate?: string, updatedAt: string, url: string * }} LinearStatus - * @typedef {'DA' | 'Disk' | 'Execution' | 'Proving' | 'Latency'} WorkCategory + * @typedef {'Execution' | 'DA' | 'Disk' | 'Infra'} WorkCategory * @typedef {{ * title: string, status: string, category?: WorkCategory, effect?: string | null, links?: Link[], * owner?: string | null, area?: Area, hypothesis?: string, change?: string, @@ -62,8 +62,8 @@ const TAGS = ['measured', 'modeled', 'estimated', 'not-measured', 'not-modeled', const VALUED_TAGS = ['measured', 'modeled', 'estimated']; const AREAS = ['da', 'execution', 'state', 'networking']; // Work log statuses follow Linear's project states; impact categories are the page's limit names. -export const WORK_STATUSES = ['in-progress', 'planned', 'done']; -export const WORK_CATEGORIES = ['DA', 'Disk', 'Execution', 'Proving', 'Latency']; +export const WORK_STATUSES = ['in-progress', 'planned', 'done', 'discarded']; +export const WORK_CATEGORIES = ['Execution', 'DA', 'Disk', 'Infra']; // Each section renders on its area page, or on the guardrails page for outcomes. const SECTION_IDS = ['da', 'execution', 'state', 'outcomes']; const INPUT_STATUSES = ['observed', 'configured', 'provisional', 'pending']; diff --git a/app/scaling/snapshot.test.ts b/app/scaling/snapshot.test.ts index 5d8bff2..95c1745 100644 --- a/app/scaling/snapshot.test.ts +++ b/app/scaling/snapshot.test.ts @@ -100,7 +100,7 @@ describe('parseSnapshot', () => { { title: 'Bad link', status: 'planned', category: 'DA', effect: 3, links: [{ label: 'Doc', url: 'http://example.com' }] }, ); expect(errorsOf(data)).toEqual([ - 'work[4].category: expected one of DA, Disk, Execution, Proving, Latency', + 'work[4].category: expected one of Execution, DA, Disk, Infra', 'work[5].category: required without area', 'work[6].effect: expected string or null', 'work[6].links[0].url: expected https URL',