create-pmos 0.477.0 → 0.479.0

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 (36) hide show
  1. package/package.json +26 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-initiative-test.js +1 -1
  7. package/workspace/changelog.json +25 -0
  8. package/workspace/guide/home.md +2 -1
  9. package/workspace/guide/programs.md +15 -5
  10. package/workspace/guide/published-board.md +1 -0
  11. package/workspace/home-rows-test.js +2 -1
  12. package/workspace/lib/board-pack-route.js +10 -1
  13. package/workspace/lib/board-pack.js +31 -2
  14. package/workspace/lib/briefing-premium-products.js +5 -2
  15. package/workspace/lib/briefing-premium.js +5 -3
  16. package/workspace/lib/ready-reports.js +31 -6
  17. package/workspace/metric-drafts-ui-test.js +2 -1
  18. package/workspace/milestone-suggest-test.js +12 -6
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/program-charter-test.js +5 -5
  22. package/workspace/program-panel-test.js +28 -25
  23. package/workspace/public/pm/bd-prog-panel.js +84 -60
  24. package/workspace/public/pm/chat-md.js +5 -2
  25. package/workspace/public/pm/cozy-board.css +1 -0
  26. package/workspace/public/pm/cozy-home.css +3 -0
  27. package/workspace/public/pm/dash-view.js +9 -5
  28. package/workspace/public/pm/goal-chat.js +3 -1
  29. package/workspace/public/pm/home-app.js +53 -21
  30. package/workspace/public/pm/home-chat.js +2 -2
  31. package/workspace/public/pm/premium.css +1 -0
  32. package/workspace/public/pm/prog-page.css +76 -0
  33. package/workspace/public/pm/prog-page.js +112 -0
  34. package/workspace/public/pm/readonly.js +11 -1
  35. package/workspace/ready-dash-ui-test.js +53 -73
  36. package/workspace/run-tests.js +44 -6
@@ -3,14 +3,15 @@
3
3
  /* ready-dash-ui-test.js — the ready-made Dashboard in the program panel and the initiative view, and a ready-made report's two cuts in the one
4
4
  * report Viewer (batch 17 item 1; canvas PbH1Header, PbA1, PbA2, PbA7, PbG2, PbG5). Serves the real Board page from the real server; Project
5
5
  * Ascent comes from fixtures/program-ascent.js, and the /api/ready-reports routes answer fixtures/ready-reports.js, the shape the backend agreed.
6
- * H the header: one toggle icon where the charter icon was (a gauge, "Show the dashboard", aria-pressed false); none before the dashboard reads
7
- * D the Dashboard: ✦ line with Adler's face, Goals, Milestones, Needs you, Reports in order; the toggle shows a list, pressed; the pencil on
8
- * Milestones opens the charter · W wide (1440): two columns (PbA7) · N ✓ on Needs you keeps the pick (POST /api/proposals/keep)
9
- * R a report row opens the one report Viewer: Sponsors · 1 minute | Team · full; Sponsors reads the cut and lists the Team-only sections
10
- * L the last choice per page: after a reload the Dashboard opens first
11
- * I the initiative view on the Board has the same toggle; a held report (PbG2): Wait posts the hold
12
- * M on a phone (390): the title keeps 150 px, the Dashboard fits the width, no page error · S the type scale only
13
- * P the product page on Home (390 and 1440) is the product's Dashboard, with no toggle (PbA3, PbG8).
6
+ * Batch 21 item 2 made the program panel and the product page ONE page (pm/prog-page.js, canvas RdProgL–P): the batch 17 Work | Dashboard
7
+ * toggle is gone there, and these checks read the one page.
8
+ * H the program page: the ✦ line, the goal card, then Tasks, Initiatives (open first), Reports, Documents; no toggle
9
+ * N the proposals fold into one row for the owner; ✓ keeps the pick (POST /api/proposals/keep)
10
+ * R the Reports tab: a report row opens the one report Viewer: Sponsors · 1 minute | Team · full; Sponsors reads the cut
11
+ * L the last tab per page: after a reload Reports opens first
12
+ * I the initiative view on the Board keeps its own dashboard toggle; G a held report (PbG2) in the Reports tab: Wait posts the hold
13
+ * Z no dashboard: the page still draws · M on a phone (390): the title keeps 150 px, no sideways scroll, tabs 40 px
14
+ * P the product page on Home (390 and 1440) is the same one page; the metrics review is a row in its Reports tab.
14
15
  * PMOS_SHOTS=<dir> also saves the screenshots. */
15
16
  const path = require('path');
16
17
  const fs = require('fs');
@@ -99,110 +100,87 @@ const SPONSORS = '# Inline login slips to early December unless passkeys move to
99
100
  const sizes = (p, sel) => p.evaluate((s) => [...new Set([...document.querySelectorAll(s + ', ' + s + ' *')].filter((e) => e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())).map((e) => getComputedStyle(e).fontSize))], sel);
100
101
  const SCALE = new Set(['11px', '12px', '14px', '16px', '20px', '28px']);
101
102
 
102
- /* ── H: the header ── */
103
+ /* ── H: the program panel is ONE page (batch 21 item 2, canvas RdProgL–P): no Work | Dashboard toggle ── */
104
+ const pg = (pp) => pp.evaluate(() => {
105
+ const v = document.querySelector('#czViewer .pv'); if (!v) return null;
106
+ return { toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]'), line: !!v.querySelector('.pv-line'), goal: !!v.querySelector('.pv-gc'),
107
+ tabs: [...v.querySelectorAll('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), props: !!v.querySelector('[data-pv="props"]'),
108
+ title: (() => { const e = document.querySelector('#czViewer .cz-vw-t'); return e ? Math.round(e.getBoundingClientRect().width) : 0; })(), w: v.getBoundingClientRect().width, over: v.scrollWidth > v.clientWidth + 1 };
109
+ });
103
110
  const X = await open();
104
111
  const p = X.page;
105
- const h0 = await until(async () => { const h = await head(p); return h.toggle ? h : null; });
106
- ok('H one toggle icon in the charter\'s place: a gauge, "Show the dashboard", not pressed, icon-only', !!h0 && !h0.charter && h0.toggle.label === 'Show the dashboard' && h0.toggle.title === 'Show the dashboard' && h0.toggle.pressed === 'false' && !h0.toggle.text, JSON.stringify(h0));
112
+ const h0 = await until(() => pg(p));
113
+ ok('H one page with no toggle: the ✦ line, the goal card, then Tasks, Initiatives (open first), Reports, Documents', !!h0 && !h0.toggle && h0.line && h0.goal && h0.tabs.join() === 'tasks,initiatives*,reports,documents', JSON.stringify(h0));
107
114
  ok('H the dashboard is read for the program, as a press to act (a Board row)', X.gets.some((g) => g.scope === 'program:project-ascent' && g.from === 'act' && g.ws === 'idpf'), JSON.stringify(X.gets));
108
- ok('H Work opens first: the panel\'s own summary shows, no Dashboard', await p.evaluate(() => !!document.querySelector('#czViewer .pp-vw .czs-sum') && !document.querySelector('#czViewer .db')));
109
-
110
- /* ── D: the Dashboard ── */
111
- await p.click('#czViewer [data-cz-vw-p="dash"]');
112
- const d0 = await until(() => dash(p));
113
- ok('D the blocks in order: Goals, Milestones, Needs you, Reports; no empty block', !!d0 && d0.heads.join() === 'Goals,Milestones,Needs you,Reports', JSON.stringify(d0));
114
- ok('D the ✦ line leads with what Claude handled, with Adler\'s face', !!d0 && d0.hd === '3 of 4 milestones hold their dates. I drafted the sponsor update for Thursday.' && d0.face, JSON.stringify(d0));
115
- const h1 = await head(p);
116
- ok('D the same icon now shows the list to go back, pressed', !!h1.toggle && h1.toggle.label === 'Show the work' && h1.toggle.pressed === 'true', JSON.stringify(h1));
117
- ok('D in the panel beside the Board the blocks stack in one column', !!d0 && d0.cols === 1, JSON.stringify(d0));
118
- const ds = await sizes(p, '#czViewer .db');
119
- ok('S the Dashboard uses the type scale only', ds.length && ds.every((x) => SCALE.has(x)), ds.join());
120
- await shot(p, 'PbA2Prog-desk-built');
115
+ await shot(p, 'RdProgL-desk-built');
121
116
 
122
- /* ── W: wide (the Board's ⧉ Full screen, panels on Board and Intelligence: ⧉ took ⤢'s place) ── */
123
- await p.click('#czViewer [data-cz-vw="place"]'); await p.click('.cz-pn-menu [data-cz-pn-place="full"]');
124
- const dw = await until(async () => { const d = await dash(p); return d && d.cols === 2 ? d : null; }, 4000);
125
- ok('W wide (PbA7): two columns, each block its own card', !!dw && dw.cols === 2, JSON.stringify(await dash(p)));
126
- await shot(p, 'PbA7Desk-built');
127
- await p.click('#czViewer [data-cz-vw="place"]'); await p.click('.cz-pn-menu [data-cz-pn-place="split"]');
128
-
129
- /* ── N: Needs you ✓ ── */
117
+ /* ── N: Claude's proposals fold into one row for the owner; ✓ keeps the pick ── */
118
+ ok('N the proposals that wait on the owner fold into one row', !!h0 && h0.props, JSON.stringify(h0));
119
+ await p.click('#czViewer [data-pv="props"]');
130
120
  await p.click('#czViewer .db-need [data-db="needs"][data-k="keep"]');
131
121
  const kp = await until(() => X.posts.find((x) => x.path === '/api/proposals/keep'));
132
122
  ok('N ✓ keeps Claude\'s pick: POST /api/proposals/keep with the proposal ids and the initiative', !!kp && kp.body.ids.join() === 'p-dates-1' && kp.body.initiative === 'descope-parity' && kp.body.ws === 'idpf', JSON.stringify(kp));
133
123
  ok('N the dashboard is read again after the press', (await until(() => X.gets.filter((g) => g.scope === 'program:project-ascent').length >= 2, 3000)));
134
124
 
135
- /* ── the Milestones pencil opens the charter, ← comes back to the Dashboard ── */
136
- await p.click('#czViewer .db [data-db="milestones"]');
137
- ok('D the pencil on Milestones opens the charter', !!(await until(() => p.evaluate(() => window.czViewer && window.czViewer.current() && /^charter:/.test(window.czViewer.current().id)), 4000)));
138
- await p.click('#czViewer [data-cz-vw="back"]');
139
- ok('D ← comes back to the Dashboard', !!(await until(() => p.evaluate(() => !!document.querySelector('#czViewer .db')), 4000)));
140
-
141
- /* ── R: a report row, and its two cuts ── */
125
+ /* ── R: the Reports tab: a report row, and its two cuts ── */
126
+ await p.click('#czViewer [data-pv="tab"][data-k="reports"]');
142
127
  await p.click('#czViewer .db [data-db="report"][data-k="r-sponsor"]');
143
128
  const seg = await until(() => p.evaluate(() => { const s = document.querySelector('#czViewer .vz-cuts'); return s ? [...s.querySelectorAll('button')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')) : null; }), 8000);
144
129
  ok('R the report opens in the one report Viewer with Sponsors · 1 minute | Team · full, Team first', !!seg && seg.join() === 'Sponsors · 1 minute:false,Team · full:true', JSON.stringify(seg));
145
- await shot(p, 'PbA4Report-team-built');
146
130
  await p.click('#czViewer .vz-cuts [data-r="cut|sponsors"]');
147
131
  const cut = await until(() => p.evaluate(() => { const L = [...document.querySelectorAll('#czViewer .vz-cutl li')]; return L.length ? L.map((l) => (l.classList.contains('on') ? '✓' : '·') + l.querySelector('b').textContent + (l.querySelector('small') ? ' (' + l.querySelector('small').textContent + ')' : '')) : null; }), 5000);
148
132
  ok('R Sponsors reads the cut (GET /api/ready-reports/cut) and ticks what sponsors read; the rest say Team only', !!cut && cut.join(' / ') === '✓The answer and 3 points / ✓Your decision / ✓Scorecard / ·Tickets and risks (Team only) / ·Next week\'s plan (Team only)', JSON.stringify(cut));
149
133
  ok('R the cut was read for this file', X.gets.some((g) => g.cut === 'sponsors' && g.path === 'reports/one-login-sponsor/2026-10-29.md'));
150
134
  ok('R Edit is not offered on the sponsors cut (the team cut is the one edited)', await p.evaluate(() => !document.querySelector('#czViewer [data-r="edit"]')));
151
- await shot(p, 'PbG5Readers-built');
152
135
  await p.click('#czViewer .vz-cuts [data-r="cut|team"]');
153
136
  ok('R Team shows the full draft again', !!(await until(() => p.evaluate(() => !document.querySelector('#czViewer .vz-cutl') && document.querySelector('#czViewer [data-r="cut|team"]').getAttribute('aria-pressed') === 'true'), 3000)));
154
137
  ok('0 no page error (desk)', X.errors.length === 0, X.errors.join(' | '));
155
138
  await p.close();
156
139
 
157
- /* ── L: the last choice per page ── */
140
+ /* ── L: the last tab per page ── */
158
141
  const L = await open({ ctx: X.ctx });
159
- const dl = await until(() => dash(L.page), 8000);
160
- ok('L after a reload the Dashboard opens first: the PM\'s last choice on this program', !!dl && dl.heads[0] === 'Goals', JSON.stringify(dl));
142
+ const hl = await until(() => pg(L.page), 8000);
143
+ ok('L after a reload the page opens on the PM\'s last tab on this program: Reports', !!hl && hl.tabs.includes('reports*'), JSON.stringify(hl));
161
144
 
162
- /* ── I: the initiative view on the Board ── */
163
- await L.page.click('#czViewer [data-cz-vw-p="dash"]'); // back to the work, so the tree is there
145
+ /* ── I: the initiative view on the Board, from the Initiatives tab ── */
146
+ await L.page.click('#czViewer [data-pv="tab"][data-k="initiatives"]');
164
147
  await until(() => L.page.evaluate(() => { const b = document.querySelector('#czViewer [data-czs-fold="tree"]'); if (b && b.getAttribute('aria-expanded') !== 'true') b.click(); return !!document.querySelector('#czViewer button.pp-open[data-ini="descope-parity"]'); }));
165
148
  await L.page.click('#czViewer button.pp-open[data-ini="descope-parity"]');
166
- const it = await until(async () => { const h = await head(L.page); return h.toggle && (await L.page.evaluate(() => !!document.querySelector('#czViewer .iv'))) ? h : null; }, 8000);
167
- ok('I the initiative view carries the same toggle; Work shows first', !!it && it.toggle.label === 'Show the dashboard', JSON.stringify(it));
149
+ const it = await until(async () => (await L.page.evaluate(() => !!document.querySelector('#czViewer .iv') && !!document.querySelector('#czViewer [data-cz-vw-p="dash"]'))), 8000);
150
+ ok('I the initiative view keeps its own dashboard toggle; Work shows first', !!it);
168
151
  ok('I the initiative\'s dashboard is read for its scope', L.gets.some((g) => g.scope === 'initiative:descope-parity'));
169
152
  await L.page.click('#czViewer [data-cz-vw-p="dash"]');
170
- const di = await until(() => dash(L.page));
171
- ok('I PbA1: Goal, Ships, Needs you, Reports', !!di && di.heads.join() === 'Goal,Ships,Needs you,Reports', JSON.stringify(di));
153
+ const di = await until(() => L.page.evaluate(() => { const d = document.querySelector('#czViewer .db'); return d ? [...d.querySelectorAll('.db-h')].map((x) => x.textContent) : null; }));
154
+ ok('I PbA1: Goal, Ships, Needs you, Reports', !!di && di.join() === 'Goal,Ships,Needs you,Reports', JSON.stringify(di));
172
155
  ok('I Ships: the range against the promise', await L.page.evaluate(() => /28 Nov to 5 Dec/.test(document.querySelector('#czViewer .db').textContent) && /promised 18 Nov/.test(document.querySelector('#czViewer .db').textContent)));
173
- await shot(L.page, 'PbA1Ini-desk-built');
174
156
  ok('0 no page error (initiative)', L.errors.length === 0, L.errors.join(' | '));
175
157
  await X.ctx.close();
176
158
 
177
- /* ── G: a held report (PbG2) ── */
159
+ /* ── G: a held report (PbG2), in the Reports tab ── */
178
160
  const G = await open({ dash: { 'program:project-ascent': { ...RR.held(), scope: 'program:project-ascent' } } });
179
- await until(async () => (await head(G.page)).toggle);
180
- await G.page.click('#czViewer [data-cz-vw-p="dash"]');
181
- await until(() => dash(G.page));
182
- ok('G the held update: the honest ✦ line and Skip, Send with a note, Wait', await G.page.evaluate(() => !!document.querySelector('#czViewer .db-hd.warn') && document.querySelectorAll('#czViewer .db-held .db-ib').length === 3));
161
+ await until(() => pg(G.page));
162
+ await G.page.click('#czViewer [data-pv="tab"][data-k="reports"]');
163
+ ok('G the held update: Skip, Send with a note, Wait', !!(await until(() => G.page.evaluate(() => document.querySelectorAll('#czViewer .db-held .db-ib').length === 3), 4000)));
183
164
  await G.page.click('#czViewer .db-held [data-k="r-weekly|wait"]');
184
165
  const hp = await until(() => G.posts.find((x) => x.path === '/api/ready-reports/hold'));
185
166
  ok('G Wait posts the hold (POST /api/ready-reports/hold, act wait)', !!hp && hp.body.act === 'wait' && hp.body.kind === 'weekly' && hp.body.scope === 'program:project-ascent', JSON.stringify(hp));
186
- await shot(G.page, 'PbG2Stale-built');
187
167
  ok('0 no page error (held)', G.errors.length === 0, G.errors.join(' | '));
188
168
  await G.ctx.close();
189
169
 
190
- /* ── Z: no dashboard: no toggle ── */
170
+ /* ── Z: no dashboard: the page still draws, no toggle ── */
191
171
  const Z = await open({ dash: { 'program:project-ascent': null } });
192
172
  await until(() => Z.gets.some((g) => g.scope === 'program:project-ascent'), 5000); await sleep(500);
193
- const hz = await head(Z.page);
194
- ok('Z the dashboard cannot be read: no toggle, the work as before', !hz.toggle && !hz.charter, JSON.stringify(hz));
173
+ const hz = await until(() => pg(Z.page), 5000);
174
+ ok('Z the dashboard cannot be read: the one page draws from the program\'s own records, no toggle', !!hz && !hz.toggle && hz.tabs.length === 4, JSON.stringify(hz));
195
175
  await Z.ctx.close();
196
176
 
197
177
  /* ── M: a phone ── */
198
178
  const M = await open({ w: 390, h: 844, dark: true });
199
- const hm = await until(async () => { const h = await head(M.page); return h.toggle ? h : null; });
200
- ok('M at 390 px the title keeps 150 px beside the one toggle (PbH1Header)', !!hm && hm.title >= 150, JSON.stringify(hm));
201
- await M.page.click('#czViewer [data-cz-vw-p="dash"]');
202
- const dm = await until(() => dash(M.page));
203
- ok('M the Dashboard fits the phone: one column, no sideways scroll', !!dm && dm.cols === 1 && !dm.over && dm.w <= 390, JSON.stringify(dm));
204
- ok('M every press is at least 40 px', await M.page.evaluate(() => [...document.querySelectorAll('#czViewer .db .db-ib')].every((b) => b.getBoundingClientRect().width >= 40)));
205
- await shot(M.page, 'PbA2Prog-phone-dark-built');
179
+ const hm = await until(() => pg(M.page));
180
+ ok('M at 390 px the title keeps 150 px (RdProgP)', !!hm && hm.title >= 150, JSON.stringify(hm));
181
+ ok('M the page fits the phone: no sideways scroll', !!hm && !hm.over && hm.w <= 390, JSON.stringify(hm));
182
+ ok('M every tab is at least 40 px tall', await M.page.evaluate(() => [...document.querySelectorAll('#czViewer [data-pv="tab"]')].every((b) => b.getBoundingClientRect().height >= 40)));
183
+ await shot(M.page, 'RdProgP-phone-dark-built');
206
184
  ok('0 no page error (phone)', M.errors.length === 0, M.errors.join(' | '));
207
185
  await M.ctx.close();
208
186
 
@@ -213,13 +191,15 @@ const SPONSORS = '# Inline login slips to early December unless passkeys move to
213
191
  pg.on('pageerror', (e) => errs.push(String((e && e.stack) || e)));
214
192
  await pg.route('**/api/ready-reports/dashboard*', (r) => { const u = new URL(r.request().url()); gets.push({ scope: u.searchParams.get('scope'), from: u.searchParams.get('from') }); return r.fulfill({ contentType: 'application/json', body: JSON.stringify(RR.product()) }); });
215
193
  await pg.goto(BASE + '/premium.html?ini=product');
216
- const pd = await until(() => pg.evaluate(() => { const d = document.querySelector('#czViewer .db'); if (!d) return null; return { heads: [...d.querySelectorAll('.db-h')].map((x) => x.textContent), sum: (d.querySelector('.db-sum b') || {}).textContent || '', late: !!d.querySelector('.db-late'), over: d.scrollWidth > d.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
217
- ok('P (' + nm + ') the product page is the Dashboard: Goals folded to dots, Ships next, This week with the late update; no toggle', !!pd && pd.sum === 'Goals' && pd.heads.join() === 'Ships next,This week' && pd.late && !pd.toggle && !pd.over, JSON.stringify(pd));
218
- const mx = await pg.evaluate(() => { const b = document.querySelector('#czViewer .db [data-db="metrics"]'); if (!b) return null; const r = b.getBoundingClientRect(), s = document.querySelector('#czViewer .db-sum').getBoundingClientRect(); return { w: r.width, label: b.getAttribute('aria-label'), beside: Math.abs((r.top + r.height / 2) - (s.top + s.height / 2)) < 12 }; });
219
- ok('P (' + nm + ') the metrics review keeps its way in: one icon at the Goals head, 40 px', !!mx && mx.label === 'Open the metrics review' && mx.w >= 40 && mx.beside, JSON.stringify(mx));
220
- if (nm === 'desk') { await pg.click('#czViewer .db [data-db="metrics"]'); ok('P the icon opens the metrics review, ← back to the product', !!(await until(() => pg.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return c && c.id !== 'product' ? c.id : null; })))); }
194
+ // batch 21 item 2: the product page is the same ONE page as a program's (prog-page.js): no toggle, Initiatives open first
195
+ const pd = await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer .pv'); if (!v) return null; return { goal: !!v.querySelector('.pv-gc'), tabs: [...v.querySelectorAll('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), over: v.scrollWidth > v.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
196
+ ok('P (' + nm + ') the product page is the one page: the goal card, Tasks, Initiatives (open first), Reports, Documents; no toggle', !!pd && pd.goal && pd.tabs.join() === 'tasks,initiatives*,reports,documents' && !pd.toggle && !pd.over, JSON.stringify(pd));
197
+ await pg.click('#czViewer [data-pv="tab"][data-k="reports"]');
198
+ const mx = await until(() => pg.evaluate(() => { const b = document.querySelector('#czViewer [data-hp="metrics"]'); if (!b) return null; const r = b.getBoundingClientRect(); return { h: r.height, text: b.textContent }; }), 4000);
199
+ ok('P (' + nm + ') the metrics review keeps its way in: a row in the Reports tab, 40 px', !!mx && /Metrics review/.test(mx.text) && mx.h >= 40, JSON.stringify(mx));
200
+ if (nm === 'desk') { await pg.click('#czViewer [data-hp="metrics"]'); ok('P the row opens the metrics review, ← back to the product', !!(await until(() => pg.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return c && c.id !== 'product' ? c.id : null; })))); }
221
201
  ok('P (' + nm + ') read as a page to read (scope product)', gets.some((g) => g.scope === 'product' && g.from === 'read'), JSON.stringify(gets));
222
- await shot(pg, 'PbA3Product-' + nm + '-built');
202
+ await shot(pg, 'RdProgProduct-' + nm + '-built');
223
203
  ok('0 no page error (product, ' + nm + ')', errs.length === 0, errs.join(' | '));
224
204
  await c.close();
225
205
  }
@@ -301,14 +301,20 @@ function traceChanges(changes, ctx) {
301
301
  let hit = false;
302
302
  for (const f of code) {
303
303
  if (f === 'server.js' || /^lib\/route(s-|-modules)/.test(f)) continue;
304
- const t = get(f); if (!t || !keys.some((k) => t.includes(k))) continue;
304
+ // the code without its comments: a file whose header comment names a route does not call it (batch 20: lib/chat-files.js
305
+ // documents GET /api/chat-file, and that sent a change to lib/routes-briefing-premium.js to every suite through spawnSessionInner)
306
+ const t = sget(f); if (!t || !keys.some((k) => t.includes(k))) continue;
305
307
  hit = true;
306
308
  if (inList.has(f)) picked.add(f);
307
309
  else if (SUITE_NAME.test(f)) continue; // a suite of another group: nothing depends on it
308
310
  else if (f.startsWith('public/')) viaPublic(f);
309
311
  else { const w = users(f); if (w) return w; }
310
312
  }
311
- return hit ? null : `${where}: nothing names the route ${r}`;
313
+ if (hit) return null;
314
+ // a route no page and no suite names: only a suite that opens its module can reach it (PM, 2026-11-01: no full regression)
315
+ const file = /^(lib\/[\w.-]+\.js)/.exec(String(where));
316
+ if (file) { nameHits(file[1]).forEach((x) => picked.add(x)); return null; }
317
+ return `${where}: nothing names the route ${r}`;
312
318
  };
313
319
  const routes = (keys, where) => { for (const r of keys) { const w = route(r, where); if (w) return w; } return null; };
314
320
  const routeModule = (f) => {
@@ -333,7 +339,11 @@ function traceChanges(changes, ctx) {
333
339
  const m = /^(?:async\s+)?function\s*\*?\s*(\w+)|^(?:const|let)\s+(\w+)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|\w+\s*=>)/.exec(C[i]);
334
340
  if (!m) continue;
335
341
  let j = i;
336
- if (/\{\s*$/.test(C[i]) || !/;\s*$/.test(C[i])) { j = i + 1; while (j < C.length && !/^\}/.test(C[j])) j++; }
342
+ // a function whole on its one line (its braces balance, e.g. `function f(s) { try { x(); } catch {} }`) ends there: before,
343
+ // it ran on to the next line that starts with '}' and swallowed the function after it (batch 20: noteSessionEnd took spawnSessionInner)
344
+ const open = (C[i].match(/\{/g) || []).length, shut = (C[i].match(/\}/g) || []).length;
345
+ const whole = open > 0 && open === shut;
346
+ if (!whole && (/\{\s*$/.test(C[i]) || !/;\s*$/.test(C[i]))) { j = i + 1; while (j < C.length && !/^\}/.test(C[j])) j++; }
337
347
  fn.push({ name: m[1] || m[2], a: i + 1, b: j + 1 });
338
348
  i = j;
339
349
  }
@@ -355,7 +365,29 @@ function traceChanges(changes, ctx) {
355
365
  return S;
356
366
  };
357
367
  const used = new Set();
358
- const serverLines = (lines) => {
368
+ // A NEW OPTION (batch 20): every changed line of a function names one of its destructured parameters that nothing else in
369
+ // server.js names. With no caller passing it the function does what it did, so the change reaches only the callers that pass
370
+ // it: the suites that name it, and the suites of each lib/ or public/ file that names it. (Before, adding `typedByPm` to
371
+ // spawnSessionInner reached every suite, through the boot code that calls spawnSession.)
372
+ const optSeen = new Map();
373
+ const optionOnly = (own, lines) => {
374
+ if (optSeen.has(own.name)) return optSeen.get(own.name);
375
+ const { C } = parseServer();
376
+ const sig = /\(\s*\{([^}]*)\}/.exec(C[own.a - 1] || '');
377
+ const params = sig ? sig[1].split(',').map((x) => x.trim().split(/[\s=:]/)[0]).filter((x) => /^\w+$/.test(x)) : [];
378
+ const outside = C.filter((_, k) => k + 1 < own.a || k + 1 > own.b).join('\n');
379
+ const fresh = params.filter((x) => !new RegExp('\\b' + x + '\\b').test(outside));
380
+ const mine = lines.filter((n) => n >= own.a && n <= own.b && (C[n - 1] || '').trim());
381
+ const res = fresh.length > 0 && mine.length > 0 && mine.every((n) => fresh.some((x) => new RegExp('\\b' + x + '\\b').test(C[n - 1])));
382
+ if (res) {
383
+ const re = new RegExp('\\b(' + fresh.join('|') + ')\\b');
384
+ for (const sfile of list) if (re.test(get(sfile) || '')) picked.add(sfile);
385
+ for (const f of code) if (f !== 'server.js' && !inList.has(f) && re.test(sget(f) || '')) nameHits(f).forEach((x) => picked.add(x));
386
+ }
387
+ optSeen.set(own.name, res);
388
+ return res;
389
+ };
390
+ const serverLines = (lines, viaUse = false) => {
359
391
  const { C, fnAt, blockAt } = parseServer();
360
392
  for (const n of lines) {
361
393
  const raw = C[n - 1];
@@ -363,10 +395,16 @@ function traceChanges(changes, ctx) {
363
395
  const b = blockAt(n);
364
396
  if (b) { const w = routes(b.keys, `server.js:${n}`); if (w) return w; continue; }
365
397
  const own = fnAt(n);
398
+ if (own && own.name !== 'handleRequest' && optionOnly(own, lines)) continue;
366
399
  if (own && own.name !== 'handleRequest') { const w = useOf(own.name); if (w) return `${own.name} (server.js:${n}) is used by ${w}`; continue; }
367
400
  const req = /^(?:const|let)\s+\w+\s*=\s*require\(\s*'\.\/(lib\/[\w.-]+)'\s*\)\s*;?\s*$/.exec(raw); // a plain top-level `const x = require('./lib/m.js')`: its uses are other lines, traced on their own
368
401
  const mod = wiringOf(n) || (req ? req[1] : null);
369
402
  if (mod) { nameHits(mod).forEach((x) => picked.add(x)); if (inList.has('test.js')) picked.add('test.js'); continue; } // start-up wiring of one lib module: the suites that name it, and the server boot suite
403
+ // a USE of a changed function at the top level (boot, a timer, session restore): the server boot suite runs that code, and
404
+ // the routes that use the function are traced on their own. Only a changed line of its own out there reaches every suite
405
+ // (PM, 2026-11-01: "DO NOT do full regression every time"; before, any function session restore calls reached all 446 suites)
406
+ // A timer (setInterval/setTimeout) runs it on its own all through every suite, so that use still reaches every suite.
407
+ if (viaUse && !/\bset(Interval|Timeout)\s*\(/.test(raw)) { if (inList.has('test.js')) picked.add('test.js'); continue; }
370
408
  return `server.js:${n}, outside every route and function`;
371
409
  }
372
410
  return null;
@@ -394,7 +432,7 @@ function traceChanges(changes, ctx) {
394
432
  if (!own && /^(?:const|let|var)\s[^=]*=\s*require\(/.test(L[i])) continue; // the binding itself
395
433
  at.push(i + 1);
396
434
  }
397
- return serverLines(at);
435
+ return serverLines(at, true);
398
436
  };
399
437
  // the files that name f, followed until a suite, a route or a page; the reason it cannot tell, or null
400
438
  const userMemo = new Map();
@@ -436,7 +474,7 @@ function traceChanges(changes, ctx) {
436
474
  if (inList.has('test.js')) picked.add('test.js');
437
475
  }
438
476
  for (const name of names) { const w = useOf(name); if (w) return w; }
439
- const w = serverLines(inline); if (w) return w;
477
+ const w = serverLines(inline, true); if (w) return w; // the lines that require it are uses of it, as useOf's
440
478
  continue;
441
479
  }
442
480
  if (/^lib\/routes-/.test(g)) { const w = routeModule(g); if (w) return w; continue; }