create-pmos 0.442.0 → 0.444.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 (81) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-board-test.js +8 -2
  7. package/workspace/briefing-premium-insights-test.js +40 -38
  8. package/workspace/briefing-premium-test.js +2 -1
  9. package/workspace/changelog.json +24 -0
  10. package/workspace/goals-clear-ui-test.js +263 -0
  11. package/workspace/guide/home.md +12 -2
  12. package/workspace/guide/metric-drafts.md +8 -2
  13. package/workspace/home-railcard-test.js +193 -0
  14. package/workspace/intel-report-ui-test.js +1 -1
  15. package/workspace/intelligence-gaps-ui-test.js +16 -14
  16. package/workspace/lib/board-premium.js +1 -1
  17. package/workspace/lib/engine/boards.js +9 -2
  18. package/workspace/lib/engine/records/index.js +9 -2
  19. package/workspace/lib/initiative-layout.js +3 -1
  20. package/workspace/lib/insights-premium.js +22 -1
  21. package/workspace/lib/metric-drafts.js +37 -10
  22. package/workspace/lib/metric-read-runs.js +20 -13
  23. package/workspace/lib/metric-reads.js +208 -23
  24. package/workspace/lib/metrics-cli.js +62 -5
  25. package/workspace/lib/routes-boards.js +40 -1
  26. package/workspace/lib/routes-goal-status.js +89 -6
  27. package/workspace/lib/routes-insights-premium.js +1 -1
  28. package/workspace/lib/routes-metric-drafts.js +26 -3
  29. package/workspace/live-pill-round-test.js +178 -0
  30. package/workspace/metric-drafts-ui-test.js +5 -2
  31. package/workspace/okr-goals-ui-test.js +27 -23
  32. package/workspace/package-lock.json +2 -2
  33. package/workspace/package.json +1 -1
  34. package/workspace/panels-test.js +231 -0
  35. package/workspace/premium-board-actions-test.js +2 -2
  36. package/workspace/premium-rec-tab-test.js +2 -1
  37. package/workspace/premium-vw-item-test.js +10 -2
  38. package/workspace/premium-vw-jira-test.js +3 -0
  39. package/workspace/public/pm/bd-ini-panel.js +3 -2
  40. package/workspace/public/pm/cozy-adler.js +21 -0
  41. package/workspace/public/pm/cozy-divider.css +32 -0
  42. package/workspace/public/pm/cozy-divider.js +45 -0
  43. package/workspace/public/pm/cozy-insights.css +96 -0
  44. package/workspace/public/pm/cozy-live-pill.css +16 -17
  45. package/workspace/public/pm/cozy-live-pill.js +28 -17
  46. package/workspace/public/pm/cozy-panels.css +59 -0
  47. package/workspace/public/pm/cozy-panels.js +524 -0
  48. package/workspace/public/pm/cozy-today.css +15 -0
  49. package/workspace/public/pm/cozy-viewer.js +173 -69
  50. package/workspace/public/pm/cozy-vw-shell.css +4 -0
  51. package/workspace/public/pm/goals-clear.js +265 -0
  52. package/workspace/public/pm/home-app.js +73 -14
  53. package/workspace/public/pm/home-ini.js +9 -3
  54. package/workspace/public/pm/home-today.js +55 -12
  55. package/workspace/public/pm/ini-edit.js +401 -0
  56. package/workspace/public/pm/ini-groups.js +14 -8
  57. package/workspace/public/pm/ini-tasks.js +84 -26
  58. package/workspace/public/pm/ini-versions.js +18 -4
  59. package/workspace/public/pm/ini-view-model.js +45 -18
  60. package/workspace/public/pm/ini-view.css +117 -5
  61. package/workspace/public/pm/ini-view.js +51 -17
  62. package/workspace/public/pm/metric-drafts.js +4 -1
  63. package/workspace/public/pm/mission.js +11 -7
  64. package/workspace/public/pm/premium-board.js +8 -6
  65. package/workspace/public/pm/premium-insights.js +375 -59
  66. package/workspace/public/pm/task-card.css +2 -0
  67. package/workspace/public/pm/task-card.js +4 -1
  68. package/workspace/server.js +6 -2
  69. package/workspace/skills/metric-read.skill +7 -5
  70. package/workspace/stage-card-tasks-test.js +396 -0
  71. package/workspace/stage-card-test.js +12 -4
  72. package/workspace/task-delete-test.js +9 -1
  73. package/workspace/task-milestones-test.js +3 -3
  74. package/workspace/task-press-test.js +12 -4
  75. package/workspace/task-views-test.js +198 -5
  76. package/workspace/test-lists/batch18-live-pill-round.json +10 -0
  77. package/workspace/test-lists/batch18-panels.json +9 -0
  78. package/workspace/test-lists/goals-clear.json +15 -0
  79. package/workspace/test-lists/home-railcard.json +9 -0
  80. package/workspace/test-lists/stage-card-tasks.json +6 -0
  81. package/workspace/tk-tasks-test.js +2 -2
@@ -98,3 +98,5 @@
98
98
  .tkc .tkc-hu { width: 30px; height: 30px; border-radius: 999px; border: 0; background: none; color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer; }
99
99
  .tkc .tkc-hu:hover { background: var(--cz-well); color: var(--cz-ink); }
100
100
  .tkc .seg .ivq-del:hover, .tkc .seg .ivq-del:focus-visible { color: var(--cz-red); background: var(--cz-redbg, transparent); }
101
+ /* one date (batch 18 item 16, StA4Milestone): a milestone's picker names its one day, with no Start and Due tabs */
102
+ .tkc .tkc-dp .one { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px; margin-bottom: 8px; font-size: var(--fs-3); color: var(--cz-ink); }
@@ -126,7 +126,10 @@ function picker(t, o, now) {
126
126
  const tom = (() => { const d = todayOf(now); d.setDate(d.getDate() + 1); return isoOf(d); })();
127
127
  const two = ['start', 'due'].map((f) => `<button type="button" data-tkc-field="${f}"${f === field ? ' class="on" aria-pressed="true"' : ' aria-pressed="false"'}><small>${f === 'start' ? 'Start' : 'Due'}</small><b>${esc(short(t[f]) || 'None')}</b></button>`).join('');
128
128
  const prevM = isoOf(new Date(y, m - 1, 1)).slice(0, 7), nextM = isoOf(new Date(y, m + 1, 1)).slice(0, 7);
129
- return `<div class="tkc-pop tkc-dp" role="dialog" aria-label="Start and due"><div class="two">${two}</div>`
129
+ // one date (batch 18 item 16, StA4Milestone): a milestone has its day only, so the Start and Due tabs give way to "◇ Date"; o.head: a
130
+ // sheet's own head (its title and ✕), drawn first
131
+ const top = o.one ? (o.head ? '' : `<div class="one">${ico('<path d="M12 4l8 8-8 8-8-8z"/>', 14)}<b>Date</b></div>`) : `<div class="two">${two}</div>`;
132
+ return `<div class="tkc-pop tkc-dp${o.one ? ' one' : ''}" role="dialog" aria-label="${o.one ? 'Date' : 'Start and due'}">${o.head || ''}${top}`
130
133
  + `<div class="qk"><button type="button" data-tkc-day="${today}">Today</button><button type="button" data-tkc-day="${tom}">Tomorrow</button><button type="button" data-tkc-day="${fri}">Fri</button>`
131
134
  + `<button type="button" data-tkc-day="" aria-label="Clear the ${field === 'start' ? 'start' : 'due'} date" title="Clear">${ico(I.clear, 14)}</button></div>`
132
135
  + `<div class="mh"><button type="button" class="tkc-ib s" data-tkc-month="${prevM}" aria-label="Previous month">${ico(I.prev, 16)}</button><span>${MONTHS[m]} ${y}</span><button type="button" class="tkc-ib s" data-tkc-month="${nextM}" aria-label="Next month">${ico(I.next, 16)}</button></div>`
@@ -2970,6 +2970,8 @@ const impactTick = () => { try { impactRuns.tick({}); } catch (e) { warnWriteFai
2970
2970
  // the goal's notify is push. At most 2 runs at once, one per product. PMOS_METRIC_READ=off.
2971
2971
  const krMetricsOf = (w) => require(require('./lib/repo-script.js').repoScript('records/index.js')).list(require('./lib/records-dir.js').recordsDirFor(metricDraftCtx(), w.id), 'kr-metrics');
2972
2972
  const goalAlertTell = (w, rec, reading) => tellNeed(w.id, 'goal-alert-' + rec.rid + '-' + reading.at, String(rec.metric || rec.rid), String(rec.metric || rec.rid) + ' broke its limit: ' + reading.txt + ' against its ' + reading.line + ' on ' + reading.at + '. The rollback ticket is drafted on Intelligence.');
2973
+ /** The working hours an hourly goal is read in: the day-check window of Settings (batch 18 item 11). */
2974
+ const metricReadHours = () => { try { const dc = proSettings().dayCheck || {}; return dc.start && dc.end ? { start: dc.start, end: dc.end } : undefined; } catch { return undefined; } };
2973
2975
  const metricReadRuns = require('./lib/metric-read-runs.js').create({
2974
2976
  workspaces: () => [...workspaces.values()],
2975
2977
  isLead: (w) => isPlanNeedsTree(w),
@@ -2980,10 +2982,12 @@ const metricReadRuns = require('./lib/metric-read-runs.js').create({
2980
2982
  testItems: (w, rids) => {
2981
2983
  const d = stateDirFor(w); if (!d) return [];
2982
2984
  const MDx = require('./lib/metric-drafts.js'), S = MDx.read(d).scopes.get(MDx.keyOf('product', w.id));
2983
- return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.text, unit: (r.metric && r.metric.unit) || '', recipe: r.recipe }));
2985
+ return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.name || r.text, unit: (r.metric && r.metric.unit) || r.unit || '', recipe: r.recipe }));
2984
2986
  },
2985
2987
  afterRead: (w, rids, now) => require('./lib/routes-goal-status.js').afterRead({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, tellGoalAlert: goalAlertTell }, w, rids, now),
2986
2988
  open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
2989
+ workOpen: (now) => require('./lib/driver-run.js').dayCheckOpen(proSettings(), now, (n, q) => proactiveLib.inQuietHours(n, q)), // batch 18 item 11: hourly goals
2990
+ hours: () => metricReadHours(),
2987
2991
  headlessOff: () => headlessLib.switchedOff(process.env),
2988
2992
  env: process.env,
2989
2993
  promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
@@ -10289,7 +10293,7 @@ async function handleRequest(req, res) {
10289
10293
  // pm-os-absorb Runs 2–5 — the planning layer's routes, one file per run (lib/route-modules.js). Last, so none shadows a route above.
10290
10294
  // meeting-notes Run 1: the Notes routes keep notes in the per-user runtime directory and start the agent-summary session.
10291
10295
  if (req.method === 'POST' && !(req.headers && req.headers['x-pmos-session'])) orchGate.touch(); // agent-orchestrator: a page press by the PM
10292
- if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, metricReadRuns, tellGoalAlert: goalAlertTell, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
10296
+ if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, metricReadRuns, metricReadHours, tellGoalAlert: goalAlertTell, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
10293
10297
  runtimeDir: STATE, homeRoot: HOME_ENABLED ? SELF_ROOT : null, spawnSession, jevModelOpts, sendToSession, endSupersededRuns, proSettings,
10294
10298
  // premium-chat-session: every premium chat panel is an interactive Claude Code session the PM talks to (text as typed, `/` kept)
10295
10299
  chatSessions,
@@ -22,11 +22,13 @@ Rules that always hold:
22
22
 
23
23
  Procedure:
24
24
  1. Run `pmos metrics reading list` to see the goals of this run.
25
- 2. For each goal, read its recipe's query through its connector. Take the value for the latest complete period of its cadence (yesterday for daily, last week for weekly, last month for monthly).
26
- 3. File it: `pmos metrics reading <rid> <value> --source "<connector> · <what you read, one line>" [--day YYYY-MM-DD]`. --day is the last day of the period the value counts, when it is not today.
27
- 4. A goal you cannot read: `pmos metrics reading <rid> --cant "<why, one line>"` with its fix (rule 6).
28
- 5. Stop when every goal of the run is read or said.
25
+ 2. For each goal, read its recipe's query through its connector. Take the value for the latest complete period of its cadence (the last full hour for hourly, yesterday for daily, last week for weekly, last month for monthly).
26
+ 3. File it: `pmos metrics reading <rid> <value> --source "<connector> · <what you read, one line>" [--day YYYY-MM-DD] [--num N --den D] [--segments "<part>=<num>/<den>,…"] [--period "<week of 19 Oct>"]`. --day is the last day of the period the value counts, when it is not today. When the goal is a rate, give its two counts with --num and --den, and its parts (for example web and app) with --segments when the source splits them. A goal that says how it is counted ("counted as") is read exactly that way.
27
+ 4. PMOS checks every value before it is drawn (a part that reads 0, a jump of more than 3 times, too small a count, a value it cannot be). A value a check fails on is HELD: it is said, not drawn. File the value the source gives anyway; never change it to pass a check.
28
+ 5. A goal you cannot read: `pmos metrics reading <rid> --cant "<why, one line>"` with its fix (rule 6).
29
+ 6. A COMPARE run (the line says the PM's number differs from yours): read the goal your way and the PM's likely way, find why they differ, and file once: `pmos metrics reading <rid> --why "<why, one or two sentences>" --suggest mine|yours --suggest-text "<which to keep and why, one line>" --yours-what "<how the PM counts it, one sentence>" --yours-query "<a query that counts it that way>"`. File no value in a compare run.
30
+ 7. Stop when every goal of the run is read or said.
29
31
 
30
32
  Output contract: produce EXACTLY these sections in your final message:
31
- - Read (each goal, its value and its source)
33
+ - Read (each goal, its value and its source; say a held value as held)
32
34
  - Not read (each goal you could not read, why, and the fix you drafted)
@@ -0,0 +1,396 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* stage-card-tasks-test.js — a task changed where it sits in the initiative's Tasks List (feedback batch 18 item 16, agreed A, Wawan
4
+ * 2026-10-28 13:48 "promote to ready for development then build"; main canvas In development, frames StA1Rows to StA10bDragPhone).
5
+ * Serves the real pages (Home's Viewer, premium.html, and the Board's panel, premium-board.html) from the real server. The Board read is a
6
+ * fixture that answers the writes the way the server does: a rename, a stage, a date, a new task and an order show on the next read.
7
+ * S1 the rows: one line, the due day only on a phone, nothing without dates, "◇ Nov 14", + on each open stage and none on the header
8
+ * S2 a title press opens the row in place: the name field, then one line: status, Start – Due, ⋯ (one row at a time; Esc closes)
9
+ * S3 rename: Enter saves (Undo) · S4 the status chip: the five icons only · S5 the date chips: the picker opens on that day
10
+ * S6 ⋯: Milestone, Move to a stage, Open the task card, Delete · S7 a milestone has one date · S8 + adds into its stage, the field stays
11
+ * S9 a Jira row: title and status read-only, "<Status> in Jira · read N min ago", dates editable, no Delete
12
+ * S10 drag on a desktop: to another stage (section + order), inside a stage (order only, kept on the next read)
13
+ * S11 a long press on a phone's title lifts the row · S12 a milestone on the Timeline is its ◇ only; Kanban says "◇ Nov 14"
14
+ * S13 light and dark, phone and desktop: no page error. PMOS_SHOTS=<dir> writes the screens. */
15
+ const path = require('path');
16
+ const { spawn } = require('child_process');
17
+ const { findBrowser } = require('./lib/find-browser');
18
+ const T = require('./test-run').configure({ name: 'stage-card-tasks' });
19
+ const BP = require('./lib/board-premium.js');
20
+ const F = require('./fixtures/board-premium-facts.js');
21
+ const BRP = require('./lib/briefing-premium.js');
22
+ const BRF = require('./fixtures/briefing-premium-facts.js');
23
+ const IP = require('./lib/initiative-premium.js');
24
+ const IF = require('./fixtures/initiative-premium-facts.js');
25
+
26
+ const BASE = T.BASE, SHOTS = process.env.PMOS_SHOTS || '';
27
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
28
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
29
+ const results = [];
30
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
31
+ let srv = null; let browser = null;
32
+ const finish = async (code) => {
33
+ if (browser) await browser.close().catch(() => {});
34
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
35
+ T.killTmux();
36
+ const bad = results.filter((x) => !x.cond).length;
37
+ console.log(`\n${results.length - bad}/${results.length} stage-card-tasks assertions passed`);
38
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
39
+ };
40
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
41
+
42
+ /* the fixture's day is 2026-10-17; Home's self-serve-v2 and the Board's usage-billing get the same tasks */
43
+ const TASKS = () => [
44
+ { uid: 'task-b1', title: 'Brief support on the device limit', status: 'To do', owner: 'Wawan', start: '2026-10-30', end: '2026-11-06', section: 'build' },
45
+ { uid: 'task-b2', title: 'IDPF-3387 Refactor the AppAuthService', status: 'To do', owner: 'Ruth Lim', start: '2026-10-27', end: '2026-11-07', section: 'build' },
46
+ { uid: 'task-b3', title: 'Device limit enforcement', status: 'To do', owner: 'Sam Hu', start: '2026-11-03', end: '2026-11-12', section: 'build' },
47
+ { uid: 'task-b4', title: 'Session must expire on logout', status: 'To do', owner: 'Sam Hu', section: 'build' },
48
+ { uid: 'task-b5', title: 'Kick-off notes', status: 'Done', owner: 'Wawan', end: '2026-10-12', section: 'build' },
49
+ { uid: 'task-d1', title: 'MAGW migration ready', status: 'To do', owner: 'Wawan', end: '2026-11-14', milestone: true, section: 'deliver' },
50
+ ];
51
+ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', status: 'In progress', raw: 'In Progress' }];
52
+
53
+ (async () => {
54
+ const exe = findBrowser();
55
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
56
+ let chromium;
57
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
58
+ 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, '..') }) });
59
+ await T.waitForServer(BASE);
60
+ browser = await chromium.launch({ executablePath: exe });
61
+
62
+ // where: 'home' (premium.html's Viewer) or 'board' (the Board's panel)
63
+ const open = async ({ where = 'home', w = 390, h = 844, theme = 'light', view = 'list' } = {}) => {
64
+ const touch = w < 700, id = where === 'home' ? 'self-serve-v2' : 'usage-billing';
65
+ const ctx = await browser.newContext({ viewport: { width: w, height: h }, hasTouch: touch, isMobile: touch, colorScheme: theme });
66
+ await ctx.addInitScript((v) => { localStorage.setItem('pmos.tasks.view', v); localStorage.setItem('pmos.tasks.zoom', 'month'); }, view);
67
+ const page = await ctx.newPage(), errors = [], posts = [];
68
+ // the board's state: the writes land here, and the next read shows them
69
+ const S = { tasks: TASKS(), order: {} };
70
+ const M = () => {
71
+ const m = BP.build(F.facts()); const r = m.rows.find((x) => x.id === id);
72
+ r.tasks = S.tasks.map((t) => { const L = S.order[t.section || ''] || [], i = L.indexOf(t.uid); return { ...t, ...(i >= 0 ? { rank: i } : {}) }; });
73
+ r.track = { ...(r.track || {}), tickets: TICKETS };
74
+ m.jira = { ...(m.jira || {}), readAt: new Date(Date.now() - 4 * 60000).toISOString() };
75
+ return m;
76
+ };
77
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
78
+ page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
79
+ await page.route('**/api/board-premium*', (r) => json(r, { ok: true, state: 'ready', model: M(), as_of: Date.now() }));
80
+ await page.route('**/api/board-trail*', (r) => json(r, { ok: false }, 500));
81
+ await page.route('**/api/initiative-premium*', (r) => json(r, { ok: true, state: 'ready', model: IP.build(IF.facts()), as_of: Date.now() }));
82
+ await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.build(BRF.facts()), as_of: Date.now() }));
83
+ await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
84
+ await page.route('**/api/jira/tickets*', (r) => json(r, { ok: false, error: 'not in this check' }));
85
+ await page.route(/\/api\/(boards\/|lifecycle)/, (r) => {
86
+ const rq = r.request(), p = new URL(rq.url()).pathname; if (rq.method() === 'GET') return json(r, { ok: true });
87
+ const b = JSON.parse(rq.postData() || '{}'); posts.push({ path: p, body: b });
88
+ const t = S.tasks.find((x) => x.uid === b.task);
89
+ if (p === '/api/boards/tasks/rename' && t) { const from = t.title; t.title = b.title; return json(r, { ok: true, from }); }
90
+ if (p === '/api/boards/tasks/state' && t) { t.status = b.state; return json(r, { ok: true }); }
91
+ if (p === '/api/boards/tasks/edit' && t) {
92
+ const from = {};
93
+ for (const k of ['start', 'due', 'section', 'milestone']) if (k in b) { const f = k === 'due' ? 'end' : k; from[k] = k === 'milestone' ? !!t.milestone : t[f] || ''; t[f] = b[k]; }
94
+ return json(r, { ok: true, from });
95
+ }
96
+ if (p === '/api/boards/tasks/add') { const uid = 'task-n' + S.tasks.length; S.tasks.push({ uid, title: b.title, status: 'To do', owner: 'Wawan', start: b.start || '', end: b.due || '', section: b.section || '' }); return json(r, { ok: true, item: { uid } }); }
97
+ if (p === '/api/boards/tasks/delete') { S.tasks = S.tasks.filter((x) => x.uid !== b.task); return json(r, { ok: true }); }
98
+ if (p === '/api/boards/tasks/order') { const from = S.order[b.section] || []; S.order[b.section] = b.tasks; return json(r, { ok: true, from }); }
99
+ return json(r, { ok: true });
100
+ });
101
+ if (where === 'home') await page.goto(BASE + '/premium.html?ini=self-serve-v2&ws=w1&board=w1&theme=' + theme);
102
+ else {
103
+ await page.goto(BASE + '/premium-board.html?theme=' + theme);
104
+ await until(() => page.evaluate(() => document.querySelectorAll('#ibBody .ini2, #ibBody .bt-l').length > 0), 20000);
105
+ await page.evaluate(() => { const b = [...document.querySelectorAll('[data-row="board:usage-billing"] .bt-nm, [data-key="board:usage-billing"]')].find((x) => x.offsetParent); if (b) b.click(); });
106
+ }
107
+ await until(() => page.evaluate((v) => !!document.querySelector(v === 'list' ? '#czViewer .iv-wbs' : '#czViewer :is(.ivt, .iva, .ivk)'), view), 20000);
108
+ // Build and Deliver open (the Board's initiative is in Discover; Home's is in Build)
109
+ await openStage(page, 'build'); await openStage(page, 'deliver');
110
+ await sleep(200);
111
+ return { ctx, page, errors, posts, S };
112
+ };
113
+ const openStage = (pg, key) => pg.evaluate((k) => {
114
+ const rest = document.querySelector('#czViewer .iv-rest[aria-expanded="false"]');
115
+ const h = document.querySelector(`#czViewer .iv-ws[data-iv-sec="${k}"]`);
116
+ if (!h && rest) rest.click();
117
+ const h2 = document.querySelector(`#czViewer .iv-ws[data-iv-sec="${k}"]`); if (h2 && h2.getAttribute('aria-expanded') === 'false') h2.click();
118
+ }, key).then(() => sleep(150)).then(() => pg.evaluate((k) => { const h = document.querySelector(`#czViewer .iv-ws[data-iv-sec="${k}"]`); if (h && h.getAttribute('aria-expanded') === 'false') h.click(); }, key)).then(() => sleep(150));
119
+ const shot = async (pg, name) => { if (SHOTS) await pg.screenshot({ path: path.join(SHOTS, name + '.png') }).catch(() => {}); };
120
+ const lastPost = (A, route) => A.posts.filter((x) => x.path === route).pop();
121
+ const toast = (pg) => pg.evaluate(() => { const t = [...document.querySelectorAll('#bdToast, .cz-toast, #czToast, [class*="toast"]')].find((x) => x.getClientRects().length && getComputedStyle(x).visibility !== 'hidden' && /\S/.test(x.textContent)); return t ? t.textContent.replace(/\s+/g, ' ').trim() : ''; });
122
+ const undo = (pg) => pg.evaluate(() => { const L = [...document.querySelectorAll('button')].filter((x) => x.offsetParent && /^Undo$/.test((x.textContent || '').trim() || x.getAttribute('aria-label') || '')); const b = L.pop() || document.querySelector('#bdToast .bd-undo'); if (b) { b.click(); return L.length ? 'also: ' + L.map((x) => x.parentElement.id || x.parentElement.className).join() : true; } return false; });
123
+ const rowsOf = (pg, key) => pg.evaluate((k) => [...document.querySelectorAll(`#czViewer .iv-wl[data-iv-sec="${k}"] > .iv-tr[data-iv-r]`)].map((r) => r.dataset.ivR), key);
124
+
125
+ /* ── Home, phone ── */
126
+ const A = await open(), p = A.page;
127
+ /* S1 the rows */
128
+ await p.evaluate(() => { const m = document.querySelector('#czViewer .iv-wl[data-iv-sec="build"] > .iv-more'); if (m) m.click(); }); await sleep(200); // the fourth open task
129
+ const R1 = await p.evaluate(() => {
130
+ const row = (u) => document.querySelector(`#czViewer .iv-tr[data-iv-r="${u}"]`);
131
+ const vis = (e) => !!e && getComputedStyle(e).display !== 'none' && e.getBoundingClientRect().width > 0;
132
+ const b1 = row('task-b1'), b4 = row('task-b4'), d1 = row('task-d1'), b2 = row('task-b2');
133
+ const tt = b1 && b1.querySelector('.iv-tt').getBoundingClientRect(), dc = b1 && b1.querySelector('.iv-dc').getBoundingClientRect();
134
+ return {
135
+ oneLine: !!(tt && dc && Math.abs((tt.top + tt.height / 2) - (dc.top + dc.height / 2)) < 6 && b1.getBoundingClientRect().height <= 52),
136
+ phoneDue: b1 && b1.querySelector('.iv-dc').innerText.trim(), startHidden: !vis(b1 && b1.querySelector('.iv-dst')),
137
+ undated: b4 && !b4.querySelector('.iv-dc'), ms: d1 && d1.querySelector('.iv-dc').innerText.trim(), msTitleGlyph: !!(d1 && d1.querySelector('.iv-tn .iv-ms')), msIcon: !!(d1 && d1.querySelector('.iv-dc .iv-dms svg')),
138
+ plus: [...document.querySelectorAll('#czViewer .iv-plus')].map((b) => b.getAttribute('aria-label')), headPlus: !!document.querySelector('#czViewer .iv-th [data-iv-add]'),
139
+ jira: b2 && !!b2.querySelector('.iv-jq.ig-sq') && !b2.querySelector('[data-iv-check]'),
140
+ grips: [...document.querySelectorAll('#czViewer .iv-grip')].filter(vis).length,
141
+ };
142
+ });
143
+ ok('S1 a phone row is one line: the title, its due day at the right (the start hidden)', R1.oneLine && R1.phoneDue === 'Nov 6' && R1.startHidden, JSON.stringify(R1));
144
+ ok('S1 a row with no dates shows none (zero is silence)', R1.undated, JSON.stringify(R1));
145
+ ok('S1 a milestone row says "◇ Nov 14", its ◇ once (not after the title)', R1.ms === 'Nov 14' && R1.msIcon && !R1.msTitleGlyph, JSON.stringify(R1));
146
+ ok('S1 each open stage has its own icon-only + ("New task in …"); the Tasks header has none', R1.plus.join('|') === 'New task in Build|New task in Deliver' && !R1.headPlus, JSON.stringify(R1));
147
+ ok('S1 a Jira row shows the square for its Jira status, no box; a phone draws no grip', R1.jira && R1.grips === 0, JSON.stringify(R1));
148
+ await shot(p, 'S1-rows-390');
149
+
150
+ /* S2 open in place */
151
+ await p.click('#czViewer [data-iv-edit="task-b1"]');
152
+ // the field takes the focus a frame or more after the row opens (ini-edit.js focusLater): wait for it, a slow runner is late
153
+ await until(() => p.evaluate(() => !!document.activeElement && document.activeElement.matches('#czViewer .iv-ed[data-iv-open="task-b1"] .iv-edn')), 4000);
154
+ const R2 = await until(() => p.evaluate(() => {
155
+ const r = document.querySelector('#czViewer .iv-ed[data-iv-open="task-b1"]'); if (!r) return null;
156
+ const f = r.querySelector('.iv-edn'), line = [...r.querySelectorAll('.iv-edl > *')].map((e) => e.getAttribute('aria-label') || e.textContent.trim());
157
+ const dates = [...r.querySelectorAll('.iv-edd')], more = r.querySelector('[data-iv-more]');
158
+ return { val: f && f.value, focus: document.activeElement === f, line, moreAfter: !!(more && dates.length && more.getBoundingClientRect().left - dates[dates.length - 1].getBoundingClientRect().right < 40), h: Math.round(more.getBoundingClientRect().height) };
159
+ }));
160
+ ok('S2 a title press opens the row in place: the name field, focused', R2 && R2.val === 'Brief support on the device limit' && R2.focus, JSON.stringify(R2));
161
+ ok('S2 one line under it: the status chip, Start – Due, then ⋯ right after the dates', R2 && R2.line.join('|') === 'Status: To do. Change|Start: Oct 30. Change|–|Due: Nov 6. Change|More for this task' && R2.moreAfter, JSON.stringify(R2));
162
+ ok('S2 ⋯ is a 44 px target on a phone', R2 && R2.h >= 44, JSON.stringify(R2));
163
+ await shot(p, 'S2-open-390');
164
+ await p.click('#czViewer [data-iv-edit="task-b3"]');
165
+ const one = await until(() => p.evaluate(() => { const o = [...document.querySelectorAll('#czViewer .iv-ed')].map((r) => r.dataset.ivOpen); return o.length === 1 && o[0] === 'task-b3' ? o : null; }));
166
+ ok('S2 one row is open at a time', !!one, JSON.stringify(one));
167
+ await p.keyboard.press('Escape');
168
+ ok('S2 Esc closes it', await until(() => p.evaluate(() => !document.querySelector('#czViewer .iv-ed')), 3000));
169
+
170
+ /* S3 rename */
171
+ await p.click('#czViewer [data-iv-edit="task-b1"]');
172
+ await until(() => p.evaluate(() => document.activeElement && document.activeElement.matches('.iv-edn')));
173
+ await p.keyboard.press('End'); await p.keyboard.type(' (v2)'); await p.keyboard.press('Enter');
174
+ const rn = await until(() => lastPost(A, '/api/boards/tasks/rename'));
175
+ ok('S3 Enter saves the new name (POST /api/boards/tasks/rename)', rn && rn.body.task === 'task-b1' && rn.body.title === 'Brief support on the device limit (v2)', JSON.stringify(rn));
176
+ const t3 = await until(async () => { const t = await toast(p); return /Renamed/.test(t) ? t : null; }, 4000);
177
+ ok('S3 the toast says Renamed, with Undo; the row closes and shows the new name', /Undo/.test(t3 || '') && await until(() => p.evaluate(() => !document.querySelector('#czViewer .iv-ed') && /\(v2\)/.test(document.querySelector('#czViewer [data-iv-edit="task-b1"]').textContent))), t3);
178
+ await undo(p);
179
+ const ru = await until(() => A.posts.filter((x) => x.path === '/api/boards/tasks/rename').length === 2 ? lastPost(A, '/api/boards/tasks/rename') : null);
180
+ ok('S3 Undo puts the old name back', ru && ru.body.title === 'Brief support on the device limit', JSON.stringify(ru));
181
+
182
+ /* S4 the status chip */
183
+ await p.click('#czViewer [data-iv-edit="task-b1"]');
184
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed')));
185
+ await p.click('#czViewer .iv-ed .iv-edst');
186
+ const st = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq .ivq-st'); return q ? { n: q.querySelectorAll('[data-ivq-state]').length, ms: !!q.querySelector('.ivq-ms'), del: !!q.querySelector('.ivq-del') } : null; }));
187
+ ok('S4 the status chip opens the task card\'s five status icons only (the ◇ and Delete are in ⋯)', st && st.n === 5 && !st.ms && !st.del, JSON.stringify(st));
188
+ await shot(p, 'S4-status-390');
189
+ await p.click('.tkc.ivq [data-ivq-state="In progress"]');
190
+ const sp = await until(() => lastPost(A, '/api/boards/tasks/state'));
191
+ ok('S4 a status picked there saves at once', sp && sp.body.task === 'task-b1' && sp.body.state === 'In progress', JSON.stringify(sp));
192
+
193
+ /* S5 the date chips: a phone's picker is a bottom sheet; Start opens on the start */
194
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed [data-f="start"]')));
195
+ await p.click('#czViewer .iv-ed [data-f="start"]');
196
+ const dp = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq.sheet .tkc-dp'); if (!q) return null; const r = q.getBoundingClientRect(); return { on: (q.querySelector('[data-tkc-field].on') || {}).textContent, bottom: Math.round(innerHeight - r.bottom), head: (q.querySelector('.ivd-h b') || {}).textContent, sub: (q.querySelector('.ivd-s') || {}).textContent }; }));
197
+ ok('S5 Start opens the task card\'s picker on the start day, as a bottom sheet on a phone', dp && dp.on === 'StartOct 30' && dp.bottom <= 1 && dp.head === 'Dates' && /Brief support/.test(dp.sub || ''), JSON.stringify(dp));
198
+ await shot(p, 'S5-dates-390');
199
+ await p.click('.tkc.ivq [data-tkc-day="2026-10-28"]');
200
+ const ds = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.start === '2026-10-28' ? x : null; });
201
+ const dueNext = await until(() => p.evaluate(() => (document.querySelector('.tkc.ivq [data-tkc-field].on') || {}).textContent));
202
+ ok('S5 a start picked saves at once, and the next tap is the due day', !!ds && /^Due/.test(dueNext || ''), JSON.stringify({ ds, dueNext }));
203
+ await p.click('.tkc.ivq [data-ivd-x]');
204
+
205
+ /* S6 ⋯ */
206
+ await until(() => p.evaluate(() => !document.querySelector('.tkc.ivq')));
207
+ if (!(await p.$('#czViewer .iv-ed'))) await p.click('#czViewer [data-iv-edit="task-b1"]');
208
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed [data-iv-more]')));
209
+ await p.click('#czViewer .iv-ed [data-iv-more]');
210
+ const mm = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq .ive-m'); return q ? [...q.querySelectorAll('button')].map((b) => b.textContent.trim()) : null; }));
211
+ ok('S6 ⋯ holds Milestone, Move to a stage, Open the task card and Delete task', mm && mm.join('|') === 'Milestone|Move to a stage|Open the task card|Delete task', JSON.stringify(mm));
212
+ await shot(p, 'S6-more-390');
213
+ await p.click('.tkc.ivq [data-ive-mv]');
214
+ const sl = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq .ive-m'); const b = q && [...q.querySelectorAll('[data-ive-to]')]; return b && b.length ? b.map((x) => x.textContent.trim() + (x.getAttribute('aria-checked') === 'true' ? '*' : '')) : null; }));
215
+ ok('S6 Move to a stage lists the workflow\'s stages, the task\'s own checked', sl && sl.includes('Build*') && sl.includes('Deliver') && sl[sl.length - 1] === 'Not in a stage', JSON.stringify(sl));
216
+ await p.click('.tkc.ivq [data-ive-to="deliver"]');
217
+ const mv = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.section === 'deliver' ? x : null; });
218
+ const t6 = await until(async () => { const t = await toast(p); return /Moved to Deliver/.test(t) ? t : null; }, 4000);
219
+ const inD = await until(async () => ((await rowsOf(p, 'deliver')).includes('task-b1') ? true : null), 4000);
220
+ ok('S6 a stage picked there moves the task (section), "Moved to Deliver" with Undo, and it shows under Deliver', mv && /Undo/.test(t6 || '') && inD, JSON.stringify({ mv, t6 }));
221
+ await undo(p);
222
+ const mu = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.section === 'build' ? x : null; });
223
+ ok('S6 Undo puts it back in Build', !!mu, JSON.stringify(A.posts.slice(-2)));
224
+
225
+ /* S7 a milestone has one date */
226
+ await until(async () => (await rowsOf(p, 'build')).includes('task-b1'));
227
+ await p.click('#czViewer [data-iv-edit="task-b3"]');
228
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed [data-iv-more]')));
229
+ await p.click('#czViewer .iv-ed [data-iv-more]');
230
+ await until(() => p.evaluate(() => !!document.querySelector('.tkc.ivq [data-ive-ms]')));
231
+ await p.click('.tkc.ivq [data-ive-ms]');
232
+ const ms = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.milestone === true ? x : null; });
233
+ ok('S7 ⋯ Milestone makes it a milestone and clears its start (one date), keeping the due day', ms && ms.body.task === 'task-b3' && ms.body.start === '' && ms.body.due == null, JSON.stringify(ms));
234
+ const one7 = await until(() => p.evaluate(() => { const r = document.querySelector('#czViewer .iv-ed[data-iv-open="task-b3"]'); if (!r) return null; const d = [...r.querySelectorAll('.iv-edd')]; return d.length === 1 && d[0].dataset.one === '1' ? d[0].getAttribute('aria-label') : null; }));
235
+ ok('S7 the open row then shows one ◇ date chip, no Start and Due', one7 === 'Milestone date: Nov 12. Change', one7);
236
+ await p.click('#czViewer .iv-ed .iv-edd');
237
+ const op7 = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq .tkc-dp'); return q ? { tabs: q.querySelectorAll('[data-tkc-field]').length, head: (q.querySelector('.ivd-h b') || {}).textContent, sub: (q.querySelector('.ivd-s') || {}).textContent } : null; }));
238
+ ok('S7 its picker is one date: "◇ Date", no Start and Due tabs', op7 && op7.tabs === 0 && op7.head === 'Date' && /one date: the milestone/.test(op7.sub || ''), JSON.stringify(op7));
239
+ await shot(p, 'S7-milestone-390');
240
+ await p.click('.tkc.ivq [data-tkc-day="2026-11-13"]');
241
+ const m7 = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.due === '2026-11-13' ? x : null; });
242
+ ok('S7 a day picked saves the due day only, and the picker closes', m7 && m7.body.start == null && await until(() => p.evaluate(() => !document.querySelector('.tkc.ivq')), 2000), JSON.stringify(m7));
243
+ await p.keyboard.press('Escape');
244
+
245
+ await until(async () => /Dates saved/.test(await toast(p)), 3000); // the date's toast lands after its read
246
+ /* S8 + on a stage */
247
+ await p.click('#czViewer .iv-plus[data-iv-plus="build"]');
248
+ await until(() => p.evaluate(() => !!document.activeElement && document.activeElement.matches('#czViewer .iv-addin input')), 4000);
249
+ const f8 = await until(() => p.evaluate(() => { const f = document.querySelector('#czViewer .iv-wl[data-iv-sec="build"] > .iv-addin'); if (!f) return null; const first = f.parentElement.firstElementChild; return { top: first === f, ph: f.querySelector('input').placeholder, focus: document.activeElement === f.querySelector('input'), dates: !!f.parentElement.querySelector('.iv-addd [data-iv-adddt]') }; }));
250
+ ok('S8 + opens the field at the top of that stage, focused, with an optional Dates chip', f8 && f8.top && f8.ph === 'New task in Build' && f8.focus && f8.dates, JSON.stringify(f8));
251
+ await p.keyboard.type('Release note for app teams'); await p.keyboard.press('Enter');
252
+ const ad = await until(() => lastPost(A, '/api/boards/tasks/add'));
253
+ ok('S8 Enter adds the task into that stage (section build)', ad && ad.body.title === 'Release note for app teams' && ad.body.section === 'build', JSON.stringify(ad));
254
+ const t8 = await until(async () => { const t = await toast(p); return /Added to Build/.test(t) ? t : null; }, 4000);
255
+ const k8 = await until(() => p.evaluate(() => { const i = document.querySelector('#czViewer .iv-addin input'); return i && i.value === '' && document.activeElement === i ? true : null; }), 4000);
256
+ ok('S8 the toast says "Added to Build" with Undo; the field stays open, empty and focused', /Undo/.test(t8 || '') && k8, JSON.stringify({ t8, k8 }));
257
+ await shot(p, 'S8-add-390');
258
+ const u8 = await undo(p);
259
+ const du = await until(() => lastPost(A, '/api/boards/tasks/delete'));
260
+ ok('S8 Undo takes the new task out', du && /^task-n/.test(du.body.task || ''), JSON.stringify({ u8, du, last: A.posts.slice(-3) }));
261
+ await p.keyboard.press('Escape');
262
+ ok('S8 Esc closes the field', await until(() => p.evaluate(() => !document.querySelector('#czViewer .iv-addin')), 3000));
263
+
264
+ /* S9 a Jira row */
265
+ await p.click('#czViewer [data-iv-edit="task-b2"]');
266
+ const j9 = await until(() => p.evaluate(() => { const r = document.querySelector('#czViewer .iv-ed[data-iv-open="task-b2"]'); if (!r) return null; return { field: !!r.querySelector('input'), st: !!r.querySelector('.iv-edst'), line: (r.querySelector('.iv-edj') || {}).textContent, dates: r.querySelectorAll('.iv-edd').length }; }));
267
+ ok('S9 a Jira row in place: the title and status read-only, "In Progress in Jira · read 4 min ago", start and due editable', j9 && !j9.field && !j9.st && j9.line === 'In Progress in Jira · read 4 min ago' && j9.dates === 2, JSON.stringify(j9));
268
+ await shot(p, 'S9-jira-390');
269
+ await p.click('#czViewer .iv-ed [data-f="due"]');
270
+ await until(() => p.evaluate(() => !!document.querySelector('.tkc.ivq .tkc-dp')));
271
+ await p.click('.tkc.ivq [data-tkc-day="2026-11-09"]');
272
+ const jd = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.task === 'task-b2' ? x : null; });
273
+ ok('S9 its due day saves to the task, kept in PMOS', jd && jd.body.due === '2026-11-09', JSON.stringify(jd));
274
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .iv-ed [data-iv-more]')));
275
+ await p.click('#czViewer .iv-ed [data-iv-more]');
276
+ const jm = await until(() => p.evaluate(() => { const q = document.querySelector('.tkc.ivq .ive-m'); return q ? [...q.querySelectorAll('button')].map((b) => b.textContent.trim()) : null; }));
277
+ ok('S9 its ⋯ has Open the ticket and no Delete; the ◇ is allowed', jm && jm.join('|') === 'Milestone|Move to a stage|Open the ticket', JSON.stringify(jm));
278
+ await p.keyboard.press('Escape'); await p.keyboard.press('Escape');
279
+
280
+ /* S11 a long press on a phone's title lifts the row; a drop on Deliver's header moves it there */
281
+ await until(() => p.evaluate(() => !document.querySelector('.tkc.ivq')));
282
+ {
283
+ const n0 = A.posts.length;
284
+ await p.evaluate(() => document.querySelector('#czViewer .iv-ws[data-iv-sec="deliver"]').scrollIntoView({ block: 'center' })); await sleep(200);
285
+ const at = await p.evaluate(() => { const t = document.querySelector('#czViewer [data-iv-edit="task-b3"]').getBoundingClientRect(), h = document.querySelector('#czViewer .iv-ws[data-iv-sec="deliver"]').getBoundingClientRect(); return { x: t.left + 30, y: t.top + t.height / 2, hx: h.left + 80, hy: h.top + h.height / 2 }; });
286
+ const pre11 = await p.evaluate(() => ({ fly: !!document.querySelector('.iv-fly'), ed: !!document.querySelector('#czViewer .iv-ed, #czViewer .iv-addin'), dl: document.querySelectorAll('.iv-dl').length }));
287
+ const cdp = await p.context().newCDPSession(p);
288
+ await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: [{ x: at.x, y: at.y }] });
289
+ await sleep(650);
290
+ const lifted = await p.evaluate(() => ({ fly: !!document.querySelector('.iv-fly'), ghost: !!document.querySelector('#czViewer .iv-tr.iv-ghost') }));
291
+ for (let i = 1; i <= 8; i++) { await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: [{ x: at.x + (at.hx - at.x) * i / 8, y: at.y + (at.hy - at.y) * i / 8 }] }); await sleep(40); }
292
+ const mid = await p.evaluate(([x, y]) => ({ at: (() => { const e = document.elementFromPoint(x, y); return e ? e.className + ' < ' + (e.parentElement || {}).className + ' wbs:' + !!e.closest('.iv-wbs') : null; })(), fly: (document.querySelector('.iv-fly') || {}).className, tgt: (document.querySelector('#czViewer .iv-ws.iv-tgt') || {}).dataset, line: !!document.querySelector('#czViewer .iv-dl:not([hidden])'), tip: (document.querySelector('.iv-dtip') || {}).textContent }), [at.hx, at.hy]);
293
+ await shot(p, 'S11-drag-390');
294
+ await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] });
295
+ ok('S11 a long press on the title lifts the row: it follows the finger, its slot stays as a dashed ghost', lifted.fly && lifted.ghost, JSON.stringify(lifted));
296
+ ok('S11 over Deliver\'s header the stage lights up and a blue line shows where it lands', mid.tgt && mid.tgt.ivSec === 'deliver' && mid.line && /^Drop: last in Deliver/.test(mid.tip || ''), JSON.stringify({ mid, pre11, at }));
297
+ const mv11 = await until(() => { const x = A.posts.slice(n0).find((y) => y.path === '/api/boards/tasks/edit' && y.body.section === 'deliver'); return x || null; });
298
+ const or11 = await until(() => A.posts.slice(n0).find((y) => y.path === '/api/boards/tasks/order') || null);
299
+ ok('S11 the drop moves it to Deliver (section) and writes the order there, last', mv11 && mv11.body.task === 'task-b3' && or11 && or11.body.section === 'deliver' && or11.body.tasks[or11.body.tasks.length - 1] === 'task-b3', JSON.stringify({ mv11, or11 }));
300
+ ok('S11 the click after the lift opens nothing', await p.evaluate(() => !document.querySelector('#czViewer .iv-ed')));
301
+ }
302
+ ok('S13 Home phone light: no page error', A.errors.length === 0, A.errors.join(' | '));
303
+ await A.ctx.close();
304
+
305
+ /* ── the Board's panel, desktop ── */
306
+ const B = await open({ where: 'board', w: 1440, h: 900 }), q = B.page;
307
+ await q.hover('#czViewer .iv-tr[data-iv-r="task-b1"]');
308
+ const R10 = await q.evaluate(() => { const r = document.querySelector('#czViewer .iv-tr[data-iv-r="task-b1"]'), g = r.querySelector('.iv-grip'); return { grip: !!g && getComputedStyle(g).opacity === '1', dates: r.querySelector('.iv-dc').textContent.replace(/\s+/g, ' ').trim(), av: !!r.querySelector('.iv-rav') }; });
309
+ ok('S10 desktop: a row shows start – due at the right and the owner\'s face; on hover the grip shows', R10.grip && R10.dates === 'Oct 30 – Nov 6' && R10.av, JSON.stringify(R10));
310
+ await shot(q, 'S10-rows-1440');
311
+ // inside the stage: the third row above the first
312
+ const b0 = await rowsOf(q, 'build');
313
+ const drag = async (fromSel, toSel, dy = 0) => {
314
+ const g = await q.evaluate((s) => { const e = document.querySelector(s).getBoundingClientRect(); return { x: e.left + e.width / 2, y: e.top + e.height / 2 }; }, fromSel);
315
+ await q.mouse.move(g.x, g.y); await q.mouse.down();
316
+ const t = await q.evaluate(([s, d]) => { const e = document.querySelector(s).getBoundingClientRect(); return { x: e.left + 60, y: e.top + (d === 'top' ? 4 : e.height / 2) }; }, [toSel, dy]);
317
+ for (let i = 1; i <= 10; i++) { await q.mouse.move(g.x + (t.x - g.x) * i / 10, g.y + (t.y - g.y) * i / 10); await sleep(20); }
318
+ return async () => { await q.mouse.up(); };
319
+ };
320
+ const n1 = B.posts.length;
321
+ const drop1 = await drag(`#czViewer .iv-tr[data-iv-r="${b0[2]}"] .iv-grip`, `#czViewer .iv-tr[data-iv-r="${b0[0]}"]`, 'top');
322
+ const mid1 = await q.evaluate(() => ({ line: !!document.querySelector('#czViewer .iv-dl:not([hidden])'), ghost: !!document.querySelector('#czViewer .iv-ghost'), tgt: (document.querySelector('#czViewer .iv-ws.iv-tgt') || {}).dataset }));
323
+ await shot(q, 'S10-drag-1440');
324
+ await drop1();
325
+ const o1 = await until(() => B.posts.slice(n1).find((x) => x.path === '/api/boards/tasks/order') || null);
326
+ ok('S10 dragging a row up inside its stage shows the ghost, the lit stage and the line; the drop saves the order only', mid1.line && mid1.ghost && mid1.tgt && mid1.tgt.ivSec === 'build' && o1 && o1.body.section === 'build' && o1.body.tasks.slice(0, 3).join() === [b0[2], b0[0], b0[1]].join() && o1.body.tasks.includes('task-b4') && !B.posts.slice(n1).some((x) => x.path === '/api/boards/tasks/edit'), JSON.stringify({ mid1, o1, b0 }));
327
+ const b1 = await until(async () => { const r = await rowsOf(q, 'build'); return r[0] === b0[2] ? r : null; }, 5000);
328
+ ok('S10 the new order shows on the next read (a task-order record)', !!b1, JSON.stringify(b1));
329
+ const t10 = await until(async () => { const t = await toast(q); return /Order saved/.test(t) ? t : null; }, 4000);
330
+ await undo(q);
331
+ const ou = await until(() => { const L = B.posts.filter((x) => x.path === '/api/boards/tasks/order'); return L.length === 2 ? L[1] : null; });
332
+ ok('S10 "Order saved" with Undo; Undo puts the old order back', /Undo/.test(t10 || '') && ou && Array.isArray(ou.body.tasks) && ou.body.tasks.length === 0, JSON.stringify({ t10, ou }));
333
+ // into another stage (once the Undo's read has put the rows back)
334
+ await until(async () => (await rowsOf(q, 'build')).join() === b0.join(), 5000);
335
+ const n2 = B.posts.length;
336
+ const drop2 = await drag('#czViewer .iv-tr[data-iv-r="task-b1"] .iv-grip', '#czViewer .iv-ws[data-iv-sec="deliver"]');
337
+ await drop2();
338
+ const e2 = await until(() => B.posts.slice(n2).find((x) => x.path === '/api/boards/tasks/edit') || null);
339
+ const o2 = await until(() => B.posts.slice(n2).find((x) => x.path === '/api/boards/tasks/order') || null);
340
+ ok('S10 a drop on another stage moves it there (section) and puts it last; status and dates stay', e2 && e2.body.section === 'deliver' && !('start' in e2.body) && !('due' in e2.body) && o2 && o2.body.section === 'deliver' && o2.body.tasks.join() === 'task-d1,task-b1', JSON.stringify({ e2, o2 }));
341
+ // ⋯ › Open the task card opens the one task editor
342
+ await until(async () => (await rowsOf(q, 'deliver')).includes('task-b1')); await sleep(500);
343
+ await q.click('#czViewer [data-iv-edit="task-b1"]');
344
+ const R8 = await until(() => q.evaluate(() => { const r = document.querySelector('#czViewer .iv-ed[data-iv-open="task-b1"]'); if (!r) return null; const d = [...r.querySelectorAll('.iv-edd')], m = r.querySelector('[data-iv-more]'); return { gap: Math.round(m.getBoundingClientRect().left - d[d.length - 1].getBoundingClientRect().right), w: Math.round(r.getBoundingClientRect().width) }; }));
345
+ ok('S2 desktop: ⋯ sits right after the dates, not at the far edge', R8 && R8.gap < 30, JSON.stringify(R8));
346
+ await shot(q, 'S2-open-1440');
347
+ await q.click('#czViewer .iv-ed [data-iv-more]');
348
+ await until(() => q.evaluate(() => !!document.querySelector('.tkc.ivq [data-ive-card]')));
349
+ await shot(q, 'S6-more-1440');
350
+ await q.click('.tkc.ivq [data-ive-card]');
351
+ ok('S6 Open the task card opens the one task editor', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .tkc, #czViewer [data-cz-vw="back"]')), 6000));
352
+ ok('S13 Board desktop light: no page error', B.errors.length === 0, B.errors.join(' | '));
353
+ await B.ctx.close();
354
+
355
+ /* S12 the Timeline and Kanban */
356
+ const C = await open({ where: 'board', w: 1440, h: 900, view: 'timeline' }), c = C.page;
357
+ await c.evaluate(() => { const b = [...document.querySelectorAll('#czViewer .ivt-gh')].find((x) => /Deliver/.test(x.textContent) && x.getAttribute('aria-expanded') === 'false'); if (b) b.click(); });
358
+ const T12 = await until(() => c.evaluate(() => { const d = document.querySelector('#czViewer .ivt [data-ivt-bar="task-d1"]'); return d ? { cls: d.className, one: d.dataset.one, label: (document.querySelector('#czViewer .ivt-ms.lb b') || {}).textContent } : null; }));
359
+ ok('S12 Timeline: a milestone is its ◇ on its date with no bar, the date beside it', T12 && /\bivt-d\b/.test(T12.cls) && /\bms\b/.test(T12.cls) && !/ivt-b/.test(T12.cls) && T12.label === 'Nov 14', JSON.stringify(T12));
360
+ await c.click('#czViewer .ivt [data-ivt-bar="task-d1"]');
361
+ const p12 = await until(() => c.evaluate(() => { const q = document.querySelector('.tkc.ivq .tkc-dp'); return q ? { tabs: q.querySelectorAll('[data-tkc-field]').length, one: !!q.querySelector('.one') } : null; }));
362
+ ok('S12 its press opens the one-date picker', p12 && p12.tabs === 0 && p12.one, JSON.stringify(p12));
363
+ await c.keyboard.press('Escape');
364
+ await shot(c, 'S12-timeline-1440');
365
+ const dms = await c.evaluate(() => { const d = document.querySelector('#czViewer .ivt [data-ivt-bar="task-d1"]').getBoundingClientRect(); return { x: d.left + d.width / 2, y: d.top + d.height / 2 }; });
366
+ await c.mouse.move(dms.x, dms.y); await c.mouse.down();
367
+ for (let i = 1; i <= 6; i++) { await c.mouse.move(dms.x + i * 6, dms.y); await sleep(20); }
368
+ await c.mouse.up();
369
+ const dd = await until(() => { const x = lastPost(C, '/api/boards/tasks/edit'); return x && x.body.task === 'task-d1' ? x : null; });
370
+ ok('S12 dragging the ◇ moves its date (the due day only)', dd && /^2026-11-\d\d$/.test(dd.body.due || '') && dd.body.due !== '2026-11-14' && !('start' in dd.body), JSON.stringify(dd));
371
+ await c.evaluate(() => { localStorage.setItem('pmos.tasks.view', 'kanban'); });
372
+ await c.evaluate(() => document.querySelector('#czViewer [data-iv-vbtn]').click());
373
+ await until(() => c.evaluate(() => !!document.querySelector('.tkc.ivq .ivs')));
374
+ await c.click('.tkc.ivq [data-ivs-view="kanban"]'); await c.keyboard.press('Escape');
375
+ await c.evaluate(() => { const b = document.querySelector('#czViewer [data-iv-kstage]'); if (b) b.click(); });
376
+ await until(() => c.evaluate(() => !!document.querySelector('.tkc.ivq .ivq-m')));
377
+ await c.evaluate(() => { const b = [...document.querySelectorAll('.tkc.ivq .ivq-m button')].find((x) => /Deliver/.test(x.textContent)); if (b) b.click(); });
378
+ const k12 = await until(() => c.evaluate(() => { const d = [...document.querySelectorAll('#czViewer .ivk-d')].find((x) => /MAGW migration ready/.test(x.textContent)); return d ? { date: (d.querySelector('.iv-dc') || {}).innerText, glyph: !!d.querySelector('.iv-dms svg'), title: !!d.querySelector('.iv-tt + .iv-ms') } : null; }));
379
+ ok('S12 Kanban: a milestone card says "◇ Nov 14" (its ◇ once)', k12 && /^Nov \d+$/.test((k12.date || '').trim()) && k12.glyph && !k12.title, JSON.stringify(k12));
380
+ await shot(c, 'S12-kanban-1440');
381
+ ok('S13 Board Timeline and Kanban: no page error', C.errors.length === 0, C.errors.join(' | '));
382
+ await C.ctx.close();
383
+
384
+ /* S13 dark, phone and desktop */
385
+ for (const [where, w, h] of [['home', 390, 844], ['board', 1440, 900], ['home', 1440, 900]]) {
386
+ const D = await open({ where, w, h, theme: 'dark' }), d = D.page;
387
+ await d.click('#czViewer [data-iv-edit="task-b1"]');
388
+ await until(() => d.evaluate(() => !!document.querySelector('#czViewer .iv-ed')));
389
+ const bg = await d.evaluate(() => { const r = document.querySelector('#czViewer .iv-ed'), f = r.querySelector('.iv-edn'); return { row: getComputedStyle(r).backgroundColor, field: getComputedStyle(f).backgroundColor, ink: getComputedStyle(f).color }; });
390
+ ok(`S13 ${where} ${w} dark: the open row and its field take the dark tokens`, bg.row !== 'rgb(255, 255, 255)' && bg.field !== 'rgb(255, 255, 255)' && bg.ink !== 'rgb(0, 0, 0)', JSON.stringify(bg));
391
+ await shot(d, `S13-${where}-${w}-dark`);
392
+ ok(`S13 ${where} ${w} dark: no page error`, D.errors.length === 0, D.errors.join(' | '));
393
+ await D.ctx.close();
394
+ }
395
+ return finish();
396
+ })();
@@ -122,7 +122,9 @@ async function pure() {
122
122
  /* re-pointed (batch 18 item 1, the card and the mission): the card's head names the stage; the mission draws a strip part a stage with the
123
123
  * current one marked; a tap on the picture opens in place "N of M done", ⋯ (the stage picker) and → the next stage, then the stages and
124
124
  * milestones with their dates. The steps are said once, in Tasks */
125
- const openMi = async (p) => { if (!(await p.evaluate((v) => !!document.querySelector(v + ' .iv-mio'), V))) await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await until(() => p.evaluate((v) => !!document.querySelector(v + ' .iv-mio'), V)); };
125
+ // the dates line shows when it is drawn: always on a desktop (Wawan 11:58), after the picture's tap on a phone
126
+ const miShown = (p) => p.evaluate((v) => { const m = document.querySelector(v + ' .iv-mio'); return !!m && getComputedStyle(m).display !== 'none'; }, V);
127
+ const openMi = async (p) => { if (!(await miShown(p))) await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await until(() => miShown(p)); };
126
128
  const card = (p) => p.evaluate((v) => {
127
129
  const c = document.querySelector(v + ' .iv-sc'); const t = (n) => (n ? n.textContent.replace(/\s+/g, ' ').trim() : '');
128
130
  const go = c.querySelector('.iv-scgo');
@@ -139,7 +141,7 @@ async function pure() {
139
141
  const c0 = await card(p);
140
142
  ok('D1 the header names the stage', c0.stage === 'Build', JSON.stringify(c0));
141
143
  ok('D1 the mission\'s strip holds one part a stage of the workflow, the current one marked', c0.bars === 8 && c0.now === 1, JSON.stringify(c0));
142
- ok('D1 the next stage waits in place until the picture is tapped (one primary: the ask\'s)', !c0.next, JSON.stringify(c0));
144
+ ok('D1 the next stage waits in place until the picture is tapped while the Viewer is one column (one primary: the ask\'s)', !(await miShown(p)), JSON.stringify(c0));
143
145
  await openMi(p);
144
146
  const c = await card(p);
145
147
  ok('D1 a tap on the picture opens in place: ⋯ for the stage and the next stage; no list of the stages, the picture shows them (Wawan 10:59)', c.more && c.stageRows === 0, JSON.stringify(c));
@@ -184,13 +186,19 @@ async function pure() {
184
186
  const f = BF.facts(); f.rows = f.rows.map((r) => (r.id === 'self-serve-v2' ? { ...r, stage: 'Build', start: '2026-06-01', end: '2027-02-01', status: 'on track' } : r));
185
187
  const B = BP.build(f), row = B.rows.find((x) => x.id === 'self-serve-v2'); row.tasks = TASKS; row.start = '2026-06-01'; row.end = '2027-02-01';
186
188
  const A = await open({ w: 1440, h: 900, board: B }), p = A.page;
187
- if (!(await p.evaluate((v) => document.querySelector(v + ' .iv').getBoundingClientRect().width >= 820, V))) await p.click('#czViewer [data-cz-vw="wide"]');
189
+ if (!(await p.evaluate((v) => document.querySelector(v + ' .iv').getBoundingClientRect().width >= 820, V))) await p.evaluate(() => window.czViewer.wide(true)); // Home's header has ⧉ in place of ⤢ since batch 18 item 15; wide() is the same width
188
190
  const mc = await until(() => p.evaluate((v) => { const m = document.querySelector(v + ' .iv-cl > .iv-msc'); if (!m || !m.offsetParent) return null; const rows = [...m.querySelectorAll('.iv-msr')];
189
191
  return { head: m.querySelector('.iv-msh').textContent.replace(/\s+/g, ' ').trim(), rows: rows.map((r) => r.className.replace('iv-msr', '').trim() + ':' + r.textContent.replace(/\s+/g, ' ').trim()), tick: m.querySelectorAll('.iv-msr.dn .iv-msk.dn svg').length,
190
192
  press: rows.every((r) => r.dataset.ivMs && /Open its task$/.test(r.getAttribute('aria-label'))), after: !!(m.previousElementSibling && m.previousElementSibling.classList.contains('iv-card')) }; }, V));
191
193
  ok('D1b the Milestones card sits under the card: "Milestones 1 of 3 done", the done one ticked', !!mc && mc.after && /^Milestones ?1 of 3 done$/.test(mc.head) && mc.tick === 1 && /^dn:Brief signed off/.test(mc.rows[0]), JSON.stringify(mc));
192
194
  ok('D1b the next one is marked with "in N days", and the release says so', !!mc && /^up:Rollout to all workspacesDec 1 · in \d+ days · release$/.test(mc.rows[1]) && /^:Did it work\?Feb 1/.test(mc.rows[2]), JSON.stringify(mc && mc.rows));
193
195
  ok('D1b each row is a press for its task', !!mc && mc.press, JSON.stringify(mc));
196
+ // Wawan 11:58 (0.442.0 hotfix): in two columns the dates line, ⋯ and the next stage show under the picture without a tap, and the
197
+ // milestones are said once, in this card; a tap on the picture does not list them again
198
+ ok('D1b in two columns the dates line and the next stage show under the picture at once', await miShown(p) && await p.evaluate((v) => { const n = document.querySelector(v + ' .iv-sc [data-iv-next]'); return !!n && !!n.offsetParent; }, V));
199
+ const once = () => p.evaluate((v) => [...document.querySelectorAll(v + ' .iv-msl')].filter((l) => l.offsetParent).length, V);
200
+ const n0 = await once(); await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await sleep(300);
201
+ ok('D1b in two columns the milestones are listed once, before and after a tap on the picture', n0 === 1 && await once() === 1, String(n0));
194
202
  await shot(p, 'desk-milestones');
195
203
  // the phone: the same list behind a tap on the mission, under the stage's dates, ⋯ and the next stage (XvpE2Stages, Wawan 10:59)
196
204
  const Q = await open({ w: 390, h: 844, board: B }), q = Q.page;
@@ -255,7 +263,7 @@ async function pure() {
255
263
  /* D5 every step done, a milestone next: the next stage is ◆ Deliver; its sheet moves it with nothing open, and says so with Undo */
256
264
  {
257
265
  const A = await open({ model: SCEN.ready() }), p = A.page;
258
- if (!(await card(p)).next) await openMi(p);
266
+ if (!(await p.evaluate((v) => { const n = document.querySelector(v + ' [data-iv-next]'); return !!(n && n.offsetParent); }, V))) await openMi(p); // the next stage shows: in the head, or under the picture once it is open
259
267
  const c = await card(p);
260
268
  ok('D5 every step done: the → names ◆ Deliver', A.up && /^Next: ◆ Deliver/.test(c.tail) && c.ms, JSON.stringify(c));
261
269
  await shot(p, 'desk-ready', V + ' .iv-sc');
@@ -38,6 +38,14 @@ const ITEMS = [
38
38
  it('scarlet.a1b2c3d4e5', 'WP2 Newsroom pilot plan', { store: 'item', end: '2026-12-11' }),
39
39
  ];
40
40
 
41
+ // batch 18 item 16: with quick changes on, a title press opens the row in place; the task card is under its ⋯ (Open the task card)
42
+ const openCard = async (pg, uid, V = '#czViewer') => {
43
+ if (await pg.$(`${V} [data-iv-task="${uid}"]`)) return pg.click(`${V} [data-iv-task="${uid}"]`);
44
+ await pg.click(`${V} [data-iv-edit="${uid}"]`);
45
+ await pg.click(`${V} .iv-ed[data-iv-open="${uid}"] [data-iv-more]`);
46
+ await pg.waitForSelector('.tkc.ivq [data-ive-card]', { timeout: 8000 });
47
+ return pg.click('.tkc.ivq [data-ive-card]');
48
+ };
41
49
  (async () => {
42
50
  const exe = findBrowser();
43
51
  if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
@@ -115,7 +123,7 @@ const ITEMS = [
115
123
  await p.click('#ibBody [data-key="board:scarlet"]');
116
124
  await p.waitForSelector('.iv-tr', { timeout: 8000 });
117
125
  await unfold(p);
118
- await p.click('.iv-tt[data-iv-task="task-api"]');
126
+ await openCard(p, 'task-api', '#czViewer');
119
127
  await p.waitForSelector('.tkc .seg', { timeout: 8000 }).catch(() => {});
120
128
  const row = await p.evaluate(() => {
121
129
  const seg = document.querySelector('.tkc .seg'); if (!seg) return null;