@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,238 +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 { validateCapabilityMap } from '../validate.js';
6
-
7
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'capability-map');
8
-
9
- const VALID_MAP = {
10
- notation: 'capability-map',
11
- capability_map: {
12
- id: 'CM-BUSINESS-001',
13
- name: 'Business Capabilities Map',
14
- assessment_date: '2026-05-08',
15
- capabilities: [
16
- {
17
- id: 'V1',
18
- name: 'Order Management',
19
- type: 'domain',
20
- current_maturity: 2,
21
- target_maturity: 3,
22
- target_date: '2026-12-31',
23
- children: [
24
- { id: 'V1.1', name: 'Order Intake', current_maturity: 3 },
25
- { id: 'V1.2', name: 'Order Fulfilment', current_maturity: 2, target_maturity: 3 },
26
- ],
27
- },
28
- {
29
- id: 'H1',
30
- name: 'Master Data Management',
31
- type: 'supporting',
32
- current_maturity: 1,
33
- target_maturity: 3,
34
- },
35
- ],
36
- },
37
- };
38
-
39
- describe('validateCapabilityMap', () => {
40
- it('passes on valid input', () => {
41
- const r = validateCapabilityMap(VALID_MAP);
42
- expect(r.valid).toBe(true);
43
- expect(r.errors).toHaveLength(0);
44
- });
45
-
46
- it('CMAP-001: rejects non-object input', () => {
47
- const r = validateCapabilityMap(null);
48
- expect(r.errors[0].code).toBe('CMAP-001');
49
- });
50
-
51
- it('CMAP-001: rejects missing notation', () => {
52
- const { notation: _, ...rest } = VALID_MAP;
53
- const r = validateCapabilityMap(rest);
54
- expect(r.errors.some(e => e.code === 'CMAP-001')).toBe(true);
55
- });
56
-
57
- it('CMAP-001: rejects wrong notation value', () => {
58
- const r = validateCapabilityMap({ ...VALID_MAP, notation: 'goals' });
59
- expect(r.errors.some(e => e.code === 'CMAP-001')).toBe(true);
60
- });
61
-
62
- it('CMAP-002: rejects missing capability_map', () => {
63
- const r = validateCapabilityMap({ notation: 'capability-map' });
64
- expect(r.errors.some(e => e.code === 'CMAP-002')).toBe(true);
65
- });
66
-
67
- it('CMAP-002: rejects missing id/name/assessment_date', () => {
68
- const r = validateCapabilityMap({ notation: 'capability-map', capability_map: { capabilities: [] } });
69
- expect(r.errors.filter(e => e.code === 'CMAP-002').length).toBeGreaterThanOrEqual(3);
70
- });
71
-
72
- it('CMAP-002: rejects non-array capabilities', () => {
73
- const map = { ...VALID_MAP.capability_map, capabilities: 'oops' };
74
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
75
- expect(r.errors.some(e => e.code === 'CMAP-002')).toBe(true);
76
- });
77
-
78
- it('CMAP-003: rejects capability missing id/name/current_maturity', () => {
79
- const map = { ...VALID_MAP.capability_map, capabilities: [{}] };
80
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
81
- expect(r.errors.filter(e => e.code === 'CMAP-003').length).toBeGreaterThanOrEqual(3);
82
- });
83
-
84
- it('CMAP-004: rejects invalid type', () => {
85
- const map = {
86
- ...VALID_MAP.capability_map,
87
- capabilities: [{ id: 'V1', name: 'X', type: 'core', current_maturity: 2 }],
88
- };
89
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
90
- expect(r.errors.some(e => e.code === 'CMAP-004')).toBe(true);
91
- });
92
-
93
- it('CMAP-004: accepts type domain/supporting', () => {
94
- for (const type of ['domain', 'supporting']) {
95
- const map = {
96
- ...VALID_MAP.capability_map,
97
- capabilities: [{ id: 'V1', name: 'X', type, current_maturity: 2 }],
98
- };
99
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
100
- expect(r.errors.some(e => e.code === 'CMAP-004')).toBe(false);
101
- }
102
- });
103
-
104
- it('CMAP-005: rejects current_maturity out of range', () => {
105
- const map = {
106
- ...VALID_MAP.capability_map,
107
- capabilities: [{ id: 'V1', name: 'X', current_maturity: 6 }],
108
- };
109
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
110
- expect(r.errors.some(e => e.code === 'CMAP-005')).toBe(true);
111
- });
112
-
113
- it('CMAP-005: rejects non-integer current_maturity', () => {
114
- const map = {
115
- ...VALID_MAP.capability_map,
116
- capabilities: [{ id: 'V1', name: 'X', current_maturity: 2.5 }],
117
- };
118
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
119
- expect(r.errors.some(e => e.code === 'CMAP-005')).toBe(true);
120
- });
121
-
122
- it('CMAP-006: rejects target_maturity out of range', () => {
123
- const map = {
124
- ...VALID_MAP.capability_map,
125
- capabilities: [{ id: 'V1', name: 'X', current_maturity: 2, target_maturity: 0 }],
126
- };
127
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
128
- expect(r.errors.some(e => e.code === 'CMAP-006')).toBe(true);
129
- });
130
-
131
- it('CMAP-007: rejects malformed assessment_date', () => {
132
- const map = { ...VALID_MAP.capability_map, assessment_date: '08-05-2026' };
133
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
134
- expect(r.errors.some(e => e.code === 'CMAP-007')).toBe(true);
135
- });
136
-
137
- it('CMAP-007: rejects malformed target_date on a node', () => {
138
- const map = {
139
- ...VALID_MAP.capability_map,
140
- capabilities: [{ id: 'V1', name: 'X', current_maturity: 2, target_date: 'tomorrow' }],
141
- };
142
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
143
- expect(r.errors.some(e => e.code === 'CMAP-007')).toBe(true);
144
- });
145
-
146
- it('CMAP-008: rejects duplicate capability id across the tree', () => {
147
- const map = {
148
- ...VALID_MAP.capability_map,
149
- capabilities: [
150
- { id: 'V1', name: 'A', current_maturity: 2, children: [{ id: 'V1', name: 'B', current_maturity: 1 }] },
151
- ],
152
- };
153
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
154
- expect(r.errors.some(e => e.code === 'CMAP-008')).toBe(true);
155
- });
156
-
157
- it('CMAP-009: rejects malformed capability id', () => {
158
- const map = {
159
- ...VALID_MAP.capability_map,
160
- capabilities: [{ id: 'X1', name: 'A', current_maturity: 2 }],
161
- };
162
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
163
- expect(r.errors.some(e => e.code === 'CMAP-009')).toBe(true);
164
- });
165
-
166
- it('CMAP-009: accepts V/H ids with dotted levels', () => {
167
- for (const id of ['V1', 'V1.2', 'V1.2.3', 'H1', 'H1.2', 'H10.20.30']) {
168
- const map = {
169
- ...VALID_MAP.capability_map,
170
- capabilities: [{ id, name: 'A', current_maturity: 2 }],
171
- };
172
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
173
- expect(r.errors.some(e => e.code === 'CMAP-009')).toBe(false);
174
- }
175
- });
176
-
177
- it('CMAP-009: accepts the canonical CAPABILITY- prefix', () => {
178
- for (const id of ['CAPABILITY-V1', 'CAPABILITY-V1.2', 'CAPABILITY-V1.2.3', 'CAPABILITY-H1', 'CAPABILITY-H1.2']) {
179
- const map = {
180
- ...VALID_MAP.capability_map,
181
- capabilities: [{ id, name: 'A', current_maturity: 2 }],
182
- };
183
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
184
- expect(r.errors.some(e => e.code === 'CMAP-009')).toBe(false);
185
- }
186
- });
187
-
188
- it('validates children recursively', () => {
189
- const map = {
190
- ...VALID_MAP.capability_map,
191
- capabilities: [{
192
- id: 'V1', name: 'Root', current_maturity: 2,
193
- children: [{ id: 'BAD_ID', name: 'X', current_maturity: 7 }],
194
- }],
195
- };
196
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
197
- expect(r.errors.some(e => e.code === 'CMAP-009')).toBe(true);
198
- expect(r.errors.some(e => e.code === 'CMAP-005')).toBe(true);
199
- });
200
-
201
- it('accepts empty capabilities array', () => {
202
- const map = { ...VALID_MAP.capability_map, capabilities: [] };
203
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
204
- expect(r.valid).toBe(true);
205
- });
206
-
207
- // Pre-release blocker regression (orchestrator review 2026-05-21).
208
- it('[blocker] tolerates a null element in capabilities[] without throwing', () => {
209
- const map = { ...VALID_MAP.capability_map, capabilities: [null] };
210
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
211
- expect(r.valid).toBe(false);
212
- expect(r.errors.some(e => e.code === 'CMAP-003')).toBe(true);
213
- });
214
-
215
- it('[blocker] tolerates a null child capability without throwing', () => {
216
- const map = {
217
- ...VALID_MAP.capability_map,
218
- capabilities: [{ id: 'V1', name: 'X', current_maturity: 2, children: [null] }],
219
- };
220
- const r = validateCapabilityMap({ ...VALID_MAP, capability_map: map });
221
- expect(r.valid).toBe(false);
222
- expect(r.errors.some(e => e.code === 'CMAP-003')).toBe(true);
223
- });
224
- });
225
-
226
- describe('capability-map examples (regression)', () => {
227
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
228
- expect(files.length).toBeGreaterThan(0);
229
- for (const file of files) {
230
- it(`validates tests/fixtures/notation-corpus/capability-map/${file}`, () => {
231
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
232
- const parsed = yaml.load(text);
233
- const r = validateCapabilityMap(parsed);
234
- expect(r.errors).toEqual([]);
235
- expect(r.valid).toBe(true);
236
- });
237
- }
238
- });
@@ -1,97 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateChange } from '../validate.js';
3
- import type { CanonCatalog } from '../../typed-id.js';
4
-
5
- function valid(): Record<string, unknown> {
6
- return {
7
- notation: 'change',
8
- id: 'CHANGE-EU-CRM-1',
9
- name: 'Stand up EU-localised CRM and payment processing',
10
- goals: ['GOAL-EU-1'],
11
- description: 'The required delta to operate in EU markets.',
12
- zone: 'canon',
13
- admitted_at: '2026-05-29',
14
- admitted_by: 'v.korobeinikov',
15
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
16
- valid_from: '2026-05-26',
17
- valid_to: null,
18
- };
19
- }
20
-
21
- const codes = (input: unknown, opts?: Parameters<typeof validateChange>[1]): string[] =>
22
- validateChange(input, opts).errors.map(e => e.code);
23
-
24
- describe('validateChange — positive', () => {
25
- it('accepts a well-formed change', () => {
26
- const r = validateChange(valid());
27
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
28
- });
29
-
30
- it('accepts a minimal change with no optional fields', () => {
31
- const c = valid();
32
- delete c.goals;
33
- delete c.description;
34
- expect(validateChange(c).valid).toBe(true);
35
- });
36
-
37
- it('accepts a child change with a CHANGE parent', () => {
38
- const c = valid();
39
- c.id = 'CHANGE-EU-CRM-2';
40
- c.parent = 'CHANGE-EU-CRM-1';
41
- expect(validateChange(c).valid).toBe(true);
42
- });
43
- });
44
-
45
- describe('validateChange — CHANGE-001 (shape / id grammar)', () => {
46
- it('flags a missing required envelope field', () => {
47
- const c = valid();
48
- delete c.name;
49
- expect(codes(c)).toContain('CHANGE-001');
50
- });
51
-
52
- it('flags an id that violates the grammar', () => {
53
- expect(codes({ ...valid(), id: 'CHANGE-EU-CRM-001' })).toContain('CHANGE-001');
54
- expect(codes({ ...valid(), id: 'CHG-1' })).toContain('CHANGE-001');
55
- });
56
-
57
- it('flags a wrong notation tag', () => {
58
- expect(codes({ ...valid(), notation: 'gap' })).toContain('CHANGE-001');
59
- });
60
-
61
- it('flags a non-array goals', () => {
62
- expect(codes({ ...valid(), goals: 'GOAL-EU-1' })).toContain('CHANGE-001');
63
- });
64
-
65
- it('rejects a non-object', () => {
66
- expect(codes(null)).toEqual(['CHANGE-001']);
67
- });
68
- });
69
-
70
- describe('validateChange — CHANGE-002 (goals references)', () => {
71
- it('flags a malformed goals entry', () => {
72
- expect(codes({ ...valid(), goals: ['not an id'] })).toContain('CHANGE-002');
73
- });
74
-
75
- it('flags a goals entry of the wrong TYPE', () => {
76
- expect(codes({ ...valid(), goals: ['FACTOR-X-1'] })).toContain('CHANGE-002');
77
- });
78
-
79
- it('flags an unresolved id when a catalog is supplied', () => {
80
- const catalog: CanonCatalog = { typeOf: () => undefined };
81
- expect(codes(valid(), { catalog })).toContain('CHANGE-002');
82
- });
83
- });
84
-
85
- describe('validateChange — CHANGE-003 (parent)', () => {
86
- it('flags a parent of the wrong TYPE', () => {
87
- expect(codes({ ...valid(), parent: 'GOAL-X-1' })).toContain('CHANGE-003');
88
- });
89
-
90
- it('flags a parent equal to self', () => {
91
- expect(codes({ ...valid(), parent: 'CHANGE-EU-CRM-1' })).toContain('CHANGE-003');
92
- });
93
-
94
- it('flags a malformed parent', () => {
95
- expect(codes({ ...valid(), parent: 'not an id' })).toContain('CHANGE-003');
96
- });
97
- });
@@ -1,40 +0,0 @@
1
- // Conformance test for CODEX worked examples under
2
- // `tests/fixtures/notation-corpus/codex/` — pins #518 Phase C2 corpus signal.
3
-
4
- import { describe, it, expect } from 'vitest';
5
- import { readFileSync, readdirSync } from 'node:fs';
6
- import { fileURLToPath } from 'node:url';
7
- import path from 'node:path';
8
- import yaml from 'js-yaml';
9
- import { validateCodex, folderJurisdictionFromPath } from '../validate.js';
10
-
11
- const corpusRoot = path.resolve(
12
- path.dirname(fileURLToPath(import.meta.url)),
13
- '../../../../../tests/fixtures/notation-corpus/codex',
14
- );
15
-
16
- function codexFixturePaths(): Array<{ rel: string; folderJurisdiction?: string }> {
17
- const out: Array<{ rel: string; folderJurisdiction?: string }> = [];
18
- for (const zone of ['external/EU', 'internal']) {
19
- const dir = path.join(corpusRoot, zone);
20
- for (const f of readdirSync(dir).filter((x) => x.endsWith('.yaml'))) {
21
- const rel = path.join('codex', zone, f).replace(/\\/g, '/');
22
- out.push({
23
- rel,
24
- folderJurisdiction: folderJurisdictionFromPath(rel),
25
- });
26
- }
27
- }
28
- return out;
29
- }
30
-
31
- describe('codex worked examples (notation-corpus)', () => {
32
- for (const { rel, folderJurisdiction } of codexFixturePaths()) {
33
- it(`validates ${rel} without error`, () => {
34
- const data = yaml.load(readFileSync(path.join(corpusRoot, rel.replace(/^codex\//, '')), 'utf-8'));
35
- const v = validateCodex(data, { folderJurisdiction });
36
- expect(v.valid, JSON.stringify(v.errors)).toBe(true);
37
- expect(v.errors).toHaveLength(0);
38
- });
39
- }
40
- });
@@ -1,84 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import {
3
- validateCodex,
4
- isCodexDoc,
5
- folderJurisdictionFromPath,
6
- } from '../validate.js';
7
-
8
- const VALID_EXTERNAL = {
9
- zone: 'codex',
10
- id: 'LAW-GDPR-1',
11
- name: 'General Data Protection Regulation',
12
- type: 'LAW',
13
- jurisdiction: 'eu',
14
- effective_date: '2018-05-25',
15
- admitted_at: '2026-06-01',
16
- admitted_by: 'legal.team',
17
- gate_checks: { uniqueness: 'pass' },
18
- };
19
-
20
- const VALID_INTERNAL = {
21
- zone: 'codex',
22
- id: 'INTERNAL_STANDARD-coding-conventions-1',
23
- name: 'Engineering Coding Conventions',
24
- type: 'INTERNAL_STANDARD',
25
- issuing_authority: 'VP Engineering',
26
- effective_date: '2026-01-01',
27
- admitted_at: '2026-05-27',
28
- admitted_by: 'vp.engineering',
29
- gate_checks: { source_authority: 'VP Engineering' },
30
- };
31
-
32
- describe('validateCodex', () => {
33
- it('accepts a valid external artefact', () => {
34
- const r = validateCodex(VALID_EXTERNAL, { folderJurisdiction: 'eu' });
35
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
36
- });
37
-
38
- it('accepts a valid internal artefact', () => {
39
- expect(validateCodex(VALID_INTERNAL).valid).toBe(true);
40
- });
41
-
42
- it('CODEX-001 rejects non-mapping input', () => {
43
- expect(validateCodex(null).errors.some((e) => e.code === 'CODEX-001')).toBe(true);
44
- });
45
-
46
- it('CODEX-001 rejects wrong zone', () => {
47
- const r = validateCodex({ ...VALID_EXTERNAL, zone: 'canon' });
48
- expect(r.errors.some((e) => e.code === 'CODEX-001' && e.path === 'zone')).toBe(true);
49
- });
50
-
51
- it('CODEX-002 rejects type/id prefix mismatch', () => {
52
- const r = validateCodex({ ...VALID_EXTERNAL, type: 'REGULATION' });
53
- expect(r.errors.some((e) => e.code === 'CODEX-002')).toBe(true);
54
- });
55
-
56
- it('CODEX-003 requires jurisdiction on external artefacts', () => {
57
- const r = validateCodex({ ...VALID_EXTERNAL, jurisdiction: '' });
58
- expect(r.errors.some((e) => e.code === 'CODEX-003' && e.path === 'jurisdiction')).toBe(true);
59
- });
60
-
61
- it('CODEX-005 enforces folder jurisdiction match', () => {
62
- const r = validateCodex(VALID_EXTERNAL, { folderJurisdiction: 'ge' });
63
- expect(r.errors.some((e) => e.code === 'CODEX-005')).toBe(true);
64
- });
65
-
66
- it('CODEX-004 requires issuing_authority on internal artefacts', () => {
67
- const r = validateCodex({ ...VALID_INTERNAL, issuing_authority: '' });
68
- expect(r.errors.some((e) => e.code === 'CODEX-004')).toBe(true);
69
- });
70
- });
71
-
72
- describe('isCodexDoc', () => {
73
- it('detects zone: codex', () => {
74
- expect(isCodexDoc({ zone: 'codex', id: 'LAW-1' })).toBe(true);
75
- expect(isCodexDoc({ zone: 'canon' })).toBe(false);
76
- });
77
- });
78
-
79
- describe('folderJurisdictionFromPath', () => {
80
- it('parses codex/external/<jurisdiction>/ paths', () => {
81
- expect(folderJurisdictionFromPath('codex/external/eu/LAW-GDPR-1.yaml')).toBe('eu');
82
- expect(folderJurisdictionFromPath('codex/internal/POLICY-1.yaml')).toBeUndefined();
83
- });
84
- });
@@ -1,68 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import {
4
- admitDocumentToCatalog,
5
- buildComplianceScan,
6
- catalogFromMap,
7
- } from '../canon-catalog.js';
8
-
9
- describe('buildComplianceScan', () => {
10
- it('admits codex, requirement, and assertion ids into the catalogue', () => {
11
- const docs = [
12
- {
13
- path: 'codex/external/ge/LAW-PERSONAL-DATA-2017-1.yaml',
14
- data: {
15
- zone: 'codex',
16
- id: 'LAW-PERSONAL-DATA-2017-1',
17
- name: 'Law',
18
- type: 'LAW',
19
- },
20
- },
21
- {
22
- path: 'canon/elements/01_motivation/requirements/REQUIREMENT-DATA-ERASURE-1.yaml',
23
- data: {
24
- notation: 'requirement',
25
- id: 'REQUIREMENT-DATA-ERASURE-1',
26
- name: 'Erasure',
27
- derived_from: ['LAW-PERSONAL-DATA-2017-1'],
28
- },
29
- },
30
- {
31
- path: 'canon/elements/02_business/products/PRODUCT-MOBILE-1.yaml',
32
- data: { notation: 'product', id: 'PRODUCT-MOBILE-1', name: 'Mobile' },
33
- },
34
- {
35
- path: 'canon/assertions/ASSERTION-MOBILE-DATA-ERASURE-1.yaml',
36
- data: {
37
- notation: 'assertion',
38
- id: 'ASSERTION-MOBILE-DATA-ERASURE-1',
39
- about: 'REQUIREMENT-DATA-ERASURE-1',
40
- subject: 'PRODUCT-MOBILE-1',
41
- status: 'compliant',
42
- },
43
- },
44
- ];
45
-
46
- const { catalog, complianceCanon, pathById } = buildComplianceScan(docs);
47
- expect(catalog.typeOf('LAW-PERSONAL-DATA-2017-1')).toBe('LAW');
48
- expect(catalog.typeOf('REQUIREMENT-DATA-ERASURE-1')).toBe('REQUIREMENT');
49
- expect(catalog.typeOf('PRODUCT-MOBILE-1')).toBe('PRODUCT');
50
- expect(complianceCanon.requirements).toHaveLength(1);
51
- expect(complianceCanon.assertions).toHaveLength(1);
52
- expect(complianceCanon.codex).toHaveLength(1);
53
- expect(pathById.get('REQUIREMENT-DATA-ERASURE-1')).toContain('requirements/');
54
- });
55
- });
56
-
57
- describe('admitDocumentToCatalog', () => {
58
- it('uses explicit codex type when the id prefix is ambiguous', () => {
59
- const map = new Map<string, string>();
60
- admitDocumentToCatalog(map, {
61
- zone: 'codex',
62
- id: 'INTERNAL_STANDARD-coding-conventions-1',
63
- type: 'INTERNAL_STANDARD',
64
- });
65
- const catalog = catalogFromMap(map);
66
- expect(catalog.typeOf('INTERNAL_STANDARD-coding-conventions-1')).toBe('INTERNAL_STANDARD');
67
- });
68
- });
@@ -1,64 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { emptyCanon, ingestComplianceDoc } from '../classify.js';
3
-
4
- describe('ingestComplianceDoc', () => {
5
- it('buckets each artefact kind by notation / zone', () => {
6
- const canon = emptyCanon();
7
- expect(ingestComplianceDoc(canon, { notation: 'product', id: 'PRODUCT-1', name: 'P' })).toBe('PRODUCT-1');
8
- expect(ingestComplianceDoc(canon, { notation: 'requirement', id: 'REQUIREMENT-1', name: 'R', severity: 'high', derived_from: ['LAW-1'], admitted_at: '2026-05-28' })).toBe('REQUIREMENT-1');
9
- expect(ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-1', about: 'REQUIREMENT-1', subject: 'PRODUCT-1', status: 'compliant', evidence: [{ kind: 'note', text: 'x' }], admitted_at: '2026-05-28' })).toBe('ASSERTION-1');
10
- expect(ingestComplianceDoc(canon, { id: 'LAW-1', name: 'Law', type: 'LAW', zone: 'codex', jurisdiction: 'ge' })).toBe('LAW-1');
11
-
12
- expect(canon.products).toEqual([{ id: 'PRODUCT-1', name: 'P' }]);
13
- expect(canon.requirements[0]).toMatchObject({ id: 'REQUIREMENT-1', severity: 'high', derived_from: ['LAW-1'] });
14
- expect(canon.assertions[0]).toMatchObject({ id: 'ASSERTION-1', status: 'compliant', evidenceCount: 1 });
15
- expect(canon.codex[0]).toMatchObject({ id: 'LAW-1', type: 'LAW', jurisdiction: 'ge' });
16
- expect(canon.subjects).toEqual([]);
17
- });
18
-
19
- it('ingests capability, process, application, system into canon.subjects', () => {
20
- const canon = emptyCanon();
21
- expect(ingestComplianceDoc(canon, { notation: 'capability', id: 'CAPABILITY-V2', name: 'CRM' })).toBe('CAPABILITY-V2');
22
- expect(ingestComplianceDoc(canon, { notation: 'process', id: 'PROCESS-CS-1', name: 'Support' })).toBe('PROCESS-CS-1');
23
- expect(ingestComplianceDoc(canon, { notation: 'application', id: 'APP-ERP-1', name: 'ERP System' })).toBe('APP-ERP-1');
24
- expect(ingestComplianceDoc(canon, { notation: 'system', id: 'SYSTEM-IAM-1', name: 'IAM' })).toBe('SYSTEM-IAM-1');
25
- expect(canon.subjects).toEqual([
26
- { id: 'CAPABILITY-V2', name: 'CRM' },
27
- { id: 'PROCESS-CS-1', name: 'Support' },
28
- { id: 'APP-ERP-1', name: 'ERP System' },
29
- { id: 'SYSTEM-IAM-1', name: 'IAM' },
30
- ]);
31
- expect(canon.products).toEqual([]);
32
- });
33
-
34
- it('falls back to id when name is absent for subjects', () => {
35
- const canon = emptyCanon();
36
- ingestComplianceDoc(canon, { notation: 'capability', id: 'CAPABILITY-X-1' });
37
- expect(canon.subjects[0]).toEqual({ id: 'CAPABILITY-X-1', name: 'CAPABILITY-X-1' });
38
- });
39
-
40
- it('captures owner_to_confirm on pending_owner assertions', () => {
41
- const canon = emptyCanon();
42
- ingestComplianceDoc(canon, {
43
- notation: 'assertion', id: 'ASSERTION-PO-1',
44
- about: 'REQUIREMENT-1', subject: 'PRODUCT-1',
45
- status: 'pending_owner', owner_to_confirm: 'alice@example.com',
46
- });
47
- expect(canon.assertions[0]).toMatchObject({
48
- id: 'ASSERTION-PO-1',
49
- status: 'pending_owner',
50
- owner_to_confirm: 'alice@example.com',
51
- });
52
- });
53
-
54
- it('returns null for non-artefacts, missing id, and malformed assertions', () => {
55
- const canon = emptyCanon();
56
- expect(ingestComplianceDoc(canon, { notation: 'goals', id: 'X-1' })).toBeNull();
57
- expect(ingestComplianceDoc(canon, { notation: 'product' })).toBeNull(); // no id
58
- expect(ingestComplianceDoc(canon, { notation: 'assertion', id: 'ASSERTION-2', about: 'R' })).toBeNull(); // missing subject/status
59
- expect(ingestComplianceDoc(canon, null)).toBeNull();
60
- expect(ingestComplianceDoc(canon, 'str')).toBeNull();
61
- expect(canon.products).toEqual([]);
62
- expect(canon.subjects).toEqual([]);
63
- });
64
- });