@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,169 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateIntegration } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'integration',
6
- id: 'INTEGRATION-OMS-CRM-1',
7
- source: 'APPLICATION-OMS-1',
8
- target: 'APPLICATION-CRM-1',
9
- direction: 'outbound',
10
- protocol: 'REST',
11
- zone: 'canon',
12
- admitted_at: '2026-06-28',
13
- admitted_by: 'v.korobeinikov',
14
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
15
- valid_from: '2024-01-01',
16
- valid_to: null,
17
- };
18
- }
19
- function validWithInterface() {
20
- return {
21
- ...valid(),
22
- id: 'INTEGRATION-OMS-EVENTS-1',
23
- interface_semantics: true,
24
- payload_class: 'domain_event',
25
- sensitivity: 'internal',
26
- directionality: 'producer',
27
- };
28
- }
29
- const codes = (input) => validateIntegration(input).errors.map(e => e.code);
30
- describe('validateIntegration — positive', () => {
31
- it('accepts a well-formed integration without interface_semantics', () => {
32
- const r = validateIntegration(valid());
33
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
34
- });
35
- it('accepts integration with no optional fields except required ones', () => {
36
- const a = valid();
37
- delete a.direction;
38
- delete a.protocol;
39
- expect(validateIntegration(a).valid).toBe(true);
40
- });
41
- it('accepts a valid integration with interface_semantics: true and all required fields', () => {
42
- const r = validateIntegration(validWithInterface());
43
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
44
- });
45
- it('accepts valid_to as a date string', () => {
46
- expect(validateIntegration({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
47
- });
48
- it('accepts interface_semantics: false without requiring conditional fields', () => {
49
- expect(validateIntegration({ ...valid(), interface_semantics: false }).valid).toBe(true);
50
- });
51
- it('accepts all four directionality values', () => {
52
- for (const d of ['producer', 'consumer', 'request_reply', 'bidirectional_stream']) {
53
- expect(validateIntegration({ ...validWithInterface(), directionality: d }).valid).toBe(true);
54
- }
55
- });
56
- it('accepts all four sensitivity values', () => {
57
- for (const s of ['public', 'internal', 'confidential', 'restricted']) {
58
- expect(validateIntegration({ ...validWithInterface(), sensitivity: s }).valid).toBe(true);
59
- }
60
- });
61
- });
62
- describe('validateIntegration — INT-001 (shape / id grammar)', () => {
63
- it('flags a non-object input', () => {
64
- expect(codes(null)).toEqual(['INT-001']);
65
- expect(codes('string')).toEqual(['INT-001']);
66
- });
67
- it('flags an id that violates the grammar', () => {
68
- expect(codes({ ...valid(), id: 'INTEGRATION-001' })).toContain('INT-001');
69
- expect(codes({ ...valid(), id: 'INT-1' })).toContain('INT-001');
70
- expect(codes({ ...valid(), id: 'integration-oms-1' })).toContain('INT-001');
71
- });
72
- it('flags a wrong notation tag', () => {
73
- expect(codes({ ...valid(), notation: 'integrations' })).toContain('INT-001');
74
- expect(codes({ ...valid(), notation: 'application' })).toContain('INT-001');
75
- });
76
- it('flags a non-canon zone', () => {
77
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('INT-001');
78
- });
79
- it('flags a missing zone', () => {
80
- const a = valid();
81
- delete a.zone;
82
- expect(codes(a)).toContain('INT-001');
83
- });
84
- it('flags a missing source', () => {
85
- const a = valid();
86
- delete a.source;
87
- expect(codes(a)).toContain('INT-001');
88
- });
89
- it('flags a missing target', () => {
90
- const a = valid();
91
- delete a.target;
92
- expect(codes(a)).toContain('INT-001');
93
- });
94
- it('flags a missing admitted_at', () => {
95
- const a = valid();
96
- delete a.admitted_at;
97
- expect(codes(a)).toContain('INT-001');
98
- });
99
- it('flags a missing valid_to key', () => {
100
- const a = valid();
101
- delete a.valid_to;
102
- expect(codes(a)).toContain('INT-001');
103
- });
104
- it('flags missing gate_checks', () => {
105
- const a = valid();
106
- delete a.gate_checks;
107
- expect(codes(a)).toContain('INT-001');
108
- });
109
- it('flags an invalid direction value', () => {
110
- expect(codes({ ...valid(), direction: 'both' })).toContain('INT-001');
111
- });
112
- });
113
- describe('validateIntegration — INT-001 (interface_semantics conditional fields)', () => {
114
- it('flags missing protocol when interface_semantics is true', () => {
115
- const a = validWithInterface();
116
- delete a.protocol;
117
- expect(codes(a)).toContain('INT-001');
118
- });
119
- it('flags missing payload_class when interface_semantics is true', () => {
120
- const a = validWithInterface();
121
- delete a.payload_class;
122
- expect(codes(a)).toContain('INT-001');
123
- });
124
- it('flags missing sensitivity when interface_semantics is true', () => {
125
- const a = validWithInterface();
126
- delete a.sensitivity;
127
- expect(codes(a)).toContain('INT-001');
128
- });
129
- it('flags missing directionality when interface_semantics is true', () => {
130
- const a = validWithInterface();
131
- delete a.directionality;
132
- expect(codes(a)).toContain('INT-001');
133
- });
134
- it('flags all four missing at once', () => {
135
- const a = valid();
136
- a.interface_semantics = true;
137
- delete a.protocol;
138
- const errs = validateIntegration(a).errors.filter(e => e.code === 'INT-001');
139
- expect(errs.length).toBeGreaterThanOrEqual(4);
140
- });
141
- it('flags an invalid sensitivity value when interface_semantics is true', () => {
142
- expect(codes({ ...validWithInterface(), sensitivity: 'secret' })).toContain('INT-001');
143
- });
144
- it('flags an invalid directionality value when interface_semantics is true', () => {
145
- expect(codes({ ...validWithInterface(), directionality: 'both_ways' })).toContain('INT-001');
146
- });
147
- it('does not fire INT-001 conditional checks when interface_semantics is absent', () => {
148
- const a = valid();
149
- const errs = validateIntegration(a).errors.filter(e => e.code === 'INT-001' && e.path && ['protocol', 'payload_class', 'sensitivity', 'directionality'].includes(e.path));
150
- expect(errs).toHaveLength(0);
151
- });
152
- });
153
- describe('validateIntegration — INT-002 (endpoint APPLICATION type)', () => {
154
- it('flags a source that is not an APPLICATION-… id when interface_semantics is true', () => {
155
- expect(codes({ ...validWithInterface(), source: 'INTEGRATION-OTHER-1' })).toContain('INT-002');
156
- expect(codes({ ...validWithInterface(), source: 'ACTOR-SALES-1' })).toContain('INT-002');
157
- });
158
- it('flags a target that is not an APPLICATION-… id when interface_semantics is true', () => {
159
- expect(codes({ ...validWithInterface(), target: 'TECHNOLOGY_SERVICE-KAFKA-1' })).toContain('INT-002');
160
- expect(codes({ ...validWithInterface(), target: 'NODE-HOST-1' })).toContain('INT-002');
161
- });
162
- it('does not fire INT-002 when interface_semantics is absent', () => {
163
- const a = { ...valid(), source: 'ACTOR-OPS-1', target: 'NODE-HOST-1' };
164
- expect(codes(a)).not.toContain('INT-002');
165
- });
166
- it('does not fire INT-002 for valid APPLICATION-… endpoints', () => {
167
- expect(codes(validWithInterface())).not.toContain('INT-002');
168
- });
169
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,107 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateLocation } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'location',
6
- id: 'LOCATION-TBILISI-1',
7
- name: 'Tbilisi Office',
8
- type: 'office',
9
- address: '14 Rustaveli Ave, Tbilisi 0108, Georgia',
10
- country_code: 'GE',
11
- timezone: 'Asia/Tbilisi',
12
- zone: 'canon',
13
- admitted_at: '2026-06-28',
14
- admitted_by: 'v.korobeinikov',
15
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
16
- valid_from: '2024-01-01',
17
- valid_to: null,
18
- };
19
- }
20
- const codes = (input) => validateLocation(input).errors.map(e => e.code);
21
- describe('validateLocation — positive', () => {
22
- it('accepts a well-formed office location', () => {
23
- const r = validateLocation(valid());
24
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
25
- });
26
- it('accepts a country with no optional fields', () => {
27
- const a = valid();
28
- a.id = 'LOCATION-GE-1';
29
- a.name = 'Georgia';
30
- a.type = 'country';
31
- delete a.address;
32
- delete a.country_code;
33
- delete a.timezone;
34
- expect(validateLocation(a).valid).toBe(true);
35
- });
36
- it('accepts a virtual location', () => {
37
- const a = valid();
38
- a.id = 'LOCATION-VIRTUAL-1';
39
- a.name = 'Remote';
40
- a.type = 'virtual';
41
- expect(validateLocation(a).valid).toBe(true);
42
- });
43
- it('accepts a location with a valid parent reference', () => {
44
- expect(validateLocation({ ...valid(), parent: 'LOCATION-GE-1' }).valid).toBe(true);
45
- });
46
- it('accepts valid_to as a date string', () => {
47
- expect(validateLocation({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
48
- });
49
- });
50
- describe('validateLocation — LOC-001 (shape / id grammar)', () => {
51
- it('flags a missing required envelope field (name)', () => {
52
- const a = valid();
53
- delete a.name;
54
- expect(codes(a)).toContain('LOC-001');
55
- });
56
- it('flags an id that violates the grammar', () => {
57
- expect(codes({ ...valid(), id: 'LOCATION-001' })).toContain('LOC-001');
58
- expect(codes({ ...valid(), id: 'LOC-1' })).toContain('LOC-001');
59
- });
60
- it('flags a wrong notation tag', () => {
61
- expect(codes({ ...valid(), notation: 'place' })).toContain('LOC-001');
62
- });
63
- it('flags a non-canon zone', () => {
64
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('LOC-001');
65
- });
66
- it('flags a missing zone', () => {
67
- const a = valid();
68
- delete a.zone;
69
- expect(codes(a)).toContain('LOC-001');
70
- });
71
- it('flags a missing type', () => {
72
- const a = valid();
73
- delete a.type;
74
- expect(codes(a)).toContain('LOC-001');
75
- });
76
- it('flags a missing valid_to key', () => {
77
- const a = valid();
78
- delete a.valid_to;
79
- expect(codes(a)).toContain('LOC-001');
80
- });
81
- it('flags missing gate_checks', () => {
82
- const a = valid();
83
- delete a.gate_checks;
84
- expect(codes(a)).toContain('LOC-001');
85
- });
86
- it('rejects a non-object', () => {
87
- expect(codes(null)).toEqual(['LOC-001']);
88
- });
89
- });
90
- describe('validateLocation — LOC-002 (type enum)', () => {
91
- it('flags a type outside the allowed enum', () => {
92
- expect(codes({ ...valid(), type: 'building' })).toContain('LOC-002');
93
- expect(codes({ ...valid(), type: 'facility' })).toContain('LOC-002');
94
- });
95
- });
96
- describe('validateLocation — LOC-003 (parent grammar)', () => {
97
- it('flags a parent that is not a LOCATION-… id', () => {
98
- expect(codes({ ...valid(), parent: 'ACTOR-OPS-1' })).toContain('LOC-003');
99
- expect(codes({ ...valid(), parent: 'not-an-id' })).toContain('LOC-003');
100
- });
101
- it('accepts a null or absent parent without error', () => {
102
- expect(codes({ ...valid(), parent: undefined })).not.toContain('LOC-003');
103
- const a = valid();
104
- delete a.parent;
105
- expect(codes(a)).not.toContain('LOC-003');
106
- });
107
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,100 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateNode } from '../validate.js';
3
- function valid() {
4
- return {
5
- notation: 'node',
6
- id: 'NODE-KAFKA-HOST-1',
7
- name: 'Kafka Cluster Host',
8
- type: 'cloud_instance',
9
- description: 'AWS EC2 auto-scaling group hosting the Kafka broker cluster.',
10
- provider: 'AWS',
11
- region: 'eu-central-1',
12
- zone: 'canon',
13
- admitted_at: '2026-06-28',
14
- admitted_by: 'v.korobeinikov',
15
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
16
- valid_from: '2024-01-01',
17
- valid_to: null,
18
- };
19
- }
20
- const codes = (input) => validateNode(input).errors.map(e => e.code);
21
- describe('validateNode — positive', () => {
22
- it('accepts a well-formed cloud_instance node with all optional fields', () => {
23
- const r = validateNode(valid());
24
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
25
- });
26
- it('accepts a server node with no optional fields', () => {
27
- const a = valid();
28
- a.id = 'NODE-DB-1';
29
- a.name = 'Primary DB Server';
30
- a.type = 'server';
31
- delete a.description;
32
- delete a.provider;
33
- delete a.region;
34
- expect(validateNode(a).valid).toBe(true);
35
- });
36
- it('accepts all five type values', () => {
37
- for (const t of ['server', 'cloud_instance', 'container_platform', 'database_server', 'network_device']) {
38
- expect(validateNode({ ...valid(), type: t }).valid).toBe(true);
39
- }
40
- });
41
- it('accepts valid_to as a date string', () => {
42
- expect(validateNode({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
43
- });
44
- });
45
- describe('validateNode — NOD-001 (shape / id grammar)', () => {
46
- it('flags a non-object input', () => {
47
- expect(codes(null)).toEqual(['NOD-001']);
48
- expect(codes('string')).toEqual(['NOD-001']);
49
- });
50
- it('flags an id that violates the grammar', () => {
51
- expect(codes({ ...valid(), id: 'NODE-001' })).toContain('NOD-001');
52
- expect(codes({ ...valid(), id: 'NOD-1' })).toContain('NOD-001');
53
- expect(codes({ ...valid(), id: 'node-kafka-1' })).toContain('NOD-001');
54
- });
55
- it('flags a wrong notation tag', () => {
56
- expect(codes({ ...valid(), notation: 'nodes' })).toContain('NOD-001');
57
- expect(codes({ ...valid(), notation: 'infrastructure' })).toContain('NOD-001');
58
- });
59
- it('flags a non-canon zone', () => {
60
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('NOD-001');
61
- });
62
- it('flags a missing zone', () => {
63
- const a = valid();
64
- delete a.zone;
65
- expect(codes(a)).toContain('NOD-001');
66
- });
67
- it('flags a missing name', () => {
68
- const a = valid();
69
- delete a.name;
70
- expect(codes(a)).toContain('NOD-001');
71
- });
72
- it('flags a missing valid_to key', () => {
73
- const a = valid();
74
- delete a.valid_to;
75
- expect(codes(a)).toContain('NOD-001');
76
- });
77
- it('flags missing gate_checks', () => {
78
- const a = valid();
79
- delete a.gate_checks;
80
- expect(codes(a)).toContain('NOD-001');
81
- });
82
- it('flags a missing type', () => {
83
- const a = valid();
84
- delete a.type;
85
- expect(codes(a)).toContain('NOD-001');
86
- });
87
- });
88
- describe('validateNode — NOD-002 (type enum)', () => {
89
- it('flags a type outside the allowed enum', () => {
90
- expect(codes({ ...valid(), type: 'virtual_machine' })).toContain('NOD-002');
91
- expect(codes({ ...valid(), type: 'storage' })).toContain('NOD-002');
92
- expect(codes({ ...valid(), type: 'cluster' })).toContain('NOD-002');
93
- });
94
- it('does not flag a missing type with NOD-002 (NOD-001 fires instead)', () => {
95
- const a = valid();
96
- delete a.type;
97
- expect(codes(a)).not.toContain('NOD-002');
98
- expect(codes(a)).toContain('NOD-001');
99
- });
100
- });
@@ -1,272 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { layoutProcessBlueprint } from '../layout.js';
3
- // ── fixtures ────────────────────────────────────────────────────────────────
4
- const STAGES = [
5
- { id: 'STAGE-1', name: 'Receive', goal: 'g1', result: 'r1' },
6
- { id: 'STAGE-2', name: 'Process', goal: 'g2', result: 'r2' },
7
- { id: 'STAGE-3', name: 'Ship', goal: 'g3', result: 'r3' },
8
- ];
9
- function buildFile(overrides = {}) {
10
- return {
11
- notation: 'process-blueprint',
12
- process_blueprint: { id: 'PROCESS_BLUEPRINT-T-1', name: 'Test', stages: STAGES, ...overrides },
13
- };
14
- }
15
- const REQ_A = { id: 'REQ-1', derived_from: ['LAW-GDPR-1'] };
16
- const REQ_B = { id: 'REQ-2', derived_from: ['LAW-GDPR-1', 'LAW-SOX-2'] };
17
- const REQ_DEADLINE = {
18
- id: 'REQ-3',
19
- derived_from: ['LAW-PCI-3'],
20
- deadline: '2020-01-01', // past_due
21
- };
22
- // ── helpers ─────────────────────────────────────────────────────────────────
23
- function makeAssertion(about, status, realisedVia) {
24
- return { about, status, realised_via: realisedVia };
25
- }
26
- function layout(file, input, overrides = {}) {
27
- return layoutProcessBlueprint(file, {
28
- complianceLane: { enabled: true, ...overrides },
29
- complianceInput: input,
30
- });
31
- }
32
- // ── tests ───────────────────────────────────────────────────────────────────
33
- describe('compliance lane derivation', () => {
34
- it('returns no complianceRow when lane is disabled (default)', () => {
35
- const l = layoutProcessBlueprint(buildFile(), {});
36
- expect(l.complianceRow).toBeUndefined();
37
- });
38
- it('returns no complianceRow when enabled but no input provided', () => {
39
- const l = layoutProcessBlueprint(buildFile(), { complianceLane: { enabled: true } });
40
- expect(l.complianceRow).toBeUndefined();
41
- });
42
- it('returns no complianceRow when assertions have no realised_via matching stage IDs', () => {
43
- const input = {
44
- assertions: [makeAssertion('REQ-1', 'compliant', ['STEP-99'])],
45
- requirements: [REQ_A],
46
- };
47
- const l = layout(buildFile(), input);
48
- expect(l.complianceRow).toBeUndefined();
49
- });
50
- it('derives a chip for each law-stage pair', () => {
51
- const input = {
52
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
53
- requirements: [REQ_A],
54
- };
55
- const l = layout(buildFile(), input);
56
- expect(l.complianceRow).toBeDefined();
57
- const chips = l.complianceRow.chips;
58
- expect(chips).toHaveLength(1);
59
- expect(chips[0].lawId).toBe('LAW-GDPR-1');
60
- expect(chips[0].stageIndex).toBe(0);
61
- });
62
- it('produces one chip per law per stage (same law, two stages → two chips)', () => {
63
- const input = {
64
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1', 'STAGE-2'])],
65
- requirements: [REQ_A],
66
- };
67
- const l = layout(buildFile(), input);
68
- const chips = l.complianceRow.chips;
69
- expect(chips).toHaveLength(2);
70
- expect(chips.map(c => c.stageIndex).sort()).toEqual([0, 1]);
71
- expect(chips.every(c => c.lawId === 'LAW-GDPR-1')).toBe(true);
72
- });
73
- it('merges multiple assertions for the same law-stage into one chip', () => {
74
- const input = {
75
- assertions: [
76
- makeAssertion('REQ-1', 'compliant', ['STAGE-1']),
77
- makeAssertion('REQ-1', 'partial', ['STAGE-1']),
78
- ],
79
- requirements: [REQ_A],
80
- };
81
- const l = layout(buildFile(), input);
82
- expect(l.complianceRow.chips).toHaveLength(1);
83
- });
84
- describe('decoration: new', () => {
85
- it('marks chip as new when law is not in previous snapshot', () => {
86
- const input = {
87
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
88
- requirements: [REQ_A],
89
- };
90
- const l = layout(buildFile(), input, { previousSnapshot: { 'STAGE-1': [] } });
91
- expect(l.complianceRow.chips[0].decorations).toContain('new');
92
- });
93
- it('does not mark chip as new when law is in previous snapshot', () => {
94
- const input = {
95
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
96
- requirements: [REQ_A],
97
- };
98
- const l = layout(buildFile(), input, { previousSnapshot: { 'STAGE-1': ['LAW-GDPR-1'] } });
99
- expect(l.complianceRow.chips[0].decorations).not.toContain('new');
100
- });
101
- });
102
- describe('decoration: gap', () => {
103
- it('marks chip as gap when assertion status is non_compliant', () => {
104
- const input = {
105
- assertions: [makeAssertion('REQ-1', 'non_compliant', ['STAGE-1'])],
106
- requirements: [REQ_A],
107
- };
108
- const l = layout(buildFile(), input);
109
- expect(l.complianceRow.chips[0].decorations).toContain('gap');
110
- });
111
- it('marks chip as gap when assertion status is partial', () => {
112
- const input = {
113
- assertions: [makeAssertion('REQ-1', 'partial', ['STAGE-2'])],
114
- requirements: [REQ_A],
115
- };
116
- const l = layout(buildFile(), input);
117
- expect(l.complianceRow.chips[0].decorations).toContain('gap');
118
- });
119
- it('does not mark chip as gap for compliant assertion', () => {
120
- const input = {
121
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
122
- requirements: [REQ_A],
123
- };
124
- const l = layout(buildFile(), input);
125
- expect(l.complianceRow.chips[0].decorations).not.toContain('gap');
126
- });
127
- it('propagates gap if any assertion for the same law-stage is non-compliant', () => {
128
- const input = {
129
- assertions: [
130
- makeAssertion('REQ-1', 'compliant', ['STAGE-1']),
131
- makeAssertion('REQ-1', 'non_compliant', ['STAGE-1']),
132
- ],
133
- requirements: [REQ_A],
134
- };
135
- const l = layout(buildFile(), input);
136
- expect(l.complianceRow.chips[0].decorations).toContain('gap');
137
- });
138
- });
139
- describe('decoration: deadline', () => {
140
- it('marks chip as deadline when gap exists and requirement deadline is past_due', () => {
141
- const input = {
142
- assertions: [makeAssertion('REQ-3', 'non_compliant', ['STAGE-1'])],
143
- requirements: [REQ_DEADLINE],
144
- };
145
- const l = layout(buildFile(), input);
146
- const d = l.complianceRow.chips[0].decorations;
147
- expect(d).toContain('gap');
148
- expect(d).toContain('deadline');
149
- });
150
- it('does not mark deadline when gap is absent even if deadline is past_due', () => {
151
- const input = {
152
- assertions: [makeAssertion('REQ-3', 'compliant', ['STAGE-1'])],
153
- requirements: [REQ_DEADLINE],
154
- };
155
- const l = layout(buildFile(), input);
156
- expect(l.complianceRow.chips[0].decorations).not.toContain('deadline');
157
- });
158
- it('does not mark deadline when no deadline on requirement', () => {
159
- const input = {
160
- assertions: [makeAssertion('REQ-1', 'non_compliant', ['STAGE-1'])],
161
- requirements: [REQ_A],
162
- };
163
- const l = layout(buildFile(), input);
164
- expect(l.complianceRow.chips[0].decorations).not.toContain('deadline');
165
- });
166
- it('all three decorations can stack on the same chip', () => {
167
- const input = {
168
- assertions: [makeAssertion('REQ-3', 'non_compliant', ['STAGE-1'])],
169
- requirements: [REQ_DEADLINE],
170
- };
171
- const l = layout(buildFile(), input, { previousSnapshot: { 'STAGE-1': [] } });
172
- const d = l.complianceRow.chips[0].decorations;
173
- expect(d).toContain('new');
174
- expect(d).toContain('gap');
175
- expect(d).toContain('deadline');
176
- });
177
- });
178
- describe('jurisdiction filter', () => {
179
- it('passes through all laws when no jurisdictions filter', () => {
180
- const input = {
181
- assertions: [makeAssertion('REQ-2', 'compliant', ['STAGE-1'])],
182
- requirements: [REQ_B], // derived_from: [LAW-GDPR-1, LAW-SOX-2]
183
- codexJurisdictions: { 'LAW-GDPR-1': 'EU', 'LAW-SOX-2': 'US' },
184
- };
185
- const l = layout(buildFile(), input, { jurisdictions: [] });
186
- expect(l.complianceRow.chips).toHaveLength(2);
187
- });
188
- it('filters to only the selected jurisdictions', () => {
189
- const input = {
190
- assertions: [makeAssertion('REQ-2', 'compliant', ['STAGE-1'])],
191
- requirements: [REQ_B],
192
- codexJurisdictions: { 'LAW-GDPR-1': 'EU', 'LAW-SOX-2': 'US' },
193
- };
194
- const l = layout(buildFile(), input, { jurisdictions: ['EU'] });
195
- expect(l.complianceRow.chips).toHaveLength(1);
196
- expect(l.complianceRow.chips[0].lawId).toBe('LAW-GDPR-1');
197
- });
198
- it('returns no row when jurisdiction filter excludes all laws', () => {
199
- const input = {
200
- assertions: [makeAssertion('REQ-2', 'compliant', ['STAGE-1'])],
201
- requirements: [REQ_B],
202
- codexJurisdictions: { 'LAW-GDPR-1': 'EU', 'LAW-SOX-2': 'US' },
203
- };
204
- const l = layout(buildFile(), input, { jurisdictions: ['AU'] });
205
- expect(l.complianceRow).toBeUndefined();
206
- });
207
- });
208
- describe('null-guards', () => {
209
- it('tolerates null assertion entries without throwing', () => {
210
- const input = {
211
- assertions: [null, makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
212
- requirements: [REQ_A],
213
- };
214
- expect(() => layout(buildFile(), input)).not.toThrow();
215
- });
216
- it('skips assertions with no realised_via', () => {
217
- const input = {
218
- assertions: [{ about: 'REQ-1', status: 'compliant' }],
219
- requirements: [REQ_A],
220
- };
221
- const l = layout(buildFile(), input);
222
- expect(l.complianceRow).toBeUndefined();
223
- });
224
- it('skips assertions whose requirement is not in the input', () => {
225
- const input = {
226
- assertions: [makeAssertion('REQ-MISSING', 'non_compliant', ['STAGE-1'])],
227
- requirements: [REQ_A],
228
- };
229
- const l = layout(buildFile(), input);
230
- expect(l.complianceRow).toBeUndefined();
231
- });
232
- });
233
- describe('legend', () => {
234
- it('adds a compliance legend entry when the row is present', () => {
235
- const input = {
236
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
237
- requirements: [REQ_A],
238
- };
239
- const l = layout(buildFile(), input);
240
- const complianceLegend = l.legend.find(entry => entry.kind === 'compliance');
241
- expect(complianceLegend).toBeDefined();
242
- expect(complianceLegend.label).toBe('Compliance');
243
- });
244
- it('does not add compliance legend when row is absent', () => {
245
- const l = layoutProcessBlueprint(buildFile(), {});
246
- expect(l.legend.some(e => e.kind === 'compliance')).toBe(false);
247
- });
248
- });
249
- describe('layout geometry', () => {
250
- it('total height grows by the compliance row height', () => {
251
- const withoutLane = layoutProcessBlueprint(buildFile(), {});
252
- const input = {
253
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-1'])],
254
- requirements: [REQ_A],
255
- };
256
- const withLane = layout(buildFile(), input);
257
- expect(withLane.bounds.height).toBeGreaterThan(withoutLane.bounds.height);
258
- expect(withLane.bounds.height).toBe(withoutLane.bounds.height + withLane.complianceRow.height);
259
- });
260
- it('chip x aligns to the stage column', () => {
261
- const input = {
262
- assertions: [makeAssertion('REQ-1', 'compliant', ['STAGE-2'])],
263
- requirements: [REQ_A],
264
- };
265
- const l = layout(buildFile(), input);
266
- const chip = l.complianceRow.chips[0];
267
- // Chip x must be at the start of stage-2's column (index 1) + cellPadding.
268
- const expectedX = l.legendColumnWidth + 1 * l.stageColumnWidth + 8; // default cellPadding = 8
269
- expect(chip.x).toBe(expectedX);
270
- });
271
- });
272
- });
@@ -1 +0,0 @@
1
- export {};