create-pmos 0.412.0 → 0.414.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/AGENTS.md +2 -2
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/README.md +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +11 -5
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/pmos-log.sh +18 -4
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +2 -2
- package/workspace/briefing-premium-board-test.js +45 -9
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/changelog.json +24 -0
- package/workspace/core-docs-workflow-test.js +144 -0
- package/workspace/guide/programs.md +13 -0
- package/workspace/guide/workflows.md +15 -1
- package/workspace/home-other-product-test.js +18 -0
- package/workspace/lib/board-premium.js +8 -2
- package/workspace/lib/briefing-premium-agent.js +16 -4
- package/workspace/lib/core-docs.js +79 -14
- package/workspace/lib/engine/boards.js +20 -12
- package/workspace/lib/headless.js +10 -1
- package/workspace/lib/initiative-chat.js +50 -0
- package/workspace/lib/initiative-premium.js +17 -7
- package/workspace/lib/item-cli.js +7 -2
- package/workspace/lib/milestone-review.js +120 -0
- package/workspace/lib/milestone-suggest.js +176 -0
- package/workspace/lib/plan-items.js +1 -1
- package/workspace/lib/pmos-verbs.js +7 -1
- package/workspace/lib/program-chat.js +1 -1
- package/workspace/lib/program-cli.js +56 -0
- package/workspace/lib/programs.js +25 -6
- package/workspace/lib/routes-boards.js +77 -13
- package/workspace/lib/routes-briefing-premium.js +17 -1
- package/workspace/lib/routes-core-docs.js +3 -1
- package/workspace/lib/routes-programs.js +84 -7
- package/workspace/lib/task-cli.js +120 -0
- package/workspace/lib/workflow-chat.js +1 -0
- package/workspace/lib/workflow-cli.js +91 -6
- package/workspace/milestone-suggest-test.js +175 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-line-test.js +12 -1
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +2 -1
- package/workspace/program-order-test.js +180 -0
- package/workspace/public/pm/bd-ini-model.js +81 -0
- package/workspace/public/pm/bd-ini-panel.js +123 -58
- package/workspace/public/pm/bd-prog-panel.js +54 -14
- package/workspace/public/pm/bd-prog.js +3 -3
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-panel.css +2 -0
- package/workspace/public/pm/cozy-viewer.js +10 -3
- package/workspace/public/pm/cozy-xv.css +51 -16
- package/workspace/public/pm/cozy-xv.js +6 -5
- package/workspace/public/pm/goal-chat.js +1 -1
- package/workspace/public/pm/home-app.js +35 -19
- package/workspace/public/pm/home-ask.js +9 -3
- package/workspace/public/pm/home-chat.js +16 -2
- package/workspace/public/pm/home-ini-model.js +42 -29
- package/workspace/public/pm/home-ini.css +1 -0
- package/workspace/public/pm/home-ini.js +26 -34
- package/workspace/public/pm/home-list.js +14 -8
- package/workspace/public/pm/home-stage-card.js +3 -1
- package/workspace/public/pm/home-task.js +41 -65
- package/workspace/public/pm/home-today.js +11 -12
- package/workspace/public/pm/ms-suggest.css +50 -0
- package/workspace/public/pm/ms-suggest.js +98 -0
- package/workspace/public/pm/premium-board.js +13 -7
- package/workspace/public/pm/premium-initiative-head.js +32 -13
- package/workspace/public/pm/premium-viewer.js +1 -0
- package/workspace/public/pm/premium-vw-item-model.js +13 -7
- package/workspace/public/pm/premium-vw-item.js +49 -5
- package/workspace/public/pm/prog-order.css +47 -0
- package/workspace/public/pm/prog-order.js +188 -0
- package/workspace/public/pm/program-charter.js +47 -7
- package/workspace/public/pm/program-model.js +79 -1
- package/workspace/public/pm/task-card.css +108 -0
- package/workspace/public/pm/task-card.js +271 -0
- package/workspace/public/pm/wf-page.js +3 -0
- package/workspace/server.js +23 -1
- package/workspace/skills/milestone-review.skill +53 -0
- package/workspace/skills/workflow-setup.skill +14 -5
- package/workspace/stage-card-test.js +11 -0
- package/workspace/task-card-test.js +248 -0
- package/workspace/test-lists/bd-ini-panel.json +5 -0
- package/workspace/test-lists/core-documents-backend.json +15 -3
- package/workspace/test-lists/milestone-suggest.json +6 -0
- package/workspace/test-lists/program-order.json +6 -0
- package/workspace/test-lists/task-card.json +6 -0
- package/workspace/test-lists/workflow-stage.json +5 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* milestone-suggest-test.js — Claude's milestone suggestions on the program panel, the charter and Home (feedback batch 4 item 6, option B;
|
|
4
|
+
* canvas XmsgB, sticky xmsgRules). Serves the real Board and Home pages from the real server; Project Ascent comes from fixtures/program-ascent.js
|
|
5
|
+
* with a `review` added the way GET /api/programs answers it, and the program writes are captured, not written.
|
|
6
|
+
* F a program with no milestones: Claude's first suggestions take the place of "Add the first milestone", each with why and its source; ✓ ✎ ✕
|
|
7
|
+
* are icon-only; keep all · W later changes lead Waits on you; ✓ keeps, ✕ drops · C the pencil opens the charter with the change filled in;
|
|
8
|
+
* Save writes it and answers the suggestion; last checked and Check now · Z nothing to suggest, nothing shows · K the ◆ dates are reported once
|
|
9
|
+
* · M Home's Your move has one line per program · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const { spawn } = require('child_process');
|
|
13
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
14
|
+
const T = require('./test-run').configure({ name: 'milestone-suggest' });
|
|
15
|
+
const BP = require('./lib/board-premium.js');
|
|
16
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
17
|
+
const A = require('./fixtures/program-ascent.js');
|
|
18
|
+
|
|
19
|
+
const BASE = T.BASE;
|
|
20
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
21
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
22
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
23
|
+
const results = [];
|
|
24
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
25
|
+
let srv = null; let browser = null;
|
|
26
|
+
const finish = async (code) => {
|
|
27
|
+
if (browser) await browser.close().catch(() => {});
|
|
28
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
29
|
+
T.killTmux();
|
|
30
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
31
|
+
console.log(`\n${results.length - bad}/${results.length} milestone-suggest assertions passed`);
|
|
32
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
33
|
+
};
|
|
34
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
35
|
+
|
|
36
|
+
const CHECKED = new Date(Date.now() - 3 * 3600e3).toISOString();
|
|
37
|
+
const CHANGES = [
|
|
38
|
+
{ key: 'k-move', op: 'move', milestone: 'pilot-live', date: '2026-12-02', why: 'Was Nov 18. Jira moved epic DSC-41 to sprint 24, which ends Dec 1.', src: { kind: 'jira', label: 'Jira, read 2h ago' } },
|
|
39
|
+
{ key: 'k-add', op: 'add', name: 'Partner SSO cut-over', date: '2027-03-15', waits: ['microsite-signin'], why: 'Partner SSO joined the program yesterday. Its ◆ Deliver is Mar 15, 2027.', src: { kind: 'member', label: 'Partner SSO' } },
|
|
40
|
+
{ key: 'k-risk', op: 'risk', milestone: 'legacy-idp-off', why: 'Steering, Oct 23: legal holds the deletion of the old user store until a review in March.', src: { kind: 'meeting', label: 'Steering, Oct 23' } },
|
|
41
|
+
];
|
|
42
|
+
const FIRST = [
|
|
43
|
+
{ key: 'f1', op: 'add', name: 'Vendor contract signed', date: '2026-10-28', waits: [], why: 'A check you tick. The vendor order form is due Oct 28, and the pilot cannot start without it.', src: { kind: 'task', label: 'Task, due Oct 28' } },
|
|
44
|
+
{ key: 'f2', op: 'add', name: 'Pilot live', date: '2026-11-14', waits: ['descope-parity', 'microsite-signin'], why: 'Descope feature parity and Microsite sign-in both reach ◆ Deliver by Nov 14. The Oct 22 steering notes call this the pilot.', src: { kind: 'deliver', label: '2 initiatives' } },
|
|
45
|
+
{ key: 'f3', op: 'add', name: 'Legacy IdP off', date: '2027-02-20', waits: ['legacy-idp-sunset'], why: 'Waits on Legacy IdP sunset reaching ◆ Deliver on Feb 20, 2027.', src: { kind: 'deliver', label: 'Legacy IdP sunset' } },
|
|
46
|
+
{ key: 'f4', op: 'add', name: 'Program review', date: '2028-06-30', waits: [], why: 'A check you tick, on the program\'s target date.', src: { kind: 'target', label: 'Program target' } },
|
|
47
|
+
];
|
|
48
|
+
const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empty ? { milestones: [] } : {}), review: { checked: CHECKED, running: false, open, facts: o.facts || '' } }));
|
|
49
|
+
|
|
50
|
+
(async () => {
|
|
51
|
+
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
52
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
53
|
+
let chromium;
|
|
54
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
55
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
56
|
+
await T.waitForServer(BASE);
|
|
57
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
58
|
+
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
59
|
+
const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
|
|
60
|
+
|
|
61
|
+
const open = async ({ w = 1440, h = 900, programs = withReview(CHANGES), dark = false, home = false } = {}) => {
|
|
62
|
+
const c = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
|
|
63
|
+
const page = await c.newPage();
|
|
64
|
+
const errors = [], posts = [];
|
|
65
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
66
|
+
await page.route('**/api/board-premium*', (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(ws)), as_of: Date.now() }) }); });
|
|
67
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs }) }));
|
|
68
|
+
const wsOf = (r) => new URL(r.request().url()).searchParams.get('ws') || 'idpf', json = (r, b) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(b) });
|
|
69
|
+
await page.route('**/api/boards/anchors*', (r) => json(r, { ok: true, anchors: A.ANCHORS[wsOf(r)] || [] }));
|
|
70
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, model: { goals: A.GOALS[wsOf(r)] || [] } }));
|
|
71
|
+
await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: A.ITEMS[wsOf(r)] || [] }));
|
|
72
|
+
await page.route('**/api/programs/*', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
73
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: '{"ok":false,"error":"not in this check"}' }));
|
|
74
|
+
if (home) { await page.goto(BASE + '/premium.html?ws=idpf'); return { page, ctx: c, errors, posts }; }
|
|
75
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&program=' + programs[0].id);
|
|
76
|
+
await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('.pp-vw .czs-sum'); }));
|
|
77
|
+
await until(() => page.evaluate(() => !/reading its board/.test((document.querySelector('#czViewer [data-czs-id="tree"]') || {}).textContent || '')), 6000);
|
|
78
|
+
return { page, ctx: c, errors, posts };
|
|
79
|
+
};
|
|
80
|
+
const charterShown = (p) => until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && /Charter/.test(v.getAttribute('aria-label') || '') && !!v.querySelector('.pc-vw .pc'); }));
|
|
81
|
+
const rows = (p, sel) => p.evaluate((s) => [...document.querySelectorAll(s + ' .msg-r')].map((r) => ({ t: r.querySelector('.msg-h b').textContent, d: (r.querySelector('.msg-d') || {}).textContent || '', why: r.querySelector('.msg-w').textContent, src: (r.querySelector('.msg-src') || {}).textContent || '',
|
|
82
|
+
presses: [...r.querySelectorAll('[data-ms-act]')].map((b) => b.dataset.msAct + (b.textContent.trim() ? ':text' : '') + (b.getAttribute('aria-label') ? '' : ':nolabel')) })), sel);
|
|
83
|
+
const wait = (p, f) => until(() => p.evaluate(f));
|
|
84
|
+
|
|
85
|
+
/* ── F: a program with no milestones ── */
|
|
86
|
+
const N = await open({ programs: withReview(FIRST, { empty: true }) });
|
|
87
|
+
const f = await rows(N.page, '#czViewer .msg-box');
|
|
88
|
+
const fh = await N.page.evaluate(() => ({ head: (document.querySelector('#czViewer .msg-box .msg-hd .msg-ht') || {}).textContent || '', ghost: !!document.querySelector('#czViewer [data-pp="first"]'), all: [...document.querySelectorAll('#czViewer .msg-hd [data-ms-act]')].map((b) => b.dataset.msAct) }));
|
|
89
|
+
ok('F a program with no milestones: Claude\'s first suggestions take the place of "Add the first milestone"', f.length === 4 && !fh.ghost && fh.head === 'Claude suggests 4 milestones from a task, the initiatives\' ◆ dates and the target date', JSON.stringify(fh));
|
|
90
|
+
ok('F each row: its name, date, why and source; ✓ ✎ ✕ icon-only with a label', f[0].t === 'Vendor contract signed' && f[0].d === 'Oct 28' && /order form is due Oct 28/.test(f[0].why) && f[0].src === 'Task, due Oct 28'
|
|
91
|
+
&& f.every((r) => r.presses.join() === 'keep,edit,drop'), JSON.stringify(f[0]));
|
|
92
|
+
await shot(N.page, 'XmsgB-first-built');
|
|
93
|
+
await N.page.click('#czViewer .msg-hd [data-ms-act="keepall"]');
|
|
94
|
+
await wait(N.page, () => true);
|
|
95
|
+
await until(() => N.posts.filter((x) => x.path === '/api/programs/suggestion').length >= 4, 6000);
|
|
96
|
+
const ka = N.posts.filter((x) => x.path === '/api/programs/suggestion').map((x) => x.body.key + ':' + x.body.answer);
|
|
97
|
+
ok('F keep all keeps each one, in order, one at a time', ka.join() === 'f1:keep,f2:keep,f3:keep,f4:keep', ka.join());
|
|
98
|
+
ok('0 no page error (first suggestions)', N.errors.length === 0, N.errors.join(' | '));
|
|
99
|
+
await N.ctx.close();
|
|
100
|
+
|
|
101
|
+
/* ── W: later changes in Waits on you ── */
|
|
102
|
+
const D = await open();
|
|
103
|
+
const p = D.page;
|
|
104
|
+
const w = await rows(p, '#czViewer [data-czs-id="needs"]');
|
|
105
|
+
const cnt = await p.evaluate(() => (document.querySelector('#czViewer [data-czs-fold="needs"] .czs-n, #czViewer [data-czs-id="needs"] .czs-n') || {}).textContent || '');
|
|
106
|
+
ok('W the changes lead Waits on you, in plain words, each with why and its source', w.map((r) => r.t).join('|') === 'Move Pilot live to Dec 2|Partner SSO cut-over|Mark Legacy IdP off at risk' && w[0].src === 'Jira, read 2h ago' && /DSC-41/.test(w[0].why), JSON.stringify(w));
|
|
107
|
+
ok('W the Waits on you count includes them', /^\d+$/.test(cnt.trim()) && Number(cnt) >= 3, cnt);
|
|
108
|
+
ok('W the track stays as it is until the PM keeps a change', await p.evaluate(() => !!document.querySelector('#czViewer .pp-mt') && !document.querySelector('#czViewer .msg-box')));
|
|
109
|
+
ok('K the ◆ dates the page reads are reported once, so a moved date asks Claude for a review', await until(() => D.posts.filter((x) => x.path === '/api/programs/facts').length === 1, 4000) && /descope-parity:\d{4}-\d{2}-\d{2}/.test((D.posts.find((x) => x.path === '/api/programs/facts') || { body: {} }).body.fp || ''), JSON.stringify(D.posts.filter((x) => x.path === '/api/programs/facts')));
|
|
110
|
+
await shot(p, 'XmsgB-asks-built');
|
|
111
|
+
await p.click('#czViewer [data-ms-act="keep"][data-key="k-move"]');
|
|
112
|
+
await until(() => D.posts.some((x) => x.path === '/api/programs/suggestion'), 4000);
|
|
113
|
+
ok('W ✓ keeps it in one press', D.posts.some((x) => x.path === '/api/programs/suggestion' && x.body.key === 'k-move' && x.body.answer === 'keep' && x.body.program === 'project-ascent'));
|
|
114
|
+
await until(() => p.evaluate(() => !document.querySelector('#czViewer [data-ms-act][disabled]')), 4000);
|
|
115
|
+
await p.click('#czViewer [data-ms-act="drop"][data-key="k-risk"]');
|
|
116
|
+
await until(() => D.posts.some((x) => x.body.key === 'k-risk'), 4000);
|
|
117
|
+
ok('W ✕ drops it', D.posts.some((x) => x.body.key === 'k-risk' && x.body.answer === 'decline'));
|
|
118
|
+
|
|
119
|
+
/* ── C: the pencil opens the charter with the change filled in ── */
|
|
120
|
+
await until(() => p.evaluate(() => !document.querySelector('#czViewer [data-ms-act][disabled]')), 4000);
|
|
121
|
+
await p.click('#czViewer [data-ms-act="edit"][data-key="k-move"]');
|
|
122
|
+
ok('C the pencil opens the charter', await charterShown(p));
|
|
123
|
+
const cv = await p.evaluate(() => { const r = document.querySelector('#czViewer .pc-lnw.msg-on'); return { day: r && r.querySelector('.pc-fd span').textContent, note: r && (r.querySelector('.msg-chg') || {}).textContent, save: !!document.querySelector('#czViewer .cz-vw-hd .cz-vw-pri'), chk: (document.querySelector('#czViewer .msg-chk span') || {}).textContent || '', now: !!document.querySelector('#czViewer [data-pc="checknow"][aria-label="Check now"]') }; });
|
|
124
|
+
ok('C the change is filled in, unsaved: the row says what it was, and Save shows', cv.day === 'Dec 2' && /^Claude's change, was Nov 18, ready to save\. Edit it, then Save\.$/.test(cv.note || '') && cv.save, JSON.stringify(cv));
|
|
125
|
+
ok('C the charter says when Claude last checked, with Check now', /^Claude checks every Monday and when a date, Jira or a meeting changes\. Last checked today, \d\d:\d\d\.$/.test(cv.chk) && cv.now, cv.chk);
|
|
126
|
+
await shot(p, 'XmsgB-charter-built');
|
|
127
|
+
await p.click('#czViewer .cz-vw-hd .cz-vw-pri');
|
|
128
|
+
await until(() => D.posts.some((x) => x.body.key === 'k-move' && x.body.answer === 'edit'), 5000);
|
|
129
|
+
const sv = D.posts.find((x) => x.path === '/api/programs/save');
|
|
130
|
+
ok('C Save writes the charter with the new date (ids kept) and answers the suggestion', !!sv && sv.body.program.milestones.find((m) => m.id === 'pilot-live').date === '2026-12-02' && D.posts.some((x) => x.body.key === 'k-move' && x.body.answer === 'edit'), JSON.stringify(sv && sv.body.program.milestones.map((m) => m.id + ':' + m.date)));
|
|
131
|
+
await p.click('#czViewer [data-pc="checknow"]');
|
|
132
|
+
await until(() => D.posts.some((x) => x.path === '/api/programs/review'), 4000);
|
|
133
|
+
ok('C Check now asks Claude to review', D.posts.some((x) => x.path === '/api/programs/review' && x.body.program === 'project-ascent'));
|
|
134
|
+
ok('0 no page error (desk)', D.errors.length === 0, D.errors.join(' | '));
|
|
135
|
+
await D.ctx.close();
|
|
136
|
+
|
|
137
|
+
/* ── Z: nothing to suggest, nothing shows; facts already heard are not sent again ── */
|
|
138
|
+
const Z = await open({ programs: withReview([], { facts: '__set_below__' }) });
|
|
139
|
+
ok('Z nothing to suggest: no suggestion row anywhere on the panel', await Z.page.evaluate(() => !document.querySelector('#czViewer .msg-r, #czViewer .msg-box')));
|
|
140
|
+
await Z.ctx.close();
|
|
141
|
+
|
|
142
|
+
/* ── M: Home's Your move ── */
|
|
143
|
+
const M = await open({ home: true });
|
|
144
|
+
// Your move lives in Your day, which the greeting opens
|
|
145
|
+
if (await until(() => M.page.$('[data-hm-day]'), 10000)) { await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await M.page.click('[data-hm-day]'); }
|
|
146
|
+
const hm = await until(() => M.page.evaluate(() => { const b = document.querySelector('[data-hm-sel="ms:project-ascent"]'); return b ? [...b.querySelectorAll('b, em')].map((x) => x.textContent.trim()).join(' · ') : null; }), 10000);
|
|
147
|
+
ok('M Home\'s Your move has one line for the program: its name and the changes', hm === 'Project Ascent · 3 milestone changes · Pilot live to Dec 2', String(hm));
|
|
148
|
+
if (hm) {
|
|
149
|
+
await M.page.click('[data-hm-sel="ms:project-ascent"]');
|
|
150
|
+
ok('M a tap opens the program, where the changes lead Waits on you', !!(await until(() => M.page.evaluate(() => !!document.querySelector('#czViewer [data-czs-id="needs"] .msg-r')), 8000)));
|
|
151
|
+
}
|
|
152
|
+
ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
|
|
153
|
+
await M.ctx.close();
|
|
154
|
+
|
|
155
|
+
/* ── H: a phone ── */
|
|
156
|
+
const S = await open({ w: 390, h: 844 });
|
|
157
|
+
const sp = await S.page.evaluate(() => { const b = document.querySelector('#czViewer [data-ms-act="keep"]'); const r = b && b.getBoundingClientRect(); return { size: r ? Math.round(r.width) : 0, wide: document.documentElement.scrollWidth <= innerWidth + 1 }; });
|
|
158
|
+
ok('H on a phone the presses are 40 px and nothing scrolls sideways', sp.size >= 40 && sp.wide, JSON.stringify(sp));
|
|
159
|
+
await S.page.evaluate(() => { const r = document.querySelector('#czViewer [data-czs-id="needs"]'); if (r) r.scrollIntoView(); });
|
|
160
|
+
await shot(S.page, 'XmsgB-phone-built');
|
|
161
|
+
ok('0 no page error on a phone', S.errors.length === 0, S.errors.join(' | '));
|
|
162
|
+
await S.ctx.close();
|
|
163
|
+
|
|
164
|
+
if (SHOTS) { // dark, for the look only
|
|
165
|
+
const K = await open({ dark: true });
|
|
166
|
+
await shot(K.page, 'XmsgB-asks-built-dark'); await K.ctx.close();
|
|
167
|
+
const K2 = await open({ dark: true, w: 390, h: 844, programs: withReview(FIRST, { empty: true }) });
|
|
168
|
+
await shot(K2.page, 'XmsgB-first-phone-dark'); await K2.ctx.close();
|
|
169
|
+
const K3 = await open({ w: 390, h: 844, home: true });
|
|
170
|
+
if (await until(() => K3.page.$('[data-hm-day]'), 8000)) { await until(() => K3.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await K3.page.click('[data-hm-day]'); }
|
|
171
|
+
await until(() => K3.page.$('[data-hm-sel="ms:project-ascent"]'), 8000);
|
|
172
|
+
await shot(K3.page, 'XmsgB-home-phone'); await K3.ctx.close();
|
|
173
|
+
}
|
|
174
|
+
finish();
|
|
175
|
+
})();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.414.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.414.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* P2 (390) a tap opens the line in place: the head line, every point, the Now row and Watch its terminal; Stop reaches the server;
|
|
8
8
|
* the line stays at the top while the page scrolls
|
|
9
9
|
* P3 (390) a session with no step list: "Working · m:ss", no count; a session with its own steps: its step and "1 of 3 done"
|
|
10
|
-
* P4 (390) Claude asks: the line is blue, "Claude asks before it goes on"; a tap scrolls to the ask, not to the Viewer
|
|
10
|
+
* P4 (390) Claude asks: the line is blue, "Claude asks before it goes on"; a tap scrolls to the ask, not to the Viewer, and pulses it
|
|
11
11
|
* P5/P6 a finished goal: no line; "Goal done" over Claude's result, or the amber "Goal stopped: …" and the box says how to go on
|
|
12
|
+
* P5b a goal that finished before every shown message: its divider leads the log, never trails the newest message
|
|
12
13
|
* P7 (390) a meeting records: the pill is in the chat's top bar, which shows ← and the title only
|
|
13
14
|
* P8 (390) Home: a running row's ring fills as its steps are met, no number; a running row with no steps has the plain ring
|
|
14
15
|
* P9 (1280) the line sits over the chat column; a tap opens the steps in the Viewer and the line is tinted while it shows them
|
|
@@ -138,6 +139,8 @@ const look = () => {
|
|
|
138
139
|
await p.click('#hmPl [data-pl="toggle"]'); await sleep(500);
|
|
139
140
|
const s1 = await p.evaluate(look);
|
|
140
141
|
ok('P4 a tap goes to the ask in the conversation, not to a panel', !s1.open && !s1.vw, JSON.stringify(s1));
|
|
142
|
+
const fl = await p.evaluate(() => { const f = document.querySelector('#hmLog .hm-flash'); return f ? f.textContent : ''; });
|
|
143
|
+
ok('P4b the tap is never silent: Claude\'s newest message, where the goal asks, pulses once (feedback batch 4, item 3)', /Is the draft ready for Dita\?/.test(fl), fl);
|
|
141
144
|
ok('F1 (ask) no page error', !errs.length, errs.join(' | '));
|
|
142
145
|
await ctx.close(); }
|
|
143
146
|
|
|
@@ -156,6 +159,14 @@ const look = () => {
|
|
|
156
159
|
ok('F1 (finished) no page error', !errs.length, errs.join(' | '));
|
|
157
160
|
await ctx.close(); }
|
|
158
161
|
|
|
162
|
+
/* P5b: a goal that finished before every message shown: the divider leads the log, it never trails the newest message */
|
|
163
|
+
{ const st = { goal: goal('done', { met: DRAFT.done, at: ago(90) }), conv: { turn: 'pm', messages: BASE.concat([{ role: 'assistant', text: 'Later work, after the goal.', at: ago(0.5) }]) } };
|
|
164
|
+
const { p, ctx, errs } = await open(1280, st);
|
|
165
|
+
const s0 = await until(async () => { const v = await p.evaluate(() => { const d = document.querySelector('#hmLog .pl-dv'); const kids = [...document.querySelectorAll('#hmLog > *')]; return d ? { first: kids.indexOf(d) <= 1, last: kids[kids.length - 1] === d } : null; }); return v; }) || {};
|
|
166
|
+
ok('P5b a goal done before the shown messages: "Goal done" leads the log, not after the newest message', s0.first && !s0.last, JSON.stringify(s0));
|
|
167
|
+
ok('F1 (old goal) no page error', !errs.length, errs.join(' | '));
|
|
168
|
+
await ctx.close(); }
|
|
169
|
+
|
|
159
170
|
/* P9: a desktop */
|
|
160
171
|
{ const st = { goal: goal('started'), conv: { turn: 'tool', messages: BASE } };
|
|
161
172
|
const { p, ctx, errs } = await open(1280, st);
|
|
@@ -74,12 +74,12 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
74
74
|
await until(async () => /UAT with five partners/.test(await paneTxt(page, TK)));
|
|
75
75
|
s = await cur(page); t = await paneTxt(page, TK);
|
|
76
76
|
ok('R9 a task inside the record opens in its place, named by the task', s.on === TK && s.title === 'UAT with five partners', JSON.stringify(s));
|
|
77
|
-
ok('R9 the task
|
|
77
|
+
ok('R9 the task is the task editor: owner, start and due, and status (item 7: no Type, Reference or Source rows)', ['Dara', '20 → 27 Oct', 'To do'].every((x) => t.includes(x)) && !/PMOS task|Reference/.test(t), t);
|
|
78
78
|
ok('R9 the record and its task read the route once', S.vgets.length - n0 === 1, String(S.vgets.length - n0));
|
|
79
|
-
await page.click(`#czViewer .obody.vw[data-vw="${TK}"] [data-
|
|
79
|
+
await page.click(`#czViewer .obody.vw[data-vw="${TK}"] [data-tkc="ini"]`);
|
|
80
80
|
s = await cur(page);
|
|
81
81
|
ok('R9 the initiative link brings the record back, not a second one', await until(async () => (await cur(page)).on === INI) && (await cur(page)).n === 1, JSON.stringify(s));
|
|
82
|
-
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await page.click('#czViewer [data-ov-tk="task:t1"]').then(() => until(async () => (await cur(page)).on === TK && /
|
|
82
|
+
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await page.click('#czViewer [data-ov-tk="task:t1"]').then(() => until(async () => (await cur(page)).on === TK && /20 → 27 Oct/.test(await paneTxt(page, TK)))), JSON.stringify(await cur(page)));
|
|
83
83
|
ok('R9 the old dialog never opens', await page.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
|
|
84
84
|
ok('R9 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
85
85
|
await ctx.close();
|
|
@@ -179,7 +179,8 @@ const TICKETS = {
|
|
|
179
179
|
{
|
|
180
180
|
const I = await open();
|
|
181
181
|
await I.page.click('#czViewer [data-ov-tk="task:ONB-12"]');
|
|
182
|
-
|
|
182
|
+
// item 7 (feedback batch 3): a Jira task opens the one task card, with Jira's values read-only, not the bare ticket view
|
|
183
|
+
ok('I2 a Jira task in the Overview opens its task card in the Viewer', !!(await until(async () => /^item:task:self-serve-v2:task:ONB-12$/.test(String(await curId(I.page))))), JSON.stringify(await curId(I.page)));
|
|
183
184
|
await I.page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1');
|
|
184
185
|
ok('I1 the initiative loads the Jira view module without a page error', !!(await until(() => I.page.evaluate(() => !!window.__premiumVwJira))) && I.errors.length === 0, I.errors.join(' | '));
|
|
185
186
|
await I.ctx.close();
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* program-order-test.js — the order of a program's initiatives on the Board and on Home (feedback batch 3 item 5, option A agreed 2026-10-25;
|
|
4
|
+
* canvas RoADrag, RoASuggest, RoAApplied, RoAPhone). Serves the real pages from the real server; GET /api/programs answers Project Ascent
|
|
5
|
+
* (fixtures/program-ascent.js) and POST /api/programs/order is answered here, from the order the page sent, so a reload reads it back.
|
|
6
|
+
* B Board: the program's rows follow its order; ✦ shows (with its dot) only while the dates disagree; the suggestion lists the date order with a
|
|
7
|
+
* reason per row; ✓ applies it, Undo puts the order back; ✕ is "not now" until a date changes; drag by the grip; Alt + ↓ moves a row
|
|
8
|
+
* H Home: the program group lists the same order; the grip moves a row there too; a phone holds the row, then drags it */
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const T = require('./test-run').configure({ name: 'program-order' });
|
|
13
|
+
const BP = require('./lib/board-premium.js');
|
|
14
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
15
|
+
const B = require('./lib/briefing-premium.js');
|
|
16
|
+
const HF = require('./fixtures/briefing-premium-facts.js');
|
|
17
|
+
const A = require('./fixtures/program-ascent.js');
|
|
18
|
+
|
|
19
|
+
const BASE = T.BASE;
|
|
20
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
21
|
+
const until = async (fn, ms = 8000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
22
|
+
const results = [];
|
|
23
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
24
|
+
let srv = null; let browser = null;
|
|
25
|
+
const finish = async (code) => {
|
|
26
|
+
if (browser) await browser.close().catch(() => {});
|
|
27
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
28
|
+
T.killTmux();
|
|
29
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
30
|
+
console.log(`\n${results.length - bad}/${results.length} program-order assertions passed`);
|
|
31
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
32
|
+
};
|
|
33
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
34
|
+
|
|
35
|
+
/** The program as GET /api/programs answers it, with the order the last POST saved. */
|
|
36
|
+
let ORDER = [];
|
|
37
|
+
const programs = () => A.programs().map((p) => ({ ...p, order: ORDER.slice() }));
|
|
38
|
+
const posts = [];
|
|
39
|
+
const routePrograms = async (page) => {
|
|
40
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: programs() }) }));
|
|
41
|
+
await page.route('**/api/programs/order', (r) => {
|
|
42
|
+
const b = JSON.parse(r.request().postData() || '{}'); posts.push(b);
|
|
43
|
+
const was = ORDER.slice(); ORDER = b.order.slice();
|
|
44
|
+
r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, was, program: programs().find((p) => p.id === b.program) }) });
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
(async () => {
|
|
49
|
+
const exe = findBrowser();
|
|
50
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
51
|
+
let chromium;
|
|
52
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
53
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
54
|
+
await T.waitForServer(BASE);
|
|
55
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
56
|
+
|
|
57
|
+
const board = async (o = {}) => {
|
|
58
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch });
|
|
59
|
+
const page = await ctx.newPage();
|
|
60
|
+
const errors = [];
|
|
61
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
62
|
+
await page.clock.setFixedTime(new Date(F.NOW));
|
|
63
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
64
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
65
|
+
await routePrograms(page);
|
|
66
|
+
await page.addInitScript(() => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); localStorage.setItem('pmos.board.view', 'track'); localStorage.setItem('pmos.board.grouping', 'program'); } } catch { /* none */ } });
|
|
67
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&board=idpf');
|
|
68
|
+
await page.waitForSelector('#ibBody [data-key]', { timeout: 15000 });
|
|
69
|
+
await page.waitForTimeout(700);
|
|
70
|
+
return { ctx, page, errors };
|
|
71
|
+
};
|
|
72
|
+
const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
|
|
73
|
+
const sug = (p) => p.evaluate(() => { const b = document.querySelector('#ibBody .bt-pg [data-po-sug]'); return b ? { dot: !!b.querySelector('.po-nd'), label: b.getAttribute('aria-label') } : null; });
|
|
74
|
+
|
|
75
|
+
/* B — the Board's stage track */
|
|
76
|
+
{
|
|
77
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity']; // the PM's order, against the dates (Descope starts Oct 5, Legacy Oct 11)
|
|
78
|
+
const { ctx, page: p, errors } = await board();
|
|
79
|
+
ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
|
|
80
|
+
const s = await sug(p);
|
|
81
|
+
ok('B ✦ shows in the program header while the dates disagree, with the blue dot', !!s && s.dot, JSON.stringify(s));
|
|
82
|
+
await p.click('#ibBody .bt-pg [data-po-sug]');
|
|
83
|
+
const pop = await until(() => p.evaluate(() => { const d = document.querySelector('.po-pop'); return d ? { why: d.querySelector('.po-why').textContent, rows: [...d.querySelectorAll('.po-so')].map((r) => ({ t: r.querySelector('b').textContent, r: r.querySelector('.r').textContent, mv: r.classList.contains('mv') })), focus: document.activeElement && document.activeElement.getAttribute('aria-label') } : null; }));
|
|
84
|
+
ok('B the suggestion lists the date order with a reason per row, the moved rows marked; ✓ has the focus', !!pop && pop.rows[0].t === 'Descope feature parity' && /Starts first, on Oct 5/.test(pop.rows[0].r) && pop.rows[0].mv && /Today the order is yours/.test(pop.why) && pop.focus === 'Use this order', JSON.stringify(pop));
|
|
85
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-suggest.png' });
|
|
86
|
+
await p.click('.po-pop [data-po-use]');
|
|
87
|
+
await until(async () => (await kids(p))[0] === 'descope-parity');
|
|
88
|
+
const toast = await p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; });
|
|
89
|
+
ok('B ✓ applies it: one write with the whole order, the rows move, the toast says where with Undo, and ✦ goes quiet', posts.length === 1 && posts[0].program === 'project-ascent' && posts[0].order[0] === 'descope-parity' && posts[0].order[1] === 'legacy-idp-sunset' && (await kids(p)).join() === 'descope-parity,legacy-idp-sunset' && /Ordered by dates · Board, program page and Home/.test(toast) && /Undo/.test(toast) && !(await sug(p)), JSON.stringify({ posts, toast, k: await kids(p) }));
|
|
90
|
+
await p.click('#bdToast .bd-undo');
|
|
91
|
+
await until(async () => (await kids(p))[0] === 'legacy-idp-sunset');
|
|
92
|
+
ok('B Undo writes the order before back', posts.length === 2 && posts[1].order.join() === 'legacy-idp-sunset,descope-parity' && (await kids(p)).join() === 'legacy-idp-sunset,descope-parity', JSON.stringify(posts));
|
|
93
|
+
// ✕: not now, until a date changes — the dot goes, ✦ stays
|
|
94
|
+
await p.click('#ibBody .bt-pg [data-po-sug]');
|
|
95
|
+
await p.waitForSelector('.po-pop');
|
|
96
|
+
await p.click('.po-pop [data-po-no]');
|
|
97
|
+
const s2 = await sug(p);
|
|
98
|
+
ok('B ✕ is "not now": no write, the popover closes, ✦ stays without its dot', posts.length === 2 && !(await p.$('.po-pop')) && !!s2 && !s2.dot, JSON.stringify(s2));
|
|
99
|
+
// drag: Descope's grip above Legacy
|
|
100
|
+
await p.hover('#ibBody [data-po-id="descope-parity"]');
|
|
101
|
+
const g = await p.locator('#ibBody [data-po-id="descope-parity"] [data-po-grip]').boundingBox();
|
|
102
|
+
const top = await p.locator('#ibBody [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
103
|
+
await p.mouse.move(g.x + g.width / 2, g.y + g.height / 2); await p.mouse.down();
|
|
104
|
+
await p.mouse.move(g.x + g.width / 2, top.y + 10, { steps: 6 });
|
|
105
|
+
const lifted = await p.evaluate(() => ({ lift: !!document.querySelector('[data-po-id="descope-parity"].po-lift'), slot: !!document.querySelector('.po-slot') }));
|
|
106
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-drag.png' });
|
|
107
|
+
await p.mouse.up();
|
|
108
|
+
await until(async () => (await kids(p))[0] === 'descope-parity');
|
|
109
|
+
ok('B drag by the grip: the row lifts over a slot, and the drop saves the new order', lifted.lift && lifted.slot && posts.length === 3 && posts[2].order.slice(0, 2).join() === 'descope-parity,legacy-idp-sunset' && (await kids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ lifted, posts: posts.slice(2) }));
|
|
110
|
+
// keyboard: Alt + ↓ on the first row's grip
|
|
111
|
+
await p.focus('#ibBody [data-po-id="descope-parity"] [data-po-grip]');
|
|
112
|
+
await p.keyboard.press('Alt+ArrowDown');
|
|
113
|
+
await until(async () => (await kids(p))[0] === 'legacy-idp-sunset');
|
|
114
|
+
const foc = await until(() => p.evaluate(() => { const r = document.activeElement && document.activeElement.closest('[data-po-id]'); return r && r.dataset.poId; }));
|
|
115
|
+
ok('B Alt + ↓ moves the focused row one place down, and the focus stays on it', posts.length === 4 && (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && foc === 'descope-parity', JSON.stringify({ k: await kids(p), foc }));
|
|
116
|
+
ok('B no page error', !errors.length, errors.join(' | '));
|
|
117
|
+
await ctx.close();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* H — Home: the same order, the grip, and a phone's hold-then-drag */
|
|
121
|
+
const home = async (o = {}) => {
|
|
122
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch, isMobile: !!o.touch });
|
|
123
|
+
const page = await ctx.newPage();
|
|
124
|
+
const errors = [];
|
|
125
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
126
|
+
const json = (body) => (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(body) });
|
|
127
|
+
await page.route(/\/api\/briefing-premium(\?.*)?$/, json({ ok: true, state: 'ready', model: B.build(HF.facts()), as_of: Date.now() }));
|
|
128
|
+
await page.route('**/api/briefing-premium/thread**', json({ ok: true, turns: [], working: false }));
|
|
129
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
130
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
131
|
+
await routePrograms(page);
|
|
132
|
+
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
133
|
+
await page.goto(BASE + '/premium.html?theme=light');
|
|
134
|
+
await until(() => page.evaluate(() => !!document.querySelector('#hmList .hv-g.prg [data-po-id]')), 20000);
|
|
135
|
+
return { ctx, page, errors };
|
|
136
|
+
};
|
|
137
|
+
const hkids = (p) => p.evaluate(() => [...document.querySelectorAll('#hmList .hv-g.prg [data-po-id]')].map((r) => r.dataset.poId));
|
|
138
|
+
{
|
|
139
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
140
|
+
const n0 = posts.length;
|
|
141
|
+
const { ctx, page: p, errors } = await home();
|
|
142
|
+
ok('H Home\'s program group lists the program\'s order (not your turn first)', (await hkids(p)).join() === 'legacy-idp-sunset,descope-parity', JSON.stringify(await hkids(p)));
|
|
143
|
+
ok('H ✦ sits in the open program header', !!(await p.$('#hmList .hv-g.prg .hv-gh [data-po-sug]')));
|
|
144
|
+
if (process.env.SHOTS) { await p.hover('#hmList [data-po-id="descope-parity"]'); await p.screenshot({ path: process.env.SHOTS + '/home-desk.png' }); }
|
|
145
|
+
await p.hover('#hmList [data-po-id="descope-parity"]');
|
|
146
|
+
const g = await p.locator('#hmList [data-po-id="descope-parity"] [data-po-grip]').boundingBox();
|
|
147
|
+
const top = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
148
|
+
await p.mouse.move(g.x + g.width / 2, g.y + g.height / 2); await p.mouse.down();
|
|
149
|
+
await p.mouse.move(g.x + g.width / 2, top.y + 6, { steps: 6 }); await p.mouse.up();
|
|
150
|
+
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
151
|
+
ok('H the grip moves a row on Home too: one write, and the list follows it', posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ k: await hkids(p), posts: posts.slice(n0) }));
|
|
152
|
+
ok('H no page error', !errors.length, errors.join(' | '));
|
|
153
|
+
await ctx.close();
|
|
154
|
+
}
|
|
155
|
+
{
|
|
156
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
157
|
+
const n0 = posts.length;
|
|
158
|
+
const { ctx, page: p, errors } = await home({ w: 390, h: 844, touch: true });
|
|
159
|
+
const grips = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-po-grip]')].filter((g) => getComputedStyle(g).display !== 'none').length);
|
|
160
|
+
ok('H phone: no grip shows (hold the row instead)', grips === 0, String(grips));
|
|
161
|
+
// a hold, then a drag, through the touch events the page reads (CDP touch input)
|
|
162
|
+
const s = await p.locator('#hmList [data-po-id="descope-parity"]').boundingBox();
|
|
163
|
+
const t = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
164
|
+
const cdp = await ctx.newCDPSession(p);
|
|
165
|
+
const pt = (y) => [{ x: s.x + s.width / 2, y }];
|
|
166
|
+
await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: pt(s.y + s.height / 2) });
|
|
167
|
+
await sleep(600);
|
|
168
|
+
const lifted = await p.evaluate(() => !!document.querySelector('[data-po-id="descope-parity"].po-lift'));
|
|
169
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/home-phone-hold.png' });
|
|
170
|
+
for (let k = 1; k <= 6; k++) await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: pt(s.y + s.height / 2 - ((s.y + s.height / 2 - (t.y + 6)) * k) / 6) });
|
|
171
|
+
await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] });
|
|
172
|
+
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
173
|
+
ok('H phone: hold the row, it lifts; drag it up and the order saves', lifted && posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ lifted, k: await hkids(p), posts: posts.slice(n0) }));
|
|
174
|
+
const wide = await p.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1);
|
|
175
|
+
ok('H phone: no sideways scroll', wide);
|
|
176
|
+
ok('H phone: no page error', !errors.length, errors.join(' | '));
|
|
177
|
+
await ctx.close();
|
|
178
|
+
}
|
|
179
|
+
finish();
|
|
180
|
+
})();
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* pm/bd-ini-model.js — the Board's initiative panel, read as XipB (feedback batch 4 item 1, agreed 2026-10-25): what the panel says, as data.
|
|
2
|
+
* Pure: no DOM, no reads. pm/bd-ini-panel.js draws it; bd-ini-model.test.js checks it.
|
|
3
|
+
*
|
|
4
|
+
* dateY(iso, now) "Aug 11" this year, "Feb 3, 2027" in any other: a date never reads as this year's when it is not
|
|
5
|
+
* ladderOf(r, pfSteps) the stages of the initiative's OWN workflow (r.wfStages, D99), the current one, the skipped ones and the next one;
|
|
6
|
+
* Product feature is the board's eight steps (pfSteps)
|
|
7
|
+
* whyOf(r, pfSteps, now) the one sentence under the status: the plan end passed, or Jira's pace runs past it, then the first blocked ticket
|
|
8
|
+
* planModel(r, now) the Plan card's line: your plan, past the plan, Jira's pace, today, as percents of the span; null with no date
|
|
9
|
+
* blockedLine(track) "SLV-144 is blocked by PLAT-88." */
|
|
10
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
11
|
+
const dayWord = (n) => n + ' ' + plural(n, 'day', 'days');
|
|
12
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
13
|
+
const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
14
|
+
const todayOf = (now) => { const d = new Date(now == null ? Date.now() : now); return new Date(d.getFullYear(), d.getMonth(), d.getDate()); };
|
|
15
|
+
const between = (a, b) => Math.round((b - a) / 864e5);
|
|
16
|
+
/** "Aug 11" this year, "Feb 3, 2027" in any other year: a date never reads as this year's when it is not. */
|
|
17
|
+
export function dateY(iso, now) {
|
|
18
|
+
const d = dayOf(iso); if (!d) return '';
|
|
19
|
+
return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== todayOf(now).getFullYear() ? ', ' + d.getFullYear() : '');
|
|
20
|
+
}
|
|
21
|
+
const PF_ID = 'product-feature';
|
|
22
|
+
/** The initiative's own workflow, when it is not Product feature and the row carries its stages (D99). */
|
|
23
|
+
export const ownWf = (r) => !!(r && r.wf && r.wf.id && r.wf.id !== PF_ID && Array.isArray(r.wfStages) && r.wfStages.length && r.wfStage);
|
|
24
|
+
/** The ladder of the initiative's own workflow: { steps [{ key, label, ms }], k (the current one), skipped [indexes], next (the stage after,
|
|
25
|
+
* skipped ones left out), name (the current stage's name), wf }. Product feature is the board's eight steps. */
|
|
26
|
+
export function ladderOf(r, pfSteps) {
|
|
27
|
+
const t = r.track || {};
|
|
28
|
+
if (ownWf(r)) {
|
|
29
|
+
const S = r.wfStages, k = S.findIndex((s) => s.key === r.wfStage.key);
|
|
30
|
+
const skipped = S.map((s, j) => (s.status === 'skipped' && j !== k ? j : -1)).filter((j) => j >= 0);
|
|
31
|
+
const next = k >= 0 ? S.slice(k + 1).find((s) => s.status !== 'skipped') || null : null;
|
|
32
|
+
return { own: true, steps: S.map((s) => ({ key: s.key, label: s.name, ms: !!s.milestone })), k, skipped, name: r.wfStage.name || (k >= 0 ? S[k].name : ''), stage: k >= 0 ? S[k] : r.wfStage,
|
|
33
|
+
next: next ? { key: next.key, label: next.name, ms: !!next.milestone } : null, wf: r.wf };
|
|
34
|
+
}
|
|
35
|
+
const S = (pfSteps || []).map((s) => ({ key: s.key, label: s.label, ms: !!s.ms })), k = t.k == null ? -1 : t.k, sk = new Set(t.skipped || []);
|
|
36
|
+
const next = k >= 0 ? S.slice(k + 1).find((s, j) => !sk.has(k + 1 + j)) || null : null;
|
|
37
|
+
return { own: false, steps: S, k, skipped: [...sk], name: k >= 0 && S[k] ? S[k].label : (t.label || r.stage || ''), stage: null, next, wf: r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' } };
|
|
38
|
+
}
|
|
39
|
+
/** The first open ticket Jira flags as blocked, said in words: "SLV-144 is blocked by PLAT-88." */
|
|
40
|
+
export function blockedLine(t) {
|
|
41
|
+
const k = (t.tickets || []).find((x) => x.blocked && x.status !== 'Done'); if (!k) return '';
|
|
42
|
+
const on = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(k.reason || '');
|
|
43
|
+
return k.key + ' is blocked' + (on && on[1] !== k.key ? ' by ' + on[1] : '') + '.';
|
|
44
|
+
}
|
|
45
|
+
/** The one sentence that says why the status is what it is, from the record: the plan end passed, or Jira's pace runs past it. '' when
|
|
46
|
+
* neither holds (the status says enough). now: ms, for the tests. */
|
|
47
|
+
export function whyOf(r, pfSteps, now) {
|
|
48
|
+
const t = r.track || {}, today = todayOf(now), end = dayOf(r.end), fc = dayOf(t.forecast), L = ladderOf(r, pfSteps);
|
|
49
|
+
const done = r.status === 'done' || r.status === 'cancelled';
|
|
50
|
+
const said = [];
|
|
51
|
+
if (end && end < today && !done) said.push('The plan ended ' + dateY(r.end, now) + ', ' + dayWord(between(end, today)) + ' ago, and ' + r.title + ' is in ' + (L.name || 'a stage not on record') + '.');
|
|
52
|
+
else if (end && fc && fc > end && !done) said.push('Jira’s pace ends it ' + dateY(t.forecast, now) + ', ' + dayWord(between(end, fc)) + ' after your plan.');
|
|
53
|
+
const bl = blockedLine(t); if (bl) said.push(bl);
|
|
54
|
+
return said.join(' ');
|
|
55
|
+
}
|
|
56
|
+
/** The plan line's model (XipB): the grey bar is your plan (start → planned end), amber dashed is past the plan to today, blue dashed is
|
|
57
|
+
* Jira's expected end beyond the plan, a tick for today. Positions are percents of the span drawn. null when no record holds a date for it
|
|
58
|
+
* (zero is silence). now: ms, for the tests. */
|
|
59
|
+
export function planModel(r, now) {
|
|
60
|
+
const t = r.track || {}, today = todayOf(now), st = dayOf(r.start), end = dayOf(r.end), fc = dayOf(t.forecast);
|
|
61
|
+
if (!end && !fc) return null;
|
|
62
|
+
const done = r.status === 'done' || r.status === 'cancelled';
|
|
63
|
+
const over = !!(end && end < today && !done), exp = !!(fc && (!end || fc > end) && !done);
|
|
64
|
+
const pts = [st, end, today, exp ? fc : null].filter(Boolean), lo = Math.min(...pts), hi = Math.max(...pts), span = hi - lo || 1;
|
|
65
|
+
const at = (d) => Math.round(((d - lo) / span) * 1000) / 10;
|
|
66
|
+
const m = { over, exp, today: at(today), marks: [], legend: [] };
|
|
67
|
+
if (end) m.bar = { from: at(st || (exp && !over ? today : end)), to: at(end) };
|
|
68
|
+
if (over) m.overBar = { from: at(end), to: at(today), days: between(end, today) };
|
|
69
|
+
if (exp) m.expBar = { from: at(end && end > today ? end : today), to: at(fc), days: end ? between(end, fc) : null };
|
|
70
|
+
if (st) m.marks.push({ at: at(st), label: dateY(r.start, now), kind: 'start' });
|
|
71
|
+
if (end) m.marks.push({ at: at(end), label: dateY(r.end, now), word: 'plan end', kind: 'end' });
|
|
72
|
+
// Today and Jira's date both label the top: when they would touch, Today keeps its tick and the legend names it instead
|
|
73
|
+
const crowd = exp && Math.abs(at(fc) - at(today)) < 24;
|
|
74
|
+
m.marks.push({ at: at(today), label: 'Today', kind: 'today', warn: over, ...(crowd ? { hide: true } : {}) });
|
|
75
|
+
if (exp) m.marks.push({ at: at(fc), label: dateY(t.forecast, now), word: 'Jira', kind: 'jira' });
|
|
76
|
+
if (end) m.legend.push({ kind: 'plan', text: 'Your plan' });
|
|
77
|
+
if (over) m.legend.push({ kind: 'over', text: 'Past the plan · ' + dayWord(m.overBar.days) });
|
|
78
|
+
if (exp) m.legend.push({ kind: 'exp', text: 'Jira’s pace' + (m.expBar.days != null ? ' · ' + dayWord(m.expBar.days) + ' more' : '') });
|
|
79
|
+
if (!over || crowd) m.legend.push({ kind: over ? 'today am' : 'today', text: 'Today' });
|
|
80
|
+
return m;
|
|
81
|
+
}
|