@startsimpli/integrations 0.2.200 → 0.2.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/package.json +7 -7
  2. package/src/__tests__/briefing-actions.test.ts +11 -0
  3. package/src/__tests__/briefing-edits.test.ts +98 -0
  4. package/src/__tests__/briefing-markdown.test.ts +64 -0
  5. package/src/__tests__/converse-brain.test.ts +64 -1
  6. package/src/__tests__/converse-cards.test.ts +53 -0
  7. package/src/__tests__/converse-handoff.test.ts +8 -0
  8. package/src/__tests__/converse-meeting-brief.test.ts +72 -8
  9. package/src/__tests__/converse-meeting-duplex.test.ts +132 -0
  10. package/src/__tests__/converse-meeting-keep-speech.test.ts +87 -0
  11. package/src/__tests__/converse-meeting-vad.test.ts +1 -1
  12. package/src/__tests__/converse-page.test.tsx +148 -37
  13. package/src/__tests__/converse-roci.test.ts +22 -0
  14. package/src/__tests__/converse-spoken-form.test.ts +10 -0
  15. package/src/__tests__/converse-spoken-summary.test.ts +27 -6
  16. package/src/__tests__/converse-structure.test.ts +27 -0
  17. package/src/__tests__/converse-view.test.ts +46 -0
  18. package/src/__tests__/converse.test.ts +29 -2
  19. package/src/__tests__/corpus-ask.test.ts +22 -0
  20. package/src/__tests__/corpus-tracker.test.tsx +42 -174
  21. package/src/__tests__/data-table-logic.test.ts +75 -0
  22. package/src/__tests__/data-table.test.tsx +133 -0
  23. package/src/__tests__/extract-classify.test.ts +17 -0
  24. package/src/__tests__/fleet-page.test.tsx +57 -0
  25. package/src/__tests__/fleet-view.test.ts +149 -0
  26. package/src/__tests__/home-brief.test.tsx +25 -40
  27. package/src/__tests__/library-call-shape.test.tsx +164 -0
  28. package/src/__tests__/load-error.test.tsx +1 -1
  29. package/src/__tests__/mini-markdown.test.tsx +24 -0
  30. package/src/__tests__/overview-page.test.tsx +36 -6
  31. package/src/__tests__/plan-shell.test.tsx +6 -4
  32. package/src/__tests__/project-basis-entity.test.ts +19 -0
  33. package/src/__tests__/project-basis.test.ts +21 -0
  34. package/src/__tests__/relay-cli.test.ts +10 -1
  35. package/src/__tests__/task-detail-project-guess.test.tsx +46 -0
  36. package/src/__tests__/timeline-events.test.ts +65 -0
  37. package/src/__tests__/timeline-table.test.tsx +66 -0
  38. package/src/__tests__/todo-table-model.test.ts +75 -0
  39. package/src/__tests__/todo-table.test.tsx +202 -0
  40. package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
  41. package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
  42. package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
  43. package/src/comms/api/comms.ts +23 -0
  44. package/src/comms/components/ResultsPanel.tsx +2 -2
  45. package/src/comms/components/SendLog.tsx +20 -8
  46. package/src/comms/components/index.ts +1 -0
  47. package/src/comms/components/pages/AppSendsPage.tsx +58 -0
  48. package/src/comms/hooks/index.ts +8 -3
  49. package/src/components/FolderTree.tsx +12 -3
  50. package/src/components/index.ts +4 -1
  51. package/src/components/pages/ConversePage.tsx +114 -105
  52. package/src/components/pages/FleetPage.tsx +115 -0
  53. package/src/components/pages/LibraryPage.tsx +63 -24
  54. package/src/components/pages/TaskDetailPage.tsx +27 -1
  55. package/src/components/pages/TrackerPage.tsx +170 -474
  56. package/src/components/pages/converse/CardView.tsx +72 -0
  57. package/src/components/pages/converse/SettingsMenu.tsx +37 -0
  58. package/src/components/pages/converse/Thread.tsx +48 -33
  59. package/src/components/pages/converse/useNeedsYou.ts +60 -0
  60. package/src/components/pages/home/BriefCard.tsx +16 -7
  61. package/src/components/pages/home/HomeBriefPage.tsx +6 -91
  62. package/src/components/pages/home/MiniMarkdown.tsx +51 -0
  63. package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
  64. package/src/components/pages/home/index.ts +1 -1
  65. package/src/components/pages/overview/OverviewPage.tsx +46 -83
  66. package/src/components/pages/plan/TalkPage.tsx +5 -14
  67. package/src/components/pages/plan/TimelinePage.tsx +4 -2
  68. package/src/components/pages/task-tracker/ProjectGuess.tsx +42 -0
  69. package/src/components/pages/tracker/SweepPanel.tsx +108 -0
  70. package/src/components/pages/tracker/TimelineTable.tsx +70 -0
  71. package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
  72. package/src/components/table/DataTable.tsx +92 -0
  73. package/src/components/table/RowMenu.tsx +35 -0
  74. package/src/components/table/TablePagination.tsx +63 -0
  75. package/src/components/table/TableToolbar.tsx +56 -0
  76. package/src/components/table/TodoTable.tsx +142 -0
  77. package/src/components/table/index.ts +10 -0
  78. package/src/components/table/table-logic.ts +60 -0
  79. package/src/components/table/todo-model.ts +93 -0
  80. package/src/corpus/ask-items.ts +7 -4
  81. package/src/corpus/ask.ts +1 -1
  82. package/src/corpus/briefing/actions/confirm.ts +9 -1
  83. package/src/corpus/briefing/actions/execute.ts +71 -11
  84. package/src/corpus/briefing/actions/log.ts +1 -1
  85. package/src/corpus/briefing/actions/seam.ts +18 -2
  86. package/src/corpus/briefing/actions/types.ts +14 -0
  87. package/src/corpus/briefing/generate-weekly.ts +4 -0
  88. package/src/corpus/briefing/generate.ts +4 -0
  89. package/src/corpus/briefing/index.ts +1 -0
  90. package/src/corpus/briefing/intent/describe.ts +5 -1
  91. package/src/corpus/briefing/intent/edits.ts +92 -0
  92. package/src/corpus/briefing/intent/grammar.ts +3 -0
  93. package/src/corpus/briefing/intent/ground.ts +5 -1
  94. package/src/corpus/briefing/intent/match.ts +3 -1
  95. package/src/corpus/briefing/intent/model.ts +36 -3
  96. package/src/corpus/briefing/intent/resolve.ts +12 -1
  97. package/src/corpus/briefing/intent/types.ts +8 -0
  98. package/src/corpus/briefing/markdown.ts +71 -0
  99. package/src/corpus/briefing/speak.ts +13 -0
  100. package/src/corpus/client.ts +40 -146
  101. package/src/corpus/converse/brain.ts +41 -13
  102. package/src/corpus/converse/briefing-queue.ts +105 -27
  103. package/src/corpus/converse/cards.ts +69 -0
  104. package/src/corpus/converse/client.ts +6 -0
  105. package/src/corpus/converse/fleet-view.ts +126 -0
  106. package/src/corpus/converse/fleet.ts +18 -5
  107. package/src/corpus/converse/followups.ts +12 -2
  108. package/src/corpus/converse/handle.ts +21 -12
  109. package/src/corpus/converse/handoff.ts +7 -2
  110. package/src/corpus/converse/index.ts +11 -3
  111. package/src/corpus/converse/meeting-config.ts +8 -4
  112. package/src/corpus/converse/meeting.ts +66 -11
  113. package/src/corpus/converse/respond.ts +14 -2
  114. package/src/corpus/converse/roci.ts +13 -0
  115. package/src/corpus/converse/spoken-form.ts +9 -2
  116. package/src/corpus/converse/spoken-summary.ts +30 -8
  117. package/src/corpus/converse/store.ts +2 -0
  118. package/src/corpus/converse/structure.ts +39 -0
  119. package/src/corpus/converse/types.ts +14 -1
  120. package/src/corpus/converse/view.ts +34 -0
  121. package/src/corpus/entities.ts +2 -0
  122. package/src/corpus/extract.ts +9 -4
  123. package/src/corpus/index.ts +2 -0
  124. package/src/corpus/participants.ts +220 -0
  125. package/src/corpus/project-basis.ts +23 -0
  126. package/src/corpus/timeline-events.ts +83 -0
  127. package/src/corpus/tracker-sort.ts +9 -3
  128. package/src/corpus/tracker-timeline-client.ts +2 -0
  129. package/src/corpus/tracker-timeline.ts +4 -0
  130. package/src/corpus/types.ts +38 -5
  131. package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
  132. package/src/native/app/converseServices.ts +5 -3
  133. package/src/native/app/device.ts +2 -0
  134. package/src/native/converse/ConverseScreen.tsx +30 -4
  135. package/src/native/converse/__tests__/liveScreen.test.tsx +35 -2
  136. package/src/native/converse/__tests__/meetingIO.test.ts +55 -1
  137. package/src/native/converse/format.ts +2 -2
  138. package/src/native/converse/io.ts +15 -5
  139. package/src/native/home/HomeScreen.tsx +1 -1
  140. package/src/native/home/tab.tsx +1 -2
  141. package/src/native/plan/PlanTab.tsx +1 -2
  142. package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
  143. package/src/native/talk/TalkTab.tsx +1 -1
  144. package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
  145. package/src/__tests__/home-needs-your-call.test.tsx +0 -65
  146. package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
  147. package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
@@ -0,0 +1,149 @@
1
+ // @vitest-environment node
2
+ /** The structured fleet view (Tandem /fleet): roles.md + open-loops ledger + `bridge find` -> relay, leads, children. */
3
+ import { describe, expect, it, vi } from 'vitest';
4
+
5
+ import { buildFleetView, parseBridgeFind, parseLoops, parseRoles } from '../corpus/converse';
6
+
7
+ const ROLES = `# Role registry
8
+ Updated 2026-11-18 ~12:30 MT
9
+
10
+ | Role | Live session | Notes |
11
+ |---|---|---|
12
+ | Tandem coordinator | 0ec3d1ff | owns Tandem stack; lane 2 = 9eb03770 reports to it |
13
+ | Crochets coordinator | a90ab874 (spawn daf13afc, live) | no live children; old c91210f5 ended |
14
+ | DebuggAI platform coordinator | none live (abe4c934 ended) | PR 837 await promote |
15
+ | Relay | 7afdf27a | relay.json current |
16
+
17
+ Rules: message only these.`;
18
+
19
+ const LOOPS = `# Relay open loops
20
+ Updated 2026-11-16 ~11:10 MT.
21
+
22
+ ## Waiting on Quinn (restate in full when asking)
23
+ - Sidebar name: "Plan" or "Strategy"?
24
+ - Unpause crochet-patterns later?
25
+
26
+ ## Waiting on sessions (I follow up if silent)
27
+ - platform f7ebc9cc: crawl guard proof
28
+ `;
29
+
30
+ const FIND = [
31
+ '[live] `Mac/last-chance · Relay: Quinn\'s fleet manager · 7afdf27a` Quinn\'s relay start-simpli@green/x',
32
+ '[live] `Mac/last-chance · Tandem coordinator: assistant · 0ec3d1ff` Coordinate Tandem work start-simpli@spawn/86b8 [model claude-sonnet-5-5]',
33
+ '[live] `Mac/last-chance · lane two · 9eb03770` Voice notes start-simpli@spawn/x',
34
+ '[live] `Mac/last-chance · Crochets coordinator · a90ab874` Fix patterns start-simpli@spawn/daf1',
35
+ '[live] `Mac/last-chance · spawn runner · runner-l` starts sessions spawn-runner',
36
+ '[live] `Mac/last-chance · stray · 11112222` Something else crochet@main',
37
+ '[dormant] `Mac/last-chance · asleep · 33334444` Napping start-simpli@y',
38
+ ' resume (on last-chance@debugg.ai): claude --resume 33334444',
39
+ ].join('\n');
40
+
41
+ describe('parsers', () => {
42
+ it('reads roles', () => {
43
+ const r = parseRoles(ROLES);
44
+ expect(r.updated).toBe('2026-11-18 ~12:30 MT');
45
+ expect(r.rows.map((x) => [x.role, x.sessionId])).toEqual([['Tandem coordinator', '0ec3d1ff'], ['Crochets coordinator', 'a90ab874'], ['DebuggAI platform coordinator', null], ['Relay', '7afdf27a']]);
46
+ expect(r.rows[0].childIds).toEqual(['9eb03770']);
47
+ expect(r.rows[1].childIds).toEqual(['daf13afc', 'c91210f5'].filter((x) => x !== 'daf13afc'));
48
+ });
49
+ it('reads loops by section', () => {
50
+ const l = parseLoops(LOOPS);
51
+ expect(l.updated).toBe('2026-11-16 ~11:10 MT.');
52
+ expect(l.waitingOnQuinn).toEqual(['Sidebar name: "Plan" or "Strategy"?', 'Unpause crochet-patterns later?']);
53
+ expect(l.waitingOnSessions).toEqual(['platform f7ebc9cc: crawl guard proof']);
54
+ });
55
+ it('reads bridge find, skipping runners and resume lines', () => {
56
+ const s = parseBridgeFind(FIND);
57
+ expect(s.map((x) => x.id)).toEqual(['7afdf27a', '0ec3d1ff', '9eb03770', 'a90ab874', '11112222', '33334444']);
58
+ expect(s[1]).toMatchObject({ name: 'Tandem coordinator: assistant', goal: 'Coordinate Tandem work', repo: 'start-simpli', branch: 'spawn/86b8', status: 'live', machine: 'Mac/last-chance' });
59
+ expect(s[5].status).toBe('dormant');
60
+ });
61
+ });
62
+
63
+ const PORTS = `# Local dev port ranges
64
+ | Project | Range | Base (staging) | Notes |
65
+ |---|---|---|---|
66
+ | Tandem | 4300-4309 | 4300 gateway (tandem-web) | 4303 fast loop |
67
+ | Other | 4360+ | ask relay | |`;
68
+
69
+ describe('tolerance', () => {
70
+ it('keeps lines it cannot place instead of failing', () => {
71
+ const v = buildFleetView({ roles: ROLES + '\nsomeone typed a stray note here\n| broken row |', loops: LOOPS + '\nfree text under the ledger\n## Misc\n- random\n## PRIORITIES (Quinn, today)\n- one', ports: PORTS, sessions: 'garbage\n[live] `no id here` x' });
72
+ expect(v.unparsed).toEqual(expect.arrayContaining(['Rules: message only these.', 'someone typed a stray note here', '| broken row |']));
73
+ expect(v.waitingOnSessions).toContain('free text under the ledger'); // stays in the section it was written under
74
+ expect(v.sections).toEqual([{ title: 'Misc', items: ['random'] }, { title: 'PRIORITIES (Quinn, today)', items: ['one'] }]);
75
+ expect(v.waitingOnQuinn).toHaveLength(2);
76
+ expect(v.leads.length).toBe(3);
77
+ });
78
+ it('lists per-project base URLs from ports.md', () => {
79
+ const v = buildFleetView({ ports: PORTS });
80
+ expect(v.ports).toEqual([
81
+ { project: 'Tandem', range: '4300-4309', base: '4300 gateway (tandem-web)', url: 'http://localhost:4300', notes: '4303 fast loop' },
82
+ { project: 'Other', range: '4360+', base: 'ask relay', url: null, notes: '' },
83
+ ]);
84
+ });
85
+ });
86
+
87
+ describe('buildFleetView', () => {
88
+ it('nests relay -> leads -> children and lists the rest', () => {
89
+ const v = buildFleetView({ roles: ROLES, loops: LOOPS, sessions: FIND });
90
+ expect(v.relay?.id).toBe('7afdf27a');
91
+ expect(v.leads.map((l) => l.role)).toEqual(['Tandem coordinator', 'Crochets coordinator', 'DebuggAI platform coordinator']);
92
+ expect(v.leads[0].session?.id).toBe('0ec3d1ff');
93
+ expect(v.leads[0].children.map((c) => c.id)).toEqual(['9eb03770']);
94
+ expect(v.leads[2].session).toBeNull();
95
+ expect(v.others.map((o) => o.id)).toEqual(['11112222', '33334444']);
96
+ expect(v.waitingOnQuinn).toHaveLength(2);
97
+ expect(v.rolesUpdated).toBe('2026-11-18 ~12:30 MT');
98
+ });
99
+ it('falls back to a live session named for the role when the listed id is not live', () => {
100
+ const v = buildFleetView({ roles: ROLES.replace('0ec3d1ff', 'deadbeef'), sessions: FIND });
101
+ expect(v.leads[0].session?.id).toBe('0ec3d1ff');
102
+ expect(v.leads[0].listedId).toBe('deadbeef');
103
+ });
104
+ it('survives empty inputs', () => {
105
+ const v = buildFleetView({});
106
+ expect(v).toMatchObject({ relay: null, leads: [], others: [], waitingOnQuinn: [], waitingOnSessions: [] });
107
+ });
108
+ });
109
+
110
+ describe('fleet-status round trip', () => {
111
+ it('stores the raw inputs and serves the parsed view', async () => {
112
+ const { converseFleetStatusResponse, converseFleetViewResponse } = await import('../corpus/converse');
113
+ const rows: any[] = [];
114
+ const http = {
115
+ get: vi.fn(async () => ({ results: rows })),
116
+ post: vi.fn(async (_p: string, body: any) => { const r = { id: 1, external_id: body.external_id, data: body.data }; rows.splice(0, rows.length, r); return r; }),
117
+ };
118
+ const deps: any = { http, ownerSub: 'me', now: () => Date.UTC(2026, 10, 19) };
119
+ const empty = await converseFleetViewResponse(deps);
120
+ expect(await empty.json()).toEqual({ snapshot: null });
121
+ const post = await converseFleetStatusResponse(new Request('http://x', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text: 'notes', inputs: { roles: ROLES, loops: LOOPS, sessions: FIND, junk: 'x' } }) }), deps);
122
+ expect(post.status).toBe(200);
123
+ expect(Object.keys(rows[0].data.fleet_inputs).sort()).toEqual(['loops', 'roles', 'sessions']);
124
+ const body: any = await (await converseFleetViewResponse(deps)).json();
125
+ expect(body.snapshot.text).toBe('notes');
126
+ expect(body.snapshot.view.leads).toHaveLength(3);
127
+ expect(body.snapshot.view.waitingOnQuinn).toHaveLength(2);
128
+ });
129
+ it('old snapshots without inputs give view: null', async () => {
130
+ const { converseFleetStatusResponse, converseFleetViewResponse } = await import('../corpus/converse');
131
+ const rows: any[] = [];
132
+ const http = { get: vi.fn(async () => ({ results: rows })), post: vi.fn(async (_p: string, b: any) => { const r = { id: 1, external_id: b.external_id, data: b.data }; rows.splice(0, rows.length, r); return r; }) };
133
+ const deps: any = { http, ownerSub: 'me' };
134
+ await converseFleetStatusResponse(new Request('http://x', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text: 'only text' }) }), deps);
135
+ expect(((await (await converseFleetViewResponse(deps)).json()) as any).snapshot.view).toBeNull();
136
+ });
137
+ });
138
+
139
+ describe('converse client fleet()', () => {
140
+ it('GETs fleet-status with the bearer', async () => {
141
+ const { createConverseClient } = await import('../corpus/converse');
142
+ const f = vi.fn(async () => Response.json({ snapshot: null }));
143
+ const c = createConverseClient({ getToken: async () => 'tok', fetch: f as any });
144
+ expect(await c.fleet()).toEqual({ snapshot: null });
145
+ const [url, init] = f.mock.calls[0] as any;
146
+ expect(url).toBe('/corpus/converse/fleet-status');
147
+ expect(init.headers.authorization).toBe('Bearer tok');
148
+ });
149
+ });
@@ -1,6 +1,5 @@
1
1
  /**
2
- * TODAY (bd startsim-cpzoz): the brief shows the stored text verbatim, and the only to-do
3
- * content is one due-soon line with the way into Plan (the list itself is Plan's).
2
+ * TODAY: the brief (structured when the result carries markdown, the stored text otherwise) and the week link. Nothing else.
4
3
  */
5
4
  import * as React from 'react';
6
5
  import { render, screen, within } from '@testing-library/react';
@@ -9,42 +8,17 @@ import { describe, expect, it, vi } from 'vitest';
9
8
 
10
9
  import { HomeBriefPage } from '../components/pages/home';
11
10
  import type { BriefingResult } from '../corpus/briefing';
12
- import type { Commitment, CorpusApi, CommitmentApi, SourceDocument } from '../corpus/types';
13
11
 
14
- const NOW = Date.parse('2026-11-06T17:00:00Z');
15
12
  const TEXT = 'Good morning Quinn. Two things are overdue.\nFirst, send the term sheet.';
16
13
  const RESULT = {
17
14
  briefingId: 'b1', text: TEXT, audioUrl: '/corpus/briefing/b1/audio', items: [], remaining: 0,
18
15
  context: { itemIds: [], localDate: '2026-11-06', timeZone: 'UTC', offsets: [] }, scriptSource: 'template', cached: true, ms: 1,
19
16
  } as unknown as BriefingResult;
20
17
 
21
- const mention = (documentId: string) => ({ documentId, originKey: 'k', occurredAt: null, quote: '', extractor: 'model' as const });
22
- function item(id: string, over: Partial<Commitment> = {}): Commitment {
23
- return {
24
- id, externalId: `commit:${id}`, dedupeKey: id, subtype: 'action', title: id, detail: '', status: 'open', subjectKey: '', actionKey: '',
25
- mentions: [], firstSeenAt: null, lastSeenAt: null, extractorVersion: 't', source: 'granola', sourceLabel: 'G', scope: { orgId: 'o' }, ...over,
26
- } as Commitment;
27
- }
28
- const DOC = { id: 'n1', title: 'Weekly sync', body: '', summary: 'We agreed to ship Friday.', sections: [], occurredAt: '2026-11-05T10:00:00Z', source: 'granola', sourceLabel: 'G', subtype: 'meeting', sourceRef: 'x' } as unknown as SourceDocument;
29
-
30
- function corpus(): CorpusApi & CommitmentApi {
31
- const open = [
32
- item('late', { dueAt: '2026-11-03', focusId: 'f1', mentions: [mention('n1')] }),
33
- item('soon', { dueAt: '2026-11-09' }),
34
- ];
35
- return {
36
- async listCommitments(q = {}) {
37
- const results = Array.isArray(q.status) ? open : [...open, item('done1', { status: 'done', mentions: [mention('n1')] })];
38
- return { count: results.length, next: null, previous: null, results };
39
- },
40
- async listDocuments() { return { count: 1, next: null, previous: null, results: [DOC] }; },
41
- } as unknown as CorpusApi & CommitmentApi;
42
- }
43
-
44
18
  describe('HomeBriefPage', () => {
45
19
  it('shows the stored brief text unchanged and never forces a regeneration', async () => {
46
20
  const fetch = vi.fn(async () => RESULT);
47
- render(<HomeBriefPage brief={{ fetch }} corpus={corpus()} now={NOW} timeZone="UTC" />);
21
+ render(<HomeBriefPage brief={{ fetch }} />);
48
22
  expect((await screen.findByTestId('brief-text')).textContent).toBe(TEXT);
49
23
  expect(fetch).toHaveBeenCalledTimes(1);
50
24
  expect(fetch.mock.calls[0]).toHaveLength(0);
@@ -52,7 +26,7 @@ describe('HomeBriefPage', () => {
52
26
 
53
27
  it('shows the weekly summary only when asked, and never loads it on mount', async () => {
54
28
  const weekly = vi.fn(async () => ({ text: 'Here is your week. You finished two items.', audioUrl: null, audioReason: 'No audio.' }));
55
- render(<HomeBriefPage brief={{ fetch: async () => RESULT }} weekly={{ fetch: weekly }} corpus={corpus()} now={NOW} timeZone="UTC" />);
29
+ render(<HomeBriefPage brief={{ fetch: async () => RESULT }} weekly={{ fetch: weekly }} />);
56
30
  await screen.findByTestId('brief-text');
57
31
  expect(weekly).not.toHaveBeenCalled();
58
32
  await userEvent.click(screen.getByRole('button', { name: 'Show your week' }));
@@ -60,21 +34,32 @@ describe('HomeBriefPage', () => {
60
34
  expect(weekly).toHaveBeenCalledTimes(1);
61
35
  });
62
36
 
63
- it('keeps one due-soon line with the way into Plan, and no to-do rows', async () => {
64
- const onOpenPlan = vi.fn();
65
- render(<HomeBriefPage brief={{ fetch: async () => RESULT }} corpus={corpus()} now={NOW} timeZone="UTC" onOpenPlan={onOpenPlan} />);
66
- const line = await screen.findByTestId('due-soon');
67
- expect(line).toHaveTextContent('1 overdue · 1 due this week');
68
- expect(screen.queryByText('late')).toBeNull();
69
- expect(screen.queryByTestId('item-row')).toBeNull();
70
- expect(screen.queryByText('Weekly sync')).toBeNull();
71
- await userEvent.click(within(line).getByRole('button', { name: 'Open Plan' }));
72
- expect(onOpenPlan).toHaveBeenCalledTimes(1);
37
+ it('shows the structured brief when the result carries one, and the stored text otherwise', async () => {
38
+ const md = '## Overdue\n- **Send the term sheet** · Acme';
39
+ const { unmount } = render(<HomeBriefPage brief={{ fetch: async () => ({ ...RESULT, markdown: md }) }} />);
40
+ const card = await screen.findByTestId('brief-text');
41
+ expect(within(card).getByRole('heading', { name: 'Overdue' })).toBeInTheDocument();
42
+ expect(within(card).getAllByRole('listitem')).toHaveLength(1);
43
+ unmount();
44
+ });
45
+
46
+ it('draws no second title: the page heading is the title', async () => {
47
+ render(<HomeBriefPage brief={{ fetch: async () => RESULT }} />);
48
+ await screen.findByTestId('brief-text');
49
+ expect(screen.queryByRole('heading', { name: /today.s brief/i })).toBeNull();
50
+ });
51
+
52
+ it('has no due-soon line, no Open Plan, no Talk and no Needs your call: it is the brief and the week only', async () => {
53
+ render(<HomeBriefPage brief={{ fetch: async () => RESULT }} />);
54
+ await screen.findByTestId('brief-text');
55
+ expect(screen.queryByTestId('due-soon')).toBeNull();
56
+ expect(screen.queryByRole('button', { name: 'Open Plan' })).toBeNull();
57
+ expect(screen.queryByText(/Needs your call/)).toBeNull();
73
58
  });
74
59
 
75
60
  it('says plainly when the brief cannot load, with a retry', async () => {
76
61
  const fetch = vi.fn().mockRejectedValueOnce(new Error('nope')).mockResolvedValue(RESULT);
77
- render(<HomeBriefPage brief={{ fetch }} corpus={corpus()} now={NOW} />);
62
+ render(<HomeBriefPage brief={{ fetch }} />);
78
63
  expect(await screen.findByRole('alert')).toHaveTextContent('nope');
79
64
  await userEvent.click(screen.getByRole('button', { name: 'Try again' }));
80
65
  expect(await screen.findByTestId('brief-text')).toBeInTheDocument();
@@ -0,0 +1,164 @@
1
+ /**
2
+ * THE LIBRARY'S CALL SHAPE (Quinn, 2026-11-20: "the Library takes about 25 seconds").
3
+ *
4
+ * MEASURED, on the local tandem stack (prod build, 1358 documents, 273 parties):
5
+ * a Library load issues ~22 API calls and the first ROWS wait on a serial chain
6
+ * — documents page -> relationships?entity__in -> the party roster walked six
7
+ * pages one after another — while the source cards wait on seven per-source
8
+ * counts. Each call is cheap alone (10-400 ms). Behind a server that serves one
9
+ * request at a time (the local tenant API is `runserver --nothreading`) or over
10
+ * a real network, that chain is the page: gateway log windows of 14 s and 17 s.
11
+ *
12
+ * SO THE BUDGET IS ON THE SHAPE, not on a wall clock a CI box could flake:
13
+ * 1. the rows paint with the ONLY calls they need — connections and the one
14
+ * documents page — while every other read is still pending;
15
+ * 2. the people on a row, the counts on a card and the party filter arrive
16
+ * afterwards and patch what is on screen;
17
+ * 3. the party roster is read in parallel, not walked page by page.
18
+ */
19
+ import { describe, expect, it } from 'vitest';
20
+ import { act, render, screen, waitFor } from '@testing-library/react';
21
+
22
+ import { LibraryPage } from '../components/pages/LibraryPage';
23
+ import { createCorpusApi } from '../corpus/client';
24
+ import type { CorpusHttp } from '../corpus/client';
25
+ import type { TenantEntity } from '../corpus/entities';
26
+
27
+ const SCOPE = { orgId: 'org_tandem' };
28
+ const EMPTY = { count: 0, next: null, previous: null, results: [] };
29
+
30
+ function document(id: string, title: string): TenantEntity {
31
+ return {
32
+ id, entity_type: 'source_document', external_id: `granola:${id}`, name: title,
33
+ org_id: SCOPE.orgId, created_at: '2026-08-01T10:00:00Z',
34
+ data: { source: 'granola', title, summary: `Summary of ${title}.`, occurred_at: '2026-08-01T09:00:00Z' },
35
+ };
36
+ }
37
+
38
+ function party(id: string, name: string): TenantEntity {
39
+ return {
40
+ id, entity_type: 'party', external_id: `person:${id}`, name,
41
+ org_id: SCOPE.orgId, created_at: '2026-08-01T10:00:00Z', data: { name, kind: 'person' },
42
+ };
43
+ }
44
+
45
+ const DOCS = [document('d1', 'Quarterly plan'), document('d2', 'Vendor review')];
46
+ const PEOPLE = Array.from({ length: 250 }, (_, i) => party(`p${i}`, i === 0 ? 'Ada Lovelace' : `Person ${i}`));
47
+
48
+ /**
49
+ * The wire. `held` reads wait on `release()`: they stand in for a slow or
50
+ * queued backend, so what the screen does WHILE they are outstanding is the
51
+ * thing under test.
52
+ */
53
+ function wire() {
54
+ const calls: Array<{ path: string; params: Record<string, unknown>; at: number }> = [];
55
+ const held: Array<() => void> = [];
56
+ let tick = 0;
57
+ const later = <T,>(value: T): Promise<T> => new Promise((resolve) => { held.push(() => resolve(value)); });
58
+ let rosterInFlight = 0;
59
+ let rosterPeak = 0;
60
+
61
+ const http: CorpusHttp = {
62
+ async get<T>(path: string, init?: { params?: Record<string, unknown> }): Promise<T> {
63
+ const params = init?.params ?? {};
64
+ calls.push({ path, params, at: tick += 1 });
65
+
66
+ if (path.includes('connections')) {
67
+ return {
68
+ count: 1, next: null, previous: null,
69
+ results: [{ connector_key: 'granola', connector_name: 'Granola', status: 'active', last_synced_at: new Date().toISOString() }],
70
+ } as T;
71
+ }
72
+ if (path.includes('relationships')) {
73
+ return later({
74
+ count: 1, next: null, previous: null, applied_filters: ['entity__in'],
75
+ results: [{ id: 'e1', source: 'd1', target: 'p0', rel_type: 'authored_by' }],
76
+ }) as Promise<T>;
77
+ }
78
+ if (path.includes('facets')) return EMPTY as T;
79
+ if (params.type === 'party') {
80
+ // The roster is walked 100 at a time; the tail has to be asked for
81
+ // together, not after each page returns.
82
+ rosterInFlight += 1;
83
+ rosterPeak = Math.max(rosterPeak, rosterInFlight);
84
+ const page = Number(params.page ?? 1);
85
+ const size = Number(params.page_size ?? 50);
86
+ const slice = PEOPLE.slice((page - 1) * size, page * size);
87
+ return later({
88
+ count: PEOPLE.length, next: page * size < PEOPLE.length ? `?page=${page + 1}` : null,
89
+ previous: null, results: slice,
90
+ }).then((v) => { rosterInFlight -= 1; return v; }) as Promise<T>;
91
+ }
92
+ if (params.source) {
93
+ return later({ count: 1358, next: null, previous: null, applied_filters: ['source'], results: [DOCS[0]] }) as Promise<T>;
94
+ }
95
+ // THE DOCUMENTS PAGE — the one read the rows are entitled to wait for.
96
+ return { count: DOCS.length, next: null, previous: null, results: DOCS } as T;
97
+ },
98
+ };
99
+
100
+ return {
101
+ http, calls,
102
+ rosterPeak: () => rosterPeak,
103
+ release: async () => { for (let i = 0; i < 20; i += 1) { held.splice(0).forEach((fn) => fn()); await act(async () => { await Promise.resolve(); }); } },
104
+ };
105
+ }
106
+
107
+ describe('Library call shape', () => {
108
+ it('paints the rows while participants, counts and the party list are still in flight', async () => {
109
+ const w = wire();
110
+ const api = createCorpusApi({ http: w.http, scope: SCOPE });
111
+ render(<LibraryPage api={api} scope={SCOPE} />);
112
+
113
+ // Rows on screen with every held read still outstanding.
114
+ expect(await screen.findByText('Quarterly plan')).toBeTruthy();
115
+ expect(await screen.findByText('Vendor review')).toBeTruthy();
116
+
117
+ const before = w.calls.map((c) => c.path);
118
+ // Nothing the rows do not need may have BLOCKED them: the relationships
119
+ // read and the roster were not awaited (they may have started, but they
120
+ // are held, and the rows are up).
121
+ expect(before.some((p) => p.includes('connections'))).toBe(true);
122
+
123
+ // Now let the deferred reads land: the count patches the card in place.
124
+ await w.release();
125
+ await waitFor(() => expect(screen.getByText(/1,?358/)).toBeTruthy());
126
+ });
127
+
128
+ it('asks for the documents page FIRST, before any deferred read', async () => {
129
+ const w = wire();
130
+ const api = createCorpusApi({ http: w.http, scope: SCOPE });
131
+ render(<LibraryPage api={api} scope={SCOPE} />);
132
+ await screen.findByText('Quarterly plan');
133
+ const firstDocs = w.calls.findIndex((c) => c.params.type === 'source_document' && !c.params.source && c.params.page_size !== 1);
134
+ const firstDeferred = w.calls.findIndex((c) => c.params.source || c.params.type === 'party' || c.path.includes('relationships'));
135
+ expect(firstDocs).toBeGreaterThanOrEqual(0);
136
+ // Order is the queue order on a server that answers one request at a time.
137
+ expect(firstDeferred === -1 || firstDocs < firstDeferred).toBe(true);
138
+ // The folder tree's facet read is the slowest on a cold tenant; it queues
139
+ // behind the rows, not ahead of them.
140
+ const firstFacets = w.calls.findIndex((c) => c.path.includes('facets'));
141
+ expect(firstFacets === -1 || firstDocs < firstFacets).toBe(true);
142
+ await w.release();
143
+ });
144
+
145
+ it('does not make the rows wait on the relationships or the roster', async () => {
146
+ const w = wire();
147
+ const api = createCorpusApi({ http: w.http, scope: SCOPE });
148
+ const page = await api.listDocuments({ page: 1, pageSize: 20 }, { participants: false });
149
+ expect(page.results).toHaveLength(2);
150
+ expect(w.calls.some((c) => c.path.includes('relationships'))).toBe(false);
151
+ expect(w.calls.some((c) => c.params.type === 'party')).toBe(false);
152
+ });
153
+
154
+ it('reads the party roster in parallel, not page by page', async () => {
155
+ const w = wire();
156
+ const api = createCorpusApi({ http: w.http, scope: SCOPE });
157
+ const pending = api.participantsFor!(['d1']);
158
+ await w.release();
159
+ const people = await pending;
160
+ expect(people.get('d1')?.map((p) => p.name)).toEqual(['Ada Lovelace']);
161
+ // 250 people at 100 a page is three reads. Walked serially the peak is 1.
162
+ expect(w.rosterPeak()).toBeGreaterThanOrEqual(2);
163
+ });
164
+ });
@@ -39,7 +39,7 @@ describe('TrackerPage when the load fails', () => {
39
39
  const api = { listCommitments: async () => { calls += 1; if (calls <= 1) throw new Error('simulated outage'); return page; } } as never;
40
40
  render(<TrackerPage api={api} scope={{} as never} classNames={{} as never} />);
41
41
  await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
42
- expect(screen.getByTestId('tracker-summary').textContent).toBe('');
42
+ expect(screen.queryByText(/Nothing is owed|Nothing has been pulled/)).toBeNull();
43
43
  fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
44
44
  await waitFor(() => expect(screen.queryByTestId('load-error')).toBeNull());
45
45
  });
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ import { MiniMarkdown } from '../components/pages/home/MiniMarkdown';
6
+
7
+ describe('MiniMarkdown', () => {
8
+ it('renders headings, bullets and bold, and never raw markup', () => {
9
+ const { container } = render(<MiniMarkdown text={'## Overdue\n- **Send it** · Acme\n- second\n\n_2 more not shown._\n<script>x</script>'} />);
10
+ expect(screen.getByRole('heading', { level: 3, name: 'Overdue' })).toBeInTheDocument();
11
+ expect(screen.getAllByRole('listitem')).toHaveLength(2);
12
+ expect(container.querySelector('strong')?.textContent).toBe('Send it');
13
+ expect(container.textContent).not.toContain('##');
14
+ expect(container.textContent).not.toContain('**');
15
+ expect(container.querySelector('script')).toBeNull();
16
+ expect(container.textContent).toContain('<script>x</script>');
17
+ expect(container.querySelector('em')?.textContent).toBe('2 more not shown.');
18
+ });
19
+
20
+ it('shows plain text (the weekly summary) as paragraphs', () => {
21
+ render(<MiniMarkdown text={'Here is your week.\nYou finished two items.'} />);
22
+ expect(screen.getByText(/Here is your week/)).toBeInTheDocument();
23
+ });
24
+ });
@@ -1,4 +1,4 @@
1
- import { fireEvent, render, screen, waitFor } from '@testing-library/react';
1
+ import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
4
  import { OverviewPage } from '../components/pages/overview/OverviewPage';
@@ -6,7 +6,7 @@ import { OverviewPage } from '../components/pages/overview/OverviewPage';
6
6
  const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
7
7
  const item = (i: number, owner: string | undefined, focusId: string, due: string | null = null) => ({ id: String(i), externalId: `c${i}`, title: `task ${i}`, status: 'open', ownerName: owner, focusId, mentions: [], dueAt: due, lastSeenAt: null });
8
8
  const api = {
9
- listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }, { id: 'f2', title: 'Beta', status: 'at_risk' }]),
9
+ listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }, { id: 'f2', title: 'Beta', status: 'at_risk' }, { id: 'f3', title: 'Gamma', status: 'draft' }]),
10
10
  listCommitments: async () => page([item(1, 'Sam', 'f1', '2030-01-02T00:00:00Z'), item(2, 'Riley', 'f1'), item(3, 'Riley', 'f2')]),
11
11
  } as never;
12
12
 
@@ -14,25 +14,55 @@ describe('OverviewPage', () => {
14
14
  it('is one row per project with Waiting on, Next step and Open columns, not a column per person', async () => {
15
15
  render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
16
16
  await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
17
- expect(screen.getAllByRole('columnheader').map((h) => h.textContent?.replace(/\s*[↑↓]$/, ''))).toEqual(['Project', 'Status', 'Waiting on', 'Next step', 'Open', 'Last activity']);
17
+ expect(screen.getAllByRole('columnheader').map((h) => h.textContent?.replace(/\s*[▲▼]$/, ''))).toEqual(['Project', 'Status', 'Waiting on', 'Next step', 'Open', 'Last activity']);
18
18
  // the project whose most pressing item is dated shows that item and its owner, with the other person as +1
19
19
  expect(screen.getAllByText('task 1').length).toBeGreaterThan(0);
20
20
  expect(screen.getAllByText('+ 1 more').length).toBeGreaterThan(0);
21
21
  });
22
22
 
23
- it('a Waiting-on chip shows only that person\'s projects', async () => {
23
+ it('has ONE filter control (a select) and no chips', async () => {
24
24
  render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
25
25
  await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
26
- fireEvent.click(screen.getByRole('button', { name: /^Sam · 1$/ }));
26
+ expect(screen.getAllByRole('combobox')).toHaveLength(1);
27
+ expect(screen.queryByRole('group', { name: 'Waiting on' })).toBeNull();
28
+ expect(document.querySelector('details')).toBeNull();
29
+ expect(screen.getByTestId('table-overview')).toBeTruthy();
30
+ });
31
+
32
+ it('Waiting on a person shows only that person\'s projects', async () => {
33
+ render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
34
+ await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
35
+ const sam = screen.getByRole('option', { name: /^Waiting on Sam/ }) as HTMLOptionElement;
36
+ fireEvent.change(screen.getByRole('combobox', { name: 'Show' }), { target: { value: sam.value } });
27
37
  expect(screen.queryAllByText('Beta').length).toBe(0);
28
38
  expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0);
29
39
  });
30
40
 
41
+ it('a project with nothing open is the SAME kind of row, quieter, behind the same control, and opens like any other', async () => {
42
+ const opened: string[] = [];
43
+ render(<OverviewPage api={api} scope={{} as never} onOpenProject={(id) => opened.push(id)} />);
44
+ await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
45
+ expect(screen.queryAllByText('Gamma').length).toBe(0);
46
+ fireEvent.change(screen.getByRole('combobox', { name: 'Show' }), { target: { value: 'all' } });
47
+ const table = screen.getByRole('table');
48
+ const gamma = within(table).getByRole('button', { name: 'Gamma' });
49
+ const row = gamma.closest('tr') as HTMLElement;
50
+ expect(row.className).toContain('text-gray-500');
51
+ expect(within(table).getByRole('button', { name: 'Alpha' }).closest('tr')?.className).not.toContain('text-gray-500');
52
+ expect(within(row).getAllByRole('cell')).toHaveLength(6);
53
+ // the whole row opens the project, not only the name
54
+ fireEvent.click(within(row).getAllByRole('cell')[3]);
55
+ expect(opened).toEqual(['f3']);
56
+ opened.length = 0;
57
+ fireEvent.click(gamma);
58
+ expect(opened).toEqual(['f3']);
59
+ });
60
+
31
61
  it('with nobody named there is no Waiting-on filter and the column says so plainly', async () => {
32
62
  const nobody = { listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }]), listCommitments: async () => page([item(1, undefined, 'f1')]) } as never;
33
63
  render(<OverviewPage api={nobody} scope={{} as never} onOpenProject={() => {}} />);
34
64
  await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
35
- expect(screen.queryByRole('group', { name: 'Waiting on' })).toBeNull();
65
+ expect(screen.queryByRole('combobox')).toBeNull();
36
66
  expect(screen.getAllByText('Nobody named').length).toBeGreaterThan(0);
37
67
  });
38
68
  });
@@ -67,8 +67,9 @@ describe('the to-do list as the Plan sub-tab', () => {
67
67
  render(<TrackerPage api={trackerApi((q) => queries.push(q), create)} scope={SCOPE} now={NOW} showTimeline={false} focusId="focus:p1" />);
68
68
  await screen.findByText('Todo a');
69
69
  expect(queries[0]).toMatchObject({ focus: 'focus:p1' });
70
- fireEvent.change(screen.getByLabelText('Add a to-do'), { target: { value: 'Ship it' } });
71
- fireEvent.click(screen.getByRole('button', { name: 'Add' }));
70
+ fireEvent.click(screen.getByRole('button', { name: /Add to-do/ }));
71
+ fireEvent.change(screen.getByLabelText('New to-do title'), { target: { value: 'Ship it' } });
72
+ fireEvent.keyDown(screen.getByLabelText('New to-do title'), { key: 'Enter' });
72
73
  await waitFor(() => expect(create).toHaveBeenCalledWith({ title: 'Ship it', focusId: 'focus:p1' }));
73
74
  });
74
75
 
@@ -115,10 +116,11 @@ describe('Projects', () => {
115
116
  });
116
117
 
117
118
  describe('Talk', () => {
118
- it('is one screen: the subtitle and the screen, no mode toggle', () => {
119
+ it('is one screen: no subtitle, no title of its own, no mode toggle', () => {
119
120
  render(<TalkPage talk={<p>talk body</p>} />);
120
121
  expect(screen.getByText('talk body')).toBeTruthy();
121
- expect(screen.getByTestId('talk-mode-subtitle').textContent).toBe(TAB_COPY.talk.subtitle);
122
+ expect(screen.queryByTestId('talk-mode-subtitle')).toBeNull();
123
+ expect(screen.queryByRole('heading')).toBeNull();
122
124
  expect(screen.queryByRole('tablist')).toBeNull();
123
125
  expect(screen.queryByRole('tab')).toBeNull();
124
126
  });
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { commitmentToEntity, toCommitment } from '../corpus/entities';
4
+ import type { Commitment } from '../corpus/types';
5
+
6
+ const scope = { orgId: 'o', userId: 'u' } as never;
7
+ const base = { externalId: 'commit:x', title: 'Send paperwork', mentions: [], status: 'open', subjectKey: 's', actionKey: 'a', dedupeKey: 'd' } as unknown as Commitment;
8
+
9
+ describe('projectBasis on a commitment', () => {
10
+ it('is written to the row and read back', () => {
11
+ const wire = commitmentToEntity({ ...base, projectBasis: 'guessed from the topic' });
12
+ expect(wire.data.project_basis).toBe('guessed from the topic');
13
+ const back = toCommitment({ id: '1', external_id: 'commit:x', entity_type: 'commitment', name: 'x', data: wire.data } as never, scope);
14
+ expect(back.projectBasis).toBe('guessed from the topic');
15
+ });
16
+ it('is absent when nothing was guessed', () => {
17
+ expect('project_basis' in commitmentToEntity(base).data).toBe(false);
18
+ });
19
+ });
@@ -0,0 +1,21 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { PROJECT_GUESSED, projectBasisFor } from '../corpus/project-basis';
4
+
5
+ const item = { title: 'Send the lease paperwork', detail: '', mentions: [{ quote: 'send the lease paperwork to the landlord' }] };
6
+
7
+ describe('projectBasisFor', () => {
8
+ it('marks a project that the item never names as a guess from the topic', () => {
9
+ expect(projectBasisFor(item, 'Home admin', 'I need to send the lease paperwork to the landlord.')).toBe(PROJECT_GUESSED);
10
+ });
11
+ it('leaves it unmarked when the project is named in what was said', () => {
12
+ expect(projectBasisFor(item, 'Home admin', 'For home admin: send the lease paperwork to the landlord.')).toBeUndefined();
13
+ });
14
+ it('leaves it unmarked when the item itself names the project', () => {
15
+ expect(projectBasisFor({ ...item, title: 'Home admin: lease paperwork' }, 'Home admin', '')).toBeUndefined();
16
+ });
17
+ it('ignores case and a missing project title', () => {
18
+ expect(projectBasisFor(item, 'HOME ADMIN', 'home admin first')).toBeUndefined();
19
+ expect(projectBasisFor(item, '', 'anything')).toBeUndefined();
20
+ });
21
+ });
@@ -6,7 +6,7 @@ import { join } from 'node:path';
6
6
  import { describe, expect, it, vi } from 'vitest';
7
7
 
8
8
  // @ts-expect-error plain .mjs scripts
9
- import { composeSnapshot, loadNotes, parseSessions, saveNotes } from '../../../../scripts/relay-converse/fleet.mjs';
9
+ import { composeSnapshot, loadNotes, parseSessions, readFleetInputs, saveNotes } from '../../../../scripts/relay-converse/fleet.mjs';
10
10
  // @ts-expect-error plain .mjs scripts
11
11
  import { accessToken, saveState } from '../../../../scripts/relay-converse/oauth.mjs';
12
12
  // @ts-expect-error plain .mjs scripts
@@ -28,6 +28,15 @@ describe('fleet snapshot composition', () => {
28
28
  });
29
29
  });
30
30
 
31
+ describe('fleet inputs for the /fleet page', () => {
32
+ it('reads roles.md, the loops ledger and the raw bridge listing; leaves out what is missing', async () => {
33
+ const dir = mkdtempSync(join(tmpdir(), 'rc-'));
34
+ writeFileSync(join(dir, 'roles.md'), '| Role | s | n |');
35
+ const env = { RELAY_ROLES_FILE: join(dir, 'roles.md'), RELAY_LOOPS_FILE: join(dir, 'nope.md'), RELAY_PORTS_FILE: join(dir, 'nope2.md') };
36
+ expect(await readFleetInputs(env, '[live] `a · b · 12345678` g')).toEqual({ roles: '| Role | s | n |', sessions: '[live] `a · b · 12345678` g' });
37
+ });
38
+ });
39
+
31
40
  describe('shared access token', () => {
32
41
  it('reuses an unexpired access token for the same base and rotates the refresh token only once when expired', async () => {
33
42
  const dir = mkdtempSync(join(tmpdir(), 'rc-'));