@transitrix/diagrams 1.8.6 → 1.8.8

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 (251) hide show
  1. package/dist/fgca/index.js +10 -10
  2. package/dist/fgca/layout.js +1 -1
  3. package/dist/fgca/nodeTypes.js +4 -4
  4. package/dist/index.js +33 -33
  5. package/package.json +8 -2
  6. package/dist/__tests__/edge-path.test.d.ts +0 -1
  7. package/dist/__tests__/edge-path.test.js +0 -55
  8. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  9. package/dist/__tests__/node-size-presets.test.js +0 -30
  10. package/dist/__tests__/scope.test.d.ts +0 -1
  11. package/dist/__tests__/scope.test.js +0 -23
  12. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  13. package/dist/__tests__/yaml-normalize.test.js +0 -148
  14. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  15. package/dist/activities/__tests__/cpm.test.js +0 -146
  16. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  17. package/dist/activities/__tests__/gantt.test.js +0 -263
  18. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  19. package/dist/activities/__tests__/layout.test.js +0 -98
  20. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  21. package/dist/activities/__tests__/validate.test.js +0 -397
  22. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  23. package/dist/activity-card/__tests__/example.test.js +0 -73
  24. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  25. package/dist/activity-card/__tests__/layout.test.js +0 -141
  26. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  27. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  28. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  29. package/dist/activity-card/__tests__/validate.test.js +0 -149
  30. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  31. package/dist/actor/__tests__/validate.test.js +0 -95
  32. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  33. package/dist/applications/__tests__/validate.test.js +0 -223
  34. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  35. package/dist/assertion/__tests__/example.test.js +0 -32
  36. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  37. package/dist/assertion/__tests__/validate.test.js +0 -130
  38. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  39. package/dist/blocks/__tests__/layout.test.js +0 -153
  40. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  41. package/dist/blocks/__tests__/validate.test.js +0 -235
  42. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  43. package/dist/business-service/__tests__/validate.test.js +0 -135
  44. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  45. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  46. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  47. package/dist/capability-map/__tests__/address.test.js +0 -49
  48. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  49. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  50. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  51. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  52. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  53. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  54. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  55. package/dist/capability-map/__tests__/validate.test.js +0 -212
  56. package/dist/change/__tests__/validate.test.d.ts +0 -1
  57. package/dist/change/__tests__/validate.test.js +0 -79
  58. package/dist/codex/__tests__/example.test.d.ts +0 -1
  59. package/dist/codex/__tests__/example.test.js +0 -33
  60. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  61. package/dist/codex/__tests__/validate.test.js +0 -68
  62. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  63. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  64. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  65. package/dist/compliance/__tests__/classify.test.js +0 -58
  66. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  67. package/dist/compliance/__tests__/confidence.test.js +0 -78
  68. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  69. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  70. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  71. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  72. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  73. package/dist/compliance/__tests__/example.test.js +0 -51
  74. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  75. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  76. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  77. package/dist/compliance/__tests__/html.test.js +0 -122
  78. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  79. package/dist/compliance/__tests__/impact.test.js +0 -913
  80. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  81. package/dist/compliance/__tests__/markdown.test.js +0 -85
  82. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  83. package/dist/compliance/__tests__/trace.test.js +0 -144
  84. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  85. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  86. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  87. package/dist/compliance/__tests__/views.test.js +0 -59
  88. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  89. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  90. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  91. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  92. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  93. package/dist/confidence/__tests__/score.test.js +0 -188
  94. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  95. package/dist/constraint/__tests__/example.test.js +0 -14
  96. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  97. package/dist/constraint/__tests__/validate.test.js +0 -58
  98. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  99. package/dist/factor/__tests__/validate.test.js +0 -112
  100. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  101. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  102. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  103. package/dist/fgca/__tests__/layout.test.js +0 -140
  104. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  105. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  106. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  107. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  108. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  109. package/dist/fgca/__tests__/resolver.test.js +0 -185
  110. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  111. package/dist/fgca/__tests__/validate.test.js +0 -125
  112. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  113. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  114. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  115. package/dist/goals/__tests__/layout.test.js +0 -153
  116. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  117. package/dist/goals/__tests__/mutations.test.js +0 -134
  118. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  119. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  120. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  121. package/dist/goals/__tests__/validate.test.js +0 -183
  122. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  123. package/dist/integration/__tests__/validate.test.js +0 -169
  124. package/dist/location/__tests__/validate.test.d.ts +0 -1
  125. package/dist/location/__tests__/validate.test.js +0 -107
  126. package/dist/node/__tests__/validate.test.d.ts +0 -1
  127. package/dist/node/__tests__/validate.test.js +0 -100
  128. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  129. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  130. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  131. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  132. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  133. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  134. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  135. package/dist/process-map/__tests__/validate.test.js +0 -199
  136. package/dist/products/__tests__/validate.test.d.ts +0 -1
  137. package/dist/products/__tests__/validate.test.js +0 -210
  138. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  139. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  140. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  141. package/dist/requirement/__tests__/example.test.js +0 -21
  142. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  143. package/dist/requirement/__tests__/validate.test.js +0 -80
  144. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  145. package/dist/scenarios/__tests__/validate.test.js +0 -183
  146. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  147. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  148. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  149. package/dist/target-state/__tests__/validate.test.js +0 -78
  150. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  151. package/dist/technology-service/__tests__/validate.test.js +0 -121
  152. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  153. package/dist/theme/__tests__/tokens.test.js +0 -159
  154. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  155. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  156. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  157. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  158. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  159. package/dist/webview/__tests__/entry.test.js +0 -56
  160. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  161. package/dist/webview/__tests__/render-activities.test.js +0 -91
  162. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  163. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  164. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  165. package/dist/webview/__tests__/render-goals.test.js +0 -120
  166. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  167. package/dist/webview/__tests__/render-process.test.js +0 -463
  168. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  169. package/dist/webview/__tests__/render-util.test.js +0 -54
  170. package/src/__tests__/edge-path.test.ts +0 -67
  171. package/src/__tests__/node-size-presets.test.ts +0 -50
  172. package/src/__tests__/scope.test.ts +0 -27
  173. package/src/__tests__/yaml-normalize.test.ts +0 -158
  174. package/src/activities/__tests__/cpm.test.ts +0 -164
  175. package/src/activities/__tests__/gantt.test.ts +0 -290
  176. package/src/activities/__tests__/layout.test.ts +0 -112
  177. package/src/activities/__tests__/validate.test.ts +0 -446
  178. package/src/activity-card/__tests__/example.test.ts +0 -83
  179. package/src/activity-card/__tests__/layout.test.ts +0 -162
  180. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  181. package/src/activity-card/__tests__/validate.test.ts +0 -167
  182. package/src/actor/__tests__/validate.test.ts +0 -114
  183. package/src/applications/__tests__/validate.test.ts +0 -256
  184. package/src/assertion/__tests__/example.test.ts +0 -37
  185. package/src/assertion/__tests__/validate.test.ts +0 -142
  186. package/src/blocks/__tests__/layout.test.ts +0 -169
  187. package/src/blocks/__tests__/validate.test.ts +0 -260
  188. package/src/business-service/__tests__/validate.test.ts +0 -160
  189. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  190. package/src/capability-map/__tests__/address.test.ts +0 -59
  191. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  192. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  193. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  194. package/src/capability-map/__tests__/validate.test.ts +0 -238
  195. package/src/change/__tests__/validate.test.ts +0 -97
  196. package/src/codex/__tests__/example.test.ts +0 -40
  197. package/src/codex/__tests__/validate.test.ts +0 -84
  198. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  199. package/src/compliance/__tests__/classify.test.ts +0 -64
  200. package/src/compliance/__tests__/confidence.test.ts +0 -98
  201. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  202. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  203. package/src/compliance/__tests__/example.test.ts +0 -57
  204. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  205. package/src/compliance/__tests__/html.test.ts +0 -142
  206. package/src/compliance/__tests__/impact.test.ts +0 -1060
  207. package/src/compliance/__tests__/markdown.test.ts +0 -95
  208. package/src/compliance/__tests__/trace.test.ts +0 -157
  209. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  210. package/src/compliance/__tests__/views.test.ts +0 -64
  211. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  212. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  213. package/src/confidence/__tests__/score.test.ts +0 -254
  214. package/src/constraint/__tests__/example.test.ts +0 -19
  215. package/src/constraint/__tests__/validate.test.ts +0 -68
  216. package/src/factor/__tests__/validate.test.ts +0 -133
  217. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  218. package/src/fgca/__tests__/layout.test.ts +0 -179
  219. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  220. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  221. package/src/fgca/__tests__/resolver.test.ts +0 -209
  222. package/src/fgca/__tests__/validate.test.ts +0 -142
  223. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  224. package/src/goals/__tests__/layout.test.ts +0 -175
  225. package/src/goals/__tests__/mutations.test.ts +0 -153
  226. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  227. package/src/goals/__tests__/validate.test.ts +0 -202
  228. package/src/integration/__tests__/validate.test.ts +0 -203
  229. package/src/location/__tests__/validate.test.ts +0 -127
  230. package/src/node/__tests__/validate.test.ts +0 -118
  231. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  232. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  233. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  234. package/src/process-map/__tests__/validate.test.ts +0 -223
  235. package/src/products/__tests__/validate.test.ts +0 -239
  236. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  237. package/src/requirement/__tests__/example.test.ts +0 -24
  238. package/src/requirement/__tests__/validate.test.ts +0 -96
  239. package/src/scenarios/__tests__/validate.test.ts +0 -209
  240. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  241. package/src/target-state/__tests__/validate.test.ts +0 -95
  242. package/src/technology-service/__tests__/validate.test.ts +0 -143
  243. package/src/theme/__tests__/tokens.test.ts +0 -185
  244. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  245. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  246. package/src/webview/__tests__/entry.test.ts +0 -64
  247. package/src/webview/__tests__/render-activities.test.ts +0 -100
  248. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  249. package/src/webview/__tests__/render-goals.test.ts +0 -128
  250. package/src/webview/__tests__/render-process.test.ts +0 -538
  251. package/src/webview/__tests__/render-util.test.ts +0 -66
@@ -1,310 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import yaml from 'js-yaml';
5
- import { validateProcessBlueprint } from '../validate.js';
6
-
7
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'process-blueprint');
8
-
9
- const VALID_BLUEPRINT = {
10
- notation: 'process-blueprint',
11
- spec_version: '0.1',
12
- process_blueprint: {
13
- id: 'PROCESS_BLUEPRINT-FULFIL-1',
14
- name: 'Order fulfilment blueprint',
15
- stages: [
16
- { id: 'STAGE-1', name: 'Receive', goal: 'Capture order', result: 'Validated order' },
17
- { id: 'STAGE-2', name: 'Pack', goal: 'Assemble', result: 'Packed shipment' },
18
- { id: 'STAGE-3', name: 'Ship', goal: 'Hand to carrier', result: 'In transit' },
19
- ],
20
- systems: [
21
- { id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
22
- ],
23
- actors: [
24
- { id: 'ROLE-WAREHOUSE-1', name: 'Warehouse op', stages: ['STAGE-2', 'STAGE-3'] },
25
- ],
26
- equipment: [
27
- { name: 'Barcode scanner', stages: ['STAGE-2', 'STAGE-3'] },
28
- ],
29
- information_entities: [
30
- { name: 'Customer order', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
31
- ],
32
- },
33
- };
34
-
35
- describe('validateProcessBlueprint', () => {
36
- it('passes on a valid blueprint', () => {
37
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
38
- expect(r.valid).toBe(true);
39
- expect(r.errors).toHaveLength(0);
40
- });
41
-
42
- it('BP-001: rejects non-object input', () => {
43
- expect(validateProcessBlueprint(null).valid).toBe(false);
44
- expect(validateProcessBlueprint(null).errors[0].code).toBe('BP-001');
45
- expect(validateProcessBlueprint('string').errors[0].code).toBe('BP-001');
46
- });
47
-
48
- it('BP-001: rejects missing process_blueprint root key', () => {
49
- const r = validateProcessBlueprint({ notation: 'process-blueprint' });
50
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
51
- });
52
-
53
- it('BP-001: rejects wrong notation value', () => {
54
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, notation: 'goals' });
55
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
56
- });
57
-
58
- it('BP-001: tolerates a missing notation field (header check is contract-level)', () => {
59
- const { notation: _, ...rest } = VALID_BLUEPRINT;
60
- const r = validateProcessBlueprint(rest);
61
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(false);
62
- });
63
-
64
- it('BP-002: rejects missing id', () => {
65
- const r = validateProcessBlueprint({
66
- ...VALID_BLUEPRINT,
67
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: '' },
68
- });
69
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
70
- });
71
-
72
- it('BP-002: rejects id that does not match PROCESS_BLUEPRINT grammar', () => {
73
- const r = validateProcessBlueprint({
74
- ...VALID_BLUEPRINT,
75
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: 'PB-1' },
76
- });
77
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
78
- });
79
-
80
- it('BP-003: rejects missing name', () => {
81
- const r = validateProcessBlueprint({
82
- ...VALID_BLUEPRINT,
83
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, name: '' },
84
- });
85
- expect(r.errors.some(e => e.code === 'BP-003')).toBe(true);
86
- });
87
-
88
- it('BP-004: rejects missing stages', () => {
89
- const { stages: _, ...rest } = VALID_BLUEPRINT.process_blueprint;
90
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, process_blueprint: rest });
91
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
92
- });
93
-
94
- it('BP-004: rejects empty stages array', () => {
95
- const r = validateProcessBlueprint({
96
- ...VALID_BLUEPRINT,
97
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, stages: [] },
98
- });
99
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
100
- });
101
-
102
- it('BP-005: rejects stage missing goal', () => {
103
- const r = validateProcessBlueprint({
104
- ...VALID_BLUEPRINT,
105
- process_blueprint: {
106
- ...VALID_BLUEPRINT.process_blueprint,
107
- stages: [{ id: 'STAGE-1', name: 'X', goal: '', result: 'R' }],
108
- },
109
- });
110
- expect(r.errors.some(e => e.code === 'BP-005' && /goal/.test(e.message))).toBe(true);
111
- });
112
-
113
- it('BP-005: rejects stage missing result', () => {
114
- const r = validateProcessBlueprint({
115
- ...VALID_BLUEPRINT,
116
- process_blueprint: {
117
- ...VALID_BLUEPRINT.process_blueprint,
118
- stages: [{ id: 'STAGE-1', name: 'X', goal: 'G', result: '' }],
119
- },
120
- });
121
- expect(r.errors.some(e => e.code === 'BP-005' && /result/.test(e.message))).toBe(true);
122
- });
123
-
124
- it('BP-006: rejects duplicate stage ids', () => {
125
- const r = validateProcessBlueprint({
126
- ...VALID_BLUEPRINT,
127
- process_blueprint: {
128
- ...VALID_BLUEPRINT.process_blueprint,
129
- stages: [
130
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
131
- { id: 'STAGE-1', name: 'B', goal: 'G', result: 'R' },
132
- ],
133
- },
134
- });
135
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
136
- });
137
-
138
- it('BP-006: treats ids that differ only in surrounding whitespace as duplicates', () => {
139
- const r = validateProcessBlueprint({
140
- ...VALID_BLUEPRINT,
141
- process_blueprint: {
142
- ...VALID_BLUEPRINT.process_blueprint,
143
- stages: [
144
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
145
- { id: 'STAGE-1 ', name: 'B', goal: 'G', result: 'R' },
146
- ],
147
- },
148
- });
149
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
150
- });
151
-
152
- it('BP-008: tolerates whitespace around aspect stage refs (matches trimmed stage ids)', () => {
153
- const r = validateProcessBlueprint({
154
- ...VALID_BLUEPRINT,
155
- process_blueprint: {
156
- ...VALID_BLUEPRINT.process_blueprint,
157
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' }],
158
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: [' STAGE-1 '] }],
159
- actors: undefined,
160
- equipment: undefined,
161
- information_entities: undefined,
162
- },
163
- });
164
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(false);
165
- });
166
-
167
- it('BP-006: rejects stage id that does not match STAGE grammar', () => {
168
- const r = validateProcessBlueprint({
169
- ...VALID_BLUEPRINT,
170
- process_blueprint: {
171
- ...VALID_BLUEPRINT.process_blueprint,
172
- stages: [{ id: 'STG-1', name: 'A', goal: 'G', result: 'R' }],
173
- },
174
- });
175
- expect(r.errors.some(e => e.code === 'BP-006')).toBe(true);
176
- });
177
-
178
- it('BP-007: rejects aspect entry missing name', () => {
179
- const r = validateProcessBlueprint({
180
- ...VALID_BLUEPRINT,
181
- process_blueprint: {
182
- ...VALID_BLUEPRINT.process_blueprint,
183
- systems: [{ name: '', stages: ['STAGE-1'] }],
184
- },
185
- });
186
- expect(r.errors.some(e => e.code === 'BP-007' && /name/.test(e.message))).toBe(true);
187
- });
188
-
189
- it('BP-007: rejects aspect entry with empty stages array', () => {
190
- const r = validateProcessBlueprint({
191
- ...VALID_BLUEPRINT,
192
- process_blueprint: {
193
- ...VALID_BLUEPRINT.process_blueprint,
194
- systems: [{ name: 'X', stages: [] }],
195
- },
196
- });
197
- expect(r.errors.some(e => e.code === 'BP-007' && /stages/.test(e.message))).toBe(true);
198
- });
199
-
200
- it('BP-008: rejects aspect entry referencing undeclared stage', () => {
201
- const r = validateProcessBlueprint({
202
- ...VALID_BLUEPRINT,
203
- process_blueprint: {
204
- ...VALID_BLUEPRINT.process_blueprint,
205
- systems: [{ name: 'X', stages: ['STAGE-1', 'STAGE-999'] }],
206
- },
207
- });
208
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(true);
209
- });
210
-
211
- it('BP-009: rejects aspect entry id that does not match canonical grammar', () => {
212
- const r = validateProcessBlueprint({
213
- ...VALID_BLUEPRINT,
214
- process_blueprint: {
215
- ...VALID_BLUEPRINT.process_blueprint,
216
- equipment: [{ id: 'lowercase-1', name: 'X', stages: ['STAGE-1'] }],
217
- },
218
- });
219
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(true);
220
- });
221
-
222
- it('BP-009: accepts an id for equipment as long as it matches general grammar', () => {
223
- const r = validateProcessBlueprint({
224
- ...VALID_BLUEPRINT,
225
- process_blueprint: {
226
- ...VALID_BLUEPRINT.process_blueprint,
227
- equipment: [{ id: 'EQUIPMENT-SCANNER-1', name: 'Barcode scanner', stages: ['STAGE-2'] }],
228
- },
229
- });
230
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
231
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
232
- });
233
-
234
- it('BP-010: rejects systems entry id without APPLICATION- prefix', () => {
235
- const r = validateProcessBlueprint({
236
- ...VALID_BLUEPRINT,
237
- process_blueprint: {
238
- ...VALID_BLUEPRINT.process_blueprint,
239
- systems: [{ id: 'SERVICE-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
240
- },
241
- });
242
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
243
- });
244
-
245
- it('BP-010: rejects actors entry id without ROLE- prefix', () => {
246
- const r = validateProcessBlueprint({
247
- ...VALID_BLUEPRINT,
248
- process_blueprint: {
249
- ...VALID_BLUEPRINT.process_blueprint,
250
- actors: [{ id: 'PERSON-1', name: 'X', stages: ['STAGE-1'] }],
251
- },
252
- });
253
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
254
- });
255
-
256
- it('BP-010: accepts free-form aspect entries without id', () => {
257
- const r = validateProcessBlueprint({
258
- ...VALID_BLUEPRINT,
259
- process_blueprint: {
260
- ...VALID_BLUEPRINT.process_blueprint,
261
- systems: [{ name: 'Legacy app', stages: ['STAGE-1'] }],
262
- },
263
- });
264
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
265
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
266
- });
267
-
268
- it('BP-011: warns when a stage has no aspect entries pointing at it', () => {
269
- const r = validateProcessBlueprint({
270
- ...VALID_BLUEPRINT,
271
- process_blueprint: {
272
- ...VALID_BLUEPRINT.process_blueprint,
273
- stages: [
274
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
275
- { id: 'STAGE-99', name: 'Orphan', goal: 'G', result: 'R' },
276
- ],
277
- systems: [{ id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
278
- actors: undefined,
279
- equipment: undefined,
280
- information_entities: undefined,
281
- },
282
- });
283
- expect(r.warnings.some(w => w.code === 'BP-011' && /STAGE-99/.test(w.message))).toBe(true);
284
- expect(r.valid).toBe(true);
285
- });
286
-
287
- // BP-012 was removed from the spec on 2026-05-21 (methodology PR #15):
288
- // a single-stage aspect entry is normal, valid blueprint content and the
289
- // warning fired on the common case. Studio side dropped to match.
290
-
291
- it('happy path: surfaces no warnings on a well-formed multi-stage blueprint', () => {
292
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
293
- expect(r.valid).toBe(true);
294
- expect(r.warnings).toHaveLength(0);
295
- });
296
- });
297
-
298
- describe('process-blueprint examples (regression)', () => {
299
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
300
- expect(files.length).toBeGreaterThan(0);
301
- for (const file of files) {
302
- it(`validates tests/fixtures/notation-corpus/process-blueprint/${file}`, () => {
303
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
304
- const parsed = yaml.load(text);
305
- const r = validateProcessBlueprint(parsed);
306
- expect(r.errors).toEqual([]);
307
- expect(r.valid).toBe(true);
308
- });
309
- }
310
- });
@@ -1,223 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import yaml from 'js-yaml';
5
- import { validateProcessMap } from '../validate.js';
6
-
7
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'process-map');
8
-
9
- const VALID_MAP = {
10
- notation: 'process-map',
11
- process_map: {
12
- id: 'PM-ENT-001',
13
- name: 'Enterprise Process Landscape',
14
- updated_at: '2026-05-08',
15
- groups: [
16
- {
17
- id: 'GRP-OPERATING',
18
- name: 'Operating Processes',
19
- type: 'operating',
20
- processes: [
21
- { process_id: 'PROC-ORD-FULFILL-001', name: 'Order Fulfilment', status: 'Active', maturity: 2 },
22
- { process_id: 'PROC-CUST-ONBOARD-001', name: 'Customer Onboarding', status: 'Draft' },
23
- ],
24
- },
25
- {
26
- id: 'GRP-SUPPORTING',
27
- name: 'Supporting Processes',
28
- type: 'supporting',
29
- processes: [
30
- { process_id: 'PROC-HR-RECRUIT-001', name: 'Recruitment', status: 'Active' },
31
- ],
32
- },
33
- ],
34
- },
35
- };
36
-
37
- describe('validateProcessMap', () => {
38
- it('passes on valid input', () => {
39
- const r = validateProcessMap(VALID_MAP);
40
- expect(r.valid).toBe(true);
41
- expect(r.errors).toHaveLength(0);
42
- });
43
-
44
- it('PMAP-001: rejects non-object input', () => {
45
- const r = validateProcessMap(null);
46
- expect(r.valid).toBe(false);
47
- expect(r.errors[0].code).toBe('PMAP-001');
48
- });
49
-
50
- it('PMAP-001: rejects missing notation', () => {
51
- const { notation: _, ...rest } = VALID_MAP;
52
- const r = validateProcessMap(rest);
53
- expect(r.errors.some(e => e.code === 'PMAP-001')).toBe(true);
54
- });
55
-
56
- it('PMAP-001: rejects wrong notation value', () => {
57
- const r = validateProcessMap({ ...VALID_MAP, notation: 'goals' });
58
- expect(r.errors.some(e => e.code === 'PMAP-001')).toBe(true);
59
- });
60
-
61
- it('PMAP-002: rejects missing process_map', () => {
62
- const r = validateProcessMap({ notation: 'process-map' });
63
- expect(r.errors.some(e => e.code === 'PMAP-002')).toBe(true);
64
- });
65
-
66
- it('PMAP-002: rejects missing id/name/updated_at', () => {
67
- const r = validateProcessMap({ notation: 'process-map', process_map: { groups: [] } });
68
- expect(r.errors.filter(e => e.code === 'PMAP-002').length).toBeGreaterThanOrEqual(3);
69
- });
70
-
71
- it('PMAP-002: rejects non-array groups', () => {
72
- const map = { ...VALID_MAP.process_map, groups: 'oops' };
73
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
74
- expect(r.errors.some(e => e.code === 'PMAP-002')).toBe(true);
75
- });
76
-
77
- it('PMAP-003: rejects group missing id/name/type', () => {
78
- const map = { ...VALID_MAP.process_map, groups: [{ processes: [] }] };
79
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
80
- expect(r.errors.filter(e => e.code === 'PMAP-003').length).toBeGreaterThanOrEqual(3);
81
- });
82
-
83
- it('PMAP-004: rejects invalid group type', () => {
84
- const map = {
85
- ...VALID_MAP.process_map,
86
- groups: [{ id: 'g1', name: 'X', type: 'random', processes: [] }],
87
- };
88
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
89
- expect(r.errors.some(e => e.code === 'PMAP-004')).toBe(true);
90
- });
91
-
92
- it('PMAP-004: accepts all valid group types', () => {
93
- for (const type of ['operating', 'supporting', 'management']) {
94
- const map = {
95
- ...VALID_MAP.process_map,
96
- groups: [{ id: 'g1', name: 'X', type, processes: [] }],
97
- };
98
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
99
- expect(r.errors.some(e => e.code === 'PMAP-004')).toBe(false);
100
- }
101
- });
102
-
103
- it('PMAP-005: rejects process missing process_id/name/status', () => {
104
- const map = {
105
- ...VALID_MAP.process_map,
106
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [{}] }],
107
- };
108
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
109
- expect(r.errors.filter(e => e.code === 'PMAP-005').length).toBeGreaterThanOrEqual(3);
110
- });
111
-
112
- it('PMAP-006: rejects invalid status', () => {
113
- const map = {
114
- ...VALID_MAP.process_map,
115
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
116
- { process_id: 'p1', name: 'X', status: 'Retired' },
117
- ]}],
118
- };
119
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
120
- expect(r.errors.some(e => e.code === 'PMAP-006')).toBe(true);
121
- });
122
-
123
- it('PMAP-007: rejects out-of-range maturity', () => {
124
- const map = {
125
- ...VALID_MAP.process_map,
126
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
127
- { process_id: 'p1', name: 'X', status: 'Active', maturity: 6 },
128
- ]}],
129
- };
130
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
131
- expect(r.errors.some(e => e.code === 'PMAP-007')).toBe(true);
132
- });
133
-
134
- it('PMAP-007: accepts maturity 1-5', () => {
135
- for (const maturity of [1, 2, 3, 4, 5]) {
136
- const map = {
137
- ...VALID_MAP.process_map,
138
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [
139
- { process_id: 'p1', name: 'X', status: 'Active', maturity },
140
- ]}],
141
- };
142
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
143
- expect(r.errors.some(e => e.code === 'PMAP-007')).toBe(false);
144
- }
145
- });
146
-
147
- it('PMAP-008: rejects malformed updated_at', () => {
148
- const map = { ...VALID_MAP.process_map, updated_at: '13-05-2026' };
149
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
150
- expect(r.errors.some(e => e.code === 'PMAP-008')).toBe(true);
151
- });
152
-
153
- it('PMAP-009: rejects duplicate process_id across groups', () => {
154
- const map = {
155
- ...VALID_MAP.process_map,
156
- groups: [
157
- { id: 'g1', name: 'A', type: 'operating', processes: [{ process_id: 'P1', name: 'X', status: 'Active' }] },
158
- { id: 'g2', name: 'B', type: 'supporting', processes: [{ process_id: 'P1', name: 'Y', status: 'Active' }] },
159
- ],
160
- };
161
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
162
- expect(r.errors.some(e => e.code === 'PMAP-009')).toBe(true);
163
- });
164
-
165
- it('PMAP-010: rejects duplicate group id', () => {
166
- const map = {
167
- ...VALID_MAP.process_map,
168
- groups: [
169
- { id: 'gdup', name: 'A', type: 'operating', processes: [] },
170
- { id: 'gdup', name: 'B', type: 'supporting', processes: [] },
171
- ],
172
- };
173
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
174
- expect(r.errors.some(e => e.code === 'PMAP-010')).toBe(true);
175
- });
176
-
177
- it('accepts empty groups array', () => {
178
- const map = { ...VALID_MAP.process_map, groups: [] };
179
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
180
- expect(r.valid).toBe(true);
181
- });
182
-
183
- it('accepts group with no processes field', () => {
184
- const map = {
185
- ...VALID_MAP.process_map,
186
- groups: [{ id: 'g1', name: 'G', type: 'operating' }],
187
- };
188
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
189
- expect(r.valid).toBe(true);
190
- });
191
-
192
- // Pre-release blocker regression (orchestrator review 2026-05-21).
193
- it('[blocker] tolerates a null element in groups[] without throwing', () => {
194
- const map = { ...VALID_MAP.process_map, groups: [null] };
195
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
196
- expect(r.valid).toBe(false);
197
- expect(r.errors.some(e => e.code === 'PMAP-003')).toBe(true);
198
- });
199
-
200
- it('[blocker] tolerates a null element in processes[] without throwing', () => {
201
- const map = {
202
- ...VALID_MAP.process_map,
203
- groups: [{ id: 'g1', name: 'G', type: 'operating', processes: [null] }],
204
- };
205
- const r = validateProcessMap({ ...VALID_MAP, process_map: map });
206
- expect(r.valid).toBe(false);
207
- expect(r.errors.some(e => e.code === 'PMAP-005')).toBe(true);
208
- });
209
- });
210
-
211
- describe('process-map examples (regression)', () => {
212
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
213
- expect(files.length).toBeGreaterThan(0);
214
- for (const file of files) {
215
- it(`validates tests/fixtures/notation-corpus/process-map/${file}`, () => {
216
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
217
- const parsed = yaml.load(text);
218
- const r = validateProcessMap(parsed);
219
- expect(r.errors).toEqual([]);
220
- expect(r.valid).toBe(true);
221
- });
222
- }
223
- });