create-pmos 0.268.0 → 0.270.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.268.0",
3
+ "version": "0.270.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@37b2f3e
1
+ kernel-source: pmos@3edeec9
2
2
  assembled: 2026-10-18
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-18T11:47:32Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T12:29:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-18T11:47:32Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T12:29:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-18T11:47:32Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T12:29:11Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -160,7 +160,7 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
160
160
  await until(() => A.matPosts.length === nRm + 2);
161
161
  ok('M2 Undo adds the same item back at the same scope', A.matPosts[nRm + 1].op === 'add' && A.matPosts[nRm + 1].scope === 'meeting' && A.matPosts[nRm + 1].item.url === 'https://x.example/road', JSON.stringify(A.matPosts[nRm + 1]));
162
162
  ok('M2 the row is back and the status says so', await until(() => p.evaluate(() => /Put back\./.test(document.querySelector('#mtgStatus').textContent) && /Roadmap/.test(document.querySelector('#oMain').textContent))));
163
- ok('M6 nothing else was written by the material work', A.planPosts.length === 0 && ![...A.reqs].some((r) => /\/api\/(notes|meeting-focus|calendar-links)/.test(r)));
163
+ ok('M6 nothing else was written by the material work', A.planPosts.length === 0 && ![...A.reqs].some((r) => /POST \/api\/(notes|meeting-focus|calendar-links)/.test(r)));
164
164
  ok('M6 no page error so far', A.errors.length === 0, JSON.stringify(A.errors));
165
165
 
166
166
  /* M5 refusals */
@@ -203,7 +203,7 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
203
203
  const all = [].concat(A.reqs, D.reqs, N.reqs, NI.reqs, NS.reqs, NR.reqs);
204
204
  const posts = [...new Set(all.filter((r) => /^POST /.test(r)))].sort();
205
205
  ok('M6 the only writes the page sent are the material and the plan items', posts.join() === 'POST /api/meeting-material,POST /api/plan-items', posts.join());
206
- ok('M6 no recording, Focus, note or calendar write was sent', !all.some((r) => /\/api\/(notes|meeting-focus)|POST \/api\/calendar/.test(r)));
206
+ ok('M6 no recording, Focus, note or calendar write was sent', !all.some((r) => /POST \/api\/(notes|meeting-focus|calendar)/.test(r)));
207
207
  ok('M6 no page error', [A, D, N, NI, NS, NR].every((x) => x.errors.length === 0), JSON.stringify([A, D, N, NI, NS, NR].map((x) => x.errors)));
208
208
 
209
209
  /* M7 floors and fidelity */
@@ -0,0 +1,360 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* briefing-premium-calendar-3-test.js — recording, the chip, Focus and Replay in the premium meeting dialog (initiative briefing-premium-calendar, slice 3;
4
+ * planning/prd/briefing-premium-calendar-3-prd.md R1 to R11). Serves the real pages from the real server. The Briefing model, the calendar, the notes, Focus and the replay
5
+ * are answered by stand-ins, so each press can be read off the request the page sent; the recorder is a stand-in that makes the same requests the console's recorder makes
6
+ * (record, pause, stop) and opens no microphone. The routes' own behaviour is in their own suites.
7
+ * R1 record · R2 honest state · R3 chip · R4 leaving · R5 Focus · R6 honest Focus · R7 Replay · R8 Topic · R9 row mark · R10 writes · R11 floors and fidelity
8
+ * Every wait polls the page; no fixed sleep stands in for a state. */
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const { spawn } = require('child_process');
12
+ const { findBrowser } = require('./lib/find-browser');
13
+ const T = require('./test-run').configure({ name: 'briefing-premium-calendar-3' });
14
+ const B = require('./lib/briefing-premium.js');
15
+ const F = require('./fixtures/briefing-premium-facts.js');
16
+
17
+ const BASE = T.BASE;
18
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
19
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
20
+ const results = [];
21
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
22
+ let srv = null; let browser = null;
23
+ const finish = async (code) => {
24
+ if (browser) await browser.close().catch(() => {});
25
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
26
+ T.killTmux();
27
+ const bad = results.filter((x) => !x.cond).length;
28
+ console.log(`\n${results.length - bad}/${results.length} briefing-premium-calendar-3 assertions passed`);
29
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
30
+ };
31
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
32
+
33
+ const pad = (n) => String(n).padStart(2, '0');
34
+ const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
35
+ const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); return `${dayKey(d)}T${pad(d.getHours())}:${pad(d.getMinutes())}:00${off >= 0 ? '+' : '-'}${pad(Math.floor(a / 60))}:${pad(a % 60)}`; };
36
+ const NOW = new Date();
37
+ const midnight = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate());
38
+ const monday = () => { const d = new Date(midnight); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
39
+ /* "Live review" is under way now (it starts at most 10 minutes ago, never before midnight); "Retro" ended long ago when the day allows, so it cannot be recorded. */
40
+ const START = new Date(Math.max(midnight.getTime(), NOW.getTime() - 10 * 60000)), END = new Date(START.getTime() + 60 * 60000);
41
+ const weekAnswer = () => {
42
+ const m = monday(), cells = [];
43
+ for (let i = 0; i < 7; i++) { const d = new Date(m.getFullYear(), m.getMonth(), m.getDate() + i); cells.push({ key: dayKey(d), start: dayKey(d), end: dayKey(d), events: [] }); }
44
+ const put = (d, e) => cells.find((c) => c.key === dayKey(d)).events.push(e);
45
+ put(START, { id: 'ev-live', at: iso(START), end: iso(END), title: 'Live review', attendees: ['Priya', 'Dara'] });
46
+ const other = new Date(midnight); other.setDate(other.getDate() + (NOW.getDay() === 0 ? -2 : 1)); other.setHours(9, 30, 0, 0);
47
+ if (cells.some((c) => c.key === dayKey(other))) put(other, { id: 'ev-standup', at: iso(other), end: iso(new Date(other.getTime() + 30 * 60000)), title: 'Standup', attendees: [] });
48
+ return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(NOW), context: {}, link_boards: [], gantt: [] };
49
+ };
50
+ const REPLAY = { ok: true, note: { id: 'n1', title: 'Live review notes' }, meeting: { title: 'Live review', attendees: ['Priya', 'Dara'] }, audio: null, length_ms: 300000,
51
+ lines: [{ i: 0, t: 1000, who: 'Dara', text: 'Welcome everyone' }, { i: 1, t: 61000, who: 'Priya', text: 'We plan eight people' }, { i: 2, t: 130000, who: 'Dara', text: 'Next the risks' }],
52
+ keys: [{ k: 'decision', text: 'Plan with eight people', t: 61000, state: 'draft' }, { k: 'action', text: 'Priya confirms the owner', t: null, owner: 'Priya', state: 'owner' }, { k: 'question', text: 'Who signs off?', t: 200000, state: 'open' }],
53
+ topics: [{ id: 'capacity', text: 'Capacity', n: 1 }, { id: 'risks', text: 'Risks', n: 2 }], runs: [{ topic: 'capacity', n: 1, from_ms: 0, to_ms: 100000 }, { topic: 'risks', n: 2, from_ms: 100000, to_ms: 300000 }],
54
+ shots: [{ t: 120000, w: 10, h: 10, why: 'A slide with the plan' }] };
55
+ const FOCUS = () => ({ ok: true, now_ms: Date.now(), date: dayKey(NOW), talk: false, event: { id: 'ev-live', title: 'Live review', at: iso(START), end: iso(END), attendees: ['Priya', 'Dara'] },
56
+ note: { id: 'n1', title: 'Live review', state: 'recording', lines: 3 }, topics: [{ id: 'capacity', text: 'Capacity', state: 'discussed', minutes: 4 }, { id: 'risks', text: 'Risks', state: 'now', minutes: 2 }, { id: 'launch', text: 'Launch date', state: 'notyet', minutes: 0 }],
57
+ current: 'risks', runs: [{ topic: 'capacity', from_min: 0, to_min: 4 }, { topic: 'risks', from_min: 4, to_min: null }], gist: 'The room is weighing the risks to the date.',
58
+ chips: [{ label: 'Premium UX', sub: 'in progress' }], tail: [{ who: 'Dara', text: 'Welcome everyone' }, { who: 'Priya', text: 'We plan eight people' }, { who: 'Dara', text: 'Next the risks' }],
59
+ captured: { decisions: [{ text: 'Plan with eight people' }], actions: [{ text: 'Priya confirms the owner' }], questions: [] }, material: [{ title: 'Capacity sheet', kind: 'doc', topic: 'Capacity' }], notes: [], asks: [], companion: { on: true, running: false, started: false, reason: 'new lines', error: null } });
60
+ const WAV = (() => { const rate = 8000, n = rate * 4, b = Buffer.alloc(44 + n * 2); b.write('RIFF', 0); b.writeUInt32LE(36 + n * 2, 4); b.write('WAVEfmt ', 8); b.writeUInt32LE(16, 16); b.writeUInt16LE(1, 20); b.writeUInt16LE(1, 22); b.writeUInt32LE(rate, 24); b.writeUInt32LE(rate * 2, 28); b.writeUInt16LE(2, 32); b.writeUInt16LE(16, 34); b.write('data', 36); b.writeUInt32LE(n * 2, 40); return b; })();
61
+ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html'), 'utf8');
62
+
63
+ /* the stand-in recorder: the console's recorder makes these same requests; this one opens no microphone */
64
+ const RECORDER = () => {
65
+ window.__premiumRecorder = {
66
+ _id: null, _started: null, _banner: null,
67
+ async listen(id) {
68
+ const r = await fetch('/api/notes/record', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }).then((x) => x.json());
69
+ if (!r.ok) { this._banner = r.error; return false; }
70
+ this._id = id; this._started = Date.now() - 65000; return true;
71
+ },
72
+ async pause() { await fetch('/api/notes/pause', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: this._id }) }); this._id = null; },
73
+ async stop(id) { await fetch('/api/notes/stop', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }); this._id = null; return { discarded: false }; },
74
+ listening() { return this._id; }, started() { return this._started; }, banner() { const b = this._banner; this._banner = null; return b; },
75
+ };
76
+ };
77
+
78
+ (async () => {
79
+ const exe = findBrowser();
80
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
81
+ let chromium;
82
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
83
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
84
+ await T.waitForServer(BASE);
85
+ browser = await chromium.launch({ executablePath: exe, args: ['--autoplay-policy=no-user-gesture-required'] });
86
+
87
+ const facts = () => { const f = F.facts(); f.meetings = [{ start: START.getTime(), end: END.getTime(), title: 'Live review', with: 'Priya, Dara', initiative: null }]; return f; };
88
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
89
+ /* opts: notes (the note rows the server holds), newStatus (the answer of POST /api/notes/new), recordError, focus (the Focus answer or a function), replay, audio, topics (the material topics) */
90
+ const SESS = [];
91
+ const open = async ({ w = 1280, h = 900, theme = 'light', notes = [], newError = null, recordError = null, focus = FOCUS, replay = REPLAY, topics = [], audio = false, url = '/premium.html', openDialog = true, stub = true } = {}) => {
92
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
93
+ const page = await ctx.newPage();
94
+ const S = { errors: [], reqs: [], notes: notes.map((n) => ({ ...n })), newPosts: [], recPosts: [], pausePosts: [], stopPosts: [], topicPosts: [], matPosts: [], focusGets: 0, dialogs: [], pauseSeen: [], newError, recordError };
95
+ page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
96
+ ctx.on('request', (r) => { if (r.method() === 'POST' && /\/api\/notes\/pause$/.test(r.url())) S.pauseSeen.push(JSON.parse(r.postData() || '{}')); });
97
+ page.on('dialog', (d) => { S.dialogs.push(d.type()); if (S.leave) d.accept(); else d.dismiss(); });
98
+ page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
99
+ const noteBy = (id) => S.notes.find((n) => n.id === id);
100
+ await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(facts()), as_of: Date.now() }));
101
+ await page.route('**/api/calendar-views*', (r) => json(r, weekAnswer()));
102
+ await page.route('**/api/meeting-replay*', (r) => json(r, S.replay || replay));
103
+ await page.route('**/api/meeting-material/suggest*', (r) => json(r, { ok: true, suggested: [{ kind: 'link', url: 'https://x.example/road', title: 'Roadmap', meta: 'link' }], found: [] }));
104
+ await page.route('**/api/meeting-material*', (r) => {
105
+ const req = r.request(), u = new URL(req.url());
106
+ if (req.method() === 'POST') { S.matPosts.push(JSON.parse(req.postData() || '{}')); return json(r, { ok: true, items: [] }); }
107
+ return json(r, { ok: true, key: 'k', items: [], ...(u.searchParams.get('topics') ? { topics: topics.map((t, i) => ({ id: 't' + i, text: t })) } : {}) });
108
+ });
109
+ await page.route('**/api/notes/recording*', (r) => r.fulfill({ status: 200, contentType: 'audio/wav', body: WAV }));
110
+ await page.route('**/api/notes/screen*', (r) => r.fulfill({ status: 200, contentType: 'image/png', body: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==', 'base64') }));
111
+ await page.route('**/api/notes/one*', (r) => json(r, { ok: true, note: { id: 'n1', body: 'text', transcript: [{ text: 'x' }], sessions: [{}] } }));
112
+ await page.route('**/api/notes/new', (r) => {
113
+ const b = JSON.parse(r.request().postData() || '{}'); S.newPosts.push(b);
114
+ if (S.newError) return json(r, { ok: false, error: S.newError }, 409);
115
+ let n = S.notes.find((x) => x.meeting && x.meeting.event_id === b.meeting.event_id);
116
+ if (!n) { n = { id: 'n1', title: b.meeting.title, state: 'idle', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: b.meeting.event_id, start: b.meeting.start, title: b.meeting.title } }; S.notes.push(n); }
117
+ return json(r, { ok: true, note: n, reused: false });
118
+ });
119
+ await page.route('**/api/notes/record', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.recPosts.push(b); if (S.recordError) return json(r, { ok: false, error: S.recordError }, 409); noteBy(b.id).state = 'recording'; return json(r, { ok: true, recorded_from: new Date().toISOString() }); });
120
+ await page.route('**/api/notes/pause', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.pausePosts.push(b); const n = noteBy(b.id); if (n) { n.state = 'paused'; n.resume_until = new Date(Date.now() + 3600000).toISOString(); } return json(r, { ok: true }); });
121
+ await page.route('**/api/notes/stop', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.stopPosts.push(b); const n = noteBy(b.id); if (n) n.state = 'ended'; return json(r, { ok: true }); });
122
+ await page.route(/\/api\/notes$/, (r) => json(r, { ok: true, notes: S.notes }));
123
+ await page.route('**/api/meeting-focus/topic', (r) => { S.topicPosts.push(JSON.parse(r.request().postData() || '{}')); return json(r, { ok: true }); });
124
+ await page.route(/\/api\/meeting-focus(\?|$)/, (r) => { S.focusGets++; const a = typeof focus === 'function' ? focus() : focus; return json(r, a, a.ok === false ? 404 : 200); });
125
+ await page.route('**/api/calendar-links', (r) => json(r, { ok: true }));
126
+ if (stub) await page.addInitScript(RECORDER);
127
+ if (audio) S.replay = { ...REPLAY, audio: { url: '/api/notes/recording?id=n1', ms: 4000 }, length_ms: 4000, lines: [{ i: 0, t: 500, who: 'Dara', text: 'Welcome' }, { i: 1, t: 2500, who: 'Priya', text: 'Plan' }], keys: [{ k: 'decision', text: 'Plan', t: 2500, state: 'draft' }], runs: [{ topic: 'capacity', n: 1, from_ms: 0, to_ms: 2000 }, { topic: 'risks', n: 2, from_ms: 2000, to_ms: 4000 }], shots: [] };
128
+ await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
129
+ if (url === '/premium.html' && openDialog) {
130
+ S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0), 20000);
131
+ await page.click('#rng [data-r=week]');
132
+ await until(() => page.evaluate(() => !document.querySelector('#tl').hasAttribute('aria-busy') && !!document.querySelector('#tl .wkd')));
133
+ await page.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Live review'); r.click(); });
134
+ S.dlg = await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#m3Rec')));
135
+ }
136
+ SESS.push(S); S.url = url;
137
+ return Object.assign(S, { ctx, page });
138
+ };
139
+ const text = (p) => p.evaluate(() => document.querySelector('#oMain').textContent);
140
+ const rec = (p) => p.evaluate(() => document.querySelector('#m3Rec') ? document.querySelector('#m3Rec').textContent : '');
141
+ const press = async (p, act) => { await p.click(`#oMain [data-m3="${act}"]`); };
142
+ const chip = (p) => p.evaluate(() => { const c = document.querySelector('#recChip'); return c && !c.hidden ? c.textContent : null; });
143
+
144
+ const A = await open();
145
+ ok('0 the dialog opens on a meeting under way with the Record row', A.up && A.dlg);
146
+ if (!A.up || !A.dlg) return finish(1);
147
+ const p = A.page;
148
+
149
+ /* R1 R2 record */
150
+ const t0 = await text(p);
151
+ ok('R1 a meeting under way has Record, and says what the press does', /Record/.test(await rec(p)) && /microphone/.test(await rec(p)) && /this machine/.test(await rec(p)));
152
+ ok('R5 the Detail view says what Focus reads before any read, and none was made', /every 3 seconds/.test(t0) && /sends nothing/.test(t0) && A.focusGets === 0);
153
+ ok('R1 nothing was sent to the notes routes before a press', !A.reqs.some((r) => /^POST \/api\/notes/.test(r)), A.reqs.join());
154
+ await press(p, 'rec');
155
+ ok('R1 the first press asks for consent in plain words and sends nothing', await until(() => p.evaluate(() => /Tell everyone first/.test(document.querySelector('#m3Rec').textContent))) && A.newPosts.length === 0 && A.recPosts.length === 0);
156
+ await press(p, 'no');
157
+ ok('R1 Not yet closes the ask and sends nothing', await until(() => p.evaluate(() => !/Tell everyone first/.test(document.querySelector('#m3Rec').textContent))) && A.newPosts.length === 0);
158
+ await press(p, 'rec'); await press(p, 'go');
159
+ ok('R1 "I told them, start" makes the note for the calendar event, then listens on it', await until(() => A.recPosts.length === 1) && A.newPosts.length === 1 && A.newPosts[0].meeting.event_id === 'ev-live' && A.newPosts[0].meeting.title === 'Live review' && A.recPosts[0].id === 'n1', JSON.stringify([A.newPosts, A.recPosts]));
160
+ ok('R2 the row now says Recording with the clock, Pause and Stop, from the recorder and the note', await until(() => p.evaluate(() => /Recording/.test(document.querySelector('#m3Rec').textContent) && /1:0\d/.test(document.querySelector('#m3Clk').textContent) && !!document.querySelector('[data-m3="pause"]') && !!document.querySelector('[data-m3="stop"]'))), await rec(p));
161
+ ok('R3 the chip says Recording with the title, and has Open and Stop', await until(async () => /Recording Live review/.test((await chip(p)) || '')) && await p.evaluate(() => !!document.querySelector('#recChip [data-r="open"]') && !!document.querySelector('#recChip [data-r="stop"]') && !!document.querySelector('#recChip [data-r="pause"]')), String(await chip(p)));
162
+ ok('R9 the meeting\'s row carries a Recording mark', await until(() => p.evaluate(() => !!document.querySelector('#tl .ev .m3-mark') && /Recording/.test(document.querySelector('#tl .m3-mark').textContent))));
163
+ await press(p, 'pause');
164
+ ok('R2 Pause pauses through the route and the row says Paused with Resume and Stop', await until(() => A.pausePosts.length === 1) && await until(() => p.evaluate(() => /Paused/.test(document.querySelector('#m3Rec').textContent) && !!document.querySelector('[data-m3="resume"]'))) && A.pausePosts[0].id === 'n1');
165
+ ok('R3 the chip follows: Paused with Resume', await until(async () => /Paused Live review/.test((await chip(p)) || '')) && await p.evaluate(() => !!document.querySelector('#recChip [data-r="resume"]')));
166
+ await press(p, 'resume');
167
+ ok('R2 Resume listens again on the same note, without asking for consent twice', await until(() => A.recPosts.length === 2) && A.newPosts.length === 1 && !(await rec(p)).includes('Tell everyone first') && await until(() => p.evaluate(() => /Recording/.test(document.querySelector('#m3Rec').textContent))));
168
+ await press(p, 'stop');
169
+ const stopAsk = await until(() => p.evaluate(() => /for good/.test(document.querySelector('#m3Rec').textContent) ? document.querySelector('#m3Rec').textContent : ''));
170
+ ok('R1 Stop asks first, says a stopped meeting cannot be resumed, and offers Pause instead', /cannot be resumed/.test(stopAsk) && /Pause instead/.test(stopAsk) && A.stopPosts.length === 0, stopAsk);
171
+ await press(p, 'stopno');
172
+ ok('R1 Cancel on the ask stops nothing', A.stopPosts.length === 0 && /Recording/.test(await rec(p)));
173
+ await press(p, 'stop'); await press(p, 'stopgo');
174
+ ok('R1 Stop for good ends the meeting through the route, and the row says it ended', await until(() => A.stopPosts.length === 1) && await until(() => p.evaluate(() => /cannot be recorded again/.test(document.querySelector('#m3Rec').textContent))), await rec(p));
175
+ ok('R3 the chip is gone once no note records', await until(async () => (await chip(p)) === null));
176
+ ok('R10 the notes writes sent were new, record, pause, record, stop and nothing else', A.reqs.filter((r) => /^POST \/api\/notes/.test(r)).join() === 'POST /api/notes/new,POST /api/notes/record,POST /api/notes/pause,POST /api/notes/record,POST /api/notes/stop', A.reqs.filter((r) => /^POST/.test(r)).join());
177
+ await A.ctx.close();
178
+
179
+ /* R2 refusals and one at a time */
180
+ const Rf = await open({ newError: 'a page press is required' });
181
+ await press(Rf.page, 'rec'); await press(Rf.page, 'go');
182
+ ok('R2 a refused note shows the server\'s reason and records nothing', await until(() => Rf.page.evaluate(() => /a page press is required/.test(document.querySelector('#m3Rec').textContent))) && Rf.recPosts.length === 0 && !(await chip(Rf.page)));
183
+ await Rf.ctx.close();
184
+ const Re = await open({ recordError: 'the note ended already' });
185
+ await press(Re.page, 'rec'); await press(Re.page, 'go');
186
+ ok('R2 a refused listen shows the reason, holds nothing and shows no chip', await until(() => Re.page.evaluate(() => /the note ended already/.test(document.querySelector('#m3Rec').textContent))) && !(await chip(Re.page)) && /Record/.test(await rec(Re.page)));
187
+ await Re.ctx.close();
188
+ const other = { id: 'n9', title: 'Design crit', state: 'recording', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-x', start: iso(START), title: 'Design crit' } };
189
+ const Ob = await open({ notes: [other] });
190
+ await press(Ob.page, 'rec'); await press(Ob.page, 'go');
191
+ ok('R2 only one meeting records at a time: the second says which one', await until(() => Ob.page.evaluate(() => /Design crit is recording\. Pause or stop it first/.test(document.querySelector('#m3Rec').textContent))) && Ob.recPosts.length === 0 && Ob.newPosts.length === 0);
192
+ ok('R3 the chip names the meeting the server holds, and says this page is not capturing audio', /Design crit is marked recording, but this page is not capturing audio/.test(String(await chip(Ob.page))), String(await chip(Ob.page)));
193
+ await Ob.ctx.close();
194
+ const Ne = await open();
195
+ const so = await Ne.page.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Standup'); return !!r; });
196
+ if (so) {
197
+ await Ne.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Standup').click(); });
198
+ await until(() => Ne.page.evaluate(() => document.querySelector('#dTitle').textContent === 'Standup' && !!document.querySelector('#m3Rec')));
199
+ ok('R1 a meeting of another day has no Record, only Focus', !/Record/.test(await rec(Ne.page)) && await Ne.page.evaluate(() => !!document.querySelector('[data-m3="focus"]')));
200
+ } else ok('R1 (no other-day meeting in this week: skipped)', true);
201
+ await Ne.ctx.close();
202
+
203
+ /* R4 leaving the Briefing */
204
+ const Lv = await open();
205
+ await press(Lv.page, 'rec'); await press(Lv.page, 'go'); await until(() => Lv.recPosts.length === 1);
206
+ await until(async () => /Recording/.test((await chip(Lv.page)) || ''));
207
+ Lv.leave = false;
208
+ await Lv.page.goto(BASE + '/premium-work.html').catch(() => {});
209
+ ok('R4 leaving the Briefing while it records makes the browser ask first, and staying pauses nothing', Lv.dialogs.includes('beforeunload') && Lv.pausePosts.length === 0 && /premium\.html/.test(Lv.page.url()), Lv.dialogs.join() + ' ' + Lv.page.url());
210
+ Lv.leave = true;
211
+ await Lv.page.goto(BASE + '/premium-work.html');
212
+ ok('R4 leaving anyway sends the pause for that note (a request that leaves with the page)', await until(() => Lv.pauseSeen.length >= 1) && Lv.pauseSeen[0].id === 'n1', JSON.stringify(Lv.pauseSeen));
213
+ if (!Lv.pausePosts.length) { const n = Lv.notes.find((x) => x.id === 'n1'); n.state = 'paused'; n.resume_until = new Date(Date.now() + 3600000).toISOString(); } // the stand-in could not answer a request sent as the page left
214
+ await Lv.page.reload();
215
+ ok('R3 the next page shows the chip as Paused, with Open and Stop and no Resume', await until(async () => /Paused Live review/.test((await chip(Lv.page)) || '')) && await Lv.page.evaluate(() => !!document.querySelector('#recChip [data-r="open"]') && !!document.querySelector('#recChip [data-r="stop"]') && !document.querySelector('#recChip [data-r="resume"]')));
216
+ await Lv.page.click('#recChip [data-r="stop"]');
217
+ ok('R3 Stop on another page asks first and says what it does', await until(() => Lv.page.evaluate(() => /Stop “Live review” for good\?.*cannot be resumed/.test(document.querySelector('#recChip').textContent))) && Lv.stopPosts.length === 0);
218
+ await Lv.page.click('#recChip [data-r="stopgo"]');
219
+ ok('R3 Stop for good there ends the meeting through POST /api/notes/stop and the chip goes', await until(() => Lv.stopPosts.length === 1) && await until(async () => (await chip(Lv.page)) === null));
220
+ await Lv.ctx.close();
221
+
222
+ /* R3 the chip on every premium page, and Open */
223
+ const paused = { id: 'n1', title: 'Live review', state: 'paused', resume_until: new Date(Date.now() + 3000000).toISOString(), updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-live', start: iso(START), title: 'Live review' } };
224
+ for (const [name, url] of [['Briefing', '/premium.html'], ['My work', '/premium-work.html'], ['Board', '/premium-board.html'], ['Initiative', '/premium-initiative.html?id=none'], ['Insights', '/premium-insights.html']]) {
225
+ const C = await open({ notes: [paused], url, openDialog: false });
226
+ ok(`R3 the ${name} page shows the chip for a paused meeting`, await until(async () => /Paused Live review/.test((await chip(C.page)) || ''), 15000), String(await chip(C.page)));
227
+ if (url === '/premium-work.html') {
228
+ await C.page.click('#recChip [data-r="open"]');
229
+ await until(() => /premium\.html\?meeting=n1|premium\.html/.test(C.page.url()));
230
+ const opened = await until(() => C.page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dTitle').textContent === 'Live review'), 20000);
231
+ ok('R3 Open on another page goes to the Briefing and opens that meeting\'s dialog', opened && !/meeting=/.test(C.page.url()), C.page.url());
232
+ }
233
+ await C.ctx.close();
234
+ }
235
+
236
+ /* R5 R6 Focus */
237
+ const Fc = await open({ notes: [{ ...paused, state: 'recording' }] });
238
+ await press(Fc.page, 'focus');
239
+ const fv = await until(() => Fc.page.evaluate(() => /Risks/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : ''));
240
+ ok('R5 Focus shows the state, the topic now, the sentence, the lines, the topics, the material and the counts as the answer holds them', /Leave focus/.test(fv) && /Live review/.test(fv) && /Now/.test(fv) && /The room is weighing the risks to the date\./.test(fv) && /Welcome everyone/.test(fv) && /Launch date/.test(fv) && /Capacity sheet/.test(fv) && /Captured so far/.test(fv) && /Premium UX/.test(fv), fv.slice(0, 400));
241
+ ok('R5 the topic bar draws a stretch for each topic that was talked about', await Fc.page.evaluate(() => document.querySelectorAll('#oMain .m3-trk .m3-stc').length === 2 && document.querySelectorAll('#oMain .m3-trk .m3-stc.on').length === 1));
242
+ const g0 = Fc.focusGets;
243
+ ok('R5 Focus reads again every 3 seconds while it is open', await until(() => Fc.focusGets >= g0 + 2, 9000), String(Fc.focusGets - g0));
244
+ await Fc.page.click('#oMain [data-m3="chg"]');
245
+ ok('R5 Change lists the topics and says it records one correction', await Fc.page.evaluate(() => document.querySelectorAll('#oMain [data-m3="topic"]').length === 3 && /records one correction/.test(document.querySelector('#oMain').textContent)));
246
+ await Fc.page.click('#oMain [data-m3="topic"][data-n="3"]');
247
+ ok('R5 a topic press posts one set for that topic on this meeting', await until(() => Fc.topicPosts.length === 1) && JSON.stringify(Fc.topicPosts[0]) === JSON.stringify({ event: 'ev-live', date: dayKey(START), action: 'set', topic: 'Launch date' }), JSON.stringify(Fc.topicPosts));
248
+ await press(Fc.page, 'unfocus');
249
+ await until(() => Fc.page.evaluate(() => !!document.querySelector('#m3Rec') && !document.querySelector('.m3-fh')));
250
+ const g1 = Fc.focusGets; await sleep(4200);
251
+ ok('R5 leaving Focus stops the reads', Fc.focusGets === g1, `${g1} -> ${Fc.focusGets}`);
252
+ await Fc.ctx.close();
253
+ const Fe = await open({ focus: () => ({ ok: false, error: 'no such meeting on the calendar' }) });
254
+ await press(Fe.page, 'focus');
255
+ ok('R6 a refused read says why and shows nothing else', await until(() => Fe.page.evaluate(() => /Focus could not read this meeting: no such meeting on the calendar/.test(document.querySelector('#oMain').textContent))) && await Fe.page.evaluate(() => !document.querySelector('#oMain .m3-now') && !document.querySelector('#oMain .m3-tops')));
256
+ await Fe.ctx.close();
257
+ const Fb = await open({ focus: () => ({ ok: true, now_ms: Date.now(), event: { title: 'Live review', at: iso(START), end: iso(END) }, note: null, companion: { on: false } }) });
258
+ await press(Fb.page, 'focus');
259
+ const bt = await until(() => Fb.page.evaluate(() => /Leave focus/.test(document.querySelector('#oMain').textContent) && /companion is off/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : ''));
260
+ ok('R6 an answer with nothing in it draws no topic, sentence, chip, line or count, and says the companion is off', /No topic is current yet/.test(bt) && /The meeting has no topics yet/.test(bt) && /The transcript starts when you record/.test(bt) && !/Captured so far/.test(bt) && await Fb.page.evaluate(() => !document.querySelector('#oMain .m3-say') && !document.querySelector('#oMain .m3-chp')), bt.slice(0, 300));
261
+ await Fb.ctx.close();
262
+
263
+ /* R7 Replay, on the page's own clock */
264
+ const Rp = await open();
265
+ const hasBtn = await until(() => Rp.page.evaluate(() => !!document.querySelector('[data-m3="replay"]')));
266
+ ok('R7 the Replay part has a Replay press when a recording is held', hasBtn);
267
+ await press(Rp.page, 'replay');
268
+ const rv = await until(() => Rp.page.evaluate(() => /Key points/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : ''));
269
+ ok('R7 Replay shows the topic track, the key points, the transcript and says there is no audio', /0:00 \/ 5:00/.test(rv) && /Plan with eight people/.test(rv) && /We plan eight people/.test(rv) && /No audio is kept/.test(rv) && await Rp.page.evaluate(() => document.querySelectorAll('#oMain .m3-trk button.m3-stc').length === 2 && document.querySelectorAll('#oMain .m3-trk .m3-mk').length === 2), rv.slice(0, 200));
270
+ ok('R7 a key point with no time has no play press', await Rp.page.evaluate(() => { const r = [...document.querySelectorAll('#oMain .m3-kp0')]; return r.length === 1 && /Priya confirms the owner/.test(r[0].textContent) && !r[0].matches('button'); }));
271
+ await Rp.page.click('#oMain .m3-kps button');
272
+ ok('R7 a key point plays from its time and marks the line', await until(() => Rp.page.evaluate(() => /Pause/.test(document.querySelector('#rpPlay').textContent) && /^1:0\d \/ 5:00/.test(document.querySelector('#rpPos').textContent) && !!document.querySelector('#rl1.cur'))), await Rp.page.evaluate(() => document.querySelector('#rpPos').textContent));
273
+ ok('R7 the playhead keeps time on its own clock', await until(() => Rp.page.evaluate(() => /^1:0[2-9] \/ 5:00/.test(document.querySelector('#rpPos').textContent)), 5000));
274
+ await Rp.page.click('#oMain [data-m3="spd"][data-v="2"]'); await Rp.page.click('#oMain [data-m3="seek"][data-t="100000"]');
275
+ ok('R7 a stretch plays from its start and the topic follows the position', await until(() => Rp.page.evaluate(() => /Risks/.test(document.querySelector('#rpTopic').textContent) && !!document.querySelector('.m3-stc.on'))));
276
+ await Rp.page.click('#oMain [data-m3="seek"][data-t="130000"]');
277
+ ok('R7 a shot is shown only from the time it was kept, with its reason', await until(() => Rp.page.evaluate(() => !!document.querySelector('#rpShot img') && /A slide with the plan/.test(document.querySelector('#rpShot').textContent))));
278
+ await Rp.page.click('#oMain [data-m3="back10"]');
279
+ ok('R7 Back 10 s moves the playhead back', await Rp.page.evaluate(() => { const m = /^(\d+):(\d+)/.exec(document.querySelector('#rpPos').textContent); return m && (+m[1] * 60 + +m[2]) < 135; }));
280
+ await Rp.page.click('#oMain [data-m3="play"]');
281
+ ok('R7 Pause stops the playhead', await until(() => Rp.page.evaluate(() => document.querySelector('#rpPlay').textContent === 'Play')));
282
+ const gets = Rp.reqs.filter((r) => /meeting-replay/.test(r)).length;
283
+ await press(Rp.page, 'unreplay');
284
+ ok('R7 Back to the meeting returns to the Detail view and focus lands on Replay', await until(() => Rp.page.evaluate(() => !!document.querySelector('#m3Rec') && document.activeElement && document.activeElement.dataset.m3 === 'replay')));
285
+ await Rp.ctx.close();
286
+ /* R7 Replay, with audio */
287
+ const Ra = await open({ audio: true });
288
+ await press(Ra.page, 'replay');
289
+ await until(() => Ra.page.evaluate(() => /Plays the note’s audio/.test(document.querySelector('#oMain').textContent)));
290
+ await Ra.page.click('#rpPlay');
291
+ ok('R7 with audio the playhead follows the audio element', await until(() => Ra.page.evaluate(() => /^0:0[1-9] \/ 0:04/.test(document.querySelector('#rpPos').textContent)), 6000) && Ra.reqs.some((r) => /GET \/api\/notes\/recording/.test(r)), await Ra.page.evaluate(() => document.querySelector('#rpPos').textContent));
292
+ ok('R7 at the end it stops by itself', await until(() => Ra.page.evaluate(() => document.querySelector('#rpPlay').textContent === 'Play' && /^0:04/.test(document.querySelector('#rpPos').textContent)), 8000), await Ra.page.evaluate(() => document.querySelector('#rpPos').textContent));
293
+ await Ra.ctx.close();
294
+
295
+ /* R8 Topic on material */
296
+ const Tp = await open({ topics: ['Capacity', 'Risks'] });
297
+ await Tp.page.click('#mmAdd'); await until(() => Tp.page.evaluate(() => /Roadmap/.test(document.querySelector('#mmSug').textContent)));
298
+ await Tp.page.click('#mmSug [data-pick]');
299
+ ok('R8 the sheet offers a Topic choice from the route\'s topics, and the line names the topic when one is chosen', await until(() => Tp.page.evaluate(() => document.querySelectorAll('[data-topic]').length === 3)));
300
+ await Tp.page.click('[data-topic="2"]');
301
+ ok('R8 choosing a topic updates the line before the press', await until(() => Tp.page.evaluate(() => /under the topic “Risks”/.test(document.querySelector('#mmLine').textContent))));
302
+ await Tp.page.click('#mmDo');
303
+ ok('R8 Add posts the topic with the item', await until(() => Tp.matPosts.length === 1) && Tp.matPosts[0].topic === 'Risks', JSON.stringify(Tp.matPosts));
304
+ await Tp.ctx.close();
305
+ const Tn = await open();
306
+ await Tn.page.click('#mmAdd'); await until(() => Tn.page.evaluate(() => /Roadmap/.test(document.querySelector('#mmSug').textContent)));
307
+ await Tn.page.click('#mmSug [data-pick]');
308
+ ok('R8 with no topics the Topic choice is not drawn and no topic is sent', await Tn.page.evaluate(() => document.querySelectorAll('[data-topic]').length === 0));
309
+ await Tn.page.click('#mmDo'); await until(() => Tn.matPosts.length === 1);
310
+ ok('R8 an item added with no topic carries none', !('topic' in Tn.matPosts[0]));
311
+ await Tn.ctx.close();
312
+
313
+ /* R10 the guard: the real server refuses these writes from anything but this launch's page */
314
+ for (const [pth, body] of [['/api/notes/new', { meeting: { kind: 'event', title: 'x', start: iso(START) } }], ['/api/notes/record', { id: 'n-nothing' }], ['/api/notes/pause', { id: 'n-nothing' }], ['/api/notes/stop', { id: 'n-nothing' }], ['/api/meeting-focus/topic', { event: 'ev', action: 'set', topic: 'x' }]]) {
315
+ const res = await fetch(BASE + pth, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
316
+ ok(`R10 ${pth} without the launch nonce is refused`, res.status === 403, String(res.status));
317
+ }
318
+ ok('R10 no page error on the Briefing in any run', SESS.filter((x) => x.url === '/premium.html').every((x) => x.errors.length === 0), JSON.stringify(SESS.map((x) => x.errors).filter((e) => e.length)));
319
+
320
+ /* R11 floors and fidelity */
321
+ const live = { id: 'n1', title: 'Live review', state: 'recording', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-live', start: iso(START), title: 'Live review' } };
322
+ const shotDir = process.env.PMOS_SHOTS || '';
323
+ for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
324
+ const P = await open({ w, h, theme: th, notes: [live] });
325
+ await until(async () => /marked recording/.test((await chip(P.page)) || ''));
326
+ const fl = async (label) => P.page.evaluate(() => ({ scroll: document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#oMain').scrollWidth <= document.querySelector('#oMain').clientWidth + 1,
327
+ btn: [...document.querySelectorAll('#dlg [data-m3], #recChip button, #dlg .mtg-b, #dlg .cta')].filter((b) => b.offsetParent).map((b) => Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height)) }));
328
+ const settled = async () => (await until(async () => { const r = await fl(); return r.btn.every((n) => n >= 43.5) ? r : null; }, 3000)) || fl();
329
+ const f0 = await settled();
330
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `detail-${w}-${th}.png`) });
331
+ await press(P.page, 'focus'); await until(() => P.page.evaluate(() => /Risks/.test(document.querySelector('#oMain').textContent)));
332
+ await P.page.click('#oMain [data-m3="chg"]');
333
+ const f1 = await settled();
334
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `focus-${w}-${th}.png`) });
335
+ await press(P.page, 'unfocus'); await press(P.page, 'replay'); await until(() => P.page.evaluate(() => /Key points/.test(document.querySelector('#oMain').textContent)));
336
+ await P.page.click('#oMain [data-m3="seek"][data-t="130000"]'); await until(() => P.page.evaluate(() => !!document.querySelector('#rpShot img')));
337
+ const f2 = await settled();
338
+ if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `replay-${w}-${th}.png`) });
339
+ ok(`R11 at ${w} px (${th}) the detail, Focus and Replay have no sideways scroll and every press is at least 44 px`, f0.scroll && f1.scroll && f2.scroll && [f0, f1, f2].every((f) => f.btn.length && f.btn.every((n) => n >= 43.5)), JSON.stringify([f0, f1, f2]).slice(0, 400));
340
+ await P.ctx.close();
341
+ }
342
+ const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
343
+ await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
344
+ const chipCss = (pg) => pg.evaluate(() => { const c = document.querySelector('.recchip, #recChip'); if (!c) return null; const k = getComputedStyle(c); const b = c.querySelector('button'); const bs = b ? getComputedStyle(b) : null; return [k.position, k.borderRadius, k.fontSize, k.fontWeight, k.display, bs && bs.borderRadius, bs && bs.fontWeight].join('|'); });
345
+ const chipM = await mp.evaluate(() => { const c = document.querySelector('#recChip'); c.hidden = false; c.innerHTML = '<i></i><span>Recording x</span><button>Open</button><button>Stop</button>'; const k = getComputedStyle(c), b = getComputedStyle(c.querySelector('button')); return [k.position, k.borderRadius, k.fontSize, k.fontWeight, k.display, b.borderRadius, b.fontWeight].join('|'); });
346
+ const Fx = await open({ notes: [live] }); await until(async () => /marked recording/.test((await chip(Fx.page)) || ''));
347
+ const chipP = await chipCss(Fx.page);
348
+ ok('R11 fidelity: the chip keeps the mockup\'s position, pill radius, type and button radius', chipM && chipP && chipM === chipP, chipM + ' vs ' + chipP);
349
+ const trkM = await mp.evaluate(() => { const d = document.createElement('div'); d.innerHTML = '<div class="trk2"><button class="stc on">1</button></div>'; document.body.appendChild(d); const c = getComputedStyle(d.querySelector('.stc')); return [c.borderRadius, c.fontWeight, c.fontSize].join('|'); });
350
+ await press(Fx.page, 'focus'); await until(() => Fx.page.evaluate(() => !!document.querySelector('.m3-stc')));
351
+ const trkP = await Fx.page.evaluate(() => { const c = getComputedStyle(document.querySelector('.m3-stc')); return [c.borderRadius, c.fontWeight, c.fontSize].join('|'); });
352
+ ok('R11 fidelity: a topic stretch keeps the mockup\'s radius, weight and size', trkM === trkP, trkM + ' vs ' + trkP);
353
+ const consM = await mp.evaluate(() => { const d = document.createElement('div'); d.innerHTML = '<div class="cons"></div>'; document.body.appendChild(d); const c = getComputedStyle(d.firstChild); return [c.borderRadius, c.display].join('|'); });
354
+ await press(Fx.page, 'unfocus'); await press(Fx.page, 'stop');
355
+ const consP = await Fx.page.evaluate(() => { const c = getComputedStyle(document.querySelector('.m3-cons')); return [c.borderRadius, c.display].join('|'); });
356
+ ok('R11 fidelity: the ask card keeps the mockup\'s radius and layout', consM === consP, consM + ' vs ' + consP);
357
+ await Fx.ctx.close(); await mk.close();
358
+
359
+ return finish();
360
+ })().catch((e) => { console.error(e); finish(1); });
@@ -154,7 +154,7 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
154
154
  await R.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning').click(); });
155
155
  const rd = await until(() => R.page.evaluate(() => /Decisions/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : null));
156
156
  ok('C6 the note\'s decisions, next steps and questions are listed as the note holds them', rd && /Plan the sprint with eight people/.test(rd) && /Sam confirms the data fix owner/.test(rd) && /Sam · Tue/.test(rd) && /Does a release eat the capacity\?/.test(rd) && /Sprint planning notes/.test(rd), String(rd).slice(0, 300));
157
- ok('C8 a kept recording is summarised, and Replay opens in the console', rd && /A recording is kept: 25 min, 3 key points/.test(rd) && /Replay opens in the console/.test(rd));
157
+ ok('C8 a kept recording is summarised, and Replay opens in the dialog', rd && /A recording is kept: 25 min, 3 key points/.test(rd) && /Replay/.test(rd) && !/Replay opens in the console/.test(rd));
158
158
  ok('C6 the replay answer\'s people are used only when the calendar lists none', rd && /Dara, Priya, Sam/.test(rd));
159
159
 
160
160
  /* C4 a Today row opens the same dialog when the calendar answer knows the meeting */
@@ -169,7 +169,7 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
169
169
  /* C9 */
170
170
  const allPosts = [].concat(A.reqs, R.reqs, Tt.reqs).filter((r) => /^POST /.test(r));
171
171
  ok('C9 the only write the page sent is the link', allPosts.length === 1 && allPosts[0] === 'POST /api/calendar-links', JSON.stringify(allPosts));
172
- ok('C9 no recording, Focus or material request was sent', ![].concat(A.reqs, R.reqs, Tt.reqs).some((r) => /\/api\/(notes|meeting-focus)|POST \/api\/meeting-material/.test(r)));
172
+ ok('C9 no recording, Focus or material write was sent', ![].concat(A.reqs, R.reqs, Tt.reqs).some((r) => /POST \/api\/(notes|meeting-focus|meeting-material)/.test(r)));
173
173
  ok('C9 no page error', [A, E, Z, R, Tt, Mg].every((x) => x.errors.length === 0), JSON.stringify([A, E, Z, R, Tt, Mg].map((x) => x.errors)));
174
174
 
175
175
  /* C10 floors and fidelity */
@@ -155,20 +155,23 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
155
155
  const qt = (sel) => q.evaluate((x) => (document.querySelector(x) || {}).textContent || '', sel);
156
156
  const last = () => sent[sent.length - 1] || [null, {}];
157
157
  const dlgOn = () => until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
158
- const shut = async () => { await q.keyboard.press('Escape'); await until(() => q.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); };
158
+ const shut = async () => { for (let i = 0; i < 2 && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on')); i++) { await q.keyboard.press('Escape'); await sleep(150); } await until(() => q.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); }; // a full-screen dialog leaves full screen on the first Escape
159
159
  await q.click('#dashTabs [data-d="pd-1"]'); await sleep(200);
160
160
  const sv = await q.evaluate(() => ({ tiles: [...document.querySelectorAll('#dashBody .mch .mlab')].map((e) => e.firstChild.textContent), gone: [...document.querySelectorAll('#dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ')), bar: document.querySelector('#dashBar').textContent }));
161
161
  ok('R1 a saved dashboard draws its charts in its order and says which chart is gone, in its place', sv.tiles.join() === 'Partner activation,Time to first call' && sv.gone.length === 1 && /krm-gone.*No KR metric record is called krm-gone/.test(sv.gone[0]) && /Main dashboard\..*Monday partner review/.test(sv.bar), JSON.stringify(sv));
162
162
  await q.click('#pdEdit'); await dlgOn();
163
- const ed = await q.evaluate(() => ({ n: document.querySelector('#pdN').value, rows: [...document.querySelectorAll('#pdList .pdrow b')].map((b) => b.textContent), main: document.querySelector('#pdMain').checked, note: document.querySelector('#oMain .addf .note').textContent }));
164
- ok('R2 Edit opens the dialog with the name, Main and the charts in order, and says what Save changes', ed.n === 'Weekly partner review' && ed.rows.join() === 'Partner activation,Time to first call,krm-gone' && ed.main && /changes nothing else/.test(ed.note), JSON.stringify(ed));
165
- await q.click('#pdList [data-mv="1:-1"]'); await q.click('#pdList [data-rm="2"]'); await q.selectOption('#pdAdd', 'krm-up'); await q.fill('#pdN', 'Monday review'); await q.click('#pdGo'); await sleep(400);
163
+ const chipv = (k) => q.evaluate((x) => (document.querySelector(`#oMain [data-st="chip|${x}"] b`) || {}).textContent || '', k);
164
+ await q.click('#oMain [data-st="chip|charts"]');
165
+ const ed = await q.evaluate(() => ({ eye: document.querySelector('#dEye').textContent, rows: [...document.querySelectorAll('#stTr .sul li > span:first-child')].map((b) => b.childNodes[0].textContent) }));
166
+ ok('R2 Edit opens the Studio with the name, Main and the charts in order', /^Insight Studio · /.test(ed.eye) && await chipv('name') === 'Weekly partner review' && await chipv('main') === 'Yes' && ed.rows.join() === 'Partner activation,Time to first call,krm-gone', JSON.stringify(ed));
167
+ await q.click('#stTr [data-st="mv|1|-1"]'); await q.click('#stTr [data-st="rm|2"]'); await q.click('#oMain [data-st="lib"]'); await q.click('#stLb [data-st="libc|krm-up"]');
168
+ await q.click('#oMain [data-st="chip|name"]'); await q.fill('#stI', 'Monday review'); await q.click('#oMain [data-st="save"]'); await sleep(400);
166
169
  ok('R2 Save posts the dashboard with the new order, name and Main to the one save route', last()[0] === '/api/premium-dashboards/save' && JSON.stringify(last()[1]) === JSON.stringify({ ws: 'w1', board: 'w1', id: 'pd-1', name: 'Monday review', purpose: 'The measures the Monday partner review reads.', charts: ['krm-ttfc', 'krm-act', 'krm-up'], main: true }), JSON.stringify(last()));
167
- await q.click('#pdNew'); await dlgOn(); await q.click('#pdGo'); await sleep(200);
168
- ok('R2 a new dashboard without a name says so and posts nothing', /Give the dashboard a name/.test(await qt('#pdM')) && last()[1].id === 'pd-1');
170
+ await q.click('#pdNew'); await dlgOn(); await q.click('#oMain [data-st="save"]'); await sleep(200);
171
+ ok('R2 a new dashboard without a name says so and posts nothing', /Give the dashboard a name/.test(await qt('#stMsg')) && last()[1].id === 'pd-1');
169
172
  answer = () => ({ ok: false, error: '“Weekly partner review” is already a dashboard on this board.' });
170
- await q.fill('#pdN', 'Weekly partner review'); await q.fill('#pdP', 'x'); await q.click('#pdGo'); await sleep(300);
171
- ok('R7 the server\'s refusal is shown in words and the dialog stays open', /already a dashboard on this board/.test(await qt('#pdM')) && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#pdGo').disabled));
173
+ await q.click('#oMain [data-st="chip|name"]'); await q.fill('#stI', 'Weekly partner review'); await q.click('#oMain [data-st="chip|use"]'); await q.fill('#stI', 'x'); await q.click('#oMain [data-st="save"]'); await sleep(300);
174
+ ok('R7 the server\'s refusal is shown in words and the dialog stays open', /already a dashboard on this board/.test(await qt('#stMsg')) && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#oMain [data-st="save"]').disabled));
172
175
  answer = (u, b) => ({ ok: true, dashboard: { id: b.id || 'pd-9' }, dashboards: [], setup: {}, drafted: { slot: '2026-10-23', path: 'planning/reports/release-readiness/2026-10-23.md' } });
173
176
  await shut();
174
177
  await q.click('#dashTabs [data-d="all"]'); await q.locator('#dashBody [data-open="ins:krm-up"]').click(); await dlgOn(); await q.click('#oMain [data-pdsw="pd-1"]'); await sleep(300);
@@ -253,7 +256,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
253
256
  ok('E7 the real page draws that chart with the record\'s numbers and no script error', await until(() => pg.evaluate(() => { const t = document.querySelector('#dashBody .mch'); return !!t && t.querySelector('.mval').textContent === '30%' && /Partner activation/.test(t.textContent); }), 20000) && errs.length === 0, errs.join(' | '));
254
257
  /* briefing-premium-reports against the real server: New dashboard, Save, the switch, then the ledger answers it back */
255
258
  await pg.click('#pdNew'); await until(() => pg.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
256
- await pg.fill('#pdN', 'Partner review'); await pg.fill('#pdP', 'The Monday partner review.'); await pg.selectOption('#pdAdd', m.charts[0].id); await pg.check('#pdMain'); await pg.click('#pdGo');
259
+ await pg.click('#oMain [data-st="chip|name"]'); await pg.fill('#stI', 'Partner review'); await pg.click('#oMain [data-st="chip|use"]'); await pg.fill('#stI', 'The Monday partner review.');
260
+ await pg.click('#stLb [data-st="libc|' + m.charts[0].id + '"]'); await pg.click('#oMain [data-st="chip|main"]'); await pg.click('#stTr [data-st="set|main|1"]'); await pg.click('#oMain [data-st="save"]');
257
261
  ok('E8 a dashboard made on the real page is saved and drawn as the main one', await until(() => pg.evaluate(() => !document.querySelector('#dlg').classList.contains('on') && [...document.querySelectorAll('#dashTabs button')].some((b) => b.textContent === 'Partner review · Main' && b.getAttribute('aria-pressed') === 'true') && document.querySelectorAll('#dashBody .mch').length === 1), 10000), await pg.evaluate(() => (document.querySelector('#pdM') || {}).textContent + ' / ' + [...document.querySelectorAll('#dashTabs button')].map((b) => b.textContent).join()));
258
262
  const j2 = await (await fetch(base2 + '/api/insights-premium')).json(), d2 = j2.model.dashboards.find((d) => d.saved);
259
263
  ok('E8 the model reads it back from the ledger', !!d2 && d2.name === 'Partner review' && d2.main && d2.charts.join() === m.charts[0].id, JSON.stringify(d2));
@@ -78,6 +78,32 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
78
78
  ok('R1 the console stays the default page', /id="c3-root"/.test(def) && !/class="rail/.test(def));
79
79
  { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('R1 the header links to the console (premium-console-link)', tc && tc.href === '/c3.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
80
80
 
81
+ /* premium-search-bell: the Search button, the bell and Ctrl K, from the shared shell */
82
+ {
83
+ await p.route('**/api/boards/backlog*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, ws: 'w1', board: 'b1', rows: [{ id: 'sb-alpha', title: 'Alpha launch plan', lane: 'feature', stage: 'Build' }] }) }));
84
+ await p.route('**/api/core-docs*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, scope: { name: 'PMOS' }, docs: [{ key: 'roadmap', title: 'Roadmap' }] }) }));
85
+ await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: [{ id: 's1', name: 'Fix the footer', state: 'idle', cwd: '.' }, { id: 's2', name: 'Nightly run', state: 'idle', automatic: true }] }) }));
86
+ const sb = await until(() => p.evaluate(() => { const s = document.querySelector('#pvSearch'), b = document.querySelector('#pvBell'), g = document.querySelector('#pvBdg'); if (!s || !b || !g || g.hidden) return null; const rs = s.getBoundingClientRect(), rb = b.getBoundingClientRect(); return { sw: Math.round(rs.width), sh: Math.round(rs.height), bw: Math.round(rb.width), bh: Math.round(rb.height), n: g.textContent, lab: b.getAttribute('aria-label') }; }), 8000);
87
+ const want = MODEL.list.count;
88
+ ok('SB1 the header has a Search button and a bell, 44 px, and the bell counts what the Briefing lists', sb && sb.sw >= 44 && sb.sh >= 44 && sb.bw >= 44 && sb.bh >= 44 && sb.n === String(want) && sb.lab === 'Needs you: ' + want, JSON.stringify(sb));
89
+ await p.keyboard.press('Control+k');
90
+ const pal = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return o && !o.hidden && document.activeElement && document.activeElement.id === 'pvQ' ? { rail: document.querySelector('.rail').inert, groups: [...document.querySelectorAll('#pvList .pv-grp')].map((x) => x.textContent) } : null; }), 6000);
91
+ ok('SB2 Ctrl K opens the search with the box focused and the page behind it inert', pal && pal.rail === true, JSON.stringify(pal));
92
+ await p.keyboard.type('alpha');
93
+ const hit = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#pvList .pv-row b')].map((x) => x.textContent); return r.length === 1 && r[0] === 'Alpha launch plan' ? r : null; }), 6000);
94
+ ok('SB3 typing narrows the results to a record read from the board', !!hit);
95
+ await p.keyboard.press('Control+a'); await p.keyboard.type('fix');
96
+ const ses = await until(() => p.evaluate(() => [...document.querySelectorAll('#pvList .pv-row b')].map((x) => x.textContent).join() === 'Fix the footer' ? 1 : 0), 6000);
97
+ ok('SB4 sessions are listed and automatic ones are left out', !!ses);
98
+ await p.keyboard.press('Escape');
99
+ const closed = await until(() => p.evaluate(() => document.querySelector('#pvOv').hidden && !document.querySelector('.rail').inert && document.activeElement.id === 'pvSearch'), 4000);
100
+ ok('SB5 Escape closes it and puts the focus back on the button', !!closed);
101
+ await p.click('#pvBell');
102
+ const rows = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return !o.hidden ? document.querySelectorAll('#pvList .pv-row').length : 0; }), 6000);
103
+ ok('SB6 the bell lists the Briefing rows and a row opens the Briefing', rows === MODEL.list.rows.length, String(rows));
104
+ await p.keyboard.press('Escape');
105
+ ok('SB7 search and the bell only read: no POST left the page', !A.reqs.some((x) => x.startsWith('POST ')));
106
+ }
81
107
  /* premium-settings: the dialog holds Workspaces and Connectors only; each press goes to its existing route */
82
108
  { const bt = await p.evaluate(() => { const b = document.querySelector('#settingsBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { label: b.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height) }; });
83
109
  ok('S1 the header has a Settings button of at least 44 px', bt && bt.label === 'Settings' && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));