@transitrix/diagrams 1.8.4 → 1.8.7

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 (254) hide show
  1. package/dist/edge-path.js +10 -1
  2. package/dist/webview/render-activities.d.ts +1 -1
  3. package/dist/webview/render-activities.js +2 -2
  4. package/dist/webview/render-fgca.js +1 -4
  5. package/package.json +7 -2
  6. package/src/edge-path.ts +15 -1
  7. package/src/webview/render-activities.ts +2 -2
  8. package/src/webview/render-fgca.ts +1 -4
  9. package/dist/__tests__/edge-path.test.d.ts +0 -1
  10. package/dist/__tests__/edge-path.test.js +0 -47
  11. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  12. package/dist/__tests__/node-size-presets.test.js +0 -30
  13. package/dist/__tests__/scope.test.d.ts +0 -1
  14. package/dist/__tests__/scope.test.js +0 -23
  15. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  16. package/dist/__tests__/yaml-normalize.test.js +0 -148
  17. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  18. package/dist/activities/__tests__/cpm.test.js +0 -146
  19. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  20. package/dist/activities/__tests__/gantt.test.js +0 -263
  21. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  22. package/dist/activities/__tests__/layout.test.js +0 -98
  23. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  24. package/dist/activities/__tests__/validate.test.js +0 -397
  25. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  26. package/dist/activity-card/__tests__/example.test.js +0 -73
  27. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  28. package/dist/activity-card/__tests__/layout.test.js +0 -141
  29. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  30. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  31. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  32. package/dist/activity-card/__tests__/validate.test.js +0 -149
  33. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  34. package/dist/actor/__tests__/validate.test.js +0 -95
  35. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  36. package/dist/applications/__tests__/validate.test.js +0 -223
  37. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  38. package/dist/assertion/__tests__/example.test.js +0 -32
  39. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  40. package/dist/assertion/__tests__/validate.test.js +0 -130
  41. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  42. package/dist/blocks/__tests__/layout.test.js +0 -153
  43. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  44. package/dist/blocks/__tests__/validate.test.js +0 -235
  45. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  46. package/dist/business-service/__tests__/validate.test.js +0 -135
  47. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  48. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  49. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  50. package/dist/capability-map/__tests__/address.test.js +0 -49
  51. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  52. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  53. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  54. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  55. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  56. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  57. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  58. package/dist/capability-map/__tests__/validate.test.js +0 -212
  59. package/dist/change/__tests__/validate.test.d.ts +0 -1
  60. package/dist/change/__tests__/validate.test.js +0 -79
  61. package/dist/codex/__tests__/example.test.d.ts +0 -1
  62. package/dist/codex/__tests__/example.test.js +0 -33
  63. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  64. package/dist/codex/__tests__/validate.test.js +0 -68
  65. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  66. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  67. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  68. package/dist/compliance/__tests__/classify.test.js +0 -58
  69. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  70. package/dist/compliance/__tests__/confidence.test.js +0 -78
  71. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  72. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  73. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  74. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  75. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  76. package/dist/compliance/__tests__/example.test.js +0 -51
  77. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  78. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  79. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  80. package/dist/compliance/__tests__/html.test.js +0 -122
  81. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  82. package/dist/compliance/__tests__/impact.test.js +0 -913
  83. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  84. package/dist/compliance/__tests__/markdown.test.js +0 -85
  85. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  86. package/dist/compliance/__tests__/trace.test.js +0 -144
  87. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  88. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  89. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  90. package/dist/compliance/__tests__/views.test.js +0 -59
  91. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  92. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  93. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  94. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  95. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  96. package/dist/confidence/__tests__/score.test.js +0 -188
  97. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  98. package/dist/constraint/__tests__/example.test.js +0 -14
  99. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  100. package/dist/constraint/__tests__/validate.test.js +0 -58
  101. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  102. package/dist/factor/__tests__/validate.test.js +0 -112
  103. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  104. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  105. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  106. package/dist/fgca/__tests__/layout.test.js +0 -140
  107. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  108. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  109. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  110. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  111. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  112. package/dist/fgca/__tests__/resolver.test.js +0 -185
  113. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  114. package/dist/fgca/__tests__/validate.test.js +0 -125
  115. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  116. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  117. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  118. package/dist/goals/__tests__/layout.test.js +0 -153
  119. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  120. package/dist/goals/__tests__/mutations.test.js +0 -134
  121. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  122. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  123. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  124. package/dist/goals/__tests__/validate.test.js +0 -183
  125. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  126. package/dist/integration/__tests__/validate.test.js +0 -169
  127. package/dist/location/__tests__/validate.test.d.ts +0 -1
  128. package/dist/location/__tests__/validate.test.js +0 -107
  129. package/dist/node/__tests__/validate.test.d.ts +0 -1
  130. package/dist/node/__tests__/validate.test.js +0 -100
  131. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  132. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  133. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  134. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  135. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  136. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  137. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  138. package/dist/process-map/__tests__/validate.test.js +0 -199
  139. package/dist/products/__tests__/validate.test.d.ts +0 -1
  140. package/dist/products/__tests__/validate.test.js +0 -210
  141. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  142. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  143. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  144. package/dist/requirement/__tests__/example.test.js +0 -21
  145. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  146. package/dist/requirement/__tests__/validate.test.js +0 -80
  147. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  148. package/dist/scenarios/__tests__/validate.test.js +0 -183
  149. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  150. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  151. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  152. package/dist/target-state/__tests__/validate.test.js +0 -78
  153. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  154. package/dist/technology-service/__tests__/validate.test.js +0 -121
  155. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  156. package/dist/theme/__tests__/tokens.test.js +0 -159
  157. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  158. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  159. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  160. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  161. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  162. package/dist/webview/__tests__/entry.test.js +0 -56
  163. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  164. package/dist/webview/__tests__/render-activities.test.js +0 -91
  165. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  166. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  167. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  168. package/dist/webview/__tests__/render-goals.test.js +0 -120
  169. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  170. package/dist/webview/__tests__/render-process.test.js +0 -463
  171. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  172. package/dist/webview/__tests__/render-util.test.js +0 -54
  173. package/src/__tests__/edge-path.test.ts +0 -58
  174. package/src/__tests__/node-size-presets.test.ts +0 -50
  175. package/src/__tests__/scope.test.ts +0 -27
  176. package/src/__tests__/yaml-normalize.test.ts +0 -158
  177. package/src/activities/__tests__/cpm.test.ts +0 -164
  178. package/src/activities/__tests__/gantt.test.ts +0 -290
  179. package/src/activities/__tests__/layout.test.ts +0 -112
  180. package/src/activities/__tests__/validate.test.ts +0 -446
  181. package/src/activity-card/__tests__/example.test.ts +0 -83
  182. package/src/activity-card/__tests__/layout.test.ts +0 -162
  183. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  184. package/src/activity-card/__tests__/validate.test.ts +0 -167
  185. package/src/actor/__tests__/validate.test.ts +0 -114
  186. package/src/applications/__tests__/validate.test.ts +0 -256
  187. package/src/assertion/__tests__/example.test.ts +0 -37
  188. package/src/assertion/__tests__/validate.test.ts +0 -142
  189. package/src/blocks/__tests__/layout.test.ts +0 -169
  190. package/src/blocks/__tests__/validate.test.ts +0 -260
  191. package/src/business-service/__tests__/validate.test.ts +0 -160
  192. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  193. package/src/capability-map/__tests__/address.test.ts +0 -59
  194. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  195. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  196. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  197. package/src/capability-map/__tests__/validate.test.ts +0 -238
  198. package/src/change/__tests__/validate.test.ts +0 -97
  199. package/src/codex/__tests__/example.test.ts +0 -40
  200. package/src/codex/__tests__/validate.test.ts +0 -84
  201. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  202. package/src/compliance/__tests__/classify.test.ts +0 -64
  203. package/src/compliance/__tests__/confidence.test.ts +0 -98
  204. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  205. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  206. package/src/compliance/__tests__/example.test.ts +0 -57
  207. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  208. package/src/compliance/__tests__/html.test.ts +0 -142
  209. package/src/compliance/__tests__/impact.test.ts +0 -1060
  210. package/src/compliance/__tests__/markdown.test.ts +0 -95
  211. package/src/compliance/__tests__/trace.test.ts +0 -157
  212. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  213. package/src/compliance/__tests__/views.test.ts +0 -64
  214. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  215. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  216. package/src/confidence/__tests__/score.test.ts +0 -254
  217. package/src/constraint/__tests__/example.test.ts +0 -19
  218. package/src/constraint/__tests__/validate.test.ts +0 -68
  219. package/src/factor/__tests__/validate.test.ts +0 -133
  220. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  221. package/src/fgca/__tests__/layout.test.ts +0 -179
  222. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  223. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  224. package/src/fgca/__tests__/resolver.test.ts +0 -209
  225. package/src/fgca/__tests__/validate.test.ts +0 -142
  226. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  227. package/src/goals/__tests__/layout.test.ts +0 -175
  228. package/src/goals/__tests__/mutations.test.ts +0 -153
  229. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  230. package/src/goals/__tests__/validate.test.ts +0 -202
  231. package/src/integration/__tests__/validate.test.ts +0 -203
  232. package/src/location/__tests__/validate.test.ts +0 -127
  233. package/src/node/__tests__/validate.test.ts +0 -118
  234. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  235. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  236. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  237. package/src/process-map/__tests__/validate.test.ts +0 -223
  238. package/src/products/__tests__/validate.test.ts +0 -239
  239. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  240. package/src/requirement/__tests__/example.test.ts +0 -24
  241. package/src/requirement/__tests__/validate.test.ts +0 -96
  242. package/src/scenarios/__tests__/validate.test.ts +0 -209
  243. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  244. package/src/target-state/__tests__/validate.test.ts +0 -95
  245. package/src/technology-service/__tests__/validate.test.ts +0 -143
  246. package/src/theme/__tests__/tokens.test.ts +0 -185
  247. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  248. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  249. package/src/webview/__tests__/entry.test.ts +0 -64
  250. package/src/webview/__tests__/render-activities.test.ts +0 -100
  251. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  252. package/src/webview/__tests__/render-goals.test.ts +0 -128
  253. package/src/webview/__tests__/render-process.test.ts +0 -538
  254. 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
- });