create-pmos 0.852.0 → 0.853.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.852.0",
3
+ "version": "0.853.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,19 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.853.0",
38
+ "at": "2026-11-25T22:04:26.202Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 2062,
43
+ "t": "The runner stops running every suite; a log no longer empties the answer cache",
44
+ "s": "The runner stops running every suite; a log no longer empties the answer cache",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
36
49
  {
37
50
  "v": "0.852.0",
38
51
  "at": "2026-11-25T21:29:45.897Z",
@@ -43,6 +56,7 @@
43
56
  "t": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
44
57
  "s": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
45
58
  "k": "new",
59
+ "i": "one-person-knows",
46
60
  "h": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
47
61
  "try": {
48
62
  "steps": [
@@ -52,30 +66,21 @@
52
66
  ],
53
67
  "see": "Areas only one person touched in 6 months show with the person and how long, with nothing typed. Leave on the calendar is read by itself, so the row of the person going on leave has a ✦; pressing it…",
54
68
  "open": "/premium-board.html"
55
- },
56
- "i": "one-person-knows"
69
+ }
57
70
  },
58
71
  {
59
72
  "n": 2061,
60
73
  "t": "Every pmos command has one line in kit/AGENTS.md so the chat runs it (job #2046)",
61
74
  "s": "Every pmos command has one line in kit/AGENTS.md so the chat runs it (job #2046)",
62
75
  "k": "new",
63
- "i": "planning",
64
- "try": {
65
- "steps": [
66
- "Open Today and open the chat",
67
- "Type: what can you do about who is away this week?",
68
- "Check that the reply runs pmos away and does not say it has no command for it"
69
- ],
70
- "see": "The chat names and runs the pmos command for the ask, because every command now has one line in kit/AGENTS.md that says what it does and when to run it",
71
- "open": "/premium-board.html"
72
- }
76
+ "i": "planning"
73
77
  },
74
78
  {
75
79
  "n": 1968,
76
80
  "t": "A live map of the product's screens on its product page (job #1895, A318)",
77
81
  "s": "A live map of the product's screens on its product page (job #1895, A318)",
78
82
  "k": "new",
83
+ "i": "screen-map",
79
84
  "h": "A live map of the product's screens on its product page (job #1895, A318)",
80
85
  "try": {
81
86
  "steps": [
@@ -85,14 +90,14 @@
85
90
  ],
86
91
  "see": "Every screen of the product's merged code shows as a small card, joined by lines to the screens it leads to. Duplicates, dead ends and screens more than 4 steps from the start carry a mark; the date…",
87
92
  "open": "/today.html"
88
- },
89
- "i": "screen-map"
93
+ }
90
94
  },
91
95
  {
92
96
  "n": 2055,
93
97
  "t": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986, Rule 12)",
94
98
  "s": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986, Rule 12)",
95
99
  "k": "new",
100
+ "i": "surface-on-item",
96
101
  "h": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986,…",
97
102
  "try": {
98
103
  "steps": [
@@ -102,8 +107,7 @@
102
107
  ],
103
108
  "see": "Each shows with no typed ask, only when its condition is true. ✓ on a yes line records where they said yes (Today can then record the sign-off), with Undo. The press release drafts in the background…",
104
109
  "open": "/premium-board.html"
105
- },
106
- "i": "surface-on-item"
110
+ }
107
111
  }
108
112
  ]
109
113
  },
@@ -896,128 +900,6 @@
896
900
  }
897
901
  }
898
902
  ]
899
- },
900
- {
901
- "v": "0.829.0",
902
- "at": "2026-11-25T13:25:22.949Z",
903
- "f": 4,
904
- "prs": [
905
- {
906
- "n": 1948,
907
- "t": "Work › Dependencies lists who waits on which team",
908
- "s": "Work › Dependencies lists who waits on which team",
909
- "k": "new",
910
- "i": "team-waits",
911
- "h": "Work › Dependencies lists who waits on which team",
912
- "try": {
913
- "steps": [
914
- "Open Work",
915
- "Press the Dependencies tab",
916
- "On a row, press the person icon (Chase)"
917
- ],
918
- "see": "Waiting on other teams: one row per wait, oldest first, each with the day it started; a wait of 14 days or more says how many days and shows the late mark; a wait in a sprint that is still running…",
919
- "open": "/premium-board.html?work=deps"
920
- }
921
- },
922
- {
923
- "n": 2002,
924
- "t": "A Today row when a critical-path task moves (A103)",
925
- "s": "A Today row when a critical-path task moves (A103)",
926
- "k": "new",
927
- "i": "critical-moved",
928
- "h": "A Today row when a critical-path task moves (A103)",
929
- "try": {
930
- "steps": [
931
- "Open Today: when a task on an initiative's critical path moved its start or due date in the last 7 days, a row names the task, the move…",
932
- "Open Work, open that initiative and read its plan: the task the row named sits on the critical path.",
933
- "Move the date of a task that is not on the critical path, then open Today again: no new row."
934
- ],
935
- "see": "One row per critical-path move, for example: \"Design review\" moved its due from Dec 3 to Dec 6. It is on the critical path of Checkout revamp, so go-live forecasts Dec 12. No. Forecast Dec 12, 2…",
936
- "open": "/today.html"
937
- }
938
- },
939
- {
940
- "n": 1964,
941
- "t": "Trade-off cards decide two close Roadmap neighbours and keep the reason (job #1918, A325)",
942
- "s": "Trade-off cards decide two close Roadmap neighbours and keep the reason (job #1918, A325)",
943
- "k": "new",
944
- "i": "tradeoff-cards",
945
- "h": "Trade-off cards decide two close Roadmap neighbours and keep the reason (job #1918, A325)",
946
- "try": {
947
- "steps": [
948
- "Open Work and find the line These two are close. Compare them between two initiatives",
949
- "Press it, read both sides and the ✦ line, write why in one line and press ✓"
950
- ],
951
- "see": "The card shows the goal, evidence, cost, risk and what waits for each side, with not known where a record says nothing. After ✓ the reason shows once under the row that went first, and the toast has…",
952
- "open": "/premium-board.html"
953
- }
954
- },
955
- {
956
- "n": 1965,
957
- "t": "Simulated users try the prototype — Findings above the design (A20, #1909)",
958
- "s": "Simulated users try the prototype — Findings above the design (A20, #1909)",
959
- "k": "new",
960
- "i": "sim-users",
961
- "h": "Simulated users try the prototype",
962
- "try": {
963
- "steps": [
964
- "Open Work and open an initiative that has a prototype",
965
- "Press its prototype to open it in the Viewer",
966
- "Read Findings above the design and press one finding"
967
- ],
968
- "see": "Findings says how many simulated users (one per persona) got stuck on each key task and where, for example 2 of 4 personas stuck at Pay, with who they are; a task everyone finished is one line.…",
969
- "open": "/premium-board.html"
970
- }
971
- },
972
- {
973
- "n": 1974,
974
- "t": "Monthly product review pack in Library › Reports (job #1910, A343)",
975
- "s": "Monthly product review pack in Library › Reports (job #1910, A343)",
976
- "k": "new",
977
- "i": "review-pack",
978
- "h": "Monthly product review pack in Library › Reports (job #1910, A343)",
979
- "try": {
980
- "steps": [
981
- "From Today, open Library in the rail and pick Reports in the Kind chip",
982
- "Press this month's review pack: read Goals, Bets that failed, Next big decision and Asks, each line with its source",
983
- "Open it with the arrow to edit it in the document view"
984
- ],
985
- "see": "One pack for each product, drafted by PMOS in the last week of the month. Every line names the record it came from; a part with nothing to say is not shown. The pack changes only when you edit it.…",
986
- "open": "/premium-library.html"
987
- }
988
- },
989
- {
990
- "n": 1962,
991
- "t": "Every page opens with one answer (job #1889)",
992
- "s": "Every page opens with one answer (job #1889)",
993
- "k": "new",
994
- "i": "page-one-answer",
995
- "h": "Every page opens with one answer (job #1889)",
996
- "try": {
997
- "steps": [
998
- "Open Today and read the first line: how many things need you, and how many are moving",
999
- "Open Work and read the same line, then the Needs you rows under it",
1000
- "Open the fold under them and see the rest"
1001
- ],
1002
- "see": "Each page opens with one sentence that counts what needs you, then the rest. Under it, only what needs you. The rest is folded until you open it. When nothing needs you the line says All moving and…",
1003
- "open": "/today.html"
1004
- }
1005
- },
1006
- {
1007
- "n": 1995,
1008
- "t": "An optional time on a task's start and due",
1009
- "s": "An optional time on a task's start and due",
1010
- "k": "new",
1011
- "i": "task-time-optional"
1012
- },
1013
- {
1014
- "n": 2007,
1015
- "t": "Portfolio's Not now draws the dismiss icon",
1016
- "s": "Portfolio's Not now draws the dismiss icon",
1017
- "k": "fix",
1018
- "i": "portfolio"
1019
- }
1020
- ]
1021
903
  }
1022
904
  ]
1023
905
  }
package/payload/AGENTS.md CHANGED
@@ -292,6 +292,7 @@ A `pmos` command that this file does not name is a feature the chat never runs.
292
292
  - `pmos pick --minutes <n>`: the one ask that fits the time and unblocks the most. Run it when the PM says how much time they have ("I have 30 minutes").
293
293
  - `pmos tracker done|status|sync`: when tracker items were last read and how much of the repository matches the last Jira read. Run it when the PM asks if Jira is up to date or why a ticket looks old.
294
294
  - `pmos source save|status|show`: the stored read of each tool the Briefing uses (Mail, Slack, Confluence and the rest). Run it when the PM asks what PMOS last read from a tool, or when a briefing looks old.
295
+ - `pmos screens [show|note]`: the product's screens from its merged code, the flows between them and their marks; a note on a screen starts work. Run it when the PM asks what screens the product has, how one screen leads to another, or wants to note a change on a screen.
295
296
  - `pmos past ask|check|verify|sources`: the records that say why something was decided or dropped, each with its line. Run it when the PM asks why we decided or dropped something.
296
297
  - `pmos lead put|show|due`: the short lead a popup shows, written ahead from stored reads. Run it when a popup's lead is missing or old, or the PM asks to rewrite it.
297
298
  - `pmos blueprint [list|show|unplaced|check]`: every feature of the product with a status from its evidence. Run it when the PM asks what the product has, or which features are not placed.
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@454210d61
1
+ kernel-source: pmos@d1acfda52
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T21:29:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T22:04:22Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-25T21:29:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T22:04:22Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-25T21:29:41Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T22:04:22Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.853.0",
4
+ "at": "2026-11-25T22:04:26.202Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 2062,
9
+ "t": "The runner stops running every suite; a log no longer empties the answer cache",
10
+ "s": "The runner stops running every suite; a log no longer empties the answer cache",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.852.0",
4
17
  "at": "2026-11-25T21:29:45.897Z",
@@ -9,6 +22,7 @@
9
22
  "t": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
10
23
  "s": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
11
24
  "k": "new",
25
+ "i": "one-person-knows",
12
26
  "h": "Only one person knows this — one-person areas and a ✦ before a leave (job #1899)",
13
27
  "try": {
14
28
  "steps": [
@@ -18,30 +32,21 @@
18
32
  ],
19
33
  "see": "Areas only one person touched in 6 months show with the person and how long, with nothing typed. Leave on the calendar is read by itself, so the row of the person going on leave has a ✦; pressing it…",
20
34
  "open": "/premium-board.html"
21
- },
22
- "i": "one-person-knows"
35
+ }
23
36
  },
24
37
  {
25
38
  "n": 2061,
26
39
  "t": "Every pmos command has one line in kit/AGENTS.md so the chat runs it (job #2046)",
27
40
  "s": "Every pmos command has one line in kit/AGENTS.md so the chat runs it (job #2046)",
28
41
  "k": "new",
29
- "i": "planning",
30
- "try": {
31
- "steps": [
32
- "Open Today and open the chat",
33
- "Type: what can you do about who is away this week?",
34
- "Check that the reply runs pmos away and does not say it has no command for it"
35
- ],
36
- "see": "The chat names and runs the pmos command for the ask, because every command now has one line in kit/AGENTS.md that says what it does and when to run it",
37
- "open": "/premium-board.html"
38
- }
42
+ "i": "planning"
39
43
  },
40
44
  {
41
45
  "n": 1968,
42
46
  "t": "A live map of the product's screens on its product page (job #1895, A318)",
43
47
  "s": "A live map of the product's screens on its product page (job #1895, A318)",
44
48
  "k": "new",
49
+ "i": "screen-map",
45
50
  "h": "A live map of the product's screens on its product page (job #1895, A318)",
46
51
  "try": {
47
52
  "steps": [
@@ -51,14 +56,14 @@
51
56
  ],
52
57
  "see": "Every screen of the product's merged code shows as a small card, joined by lines to the screens it leads to. Duplicates, dead ends and screens more than 4 steps from the start carry a mark; the date…",
53
58
  "open": "/today.html"
54
- },
55
- "i": "screen-map"
59
+ }
56
60
  },
57
61
  {
58
62
  "n": 2055,
59
63
  "t": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986, Rule 12)",
60
64
  "s": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986, Rule 12)",
61
65
  "k": "new",
66
+ "i": "surface-on-item",
62
67
  "h": "Sign-offs, numbers, press release and first milestones show on the open item (job #1986,…",
63
68
  "try": {
64
69
  "steps": [
@@ -68,8 +73,7 @@
68
73
  ],
69
74
  "see": "Each shows with no typed ask, only when its condition is true. ✓ on a yes line records where they said yes (Today can then record the sign-off), with Undo. The press release drafts in the background…",
70
75
  "open": "/premium-board.html"
71
- },
72
- "i": "surface-on-item"
76
+ }
73
77
  }
74
78
  ]
75
79
  },
@@ -13,7 +13,7 @@
13
13
  * warm(url, run, ctx) read this answer in the background, once the server is idle, so its first open is fast too
14
14
  * onKept(fn) fn(url, body, ctx) after each fresh answer is kept: route-modules warms what the page opens next from it
15
15
  * watch(roots) watch each workspace's records for a write made outside the server (an agent's `pmos` command, an editor)
16
- * stats() · reset() for the tests
16
+ * stats() · reset() stats() also lists the last drops and what caused each (GET /api/board-premium/cache); reset() for the tests
17
17
  *
18
18
  * THE RULES
19
19
  * - A kept answer is shown only when nothing was written since it was read (GEN). A write the PM makes (any POST, PUT, PATCH or
@@ -51,6 +51,8 @@ const AGAIN_MAX = 12; // kept answers read again after a write, newest first
51
51
  const QUEUE_MAX = 40;
52
52
 
53
53
  let GEN = 0;
54
+ const DROPS_MAX = 30;
55
+ const drops = []; // the last DROPS_MAX drops, newest last: { at, why } (GET /api/board-premium/cache), so a cache that keeps nothing says what keeps writing
54
56
  // the background read answers nobody: a route that touches `res` itself finds a response that takes nothing
55
57
  const DUMMY = { headersSent: false, setHeader() {}, getHeader() {}, writeHead() { return this; }, write() { return true; }, end() {}, on() {} };
56
58
  const kept = new Map(); // key → { gen, day, at, body, again } again(): the background read of the same question
@@ -73,11 +75,12 @@ function bump(method, pathname) {
73
75
  if (m === 'GET' || m === 'HEAD' || m === 'OPTIONS') return false;
74
76
  if (!String(pathname || '').startsWith('/api/')) return false;
75
77
  if (QUIET.some((re) => re.test(pathname))) return false;
76
- return drop();
78
+ return drop(m + ' ' + pathname);
77
79
  }
78
- /** Every kept answer is too old from now on; the newest are read again once the server is idle. */
79
- function drop() {
80
+ /** Every kept answer is too old from now on; the newest are read again once the server is idle. why: what wrote, for stats(). */
81
+ function drop(why) {
80
82
  GEN++; n.bumped++; queue.clear(); ahead.clear();
83
+ drops.push({ at: Date.now(), why: String(why || 'a chat turn ended').slice(0, 200) }); if (drops.length > DROPS_MAX) drops.shift();
81
84
  // the newest kept answers are read again once the server is idle; until then a read waits for its own fresh answer
82
85
  const last = [...kept.entries()].slice(-AGAIN_MAX).reverse();
83
86
  for (const [key, e] of last) if (e.again) queue.set(key, e.again);
@@ -105,11 +108,15 @@ function watchDir(dir, recursive) {
105
108
  try {
106
109
  const w = fs.watch(dir, { recursive: recursive && !tree, persistent: false }, (ev, f) => {
107
110
  if (f && SKIP.test(String(f))) return;
108
- n.outside++; drop();
111
+ // the workspace folder itself is watched only to see planning/ or pmos/ appear: a file beside them (a log the server appends, an
112
+ // editor's swap file) is no record. On the Mac the server's own state folder is a workspace, and its refresh-log.jsonl, appended
113
+ // every 20-30 s, emptied every kept answer (page-open-200ms, measured 2026-11-26)
114
+ if (!recursive && f && f !== 'planning' && f !== 'pmos') return;
115
+ n.outside++; drop('changed: ' + (f ? path.join(dir, String(f)) : dir));
109
116
  if (!recursive && (f === 'planning' || f === 'pmos')) watchDir(path.join(dir, f), true);
110
117
  else if (tree && f) watchDir(path.join(dir, String(f)), true); // a new sub-folder (a file is not a folder: it is skipped)
111
118
  });
112
- w.on('error', () => { try { w.close(); } catch { /* closed */ } watched.set(dir, 'blind'); blind = true; drop(); });
119
+ w.on('error', () => { try { w.close(); } catch { /* closed */ } watched.set(dir, 'blind'); blind = true; drop('cannot watch ' + dir); });
113
120
  watched.set(dir, w);
114
121
  } catch { watched.set(dir, 'blind'); blind = true; return; }
115
122
  if (tree) {
@@ -190,7 +197,7 @@ async function serve(req, res, url, ctx, run) {
190
197
  return true;
191
198
  }
192
199
 
193
- function stats() { return { ...n, size: kept.size, gen: GEN, queued: queue.size, ahead: ahead.size }; }
194
- function reset() { for (const w of watched.values()) if (w && typeof w === 'object') { try { w.close(); } catch { /* closed */ } } watched.clear(); blind = false; kept.clear(); queue.clear(); ahead.clear(); GEN = 0; if (timer) clearTimeout(timer); timer = null; busy = false; lastReq = 0; follower = null; for (const k of Object.keys(n)) n[k] = 0; }
200
+ function stats() { return { ...n, size: kept.size, gen: GEN, queued: queue.size, ahead: ahead.size, blind, drops: drops.slice() }; }
201
+ function reset() { for (const w of watched.values()) if (w && typeof w === 'object') { try { w.close(); } catch { /* closed */ } } watched.clear(); blind = false; kept.clear(); queue.clear(); ahead.clear(); GEN = 0; drops.length = 0; if (timer) clearTimeout(timer); timer = null; busy = false; lastReq = 0; follower = null; for (const k of Object.keys(n)) n[k] = 0; }
195
202
 
196
203
  module.exports = { SLOW, QUIET, FRESH_MS, MAX_AGE_MS, IDLE_MS, AHEAD_IDLE_MS, AGAIN_MAX, cacheable, serve, bump, drop, idle, warm, onKept, watch, stats, reset, keyOf };
@@ -65,6 +65,14 @@ module.exports = {
65
65
  /* GET /api/board-premium/stale?ws=<id>[,<id>] → { ok, stale } whether the rows of those workspaces (every one when none is named) are
66
66
  * still derived again. Work asks this while its answer says `stale`, and reads the whole board again only when it says false: the board
67
67
  * read takes a second or more, the check a few milliseconds (page-open-200ms). It starts a derivation when the rows are old and none runs. */
68
+ /* GET /api/board-premium/cache → { ok, hit, miss, size, gen, drops: [{ at, why }] } the answer cache's counts and the last writes that
69
+ * emptied it (lib/answer-cache.js), read-only: when Work or an initiative opens slowly on a PM's own machine, this names what keeps writing. */
70
+ if (url.pathname === '/api/board-premium/cache') {
71
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
72
+ let st = {}; try { st = require('./answer-cache.js').stats(); } catch { st = {}; }
73
+ ctx.json(res, { ok: true, ...st });
74
+ return true;
75
+ }
68
76
  if (url.pathname === '/api/board-premium/stale') {
69
77
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
70
78
  const want = String(url.searchParams.get('ws') || '').split(',').filter(Boolean);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.852.0",
3
+ "version": "0.853.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.852.0",
9
+ "version": "0.853.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.852.0",
3
+ "version": "0.853.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@
5
5
  * D1 the shell's Discuss in chat names the item: ?about=<prefix>:<id>, ?label, ?vk, ?vid · D2 an initiative lands on its layout, chat and
6
6
  * overview · D3 a document lands on its chat with the document open · D4 a kind Home has no view for is the chat alone · D5 no page error */
7
7
  const path = require('path');
8
+ const http = require('http'); // the localhost settle poll in discussFrom
8
9
  const { spawn } = require('child_process');
9
10
  const { findBrowser } = require('./lib/find-browser');
10
11
  const T = require('./test-run').configure({ name: 'premium-discuss-landing' });
@@ -51,35 +52,41 @@ const json = (r, body, status = 200) => r.fulfill({ status, contentType: 'applic
51
52
 
52
53
  // the Discuss press of an item on a page with no chat beside it (the Viewer floats there), read as the address it goes to
53
54
  const discussFrom = async (item) => {
54
- await page.goto(BASE + '/premium-viewer.html?theme=light');
55
+ // CI: Today with an initiative open sends ~50 reads, and on a loaded runner the server answered nothing (not even this page) for 30-45 s after it.
56
+ // Leave Today and wait until the server answers a page in under a second, then open the Viewer; DOM-ready, since the czViewer wait is the ready signal.
57
+ await page.goto('about:blank');
58
+ for (const t0 = Date.now(); Date.now() - t0 < 90000;) { const t = Date.now(); await new Promise((done) => { const rq = http.get(BASE + '/premium-viewer.html?theme=light', (r) => { r.resume(); r.on('end', done); }); rq.on('error', done); rq.setTimeout(60000, () => { rq.destroy(); done(); }); }); if (Date.now() - t < 1000) break; }
59
+ await page.goto(BASE + '/premium-viewer.html?theme=light', { waitUntil: 'domcontentloaded', timeout: 60000 });
55
60
  await page.waitForFunction(() => !!window.czViewer, null, { timeout: 15000 });
56
61
  await page.evaluate((it) => window.czViewer.open({ ...it, discuss: true, html: '<p>The item</p>' }), item);
57
62
  await page.click('#czViewer [data-cz-vw="discuss"]');
58
- await page.waitForURL(/\/today\.html\?/, { timeout: 15000 }); // Home's address opens Today (home-page-retire)
63
+ await page.waitForURL(/\/today\.html\?/, { waitUntil: 'commit', timeout: 60000 }); // Home's address opens Today (home-page-retire); its draw is waited on below
59
64
  return new URL(page.url());
60
65
  };
61
66
  // on a desktop the popup's chat names the item (home-page-retire)
62
67
  const state = () => page.evaluate(() => ({
63
68
  vw: !!document.querySelector('#czViewer:not([hidden])'), vwTitle: ((document.querySelector('#czViewer .cz-vw-hd') || {}).textContent || '').replace(/\s+/g, ' ').trim(),
64
- top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, url: location.search,
69
+ top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle') || {}).textContent, url: location.search,
65
70
  pop: !!document.querySelector('.cz-pop:not([hidden]) #hmChat'), cx: ((document.querySelector('.cz-pop-cx') || {}).textContent || ''),
66
71
  log: ((document.querySelector('#hmLog') || {}).textContent || '').replace(/\s+/g, ' ').trim().slice(0, 160), ph: (document.querySelector('#hmIn') || {}).placeholder || '',
67
- }));
72
+ })).catch((e) => ({ err: String(e.message || e).slice(0, 80) })); // the page may still be arriving (waitForURL waits for its address only)
68
73
 
69
74
  let u = await discussFrom({ kind: 'Initiative', id: 'usage-billing', title: 'Usage-based billing' });
70
75
  ok('D1 an initiative\'s Discuss names it: about=init:<id>, its title, its kind and id', u.searchParams.get('about') === 'init:usage-billing' && u.searchParams.get('label') === 'Usage-based billing' && u.searchParams.get('vk') === 'initiative' && u.searchParams.get('vid') === 'usage-billing', u.search);
71
- let s = await until(async () => { const v = await state(); return v.vw && /Usage-based billing/.test(v.vwTitle) ? v : null; }, 15000) || await state();
76
+ let s = await until(async () => { const v = await state(); return v.vw && /Usage-based billing/.test(v.vwTitle) ? v : null; }, 45000) || await state();
72
77
  ok('D2 an initiative lands on its layout, with its chat and its overview in the Viewer beside it', s.top === 'Usage-based billing' && s.vw && /Usage-based billing/.test(s.vwTitle) && /ini=usage-billing/.test(s.url), JSON.stringify(s));
73
78
 
74
79
  if (process.env.DL_SHOTS) await page.screenshot({ path: path.join(process.env.DL_SHOTS, 'discuss-landing-1440.png') }); // a folder: a review shot
75
80
  u = await discussFrom({ kind: 'PRD', id: 'planning/prd/usage-billing.md', title: 'Usage billing PRD' });
76
81
  ok('D1 a document\'s Discuss keeps its path for Home: about=doc:…, vid=<path>', /^doc:planning-prd-usage-billing\.md$/.test(u.searchParams.get('about') || '') && u.searchParams.get('vid') === 'planning/prd/usage-billing.md', u.search);
77
- s = await until(async () => { const v = await state(); return v.vw && /usage-billing|Usage billing PRD/i.test(v.vwTitle) ? v : null; }, 15000) || await state();
82
+ // CI: premium-vw-doc.js alone took ~27 s to arrive on a loaded runner (4 suites on 4 cores locally); the document opens once it does
83
+ s = await until(async () => { const v = await state(); return v.vw && /usage-billing|Usage billing PRD/i.test(v.vwTitle) ? v : null; }, 45000) || await state();
78
84
  ok('D3 a document lands on the chat about it, with the document open in the Viewer', s.top === 'Usage billing PRD' && s.vw && /usage-billing|Usage billing PRD/i.test(s.vwTitle), JSON.stringify(s));
79
85
 
80
86
  u = await discussFrom({ kind: 'Person', id: 'ana', title: 'Ana Lim' });
81
87
  ok('D1 a kind Home has no key for is a chat key: about=chat:<id>', u.searchParams.get('about') === 'chat:ana', u.search);
82
- await sleep(2500); s = await state();
88
+ s = await until(async () => { const v = await state(); return v.top === 'Ana Lim' ? v : null; }, 45000) || await state();
89
+ await sleep(2500); s = await state(); // then what it settles on
83
90
  ok('D4 a kind Home has no view for is the chat alone, named by its label', s.top === 'Ana Lim' && (!s.vw || (s.pop && /All sessions/.test(s.vwTitle))), // the popup's work side holds the session list (home-page-retire)
84
91
  JSON.stringify(s));
85
92
  // bug 2026-10-24: the Board's program panel Discuss named board:program:<id>, which Home sent as a Board row it does not have
@@ -87,7 +94,7 @@ const json = (r, body, status = 200) => r.fulfill({ status, contentType: 'applic
87
94
  await ctx.route(/\/api\/programs(\?.*)?$/, (r) => json(r, { ok: true, programs: [{ id: 'project-ascent', title: 'Project Ascent', members: [], tasks: [], milestones: [] }] }));
88
95
  u = await discussFrom({ kind: 'Program', id: 'program:project-ascent', title: 'Project Ascent' });
89
96
  ok('D6 a program\'s Discuss names it: about=board:program:<id>', u.searchParams.get('about') === 'board:program:project-ascent', u.search);
90
- s = await until(async () => { const v = await page.evaluate(() => { const c = document.querySelector('[data-hm-scope]'); return { top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, scope: c ? c.textContent.trim() : '' }; }); return /Project Ascent/.test(v.scope) ? v : null; }, 15000)
97
+ s = await until(async () => { const v = await page.evaluate(() => { const c = document.querySelector('[data-hm-scope]'); return { top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle') || {}).textContent, scope: c ? c.textContent.trim() : '' }; }).catch(() => ({ scope: '' })); return /Project Ascent/.test(v.scope) ? v : null; }, 45000)
91
98
  || await page.evaluate(() => ({ top: (document.querySelector('.cz-pop:not([hidden]) .cz-pop-t span') || document.querySelector('#hmTopTitle')).textContent, scope: ((document.querySelector('[data-hm-scope]') || {}).textContent || '').trim() }));
92
99
  ok('D6 a program lands on its own conversation: the chat goes in the program, not All work', s.top === 'Project Ascent' && s.scope === 'In: Project Ascent', JSON.stringify(s));
93
100
  ok('D5 no page error', errors.length === 0, errors.join(' | '));
@@ -116,8 +116,12 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
116
116
  await p.click('#czViewer [data-cz-vw-rn]');
117
117
  await p.fill('#czViewer .cz-vw-ren input', 'Descope parity');
118
118
  await p.check('#czViewer .cz-vw-jt input');
119
+ // the address the press opens: Today then opens the initiative and writes its own ?ini= address over it (history.replaceState),
120
+ // so p.url() read after the load can already be the rewritten one on a fast or a slow runner. The first Today address is the press's.
121
+ const navs = []; const onNav = (f) => { if (f === p.mainFrame()) navs.push(f.url()); }; p.on('framenavigated', onNav);
119
122
  await Promise.all([p.waitForURL(/\/today\.html\?/, { timeout: 15000 }).catch(() => null), p.click('#czViewer .cz-vw-sv')]);
120
- const u = new URL(p.url());
123
+ p.off('framenavigated', onNav);
124
+ const u = new URL(navs.find((x) => /\/today\.html\?/.test(x)) || p.url());
121
125
  ok('I with the Jira box ticked, Today opens the initiative\'s chat with the request typed, not sent', u.pathname === '/today.html' && u.searchParams.get('about') === 'init:descope-parity'
122
126
  && u.searchParams.get('say') === 'Rename the Jira epic IDPF-12 to "Descope parity".', u.href);
123
127
  ok('I a row with no Jira epic has no Jira box', await (async () => {
@@ -148,6 +148,7 @@ function shardOf(list, spec) {
148
148
  // Files every page or every suite loads. A change to one can break any suite, so --changed runs
149
149
  // the whole group. A changed file no suite can be traced to is treated the same way (see below).
150
150
  // server.js is not on the list: traceChanges() reads which part of it changed (see there).
151
+ const TRACER = new Set(['run-tests.js', 'test-run.js']);
151
152
  const WIDE = new Set([
152
153
  'test-run.js', 'run-tests.js', 'test-files.json', 'package.json', 'package-lock.json',
153
154
  'public/pm/app.js', 'public/pm/state.js', 'public/pm/dom.js', 'public/pm/data.js',
@@ -179,7 +180,10 @@ const WIDE = new Set([
179
180
  * prefixes it declares (a route it only calls through ctx is left out). With no prefixes it can read: every route it names.
180
181
  * - lib/pmos-verbs.js, when the diff only adds a verb (its module line and its help line): the suites that name pmos-verbs or the new module.
181
182
  * - lib/needs-providers.js, when the diff only adds a provider name to PROVIDERS: the suites that name needs-providers or the new provider.
182
- * - lib/route-modules.js, when the diff only adds module names to its list: what each added lib/routes-<x>.js reaches. Any other change to it is the rule below.
183
+ * - lib/route-modules.js, when the diff only adds module names to its list: what each added lib/routes-<x>.js reaches. Any other change
184
+ * to it: every suite, as its dispatch() serves every route module. A file it requires (answer-cache.js) is traced by the rule below.
185
+ * - The runner itself (run-tests.js, test-run.js) is no file's user unless it requires the file: it names lib files only as strings in
186
+ * these rules. Before, a change to any file on the path to route-modules.js ran every suite ("route-modules.js is used by run-tests.js").
183
187
  * - Any other file: the files that name it (a require, an import or a path string), followed the same way: server.js
184
188
  * through the names it binds the module to, a lib/ file through its own users, a suite directly. A lib/ file that no
185
189
  * file names reaches every suite.
@@ -647,6 +651,9 @@ function traceChanges(changes, ctx) {
647
651
  if (g !== 'server.js' && !usesChanged(g, f, re)) continue; // it names the file, but none of the exports the change touched
648
652
  if (inList.has(g)) { picked.add(g); continue; }
649
653
  if (SUITE_NAME.test(g)) continue; // a suite of another group: nothing depends on it
654
+ // the runner itself (run-tests.js, test-run.js) names lib files only as strings in its own rules ('lib/route-modules.js'), never by
655
+ // loading them: it is a user only where it requires the file. It made every change of route-modules.js, and every lib file on its path, run every suite.
656
+ if (TRACER.has(g) && !new RegExp(`require\\(\\s*['"\`][^'"\`]*${reEsc(stemOf(f))}(?:\\.m?js)?['"\`]`).test(t)) continue;
650
657
  if (WIDE.has(g)) return `${f} is used by ${g}`;
651
658
  // a verb module is named by the verb table only as `module: '<x>-cli.js'`: only `pmos <verb>` runs it, so its own suites are its users,
652
659
  // not every user of the table (launch-readiness-check: a new verb module reached 177 suites through bin/pmos.js)
@@ -748,6 +755,7 @@ function traceChanges(changes, ctx) {
748
755
  // only module names were added to the list: each reaches what its own file reaches, as if that file had changed
749
756
  for (const n of lines) { const m = /'(routes-[\w-]+)'/.exec(get(f).split('\n')[n - 1]); if (m && !why) why = routeModule(`lib/${m[1]}.js`); }
750
757
  }
758
+ else if (f === 'lib/route-modules.js') why = 'lib/route-modules.js changed beyond its module list, and it routes every module'; // its dispatch() serves every lib/routes-<x>.js
751
759
  else if (f.startsWith('public/')) viaPublic(f);
752
760
  else {
753
761
  why = users(f);