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.
- package/package.json +26 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-initiative-test.js +1 -1
- package/workspace/changelog.json +25 -0
- package/workspace/guide/home.md +2 -1
- package/workspace/guide/programs.md +15 -5
- package/workspace/guide/published-board.md +1 -0
- package/workspace/home-rows-test.js +2 -1
- package/workspace/lib/board-pack-route.js +10 -1
- package/workspace/lib/board-pack.js +31 -2
- package/workspace/lib/briefing-premium-products.js +5 -2
- package/workspace/lib/briefing-premium.js +5 -3
- package/workspace/lib/ready-reports.js +31 -6
- package/workspace/metric-drafts-ui-test.js +2 -1
- package/workspace/milestone-suggest-test.js +12 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +5 -5
- package/workspace/program-panel-test.js +28 -25
- package/workspace/public/pm/bd-prog-panel.js +84 -60
- package/workspace/public/pm/chat-md.js +5 -2
- package/workspace/public/pm/cozy-board.css +1 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/dash-view.js +9 -5
- package/workspace/public/pm/goal-chat.js +3 -1
- package/workspace/public/pm/home-app.js +53 -21
- package/workspace/public/pm/home-chat.js +2 -2
- package/workspace/public/pm/premium.css +1 -0
- package/workspace/public/pm/prog-page.css +76 -0
- package/workspace/public/pm/prog-page.js +112 -0
- package/workspace/public/pm/readonly.js +11 -1
- package/workspace/ready-dash-ui-test.js +53 -73
- 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
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
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(
|
|
106
|
-
ok('H one toggle
|
|
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
|
-
|
|
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
|
-
/* ──
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
136
|
-
await p.click('#czViewer
|
|
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
|
|
140
|
+
/* ── L: the last tab per page ── */
|
|
158
141
|
const L = await open({ ctx: X.ctx });
|
|
159
|
-
const
|
|
160
|
-
ok('L after a reload the
|
|
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-
|
|
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 () =>
|
|
167
|
-
ok('I the initiative view
|
|
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(() =>
|
|
171
|
-
ok('I PbA1: Goal, Ships, Needs you, Reports', !!di && 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(
|
|
180
|
-
await G.page.click('#czViewer [data-
|
|
181
|
-
await until(() =>
|
|
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
|
|
194
|
-
ok('Z the dashboard cannot be read:
|
|
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(
|
|
200
|
-
ok('M at 390 px the title keeps 150 px
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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, '
|
|
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
|
}
|
package/workspace/run-tests.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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; }
|