create-pmos 0.396.0 → 0.398.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.396.0",
3
+ "version": "0.398.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": {
@@ -32,6 +32,30 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.398.0",
37
+ "at": "2026-10-23T04:45:54.728Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1012,
42
+ "t": "Rebuild Home, Viewer, Board and Insights to the Agreed design",
43
+ "s": "Rebuild Home, Viewer, Board and Insights to the Agreed design"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "v": "0.397.0",
49
+ "at": "2026-10-22T20:10:19.514Z",
50
+ "f": 2,
51
+ "prs": [
52
+ {
53
+ "n": 1011,
54
+ "t": "The premium pages follow the Agreed design",
55
+ "s": "The premium pages follow the Agreed design"
56
+ }
57
+ ]
58
+ },
35
59
  {
36
60
  "v": "0.396.0",
37
61
  "at": "2026-10-22T10:57:02.235Z",
@@ -267,30 +291,6 @@
267
291
  "s": "Notes replace the Scratchpad in the premium chat"
268
292
  }
269
293
  ]
270
- },
271
- {
272
- "v": "0.378.0",
273
- "at": "2026-10-21T07:48:19.057Z",
274
- "f": 2,
275
- "prs": [
276
- {
277
- "n": 987,
278
- "t": "Chips for what an answer worked with, main one opens by itself",
279
- "s": "Chips for what an answer worked with, main one opens by itself"
280
- }
281
- ]
282
- },
283
- {
284
- "v": "0.377.0",
285
- "at": "2026-10-21T07:27:29.956Z",
286
- "f": 2,
287
- "prs": [
288
- {
289
- "n": 986,
290
- "t": "Attach files and photos to a premium chat message",
291
- "s": "Attach files and photos to a premium chat message"
292
- }
293
- ]
294
294
  }
295
295
  ]
296
296
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@89b779a8
2
- assembled: 2026-10-22
1
+ kernel-source: pmos@dde8a9db
2
+ assembled: 2026-10-23
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-22T10:56:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-22T10:56:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,40 +1,63 @@
1
1
  'use strict';
2
2
  /*
3
- * The nine stage names as a label layer over the workflow engine's derived stage (run 3).
3
+ * The lifecycle label layer over the workflow engine's derived stage: six stages and two milestones
4
+ * (premium-agreed-design L1, PM decision 2026-10-22). The file keeps its old name and export names
5
+ * (`nineStages`, `STAGES`, `LABELS`, `LANE_STAGES`) so that every caller keeps working; the
6
+ * `nine_stages` field on a row keeps its name for the same reason. It now carries eight entries.
7
+ *
8
+ * Triage (BRD) → Discover (PRD) → Plan (scope, timeline, WBS; the PM's Commit pushes tickets to Jira)
9
+ * → Prioritize (ranked on the roadmap) → Build (features delivered, Jira) → ◆ Deliver (milestone:
10
+ * release shipped, PM sign-off) → Monitor (outcome report) → ◆ Evaluate (milestone: keep, iterate or stop)
4
11
  *
5
12
  * The engine derives one of six rungs (intake, spec, contract, build, eval, accepted) from the steps
6
- * it found. This file names the nine stages the PM sees and says which of them each lane uses. It
7
- * never decides a stage itself: a stage is `done` only when a derived signal shows it, and a stage
8
- * no record can yet show is `no-signal`, not guessed.
13
+ * it found. This file names the stages the PM sees and says which of them each lane uses. It never
14
+ * decides a stage itself: a stage is `done` only when a derived signal shows it, and a stage no record
15
+ * can yet show is `no-signal`, not guessed.
9
16
  *
10
- * The lane sets below are a proposal for the PM to correct (see the run 3 contract in the PRD).
17
+ * Migration: the old nine had Ideate and Strategize. Stage is derived, never stored, so there is no
18
+ * stored stage to rewrite. Records that signalled Ideate (ideas, hypotheses) now count for Discover;
19
+ * records that signalled Strategize (decisions, bets) now count for Prioritize. `stageKey` maps an
20
+ * old key read from anywhere (a stored payload, a URL, a fixture) to its new key at read time.
11
21
  */
12
22
 
13
- const STAGES = ['discover', 'ideate', 'strategize', 'prioritize', 'plan', 'build', 'deliver', 'monitor', 'evaluate'];
23
+ const STAGES = ['triage', 'discover', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate'];
14
24
 
15
25
  const LABELS = {
16
- discover: 'Discover', ideate: 'Ideate', strategize: 'Strategize', prioritize: 'Prioritize', plan: 'Plan',
26
+ triage: 'Triage', discover: 'Discover', plan: 'Plan', prioritize: 'Prioritize',
17
27
  build: 'Build', deliver: 'Deliver', monitor: 'Monitor', evaluate: 'Evaluate',
18
28
  };
19
29
 
30
+ // What each stage produces (the PM's words on the Agreed design).
31
+ const OUTPUTS = {
32
+ triage: 'BRD', discover: 'PRD', plan: 'Scope, timeline and work breakdown', prioritize: 'Ranked on the roadmap',
33
+ build: 'Features delivered (Jira)', deliver: 'Release shipped, PM sign-off', monitor: 'Outcome report', evaluate: 'Keep, iterate or stop',
34
+ };
35
+
36
+ // Deliver and Evaluate are milestones (drawn as a diamond), not stages with duration.
37
+ const MILESTONES = new Set(['deliver', 'evaluate']);
38
+
39
+ // The removed keys and where they went. Read-time only: nothing stored is rewritten.
40
+ const LEGACY = { ideate: 'discover', strategize: 'prioritize' };
41
+ const stageKey = (k) => (k == null ? k : LEGACY[k] || k);
42
+
20
43
  // Which stages each product-code lane uses. Stages not listed read `skipped`.
21
44
  const LANE_STAGES = {
22
45
  feature: STAGES,
23
- discovery: ['discover', 'ideate', 'strategize', 'prioritize', 'evaluate'],
24
- chore: ['plan', 'build', 'evaluate'],
46
+ discovery: ['triage', 'discover', 'prioritize', 'evaluate'],
47
+ chore: ['plan', 'build', 'deliver', 'evaluate'],
25
48
  incident: ['build', 'deliver', 'monitor', 'evaluate'],
26
- content: ['ideate', 'plan', 'build', 'deliver'],
27
- prototype: ['discover', 'ideate', 'evaluate'],
49
+ content: ['discover', 'plan', 'build', 'deliver'],
50
+ prototype: ['triage', 'discover', 'evaluate'],
28
51
  };
29
52
 
30
53
  // Stages that have a derived signal today. Every other stage reads `no-signal` until its record exists.
31
- const SIGNALLED = new Set(['discover', 'plan', 'build', 'evaluate']);
54
+ const SIGNALLED = new Set(['triage', 'discover', 'plan', 'build', 'evaluate']);
32
55
 
33
56
  const RANK = { intake: 0, spec: 1, contract: 2, build: 3, eval: 4, accepted: 5 };
34
57
 
35
58
  // Stages that gain a signal only when the caller passes the records (scripts/records readAll plus optional `releases`).
36
- // With no records the output is exactly the older output, so the lifecycle-lens mirror stays equal.
37
- const RECORD_SIGNALLED = new Set(['ideate', 'strategize', 'prioritize', 'monitor', 'deliver']);
59
+ // With no records the output is exactly the records-free output, so the lifecycle-lens mirror stays equal.
60
+ const RECORD_SIGNALLED = new Set(['discover', 'prioritize', 'monitor', 'deliver']);
38
61
 
39
62
  // records: { initiative?, anchor?, ideas, hypotheses, decisions, bets, 'kr-metrics', releases } (every list optional).
40
63
  // The initiative id and anchor come from `derived` (id, anchor) or from records.initiative / records.anchor.
@@ -43,10 +66,12 @@ function recordSignals(derived, records, buildDone) {
43
66
  const anchor = (derived && derived.anchor) || records.anchor || null;
44
67
  const mine = (list) => (list || []).filter((r) => id && r.initiative === id);
45
68
  const kr = (records['kr-metrics'] || []).filter((m) => anchor && (m.rid === anchor || m.parent_kr === anchor || 'kr:' + m.rid === anchor));
69
+ const ranked = mine(records.bets).some((b) => ['now', 'next', 'later'].includes(b.horizon) && Number.isInteger(b.rank));
46
70
  return {
47
- ideate: mine(records.ideas).length + mine(records.hypotheses).length > 0,
48
- strategize: mine(records.decisions).length + mine(records.bets).length > 0,
49
- prioritize: mine(records.bets).some((b) => ['now', 'next', 'later'].includes(b.horizon) && Number.isInteger(b.rank)),
71
+ // was Ideate: an idea or hypothesis on the initiative
72
+ discover: mine(records.ideas).length + mine(records.hypotheses).length > 0,
73
+ // was Strategize (a decision or bet) or the old Prioritize (a ranked bet)
74
+ prioritize: ranked || mine(records.decisions).length + mine(records.bets).length > 0,
50
75
  monitor: !!buildDone && kr.some((m) => (m.readings || []).length > 0),
51
76
  deliver: mine(records.releases).length > 0,
52
77
  };
@@ -57,6 +82,7 @@ function nineStages(lane, derived, records) {
57
82
  const rank = RANK[derived && derived.stage] ?? 0;
58
83
  const step = (key) => (derived && derived.steps || []).find((s) => s.key === key);
59
84
  const done = {
85
+ triage: rank >= 1,
60
86
  discover: rank >= 1,
61
87
  plan: rank >= 2,
62
88
  build: rank >= 3 || (step('build') && step('build').status === 'done'),
@@ -64,18 +90,21 @@ function nineStages(lane, derived, records) {
64
90
  };
65
91
  const accepted = rank >= 5;
66
92
  const fromRecords = records && typeof records === 'object' ? recordSignals(derived, records, done.build) : null;
93
+ const signalled = (key) => SIGNALLED.has(key) || (fromRecords && RECORD_SIGNALLED.has(key) && (key !== 'deliver' || fromRecords.deliver));
67
94
  const out = [];
68
95
  let currentSet = false;
69
96
  for (const key of STAGES) {
70
97
  let status;
71
98
  if (!laneSet.has(key)) status = 'skipped';
72
- else if (!SIGNALLED.has(key) && !(fromRecords && RECORD_SIGNALLED.has(key) && (key !== 'deliver' || fromRecords.deliver))) status = 'no-signal';
99
+ else if (!signalled(key)) status = 'no-signal';
73
100
  else if (done[key] || (fromRecords && fromRecords[key])) status = 'done';
74
101
  else status = 'pending';
75
102
  if (status === 'pending' && !currentSet) { status = 'current'; currentSet = true; }
76
- out.push({ key, label: LABELS[key], status, accepted: key === 'evaluate' ? accepted : undefined });
103
+ const entry = { key, label: LABELS[key], status, accepted: key === 'evaluate' ? accepted : undefined };
104
+ if (MILESTONES.has(key)) entry.milestone = true;
105
+ out.push(entry);
77
106
  }
78
107
  return out;
79
108
  }
80
109
 
81
- module.exports = { STAGES, LABELS, LANE_STAGES, nineStages };
110
+ module.exports = { STAGES, LABELS, OUTPUTS, MILESTONES, LEGACY, LANE_STAGES, stageKey, nineStages, lifecycleStages: nineStages };
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-22T10:56:59Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-10-22
5
+ ## 2026-10-23
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -2,13 +2,10 @@
2
2
  'use strict';
3
3
  /* briefing-premium-adddoc-test.js — Add a document on the premium Board and initiative page (initiative briefing-premium-adddoc; planning/prd/briefing-premium-adddoc-prd.md A1 to A8).
4
4
  * Serves the real pages from the real server. The model routes and the add route are answered from fixtures, so nothing is written to this repository; the real
5
- * route is checked only for its refusals. A1 dialog · A3 the press · A4 messages · A5 rows · A7 labels · A8 floors and fidelity */
6
- const fs = require('fs');
5
+ * route is checked only for its refusals. The Board's Add a document is the plain side-panel form of the Agreed Board (premium-agreed-design). A1 dialog · A3 the press · A4 messages · A5 rows · A7 labels · A8 floors and fidelity */
7
6
  const path = require('path');
8
7
  const { spawn } = require('child_process');
9
8
  const { findBrowser } = require('./lib/find-browser');
10
- const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
11
- const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
12
9
  const T = require('./test-run').configure({ name: 'briefing-premium-adddoc' });
13
10
  const BP = require('./lib/board-premium.js');
14
11
  const IP = require('./lib/initiative-premium.js');
@@ -31,14 +28,14 @@ const finish = async (code) => {
31
28
  };
32
29
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
30
 
34
- const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
35
31
  const CUSTOM = [
36
32
  { id: 'cd-1', scope: 'board:w1', title: 'UAT plan', writer: 'you', phase: null, link: null, at: '2026-10-18T09:00:00.000Z' },
37
33
  { id: 'cd-2', scope: 'board:w1', title: 'Contract', writer: 'drafts', phase: null, link: { kind: 'Confluence', url: 'https://example.atlassian.net/wiki/spaces/X/pages/1' }, at: '2026-10-18T09:05:00.000Z' },
38
34
  ];
39
35
  const PAGES = {
40
36
  board: { file: '/premium-board.html', api: '**/api/board-premium*', scope: 'board:w1', mk: (custom) => BP.build(BF.facts({ custom })), ready: '#ibBody .ini2', btn: '#addDoc', qs: '?theme=' },
41
- initiative: { file: '/premium-initiative.html', api: '**/api/initiative-premium*', scope: 'initiative:self-serve-v2', mk: (custom) => IP.build(IF.facts({ custom })), ready: '#cIniTk', btn: '[data-adddoc]', qs: '?id=self-serve-v2&ws=w1&board=w1&theme=' },
37
+ // the initiative is a layout inside Home (premium-agreed-design): Add a document is in its Overview, a minimal form in the Viewer (Waiting for design)
38
+ initiative: { file: '/premium.html', api: '**/api/initiative-premium*', scope: 'initiative:self-serve-v2', mk: (custom) => IP.build(IF.facts({ custom })), ready: '.hm-card [data-hm-ov]', btn: '#czViewer [data-ov-adddoc]', qs: '?ini=self-serve-v2&ws=w1&board=w1&theme=' },
42
39
  };
43
40
 
44
41
  (async () => {
@@ -61,57 +58,104 @@ const PAGES = {
61
58
  await page.route('**/api/custom-docs/**', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ status: reply.status, contentType: 'application/json', body: JSON.stringify(reply.body) }); });
62
59
  await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
63
60
  await page.goto(BASE + P.file + P.qs + theme);
64
- const up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.ready), 20000);
61
+ let up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.ready), 20000);
62
+ if (up && kind === 'initiative') { if (!(await page.locator('.hm-card [data-hm-ov]').isVisible())) await page.click('#hmNeeds'); await page.click(P.ready); /* a phone: the initiative card is in the top bar's sheet */ up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.btn), 20000); } // the Overview holds the button
63
+ if (up && P.file === '/premium-board.html') await page.click(w <= 720 ? '#chDocs' : '#tabDocs'); // a phone reaches the documents from its Docs chip // the Agreed design shows the documents on the Documents tab (premium-agreed-design)
65
64
  return { ctx, page, errors, posts, up, calls: () => calls, setCustom: (c) => { current = c; }, reply: (a) => { reply = a; } };
66
65
  };
67
66
  const txt = (p, s) => p.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
68
67
 
69
- for (const kind of ['board', 'initiative']) {
68
+ /* the Board (premium-agreed-design): the Documents tab is a plain list with a plain Add a document form in the side panel, tagged
69
+ "Waiting for design"; the same route, the same fields, the same refusals */
70
+ {
71
+ const A = await open('board'), p = A.page, P = PAGES.board;
72
+ ok('board 0 the page draws', A.up);
73
+ if (!A.up) return finish(1);
74
+ ok('board A1 the Documents tab has an Add a document button', await p.evaluate(() => { const b = document.querySelector('#docBody #addDoc'); return !!b && b.textContent === 'Add a document'; }));
75
+ await p.click('#addDoc');
76
+ const form = await until(() => p.evaluate(() => { const f = document.querySelector('#peek form[data-form="adddoc"]'); return f ? { title: document.querySelector('#pkTitle').textContent, tag: (document.querySelector('#peek .bd-wtag') || {}).textContent, seg: [...f.querySelectorAll('.bd-rad span')].map((x) => x.textContent), kinds: [...f.kind.options].map((o) => o.textContent), uOff: f.url.disabled, note: f.querySelector('.bd-amut').textContent, dlg: !!document.querySelector('#dlg.on') } : null; }));
77
+ ok('board A1 the side panel has the dialog\'s fields, tagged "Waiting for design", and the old dialog stays shut', !!form && form.title === 'Add a document' && form.tag === 'Waiting for design' && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff && !form.dlg, JSON.stringify(form));
78
+ ok('board A7 it says the document is saved and the linked page is not read', !!form && /saved on the board's record/.test(form.note) && /does not read or sync/.test(form.note), form && form.note);
79
+ const go = '#peek form[data-form="adddoc"] [type="submit"]';
80
+ await p.click(go); await sleep(120);
81
+ ok('board A4 an empty title is refused in the panel and posts nothing', /Give the document a title/.test(await txt(p, '#formM')) && A.posts.length === 0);
82
+ await p.fill('#peek input[name="title"]', 'UAT plan'); await p.selectOption('#peek select[name="kind"]', 'Confluence');
83
+ ok('board A1 the address field opens for a link kind', await p.evaluate(() => !document.querySelector('#peek input[name="url"]').disabled));
84
+ await p.click(go); await sleep(120);
85
+ ok('board A4 a link kind with no address is refused in the panel and posts nothing', /Paste the address of the Confluence page/.test(await txt(p, '#formM')) && A.posts.length === 0);
86
+ A.reply({ status: 409, body: { ok: false, error: '“UAT plan” is already on this board.' } });
87
+ await p.fill('#peek input[name="url"]', 'https://example.atlassian.net/wiki/x'); await p.click(go); await sleep(300);
88
+ ok('board A4 a refusal from the route is shown in the panel, which stays open', /already on this/.test(await txt(p, '#formM')) && await p.evaluate((g) => !document.querySelector('#peek').hidden && !document.querySelector(g).disabled, go));
89
+ A.reply({ status: 200, body: { ok: true } }); const calls0 = A.calls();
90
+ await p.check('#peek input[name="writer"][value="you"]'); await p.click(go); await sleep(500);
91
+ const last = A.posts[A.posts.length - 1], mint = await T.nonce(BASE);
92
+ const want = { ws: 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
93
+ ok('board A3 the press posts the entered fields to the one route, with the launch nonce and no writer field', last && last.path === '/api/custom-docs/add' && JSON.stringify(Object.keys(last.body).sort()) === JSON.stringify(Object.keys(want).sort()) && Object.keys(want).every((k) => last.body[k] === want[k] || k === 'ws') && !!mint && last.headers['x-pmos-nonce'] === mint && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in last.body), JSON.stringify(last && last.body));
94
+ ok('board A3 nothing else was posted', A.posts.every((x) => x.path === '/api/custom-docs/add'));
95
+ ok('board A1 the panel closes, the page reads again and says it was added', A.calls() > calls0 && await p.evaluate(() => document.querySelector('#peek').hidden && /is added to the board's documents/.test(document.querySelector('#bdToast').textContent)));
96
+ A.setCustom(CUSTOM); await p.reload(); await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await p.click('#tabDocs'); await sleep(300);
97
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#docBody .bd-lr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.st').textContent, small: r.querySelector('small').textContent, btn: r.querySelectorAll('button').length })));
98
+ const uat = rows.find((r) => r.t === 'UAT plan'), con = rows.find((r) => r.t === 'Contract');
99
+ ok('board A5 an unlinked document reads Not started with the date it was added and no press', uat && uat.s === 'Not started' && /added 18 Oct/.test(uat.small) && /You write it/.test(uat.small) && uat.btn === 0, JSON.stringify(uat));
100
+ ok('board A5 a linked document reads Linked, shows its address as text and has no press', con && con.s === 'Linked' && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0, JSON.stringify(con));
101
+ ok('board A5 the summary counts one linked', /1 linked/.test(await txt(p, '#docBody .bd-whead')), await txt(p, '#docBody .bd-whead'));
102
+ ok('board no page error', A.errors.length === 0, A.errors.join(' | '));
103
+ await A.ctx.close();
104
+ const N = await open('board', { w: 390, h: 844 }); await N.page.click('#addDoc'); await sleep(300);
105
+ const fl = await N.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, add: Math.round(document.querySelector('#addDoc').getBoundingClientRect().height), go: Math.round(document.querySelector('#peek form[data-form="adddoc"] [type="submit"]').getBoundingClientRect().height) }));
106
+ ok('board A8 at 390 px no sideways scroll with the form open, and its buttons are 44 px', !fl.over && fl.add >= 44 && fl.go >= 44, JSON.stringify(fl));
107
+ await N.ctx.close();
108
+ }
109
+
110
+ for (const kind of ['initiative']) {
70
111
  const P = PAGES[kind], ini = kind === 'initiative';
71
112
  const A = await open(kind), p = A.page;
72
- ok(`${kind} 0 the page draws`, A.up);
113
+ const F = '#czViewer:not([hidden])';
114
+ const dlgShut = () => p.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); });
115
+ ok(`${kind} 0 the page draws (Home with the initiative, its Overview open)`, A.up);
73
116
  if (!A.up) return finish(1);
74
- ok(`${kind} A1 the Core documents card has an Add a document button`, await p.evaluate((s) => { const b = document.querySelector(s); return !!b && /Add a document/.test(b.textContent) && !b.hidden; }, P.btn));
75
- await p.click(P.btn); await sleep(250);
76
- const form = await p.evaluate(() => ({ open: document.querySelector('#dlg').classList.contains('on'), title: document.querySelector('#dTitle').textContent, t: !!document.querySelector('#adT'), phase: !!document.querySelector('#adC'), seg: [...document.querySelectorAll('#adW button')].map((b) => b.textContent), kinds: [...document.querySelectorAll('#adK option')].map((o) => o.textContent), uOff: document.querySelector('#adU').disabled, note: document.querySelector('.addf .note').textContent }));
77
- ok(`${kind} A1 the dialog has the mockup's fields`, form.open && form.title === 'Add a document' && form.t && form.phase === ini && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff, JSON.stringify(form));
78
- ok(`${kind} A7 the dialog says the document is saved and the linked page is not read`, /saved on the (board|initiative)'s record/.test(form.note) && /does not read or sync/.test(form.note), form.note);
79
- await p.click('#adGo'); await sleep(120);
80
- ok(`${kind} A4 an empty title is refused in the dialog and posts nothing`, /Give the document a title/.test(await txt(p, '#adM')) && A.posts.length === 0);
81
- await p.fill('#adT', 'UAT plan'); await p.selectOption('#adK', 'Confluence'); await sleep(100);
82
- ok(`${kind} A1 the address field opens for a link kind`, await p.evaluate(() => !document.querySelector('#adU').disabled));
83
- await p.click('#adGo'); await sleep(120);
84
- ok(`${kind} A4 a link kind with no address is refused in the dialog and posts nothing`, /Paste the address of the Confluence page/.test(await txt(p, '#adM')) && A.posts.length === 0);
117
+ ok(`${kind} A1 the Overview's Core documents has an Add a document button`, await p.evaluate((s) => { const b = document.querySelector(s); return !!b && /Add a document/.test(b.textContent) && !b.hidden; }, P.btn));
118
+ await p.click(P.btn); await until(() => p.evaluate(() => !!document.querySelector('#czViewer #adT')));
119
+ const form = await p.evaluate((V) => ({ open: !!document.querySelector(V + ' #adT'), title: (document.querySelector('#czVwTitle') || {}).textContent || '', wait: !!document.querySelector(V + ' .hx-wait'), phase: !!document.querySelector(V + ' #adPh'), seg: [...document.querySelectorAll(V + ' #adW button')].map((b) => b.textContent), kinds: [...document.querySelectorAll(V + ' #adK option')].map((o) => o.textContent), uOff: document.querySelector(V + ' #adU').disabled, note: (document.querySelector(V + ' [data-ad-note]') || {}).textContent || '' }), F);
120
+ ok(`${kind} A1 the form in the Viewer has the dialog's fields, tagged "Waiting for design", and the old dialog stays shut`, form.open && /^Add a document/.test(form.title) && form.wait && form.phase === ini && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff && await dlgShut(), JSON.stringify(form));
121
+ ok(`${kind} A7 the form says the document is saved and the linked page is not read`, /saved on the (board|initiative)'s record/.test(form.note) && /does not read or sync/.test(form.note), form.note);
122
+ await p.click('#czViewer #adGo'); await sleep(120);
123
+ ok(`${kind} A4 an empty title is refused in the form and posts nothing`, /Give the document a title/.test(await txt(p, '#czViewer #adM')) && A.posts.length === 0);
124
+ await p.fill('#czViewer #adT', 'UAT plan'); await p.selectOption('#czViewer #adK', 'Confluence'); await sleep(100);
125
+ ok(`${kind} A1 the address field opens for a link kind`, await p.evaluate(() => !document.querySelector('#czViewer #adU').disabled));
126
+ await p.click('#czViewer #adGo'); await sleep(120);
127
+ ok(`${kind} A4 a link kind with no address is refused in the form and posts nothing`, /Paste the address of the Confluence page/.test(await txt(p, '#czViewer #adM')) && A.posts.length === 0);
85
128
  A.reply({ status: 409, body: { ok: false, error: '“UAT plan” is already on this ' + (ini ? 'initiative' : 'board') + '.' } });
86
- await p.fill('#adU', 'https://example.atlassian.net/wiki/x'); await p.click('#adGo'); await sleep(250);
87
- ok(`${kind} A4 a refusal from the route is shown in the dialog, which stays open`, /already on this/.test(await txt(p, '#adM')) && await p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#adGo').disabled));
129
+ await p.fill('#czViewer #adU', 'https://example.atlassian.net/wiki/x'); await p.click('#czViewer #adGo'); await sleep(250);
130
+ ok(`${kind} A4 a refusal from the route is shown in the form, which stays open`, /already on this/.test(await txt(p, '#czViewer #adM')) && await p.evaluate(() => !!document.querySelector('#czViewer #adT') && !document.querySelector('#czViewer #adGo').disabled));
88
131
  A.reply({ status: 200, body: { ok: true } }); const calls0 = A.calls();
89
- await p.click('[data-w="you"]'); if (ini) await p.selectOption('#adC', 'Plan');
90
- await p.click('#adGo'); await sleep(500);
132
+ await p.click('#czViewer [data-w="you"]'); if (ini) await p.selectOption('#czViewer #adPh', 'Plan');
133
+ await p.click('#czViewer #adGo'); await sleep(500);
91
134
  const last = A.posts[A.posts.length - 1], mint = await T.nonce(BASE);
92
- const want = { ws: ini ? 'w1' : 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
135
+ const want = { ws: 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
93
136
  if (ini) want.phase = 'Plan';
94
137
  ok(`${kind} A3 the press posts the entered fields to the one route, with the launch nonce and no writer field`, last && last.path === '/api/custom-docs/add' && JSON.stringify(Object.keys(last.body).sort()) === JSON.stringify(Object.keys(want).sort()) && Object.keys(want).every((k) => last.body[k] === want[k] || k === 'ws') && !!mint && last.headers['x-pmos-nonce'] === mint && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in last.body), JSON.stringify(last && last.body));
95
138
  ok(`${kind} A3 nothing else was posted`, A.posts.every((x) => x.path === '/api/custom-docs/add'));
96
- ok(`${kind} A1 the dialog closes, the page reads again and focus returns to the button`, A.calls() > calls0 && await p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')) && await p.evaluate((s) => document.activeElement === document.querySelector(s), P.btn));
97
- A.setCustom(CUSTOM.map((d) => Object.assign({}, d, { scope: P.scope }))); await p.reload(); await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await sleep(400);
98
- const sel = ini ? '#cIniDoc' : '#cDocs';
99
- const rows = await p.evaluate((s) => [...document.querySelectorAll(s + ' .dmr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.dmm .s').textContent.trim(), small: r.querySelector('.dmn>small').textContent, meta: r.querySelector('.dmm').textContent, btn: r.querySelectorAll('.dmq button').length })), sel);
139
+ ok(`${kind} A1 the form closes, the initiative is read again and its Overview comes back`, await until(() => A.calls() > calls0) && await until(() => p.evaluate(() => !document.querySelector('#czViewer #adT') && !!document.querySelector('#czViewer [data-ov-adddoc]'))));
140
+ A.setCustom(CUSTOM.map((d) => Object.assign({}, d, { scope: P.scope }))); await p.reload();
141
+ await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await p.click(P.ready);
142
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-ov-doc="custom:cd-2"]')), 20000);
143
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-ov-doc]')].map((r) => ({ t: r.querySelector('b').textContent, meta: r.querySelector('em').textContent, small: (r.querySelector('small') || {}).textContent || '', btn: r.querySelectorAll('button').length })));
100
144
  const uat = rows.find((r) => r.t === 'UAT plan'), con = rows.find((r) => r.t === 'Contract');
101
- ok(`${kind} A5 an unlinked document reads Not started with the date it was added and no press`, uat && uat.s === 'Not started' && /added 18 Oct/.test(uat.meta) && /You write it/.test(uat.meta) && uat.btn === 0, JSON.stringify(uat));
102
- ok(`${kind} A5 a linked document reads Linked, shows its address as text and has no press`, con && con.s === 'Linked' && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0 && !/Up to date/.test(con.s), JSON.stringify(con));
103
- const sum = await txt(p, sel + ' .dsum');
104
- ok(`${kind} A5 the summary counts one linked and the total counts both`, /1\s*linked/.test(sum) && /up to date/.test(sum), sum);
105
- ok(`${kind} A5 the filter chips keep their four and a linked document is under All only`, await p.evaluate((s) => { const b = [...document.querySelectorAll(s + ' #dmF button')]; return b.length === 4 && /Linked/.test(b.map((x) => x.textContent).join('')) === false; }, sel));
106
- await p.click(P.btn); await sleep(250);
107
- const floors = await p.evaluate(() => { const h = (s) => Math.round(document.querySelector(s).getBoundingClientRect().height); return { go: h('#adGo'), no: h('#adNo'), t: h('#adT'), k: h('#adK'), w: Math.round(document.querySelector('#adW button').getBoundingClientRect().height), add: h('.dmadd2') }; });
108
- ok(`${kind} A8 the buttons are at least 44 px (the fields and the switch keep the mockup's own size)`, [floors.go, floors.no, floors.add].every((v) => v >= 44), JSON.stringify(floors));
145
+ ok(`${kind} A5 an unlinked document reads Not started with the date it was added and no press`, uat && /^Not started/.test(uat.meta) && /added 18 Oct/.test(uat.meta) && /You write it/.test(uat.meta) && uat.btn === 0, JSON.stringify(uat));
146
+ ok(`${kind} A5 a linked document reads Linked, shows its address as text and has no press`, con && /^Linked/.test(con.meta) && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0 && !/Up to date/.test(con.meta), JSON.stringify(con));
147
+ const sum = await txt(p, '#czViewer [data-ov-dsum]');
148
+ ok(`${kind} A5 the summary counts one linked and the up-to-date ones`, /1\s*linked/.test(sum) && /up to date/.test(sum), sum);
149
+ ok(`${kind} A5 a linked document is listed apart from the up-to-date ones (no Up to date on it, no Open press)`, !!con && !/Up to date/.test(con.meta) && con.btn === 0); // the old filter chips are not in the Agreed design
150
+ await p.click(P.btn); await until(() => p.evaluate(() => !!document.querySelector('#czViewer #adT')));
109
151
  await p.keyboard.press('Escape'); await sleep(250);
110
- ok(`${kind} A8 Escape closes the dialog`, await p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
152
+ ok(`${kind} A8 Escape closes the form`, await p.evaluate(() => !document.querySelector('#czViewer #adT')));
111
153
  ok(`${kind} no page error`, A.errors.length === 0, A.errors.join(' | '));
112
154
  await A.ctx.close();
113
- const N = await open(kind, { w: 390, h: 844 }); await N.page.click(P.btn); await sleep(300);
114
- ok(`${kind} A8 no sideways scroll at 390 px with the dialog open`, await N.page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#dlg').getBoundingClientRect().right <= innerWidth + 1));
155
+ const N = await open(kind, { w: 390, h: 844 }); await N.page.click(P.btn); await until(() => N.page.evaluate(() => !!document.querySelector('#czViewer #adT')));
156
+ const floors = await N.page.evaluate(() => { const h = (s) => Math.round(document.querySelector('#czViewer ' + s).getBoundingClientRect().height); return { go: h('#adGo'), no: h('#adNo'), t: h('#adT'), k: h('#adK'), w: h('#adW button'), fs: getComputedStyle(document.querySelector('#czViewer #adT')).fontSize }; });
157
+ ok(`${kind} A8 at 390 px the presses and fields are at least 44 px and the fields do not zoom the page`, [floors.go, floors.no, floors.t, floors.k, floors.w].every((v) => v >= 44) && parseFloat(floors.fs) >= 16, JSON.stringify(floors));
158
+ ok(`${kind} A8 no sideways scroll at 390 px with the form open`, await N.page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#czViewer').getBoundingClientRect().right <= innerWidth + 1));
115
159
  await N.ctx.close();
116
160
  }
117
161
 
@@ -135,40 +179,25 @@ const PAGES = {
135
179
  ok('A3 the add route takes POST only', wrong === 405);
136
180
  }
137
181
 
138
- /* A8 fidelity against the mockup's own dialog */
139
- if (!fs.existsSync(MOCKUP)) ok('A8 the mockup is in the repository', false, MOCKUP);
140
- else {
141
- const PAIRS = [['ttl', '#dTitle'], ['note', '.addf .note'], ['lbl', '.addf label'], ['inp', '#adT'], ['phase', '#adC'], ['seg', '#adW'], ['segb', '#adW button'], ['kind', '#adK'], ['url', '#adU'], ['msg', '#adM'], ['go', '#adGo'], ['no', '#adNo'], ['pane', '#oMain'], ['paper', '#oMain .paper']];
142
- const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'borderTopColor', 'minHeight'];
143
- const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { width: e.offsetWidth, height: e.offsetHeight, cw: e.clientWidth, sh: e.scrollHeight }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
144
- for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
145
- const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
146
- await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
147
- await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
148
- await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
149
- await until(() => m.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0)); await sleep(500);
150
- await m.evaluate(() => { showInit('initiative', 'pmos', 0); });
151
- await until(() => m.evaluate(() => !!document.querySelector('#cIniDoc .dmr'))); await sleep(800);
152
- const mBtn = await m.evaluate(() => { const b = document.querySelector('#cIniDoc .dmadd2'), cs = getComputedStyle(b), r = b.getBoundingClientRect(); return { fs: cs.fontSize, fw: cs.fontWeight, bg: cs.backgroundColor, c: cs.color, br: cs.borderRadius, h: Math.round(r.height) }; });
153
- await m.click('#cIniDoc .dmadd2'); await sleep(500);
154
- const a = await grab(m);
155
- const R = await open('initiative', { w, h, theme: th }); await sleep(400);
156
- const rBtn = await R.page.evaluate(() => { const b = document.querySelector('[data-adddoc]'), cs = getComputedStyle(b), r = b.getBoundingClientRect(); return { fs: cs.fontSize, fw: cs.fontWeight, bg: cs.backgroundColor, c: cs.color, br: cs.borderRadius, h: Math.round(r.height) }; });
157
- await R.page.click('[data-adddoc]'); await sleep(500);
158
- const c = await grab(R.page), diffs = [];
159
- for (const k of Object.keys(mBtn)) if (k !== 'h' && mBtn[k] !== rBtn[k]) diffs.push(`btn.${k} ${mBtn[k]} | ${rBtn[k]}`); // the height is the 44 px floor the earlier slices keep (the mockup draws 36)
160
- for (const [n] of PAIRS) {
161
- if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
162
- for (const k of Object.keys(a[n])) {
163
- if (k === 'cw' || k === 'sh' || ((n === 'ttl' || n === 'pane' || n === 'paper') && (k === 'width' || k === 'height'))) continue; // the dialog's columns size to the conversation beside the form, which differs
164
- if (w < 1000 && n === 'ttl' && (k === 'fontSize' || k === 'letterSpacing' || k === 'lineHeight')) continue; // on a phone every dialog has the compact head's smaller title (Wawan, 2026-10-20), which the mockup predates
165
- const geom = k === 'width' || k === 'height';
166
- if (geom ? Math.abs(a[n][k] - c[n][k]) > 14 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
167
- }
168
- }
169
- ok(`A8 the button and the dialog match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
170
- await m.context().close(); await R.ctx.close();
171
- }
182
+ /* A8 fidelity: the form follows the Agreed design (premium-agreed-design): the Viewer is one cozy card in Nunito, its presses pills, the main one
183
+ * the solid colour. The colours are read from the page's own tokens, so a theme is checked against itself. */
184
+ for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
185
+ const R = await open('initiative', { w, h, theme: th });
186
+ const btn = await R.page.evaluate(() => { const cs = getComputedStyle(document.querySelector('#czViewer [data-ov-adddoc]')); return { ff: cs.fontFamily, br: cs.borderRadius }; });
187
+ await R.page.click('#czViewer [data-ov-adddoc]'); await until(() => R.page.evaluate(() => !!document.querySelector('#czViewer #adT')));
188
+ const g = await R.page.evaluate(() => {
189
+ const tok = (v, prop) => { const x = document.createElement('i'); x.style.setProperty(prop, 'var(' + v + ')'); document.querySelector('#czViewer').appendChild(x); const c = getComputedStyle(x)[prop === 'color' ? 'color' : 'backgroundColor']; x.remove(); return c; };
190
+ const cs = (s) => getComputedStyle(document.querySelector(s));
191
+ return { vw: cs('#czViewer').backgroundColor, card: tok('--cz-card', 'background-color'), vwR: cs('#czViewer').borderTopLeftRadius, ff: cs('#czViewer').fontFamily, go: [cs('#czViewer #adGo').backgroundColor, cs('#czViewer #adGo').fontWeight, cs('#czViewer #adGo').borderTopLeftRadius], solid: tok('--cz-solid', 'background-color'), no: cs('#czViewer #adNo').backgroundColor, dlg: !!(document.querySelector('#dlg') && !!document.querySelector('#dlg.on')) };
192
+ });
193
+ const d = [];
194
+ if (!/^Nunito/.test(btn.ff) || btn.br !== '999px') d.push('button ' + JSON.stringify(btn));
195
+ if (g.vw !== g.card || !/^Nunito/.test(g.ff) || (w > 760 && parseFloat(g.vwR) < 20)) d.push('viewer ' + [g.vw, g.card, g.vwR, g.ff].join(' '));
196
+ if (g.go[0] !== g.solid || +g.go[1] < 700 || g.go[2] !== '999px') d.push('Add document ' + g.go.join(' ') + ' want ' + g.solid);
197
+ if (g.no !== g.card) d.push('Cancel ' + g.no);
198
+ if (g.dlg) d.push('the old dialog opened');
199
+ ok(`A8 the button and the form follow the Agreed design at ${w} px, ${th}`, d.length === 0, d.join(' ; '));
200
+ await R.ctx.close();
172
201
  }
173
202
  return finish();
174
203
  })().catch((e) => { console.error(e); finish(1); });