create-pmos 0.396.0 → 0.398.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 (177) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+ /* viewer-report.js — the three checks the Viewer's report panel shows before Issue (initiative premium-agreed-design, area viewer;
3
+ * ReportPanel.dc.html AgRptIssue: "All 3 sources reached · data from Oct 19", "5 slides, every section filled", "The 81% figure is 2 days old.
4
+ * Refresh it first?").
5
+ *
6
+ * issueChecks(markdown, { now, slot }) → [{ id, ok, text }] pure: the report's own text, read as it is
7
+ *
8
+ * sources The draft's "Sources reached and not reached" section (lib/report-draft.js writes it): every source reached, or the ones that
9
+ * were not, by name. The data date is the newest "as of" date the text names, else the cycle's date (slot).
10
+ * sections Each "## " section holds words. An empty one ("—", "none", or nothing) is named.
11
+ * figures The oldest figure that carries its date ("as of 2026-10-19", "Data: 19 Oct 2026"): its age in days. A figure is a number with a
12
+ * unit or a percent sign on the same line. With no dated figure the check passes and says so.
13
+ * A check that passes has ok: true; ok: false is a warning the PM reads before pressing Issue it. Nothing blocks the press. */
14
+
15
+ const MON = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
16
+ const MONN = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
17
+ const body = (t) => String(t || '').replace(/\r/g, '').replace(/^---\n[\s\S]*?\n---\n?/, '');
18
+ const DAY = 86400000;
19
+ /** "Oct 19", from a date in ms. */
20
+ const short = (ms) => { const d = new Date(ms); return MONN[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
21
+
22
+ /** Every date a line names, in ms (UTC midnight): 2026-10-19, 19 Oct 2026, 19 October 2026, Oct 19 2026. */
23
+ function datesIn(line) {
24
+ const out = [];
25
+ for (const m of String(line).matchAll(/\b(\d{4})-(\d{2})-(\d{2})\b/g)) out.push(Date.UTC(+m[1], +m[2] - 1, +m[3]));
26
+ for (const m of String(line).matchAll(/\b(\d{1,2})\s+([A-Za-z]{3,9})\.?\s+(\d{4})\b/g)) { const i = MON.indexOf(m[2].slice(0, 3).toLowerCase()); if (i >= 0) out.push(Date.UTC(+m[3], i, +m[1])); }
27
+ for (const m of String(line).matchAll(/\b([A-Za-z]{3,9})\.?\s+(\d{1,2}),?\s+(\d{4})\b/g)) { const i = MON.indexOf(m[1].slice(0, 3).toLowerCase()); if (i >= 0) out.push(Date.UTC(+m[3], i, +m[2])); }
28
+ return out.filter(Number.isFinite);
29
+ }
30
+ /** The sections of the text: [{ h, lines }]. The text before the first "## " is not a section. */
31
+ function sectionsOf(text) {
32
+ const out = []; let cur = null;
33
+ for (const l of body(text).split('\n')) {
34
+ const h = /^##\s+(.*)$/.exec(l);
35
+ if (h) { cur = { h: h[1].trim(), lines: [] }; out.push(cur); continue; }
36
+ if (cur) cur.lines.push(l);
37
+ }
38
+ return out;
39
+ }
40
+ const filled = (lines) => lines.some((l) => { const t = l.replace(/<!--.*?-->/g, '').replace(/^[\s>*\-–—|:]+$/, '').trim(); return t && !/^(none|n\/a|tbd|todo|—|-)\.?$/i.test(t.replace(/^[-*]\s+/, '')); });
41
+
42
+ function sourcesCheck(S, text, slot, now) {
43
+ const src = S.find((s) => /^sources\b/i.test(s.h));
44
+ const all = body(text).split('\n');
45
+ const asOf = all.filter((l) => /\bas of\b|\bdata\s*:/i.test(l)).flatMap(datesIn).filter((t) => t <= now + DAY);
46
+ const slotMs = /^\d{4}-\d{2}-\d{2}$/.test(String(slot || '')) ? Date.parse(slot + 'T00:00:00Z') : null;
47
+ const dataAt = asOf.length ? Math.max(...asOf) : slotMs;
48
+ const from = dataAt ? ' · data from ' + short(dataAt) : '';
49
+ if (!src) return { id: 'sources', ok: true, text: 'The report names no sources section' + from };
50
+ let part = '', reached = [], missed = [];
51
+ for (const l of src.lines) {
52
+ if (/^\*\*\s*reached\s*\*\*/i.test(l.trim())) { part = 'r'; continue; }
53
+ if (/^\*\*\s*not reached\s*\*\*/i.test(l.trim())) { part = 'n'; continue; }
54
+ const b = /^\s*[-*]\s+(.*)$/.exec(l); if (!b || /^none\.?$/i.test(b[1].trim())) continue;
55
+ if (part === 'n') missed.push(b[1].split(':')[0].trim()); else reached.push(b[1].trim());
56
+ }
57
+ const n = reached.length + missed.length;
58
+ if (!n) return { id: 'sources', ok: true, text: 'No sources are listed' + from };
59
+ if (!missed.length) return { id: 'sources', ok: true, text: (n === 1 ? 'The 1 source' : 'All ' + n + ' sources') + ' reached' + from };
60
+ return { id: 'sources', ok: false, text: missed.length + ' of ' + n + (n === 1 ? ' source' : ' sources') + ' not reached: ' + missed.slice(0, 3).join(', ') + from };
61
+ }
62
+ function sectionsCheck(S) {
63
+ if (!S.length) return { id: 'sections', ok: false, text: 'The report has no sections yet' };
64
+ const empty = S.filter((s) => !filled(s.lines)).map((s) => s.h);
65
+ const slides = S.length + 1; // a title slide, then one per section (premium-report-read.js slides)
66
+ if (!empty.length) return { id: 'sections', ok: true, text: slides + ' slides, every section filled' };
67
+ return { id: 'sections', ok: false, text: (empty.length === 1 ? '1 section is empty: ' : empty.length + ' sections are empty: ') + empty.slice(0, 3).join(', ') };
68
+ }
69
+ function figuresCheck(text, now) {
70
+ let oldest = null;
71
+ for (const l of body(text).split('\n')) {
72
+ if (!/\bas of\b|\bdata\s*:|\bmeasured\b/i.test(l)) continue;
73
+ const fig = /(\d+(?:[.,]\d+)?\s?%|\d+(?:[.,]\d+)?\s?(?:pp|ms|s|h|d|days|pts|points)\b)/i.exec(l.replace(/\b\d{4}-\d{2}-\d{2}\b/g, ' '));
74
+ const ds = datesIn(l).filter((t) => t <= now + DAY);
75
+ if (!fig || !ds.length) continue;
76
+ const at = Math.min(...ds);
77
+ if (!oldest || at < oldest.at) oldest = { at, fig: fig[1].replace(/\s+/g, '') };
78
+ }
79
+ if (!oldest) return { id: 'figures', ok: true, text: 'No figure carries an older date' };
80
+ const days = Math.floor((Date.UTC(new Date(now).getUTCFullYear(), new Date(now).getUTCMonth(), new Date(now).getUTCDate()) - oldest.at) / DAY);
81
+ if (days <= 1) return { id: 'figures', ok: true, text: 'The ' + oldest.fig + ' figure is from ' + (days <= 0 ? 'today' : 'yesterday') };
82
+ return { id: 'figures', ok: false, text: 'The ' + oldest.fig + ' figure is ' + days + ' days old. Refresh it first?' };
83
+ }
84
+ function issueChecks(markdown, { now = Date.now(), slot = '' } = {}) {
85
+ const S = sectionsOf(markdown);
86
+ return [sourcesCheck(S, markdown, slot, now), sectionsCheck(S), figuresCheck(markdown, now)];
87
+ }
88
+
89
+ module.exports = { issueChecks, sectionsOf, datesIn };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.396.0",
3
+ "version": "0.398.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.396.0",
9
+ "version": "0.398.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.396.0",
3
+ "version": "0.398.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-agreed-viewer-shots.js — screenshots of the initiative page and the Viewer in the Agreed design (initiative premium-agreed-design, area viewer).
4
+ * Not a suite: it serves the real page from the real server, answers the routes from the fixtures the browser suites use, and writes PNGs to
5
+ * the directory given as the first argument (default: ./shots). Run: node premium-agreed-viewer-shots.js /mnt/project-files/agreed-build */
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { spawn } = require('child_process');
9
+ const { findBrowser } = require('./lib/find-browser');
10
+ const T = require('./test-run').configure({ name: 'agreed-viewer-shots' });
11
+ const IP = require('./lib/initiative-premium.js');
12
+ const F = require('./fixtures/initiative-premium-facts.js');
13
+
14
+ const OUT = path.resolve(process.argv[2] || 'shots');
15
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
+ (async () => {
17
+ fs.mkdirSync(OUT, { recursive: true });
18
+ const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
19
+ await T.waitForServer(T.BASE);
20
+ const { chromium } = require('playwright-core');
21
+ const browser = await chromium.launch({ executablePath: findBrowser() });
22
+ const model = IP.build(F.facts());
23
+ const NOW = new Date(F.NOW);
24
+ const tickets = { ok: true, initiative: 'self-serve-v2', title: 'Self-serve onboarding v2', checkedAt: new Date(F.NOW - 12 * 60000).toISOString(), sectionNames: [{ key: 'story', name: 'User Story' }],
25
+ tickets: [{ id: 'TD-01', key: 'ONB-12', summary: 'Sandbox key step', type: 'Story', priority: 'High', depends: [], sections: { story: 'As a partner I get a sandbox key in one step.' }, jira: { status: 'In Progress', category: 'doing', assignee: { displayName: 'Rudi' }, sprint: { name: 'Sprint 14', state: 'active', start: '2026-10-07', end: '2026-10-21' } } }] };
26
+ const shot = async (name, w, h, theme, act) => {
27
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
28
+ const page = await ctx.newPage();
29
+ await page.clock.setFixedTime(NOW).catch(() => {});
30
+ await page.route('**/api/initiative-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: F.NOW }) }));
31
+ await page.route('**/api/jira/tickets*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(tickets) }));
32
+ await page.route('**/api/boards/sprints*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, source: 'none', sprints: [] }) }));
33
+ await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
34
+ await page.goto(T.BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme);
35
+ for (let i = 0; i < 100 && !(await page.$('#cIniTk')); i++) await sleep(100);
36
+ await sleep(600);
37
+ if (act) await act(page);
38
+ await page.screenshot({ path: path.join(OUT, name + '.png') });
39
+ await ctx.close();
40
+ };
41
+ await shot('viewer-initiative-1440', 1440, 900, 'light');
42
+ await shot('viewer-initiative-1440-dark', 1440, 900, 'dark');
43
+ await shot('viewer-initiative-390', 390, 844, 'light');
44
+ await shot('viewer-initiative-1440-folded', 1440, 900, 'light', async (p) => { await p.click('#czBox [data-czfold]'); await sleep(200); });
45
+ const ticket = async (p) => { await p.click('#cIniTk [data-task="task:ONB-12"]'); await sleep(1500); };
46
+ await shot('viewer-jira-1440', 1440, 900, 'light', ticket);
47
+ await shot('viewer-jira-390', 390, 844, 'light', ticket);
48
+ // the meeting views and the calendar in the cozy dialog: opened on this page with the shell's own dialog, from fixture answers
49
+ const iso = (d) => d.toISOString(), key = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
50
+ const START = new Date(F.NOW - 10 * 60000), END = new Date(START.getTime() + 45 * 60000);
51
+ const mon = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate() - ((NOW.getDay() + 6) % 7));
52
+ const cells = []; for (let i = 0; i < 7; i++) { const d = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + i); cells.push({ key: key(d), start: key(d), end: key(d), events: [] }); }
53
+ cells.find((c) => c.key === key(START)).events.push({ id: 'ev-sync', at: iso(START), end: iso(END), title: 'Weekly sync', attendees: ['Dara', 'Sam'] });
54
+ const week = { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: key(NOW), context: {}, link_boards: [], gantt: [] };
55
+ const NOTE = { id: 'n1', title: 'Weekly sync', state: 'ended', updated_at: iso(NOW), meeting_ms: 32 * 60000, series: { key: 'weekly-sync' },
56
+ meeting: { kind: 'event', event_id: 'ev-sync', start: iso(START), end: iso(END), title: 'Weekly sync', context: { with: 'Dara and Sam', purpose: 'Agree what blocks the release.', agenda: ['Migration check status'] } },
57
+ final_notes: { overview: 'The team reviewed the migration check.', decisions: [{ text: 'Keep the new copy', why: 'Completion rose six points.' }], actions: [{ text: 'Start the migration check', owner: 'Sam', due: '2026-10-22' }], questions: [{ text: 'Do old workspaces need a manual step?' }] },
58
+ final: { segments: [{ t: 61000, spk: 'meeting', text: 'The migration check status is not started.' }] }, speakers: { meeting: 'Dara' } };
59
+ const meet = async (p, which) => {
60
+ await p.route('**/api/calendar-views*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(week) }));
61
+ await p.route('**/api/notes/one*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, note: NOTE }) }));
62
+ await p.route('**/api/notes/series?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, series: { key: 'weekly-sync', meetings: [] } }) }));
63
+ await p.evaluate(async (w) => {
64
+ const S = await import('/pm/premium-shell.js');
65
+ const d = { ...S, pmGet: (u) => fetch(u).then((r) => r.json()).catch(() => null), pmPost: async () => ({ ok: true }), task: async () => ({ ok: false }), openRow: () => {} };
66
+ if (w === 'cal') { const C = await import('/pm/premium-vw-cal.js'); C.openCalendar(d); }
67
+ else { S.openDlg({ eye: 'Meeting · real data', title: 'Weekly sync', say: 'The notes of the meeting.', stream: S.turnA(S.ptx('The notes of the meeting.')), pane: '<article class="paper doc"><p class="note">The meeting.</p></article>', label: 'Meeting' }); const M = await import('/pm/premium-vw-meet.js'); await M.openNoteTab(d, 'n1'); }
68
+ }, which);
69
+ await sleep(1500);
70
+ };
71
+ await shot('viewer-calendar-1440', 1440, 900, 'light', (p) => meet(p, 'cal'));
72
+ await shot('viewer-meeting-1440', 1440, 900, 'light', (p) => meet(p, 'note'));
73
+ await shot('viewer-meeting-390', 390, 844, 'light', (p) => meet(p, 'note'));
74
+ await browser.close(); srv.kill('SIGKILL'); T.killTmux();
75
+ console.log('wrote', fs.readdirSync(OUT).filter((f) => /^viewer-/.test(f)).join(' '));
76
+ })().catch((e) => { console.error(e); process.exit(1); });
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* premium-board-actions-test.js — the board presses of the premium Board and initiative pages (initiative premium-board-actions; planning/prd/premium-board-actions-prd.md A1 to A12).
4
- * A real server on a scratch `team` repository (planning/initiatives, pmos/state), never the PMOS checkout. The real pages press the real routes:
4
+ * A real server on a scratch `team` repository (planning/initiatives, pmos/state), never the PMOS checkout. The real pages press the real routes.
5
+ * Re-pointed for the Agreed Board (premium-agreed-design): the Board's presses are the plain versions of pm/bd-acts.js in the side panel.
5
6
  * T triage (accept, decline) · N New initiative · M move and Undo · L hold, resume, cancel, reopen, archive, restore · I the initiative page's bar
6
7
  * S the PMOS-self board (a model answer, since only the embedded checkout is self) · P the POST allow-list and the refusals · F floors */
7
8
  const fs = require('fs');
@@ -74,102 +75,111 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
74
75
  };
75
76
  const P = await open('/premium-board.html');
76
77
  const p = P.page;
78
+ // re-pointed for the Agreed Board (premium-agreed-design): the presses live in plain versions in the side panel (pm/bd-acts.js), tagged
79
+ // "Waiting for design"; a row's actions open from the panel's ⋯; the toast is #bdToast with its Undo; the old dialog never opens.
77
80
  const listed = (id) => p.evaluate((x) => [...document.querySelectorAll('#ibBody .ini2')].some((b) => b.dataset.key === 'board:' + x), id);
78
- const toastIs = (re) => until(() => p.evaluate((s) => { const t = document.querySelector('#toast'); return t.classList.contains('on') && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
79
- const dlgOn = async () => { const v = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800); return v; };
80
- const dlgOff = () => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
81
- ok('A2 the New asks card lists both asks with Accept and Decline', await until(() => p.evaluate(() => document.querySelectorAll('#cAsks .baa').length === 2 && document.querySelectorAll('#cAsks [data-ask^="acc:"]').length === 2)), await p.evaluate(() => (document.querySelector('#asksHost') || {}).textContent));
82
- ok('A2 an ask shows its source, not an invented name', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#cAsks').textContent) && !/demo/i.test(document.querySelector('#cAsks').textContent)));
81
+ const toastIs = (re) => until(() => p.evaluate((s) => { const t = document.querySelector('#bdToast'); return t && !t.hidden && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
82
+ const peekOn = (title) => until(() => p.evaluate((t) => { const k = document.querySelector('#peek'); return k && !k.hidden && (document.querySelector('#pkTitle') || {}).textContent === t && !!k.querySelector('.bd-wtag'); }, title));
83
+ const noDlg = () => p.evaluate(() => !document.querySelector('#dlg.on'));
84
+ const acts = async (id) => { await until(() => listed(id), 30000); await p.click(`#ibBody .ini2[data-key="board:${id}"]`); await until(() => p.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await p.click('#peek [data-pk="acts"]'); return peekOn('Initiative actions'); };
85
+ await until(() => p.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
86
+ await p.click('#chAsks');
87
+ ok('A2 the New asks panel lists both asks with Accept and Decline', await until(() => p.evaluate(() => document.querySelectorAll('#peek .bd-ask').length === 2 && document.querySelectorAll('#peek [data-act="accept"]').length === 2)), await p.evaluate(() => (document.querySelector('#peek') || {}).textContent));
88
+ ok('A2 an ask shows its source, not an invented name, and the panel is tagged "Waiting for design"', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#peek').textContent) && !/demo/i.test(document.querySelector('#peek').textContent) && !!document.querySelector('#peek .bd-wtag')));
83
89
 
84
90
  /* T triage */
85
- await p.click(`#cAsks [data-ask="acc:${a1.body.ask.id}"]`); await dlgOn();
86
- const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && s.tagName === 'SELECT' && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
91
+ await p.click(`#peek [data-act="accept"][data-id="${a1.body.ask.id}"]`); await peekOn('Accept ask');
92
+ const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#peek select[name="anchor"]'); return s && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
87
93
  ok('T1 Accept opens the form with the anchors the board declares', !!anc && anc.includes('health:tech'), JSON.stringify(anc));
88
- await p.fill('#paNT', ''); await p.click('#paNGo');
89
- ok('T2 an empty title is refused on the page, before any press', await p.evaluate(() => /Give it a title/.test(document.querySelector('#paNM').textContent)) && !P.posts.some((x) => x.path === '/api/boards/asks/accept'));
90
- await p.fill('#paNT', 'Daily CSV of failed payouts'); await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
94
+ await p.fill('#peek input[name="title"]', ''); await p.click('#peek form[data-form="new"] [type="submit"]');
95
+ ok('T2 an empty title is refused on the page, before any press', await p.evaluate(() => /Give it a title/.test(document.querySelector('#formM').textContent)) && !P.posts.some((x) => x.path === '/api/boards/asks/accept'));
96
+ await p.fill('#peek input[name="title"]', 'Daily CSV of failed payouts'); await p.selectOption('#peek select[name="anchor"]', 'health:tech'); await p.click('#peek form[data-form="new"] [type="submit"]');
91
97
  ok('T3 Accept records the accept line and a new initiative, and says so', !!(await toastIs(/accepted in/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-accept' && l.ask === a1.body.ask.id), JSON.stringify(lines('boards.jsonl').map((l) => l.kind)));
92
- await dlgOff();
93
- ok('T4 the accepted ask leaves the card', await until(() => p.evaluate((id) => !document.querySelector(`#cAsks [data-ask="acc:${id}"]`) && document.querySelectorAll('#cAsks .baa').length === 1, a1.body.ask.id)));
94
- await p.click(`#cAsks [data-ask="dec:${a2.body.ask.id}"]`); await dlgOn();
95
- ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#paDGo').disabled));
96
- await p.fill('#paDW', 'Not tied to a goal this quarter'); await p.click('#paDGo');
98
+ await until(() => p.evaluate(() => document.querySelector('#chAsks') && /\b1\b/.test(document.querySelector('#chAsks').textContent)), 30000);
99
+ await p.click('#chAsks');
100
+ ok('T4 the accepted ask leaves the panel', await until(() => p.evaluate((id) => !document.querySelector(`#peek [data-act="accept"][data-id="${id}"]`) && document.querySelectorAll('#peek .bd-ask').length === 1, a1.body.ask.id)));
101
+ await p.click(`#peek [data-act="decline"][data-id="${a2.body.ask.id}"]`); await peekOn('Decline ask');
102
+ await p.click('#peek form[data-form="decline"] [type="submit"]');
103
+ ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#peek textarea[name="why"]').validity.valueMissing) && !P.posts.some((x) => x.path === '/api/boards/asks/decline'));
104
+ await p.fill('#peek textarea[name="why"]', 'Not tied to a goal this quarter'); await p.click('#peek form[data-form="decline"] [type="submit"]');
97
105
  ok('T6 Decline records the reason in the board ledger', !!(await toastIs(/Ask declined/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-decline' && l.why === 'Not tied to a goal this quarter'));
98
- ok('T7 the card says nothing is left to triage', await until(() => p.evaluate(() => /Nothing new to triage/.test(document.querySelector('#cAsks').textContent))));
106
+ await until(() => p.evaluate(() => /^No new asks|0 new asks/.test((document.querySelector('#chAsks') || {}).textContent.trim())), 30000);
107
+ await p.click('#chAsks');
108
+ ok('T7 the panel says nothing is left to triage', await until(() => p.evaluate(() => /No new ask waits for triage/.test(document.querySelector('#peek').textContent))));
109
+ await p.keyboard.press('Escape');
99
110
 
100
111
  /* N New initiative */
101
112
  ok('N1 New initiative is offered on a team board', await p.evaluate(() => !document.querySelector('#newIni').hidden));
102
- await p.click('#newIni'); await dlgOn();
103
- await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && !s.disabled; }));
104
- await p.fill('#paNT', 'Partner usage per key'); await p.click('#paNGo');
105
- ok('N2 an unanchored create is refused on the page', await p.evaluate(() => /Choose an anchor/.test(document.querySelector('#paNM').textContent)));
106
- await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
113
+ await p.click('#newIni'); await peekOn('New initiative');
114
+ await until(() => p.evaluate(() => { const s = document.querySelector('#peek select[name="anchor"]'); return s && !s.disabled; }));
115
+ await p.fill('#peek input[name="title"]', 'Partner usage per key'); await p.click('#peek form[data-form="new"] [type="submit"]');
116
+ ok('N2 an unanchored create is refused on the page', await p.evaluate(() => /Choose an anchor/.test(document.querySelector('#formM').textContent)));
117
+ await p.selectOption('#peek select[name="anchor"]', 'health:tech'); await p.click('#peek form[data-form="new"] [type="submit"]');
107
118
  const made = await toastIs(/created in/);
108
119
  const recs = fs.readdirSync(path.join(team, 'planning', 'initiatives'));
109
120
  ok('N3 Create writes an ask, its accept and a new initiative record, as the console does', !!made && recs.some((f) => /partner-usage/.test(f)) && lines('boards.jsonl').some((l) => l.kind === 'ask' && l.line === 'Partner usage per key'), made + ' / ' + recs.join());
110
121
 
111
- /* M move and Undo, from the row's menu */
112
- await dlgOff();
113
- await until(() => listed('pa-one'));
114
- const menuBtn = '#ibBody .inim[data-im="board:pa-one"]';
115
- await p.click(menuBtn);
116
- const items = await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m ? [...m.querySelectorAll('[role="menuitem"] b')].map((b) => b.textContent) : null; }));
117
- ok('M1 the row menu offers the next stage, hold, cancel and archive', !!items && /^Move to /.test(items[0]) && items.includes('Put on hold') && items.includes('Cancel') && items.includes('Archive'), JSON.stringify(items));
118
- ok('M2 the menu takes the focus and the arrow keys move it; Escape closes it and gives the focus back', await (async () => {
119
- const f0 = await p.evaluate(() => document.activeElement.closest('.bam2') !== null);
120
- await p.keyboard.press('ArrowDown'); const f1 = await p.evaluate(() => [...document.querySelectorAll('.bam2 [role="menuitem"]')].indexOf(document.activeElement));
121
- await p.keyboard.press('Escape'); const gone = await p.evaluate(() => !document.querySelector('.bam2') && document.activeElement.matches('.inim'));
122
- return f0 && f1 === 1 && gone;
123
- })());
122
+ /* M move and Undo, from the panel's ⋯ */
123
+ ok('M1 the initiative actions offer the next stage, hold, cancel and archive', await acts('pa-one') && await p.evaluate(() => { const L = [...document.querySelectorAll('#peek .bd-ai b')].map((b) => b.textContent); return /^Move to /.test(L[0]) && L.includes('Put on hold') && L.includes('Cancel') && L.includes('Archive'); }), await p.evaluate(() => document.querySelector('#peek').textContent));
124
+ await p.keyboard.press('Escape');
125
+ ok('M2 Escape closes the actions and gives the focus back to the row', await until(() => p.evaluate(() => document.querySelector('#peek').hidden && !!document.activeElement.closest('#ibBody'))));
124
126
  const from = ready.model.initiatives.list.rows.find((r) => r.id === 'pa-one').acts.stage;
125
- await p.click(menuBtn); await p.click('.bam2 [data-pk^="mv:"]');
127
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k^="mv:"]');
126
128
  const mv = await toastIs(/^Moved to/);
127
129
  ok('M3 Move records one move line and says what it recorded', !!mv && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').length === 1, mv);
128
- await p.click('#paUndo');
130
+ await p.click('#bdToast .bd-undo');
129
131
  ok('M4 Undo writes the move back', !!(await toastIs(new RegExp('Back in ' + from))) && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').pop().to === from);
130
132
 
131
133
  /* L hold, resume, cancel, reopen, archive, restore */
132
- await until(() => listed('pa-one'));
133
- await p.click(menuBtn);
134
- await p.click('.bam2 [data-pk="hold"]'); await dlgOn();
135
- await p.fill('#paHR', 'Waiting for the Q1 budget'); await tap(p, '#paHB [data-v="two"]'); await p.click('#paHGo');
134
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="hold"]'); await peekOn('Put on hold');
135
+ await p.fill('#peek textarea[name="why"]', 'Waiting for the Q1 budget'); await p.check('#peek input[name="back"][value="two"]'); await p.click('#peek form[data-form="hold"] [type="submit"]');
136
136
  const hl = await until(() => lines('lifecycle.jsonl').find((l) => l.initiative_id === 'pa-one' && l.state === 'on-hold'));
137
- ok('L1 Put on hold records one on-hold line with the reason and a check-back day', !!hl && hl.reason === 'Waiting for the Q1 budget' && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || ''), JSON.stringify(hl) + ' ' + await p.evaluate(() => (document.querySelector('#paHM') || {}).textContent));
138
- ok('L2 the row then says On hold and its menu offers Resume', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
139
- await p.click(menuBtn);
140
- ok('L2 Resume is offered and the moves are not', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && !!m.querySelector('[data-pk="resume"]') && !m.querySelector('[data-pk^="mv:"]'); })));
141
- await p.click('.bam2 [data-pk="resume"]');
137
+ ok('L1 Put on hold records one on-hold line with the reason and a check-back day', !!hl && hl.reason === 'Waiting for the Q1 budget' && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || ''), JSON.stringify(hl) + ' ' + await p.evaluate(() => (document.querySelector('#formM') || {}).textContent));
138
+ ok('L2 the row then says On hold', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
139
+ await acts('pa-one');
140
+ ok('L2 Resume is offered and the moves are not', await p.evaluate(() => !!document.querySelector('#peek .bd-ai[data-k="resume"]') && !document.querySelector('#peek .bd-ai[data-k^="mv:"]')));
141
+ await p.click('#peek .bd-ai[data-k="resume"]');
142
142
  ok('L3 Resume records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L.length && L[L.length - 1].state === 'active'; }));
143
143
  await until(() => p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b && !/On hold/.test(b.textContent); }), 30000);
144
- await p.click(menuBtn); await p.click('.bam2 [data-pk="cancel"]'); await dlgOn();
145
- ok('L4 Cancel waits for a reason', await p.evaluate(() => document.querySelector('#paCGo').disabled));
146
- await tap(p, '#paCW [data-v="worth"]'); await p.click('#paCGo');
144
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="cancel"]'); await peekOn('Cancel the initiative');
145
+ await p.click('#peek form[data-form="cancel"] [type="submit"]');
146
+ ok('L4 Cancel waits for a reason', await p.evaluate(() => /Pick a reason/.test(document.querySelector('#formM').textContent)) && !lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled'));
147
+ await p.check('#peek input[name="why"][value="Not worth it now"]'); await p.click('#peek form[data-form="cancel"] [type="submit"]');
147
148
  ok('L4 Cancel records a cancelled line with the reason', await until(() => lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled' && l.reason === 'Not worth it now')));
148
- ok('L5 the row leaves the list and the fold counts it', await until(() => p.evaluate(() => !document.querySelector('#ibBody .inil .ini2[data-key="board:pa-one"]') && /1 cancelled/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
149
- await p.click('#goneT'); await p.click('#ibBody .inim[data-im="board:pa-one"]');
150
- ok('L6 a cancelled row offers Reopen only', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'reopen'; })));
151
- await p.click('.bam2 [data-pk="reopen"]');
149
+ // re-pointed for the Agreed design: the track's footer carries only the fold and the sort (AgBoard), so the count moved to the ⋯ menu's item
150
+ ok('L5 the row leaves the track and the ⋯ menu\'s Cancelled and archived item counts it', await until(() => p.evaluate(() => !document.querySelector('#ibBody .bt-l[data-row="board:pa-one"]') && /1 cancelled/.test((document.querySelector('#bdGone') || {}).textContent || '')), 30000));
151
+ await p.click('#moreBtn'); await p.click('#bdGone'); await peekOn('Cancelled and archived');
152
+ ok('L6 a cancelled initiative offers Reopen only', await p.evaluate(() => [...document.querySelectorAll('#peek .bd-ar [data-act]')].map((b) => b.dataset.act).join() === 'reopen'));
153
+ await p.click('#peek [data-act="reopen"]');
152
154
  ok('L6 Reopen records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L[L.length - 1].state === 'active'; }));
153
155
  await until(() => listed('pa-one'), 30000);
154
- await p.click(menuBtn); await p.click('.bam2 [data-pk="archive"]'); await dlgOn();
155
- await tap(p, '#paAW [data-v="dup"]'); await p.fill('#paAN', 'Same as the CSV export'); await p.click('#paAGo');
156
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="archive"]'); await peekOn('Archive the initiative');
157
+ await p.check('#peek input[name="why"][value="Duplicate"]'); await p.fill('#peek textarea[name="note"]', 'Same as the CSV export'); await p.click('#peek form[data-form="archive"] [type="submit"]');
156
158
  ok('L7 Archive records one archive line with the reason', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === true && l.reason === 'Duplicate: Same as the CSV export')));
157
- ok('L8 the fold counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
158
- await p.click('#paUndo');
159
+ ok('L8 the ⋯ menu\'s item counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#bdGone') || {}).textContent || '')), 30000));
160
+ await p.click('#bdToast .bd-undo');
159
161
  ok('L9 Undo restores it with a restore line', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === false)));
162
+ ok('L10 none of the presses opened the old dialog', await noDlg());
160
163
 
161
- /* I the initiative page's bar */
164
+ /* I the Board's expand link: the initiative is a layout inside Home (premium-agreed-design). Its stage moves and lifecycle presses are in the Overview */
162
165
  const I = await open('/premium-initiative.html?id=pa-one&ws=' + encodeURIComponent(B.ws) + '&board=' + encodeURIComponent(B.id));
163
166
  const ip = I.page;
164
- const bar = await until(() => ip.evaluate(() => { const b = document.querySelector('#iBar'); return b && b.querySelector('[data-pk^="mv:"]') ? [...b.querySelectorAll('button')].map((x) => x.textContent.trim()) : null; }), 60000);
165
- ok('I1 the bar offers the next stage and More', !!bar && bar.some((t) => /^Move to /.test(t)) && bar.includes('More'), JSON.stringify(bar));
167
+ const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/premium.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('.hm-card [data-hm-ov]'); }), 60000);
168
+ ok('I0 the expand link lands on Home with the initiative selected, ws and board kept', !!landed, await ip.evaluate(() => location.href));
169
+ await ip.click('.hm-card [data-hm-ov]');
170
+ const bar = await until(() => ip.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); if (!v || !v.querySelector('[data-ov-move]')) return null; const cur = v.querySelector('[data-ov-move][aria-pressed="true"]'); return { moves: [...v.querySelectorAll('[data-ov-move]')].map((x) => x.dataset.ovMove), cur: cur ? cur.dataset.ovMove : '', life: [...v.querySelectorAll('[data-ov-life]')].map((x) => x.dataset.ovLife) }; }), 60000);
171
+ ok('I1 the Overview offers the stages, the current one pressed, and the lifecycle presses', !!bar && bar.moves.length > 1 && !!bar.cur && bar.moves.indexOf(bar.cur) < bar.moves.length - 1 && bar.life.join() === 'on-hold,cancelled', JSON.stringify(bar) + ' ' + (await ip.evaluate(() => (document.querySelector('#czViewer .cz-vw-body') || {}).innerText || 'no Viewer')).slice(0, 400));
166
172
  const n0 = lines('boards.jsonl').filter((l) => l.kind === 'move').length;
167
- await ip.click('#iBar [data-pk^="mv:"]');
168
- ok('I2 a press on the bar records one move line', await until(() => lines('boards.jsonl').filter((l) => l.kind === 'move').length === n0 + 1));
169
- await ip.click('#iBar [data-im="bar"]');
170
- ok('I3 More lists the lifecycle presses and no move', await until(() => ip.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'hold,cancel,archive'; })));
173
+ const next = bar ? bar.moves[bar.moves.indexOf(bar.cur) + 1] : '';
174
+ await ip.click(`#czViewer [data-ov-move="${next}"]`);
175
+ ok('I2 a stage press records one move line', await until(() => { const L = lines('boards.jsonl').filter((l) => l.kind === 'move'); return L.length === n0 + 1 && L[L.length - 1].id === 'pa-one' && L[L.length - 1].to === next; }), JSON.stringify(lines('boards.jsonl').filter((l) => l.kind === 'move').slice(-1)));
176
+ ok('I2 the Overview then shows the new stage pressed', await until(() => ip.evaluate((n) => !!document.querySelector(`#czViewer [data-ov-move="${n}"][aria-pressed="true"]`), next)));
177
+ const lif0 = lines('lifecycle.jsonl').length;
178
+ await ip.click('#czViewer [data-ov-life="on-hold"]');
179
+ ok('I3 a lifecycle press asks its reason inline, records nothing yet and opens no browser dialog', await until(() => ip.evaluate(() => !!document.querySelector('#czViewer #ovWhy'))) && lines('lifecycle.jsonl').length === lif0 && !(await ip.evaluate(() => { const d = document.querySelector('#dlg'); return !!(d && d.classList.contains('on')); })));
180
+ await ip.click('#czViewer [data-ov-life-no]');
181
+ ok('I3 Not now takes the question back', await until(() => ip.evaluate(() => !document.querySelector('#czViewer #ovWhy') && !!document.querySelector('#czViewer [data-ov-life="on-hold"]'))));
171
182
  await ip.keyboard.press('Escape');
172
- await ip.click('#paUndo').catch(() => {});
173
183
 
174
184
  /* S the PMOS-self board: the model says self, the page offers no move and no New initiative */
175
185
  {
@@ -178,9 +188,11 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
178
188
  await S.page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: m, as_of: Date.now() }) }));
179
189
  await S.page.reload();
180
190
  await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0));
181
- ok('S1 the PMOS-self board names the router in its asks card and hides New initiative', await S.page.evaluate(() => /pmos-router/.test(document.querySelector('#cAsks').textContent) && document.querySelector('#newIni').hidden));
182
- await S.page.click('#ibBody .inim');
183
- ok('S2 its row menu has no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('.bam2'); return x && !x.querySelector('[data-pk^="mv:"]') && !!x.querySelector('[data-pk="hold"]'); })));
191
+ await S.page.click('#chAsks');
192
+ ok('S1 the PMOS-self board names the router in its asks panel and hides New initiative', await until(() => S.page.evaluate(() => /pmos-router/.test(document.querySelector('#peek').textContent) && document.querySelector('#newIni').hidden)));
193
+ await S.page.keyboard.press('Escape');
194
+ await S.page.click('#ibBody .ini2'); await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await S.page.click('#peek [data-pk="acts"]');
195
+ ok('S2 its actions have no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('#peek .bd-alist'); return x && !x.querySelector('[data-k^="mv:"]') && !!x.querySelector('[data-k="hold"]'); })));
184
196
  await S.ctx.close();
185
197
  }
186
198
 
@@ -196,12 +208,12 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
196
208
  /* F floors */
197
209
  {
198
210
  const S = await open('/premium-board.html', { w: 390, h: 844 });
199
- await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .inim').length > 0), 30000);
200
- const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .inim, #cAsks button, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
211
+ await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
212
+ const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .ini2, #chAsks, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
201
213
  ok('F1 at 390 px there is no sideways scroll and every new control is at least 44 px', !f.wide && !f.small.length, JSON.stringify(f));
202
- await S.page.click('#ibBody .inim');
203
- const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('.bam2 [role="menuitem"]')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
204
- ok('F2 the menu items are 44 px tall and the open menu adds no sideways scroll', !!mi);
214
+ await S.page.click('#ibBody .ini2'); await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await S.page.click('#peek [data-pk="acts"]');
215
+ const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('#peek .bd-ai')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
216
+ ok('F2 the action rows are 44 px tall and the open sheet adds no sideways scroll', !!mi);
205
217
  await S.ctx.close();
206
218
  }
207
219
  await P.ctx.close(); await I.ctx.close();