@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,147 +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 { parseCanonicalGoals } from '../parse-canonical.js';
6
-
7
- const VALID = {
8
- notation: 'goals',
9
- spec_version: '0.1',
10
- id: 'GOALS-SAMPLE-1',
11
- name: 'Sample goals tree',
12
- goal_types: [
13
- { name: 'Strategy', level: 0 },
14
- { name: 'Project', level: 1 },
15
- ],
16
- goals: [
17
- { id: 'GOAL-1', name: 'Root', type: 'Strategy', level: 0 },
18
- { id: 'GOAL-2', name: 'Child', type: 'Project', level: 1, parent: 'GOAL-1' },
19
- ],
20
- };
21
-
22
- describe('parseCanonicalGoals', () => {
23
- it('accepts a valid canonical document', () => {
24
- const r = parseCanonicalGoals(VALID);
25
- expect(r.valid).toBe(true);
26
- expect(r.errors).toEqual([]);
27
- expect(r.parsed?.goals).toHaveLength(2);
28
- });
29
-
30
- it('GOALS-001: rejects non-object input', () => {
31
- expect(parseCanonicalGoals(null).errors[0].code).toBe('GOALS-001');
32
- });
33
-
34
- it('GOALS-001: rejects wrong notation', () => {
35
- const r = parseCanonicalGoals({ ...VALID, notation: 'fga' });
36
- expect(r.errors.some((e) => e.code === 'GOALS-001')).toBe(true);
37
- });
38
-
39
- it('GOALS-002: rejects malformed doc id', () => {
40
- const r = parseCanonicalGoals({ ...VALID, id: 'goals-1' });
41
- expect(r.errors.some((e) => e.code === 'GOALS-002')).toBe(true);
42
- });
43
-
44
- it('GOALS-003: rejects missing name', () => {
45
- const { name: _, ...rest } = VALID;
46
- const r = parseCanonicalGoals(rest);
47
- expect(r.errors.some((e) => e.code === 'GOALS-003')).toBe(true);
48
- });
49
-
50
- it('GOALS-004: rejects empty goal_types', () => {
51
- const r = parseCanonicalGoals({ ...VALID, goal_types: [] });
52
- expect(r.errors.some((e) => e.code === 'GOALS-004')).toBe(true);
53
- });
54
-
55
- it('GOALS-007: rejects malformed goal id', () => {
56
- const r = parseCanonicalGoals({
57
- ...VALID,
58
- goals: [{ id: 'goal-1', name: 'A', type: 'Strategy', level: 0 }],
59
- });
60
- expect(r.errors.some((e) => e.code === 'GOALS-007')).toBe(true);
61
- });
62
-
63
- it('GOALS-007: rejects duplicate goal ids', () => {
64
- const r = parseCanonicalGoals({
65
- ...VALID,
66
- goals: [
67
- { id: 'GOAL-1', name: 'A', type: 'Strategy', level: 0 },
68
- { id: 'GOAL-1', name: 'B', type: 'Strategy', level: 0 },
69
- ],
70
- });
71
- expect(r.errors.some((e) => e.code === 'GOALS-007')).toBe(true);
72
- });
73
-
74
- it('GOALS-008: rejects goal.type not in goal_types', () => {
75
- const r = parseCanonicalGoals({
76
- ...VALID,
77
- goals: [{ id: 'GOAL-1', name: 'A', type: 'Unknown', level: 0 }],
78
- });
79
- expect(r.errors.some((e) => e.code === 'GOALS-008')).toBe(true);
80
- });
81
-
82
- it('GOALS-008: rejects goal.level mismatched with goal_types', () => {
83
- const r = parseCanonicalGoals({
84
- ...VALID,
85
- goals: [{ id: 'GOAL-1', name: 'A', type: 'Strategy', level: 5 }],
86
- });
87
- expect(r.errors.some((e) => e.code === 'GOALS-008')).toBe(true);
88
- });
89
-
90
- it('GOALS-009: warns on broken parent ref', () => {
91
- const r = parseCanonicalGoals({
92
- ...VALID,
93
- goals: [
94
- { id: 'GOAL-1', name: 'Root', type: 'Strategy', level: 0 },
95
- { id: 'GOAL-2', name: 'Orphan', type: 'Project', level: 1, parent: 'GOAL-99' },
96
- ],
97
- });
98
- expect(r.valid).toBe(true);
99
- expect(r.warnings.some((w) => w.code === 'GOALS-009')).toBe(true);
100
- });
101
-
102
- it('GOALS-010: detects parent-chain cycle', () => {
103
- const r = parseCanonicalGoals({
104
- ...VALID,
105
- goals: [
106
- { id: 'GOAL-1', name: 'A', type: 'Strategy', level: 0, parent: 'GOAL-2' },
107
- { id: 'GOAL-2', name: 'B', type: 'Strategy', level: 0, parent: 'GOAL-1' },
108
- ],
109
- });
110
- expect(r.errors.some((e) => e.code === 'GOALS-010')).toBe(true);
111
- });
112
-
113
- it('GOALS-011: warns when non-root goal has no parent', () => {
114
- const r = parseCanonicalGoals({
115
- ...VALID,
116
- goals: [{ id: 'GOAL-1', name: 'A', type: 'Project', level: 1 }],
117
- });
118
- expect(r.valid).toBe(true);
119
- expect(r.warnings.some((w) => w.code === 'GOALS-011')).toBe(true);
120
- });
121
-
122
- it('maps canonical IDs to internal numeric ids; parent_id is the parent\'s mapped id', () => {
123
- const r = parseCanonicalGoals(VALID);
124
- expect(r.parsed?.goals[0].id).toBe(1);
125
- expect(r.parsed?.goals[0].canonical_id).toBe('GOAL-1');
126
- expect(r.parsed?.goals[0].parent_id).toBe(0);
127
- expect(r.parsed?.goals[1].id).toBe(2);
128
- expect(r.parsed?.goals[1].canonical_id).toBe('GOAL-2');
129
- expect(r.parsed?.goals[1].parent_id).toBe(1);
130
- });
131
- });
132
-
133
- describe('parseCanonicalGoals — example file regression', () => {
134
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'goals');
135
- const files = fs.existsSync(EXAMPLES_DIR)
136
- ? fs.readdirSync(EXAMPLES_DIR).filter((f) => f.endsWith('.transitrix.yaml'))
137
- : [];
138
- for (const file of files) {
139
- it(`accepts tests/fixtures/notation-corpus/goals/${file}`, () => {
140
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
141
- const parsedYaml = yaml.load(text);
142
- const r = parseCanonicalGoals(parsedYaml);
143
- expect(r.errors).toEqual([]);
144
- expect(r.valid).toBe(true);
145
- });
146
- }
147
- });
@@ -1,202 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateGoalTree } from '../validate.js';
3
-
4
- const VALID_TREE = {
5
- goal_types: [
6
- { name: 'Strategy', level: 0 },
7
- { name: 'Business Goal', level: 1 },
8
- { name: 'Project', level: 2 },
9
- ],
10
- goals: [
11
- { id: 1, name: 'Triple revenue', type: 'Strategy', level: 0, parent_id: 0 },
12
- { id: 2, name: 'Launch EU', type: 'Business Goal', level: 1, parent_id: 1 },
13
- { id: 3, name: 'Open Berlin office', type: 'Project', level: 2, parent_id: 2 },
14
- ],
15
- };
16
-
17
- describe('validateGoalTree', () => {
18
- it('passes on valid input', () => {
19
- const r = validateGoalTree(VALID_TREE);
20
- expect(r.valid).toBe(true);
21
- expect(r.errors).toHaveLength(0);
22
- });
23
-
24
- it('SCHEMA_INVALID: rejects non-object', () => {
25
- expect(validateGoalTree(null).valid).toBe(false);
26
- expect(validateGoalTree('string').errors[0].code).toBe('SCHEMA_INVALID');
27
- });
28
-
29
- it('SCHEMA_INVALID: rejects missing goals array', () => {
30
- const r = validateGoalTree({ goal_types: [] });
31
- expect(r.errors.some(e => e.code === 'SCHEMA_INVALID')).toBe(true);
32
- });
33
-
34
- it('DUPLICATE_ID: detects duplicate goal ids', () => {
35
- const tree = {
36
- ...VALID_TREE,
37
- goals: [
38
- { id: 1, name: 'A', type: 'Strategy', level: 0, parent_id: 0 },
39
- { id: 1, name: 'B', type: 'Strategy', level: 0, parent_id: 0 },
40
- ],
41
- };
42
- const r = validateGoalTree(tree);
43
- expect(r.errors.some(e => e.code === 'DUPLICATE_ID')).toBe(true);
44
- });
45
-
46
- it('EMPTY_NAME: detects empty name', () => {
47
- const tree = {
48
- ...VALID_TREE,
49
- goals: [{ id: 1, name: '', type: 'Strategy', level: 0, parent_id: 0 }],
50
- };
51
- expect(validateGoalTree(tree).errors.some(e => e.code === 'EMPTY_NAME')).toBe(true);
52
- });
53
-
54
- it('MAX_LEVEL_EXCEEDED: detects level overflow', () => {
55
- const tree = {
56
- goal_types: [{ name: 'Strategy', level: 0 }],
57
- goals: [{ id: 1, name: 'Too deep', type: 'Strategy', level: 5, parent_id: 0 }],
58
- };
59
- expect(validateGoalTree(tree).errors.some(e => e.code === 'MAX_LEVEL_EXCEEDED')).toBe(true);
60
- });
61
-
62
- it('TYPE_LEVEL_MISMATCH: warns when type level disagrees', () => {
63
- const tree = {
64
- ...VALID_TREE,
65
- goals: [{ id: 1, name: 'Mismatch', type: 'Project', level: 0, parent_id: 0 }],
66
- };
67
- const r = validateGoalTree(tree);
68
- expect(r.warnings.some(w => w.code === 'TYPE_LEVEL_MISMATCH')).toBe(true);
69
- });
70
-
71
- it('BROKEN_PARENT_REF: warns on missing parent (renders to backlog)', () => {
72
- const tree = {
73
- ...VALID_TREE,
74
- goals: [
75
- { id: 1, name: 'Root', type: 'Strategy', level: 0, parent_id: 0 },
76
- { id: 2, name: 'Orphan', type: 'Business Goal', level: 1, parent_id: 99 },
77
- ],
78
- };
79
- const r = validateGoalTree(tree);
80
- expect(r.valid).toBe(true);
81
- expect(r.warnings.some(w => w.code === 'BROKEN_PARENT_REF')).toBe(true);
82
- });
83
-
84
- it('CYCLE_DETECTED: detects direct cycle', () => {
85
- const tree = {
86
- goal_types: [{ name: 'S', level: 0 }, { name: 'B', level: 1 }],
87
- goals: [
88
- { id: 1, name: 'A', type: 'S', level: 0, parent_id: 2 },
89
- { id: 2, name: 'B', type: 'B', level: 1, parent_id: 1 },
90
- ],
91
- };
92
- expect(validateGoalTree(tree).errors.some(e => e.code === 'CYCLE_DETECTED')).toBe(true);
93
- });
94
-
95
- // Pre-release blocker regression tests (orchestrator review 2026-05-21).
96
- it('[blocker] tolerates a null element in goals[] without throwing', () => {
97
- const tree = { ...VALID_TREE, goals: [null] };
98
- const r = validateGoalTree(tree);
99
- expect(r.valid).toBe(false);
100
- expect(r.errors.some(e => e.code === 'SCHEMA_INVALID')).toBe(true);
101
- });
102
-
103
- it('[blocker] tolerates a non-object element in goals[] without throwing', () => {
104
- const tree = { ...VALID_TREE, goals: ['x'] };
105
- const r = validateGoalTree(tree);
106
- expect(r.valid).toBe(false);
107
- expect(r.errors.some(e => e.code === 'SCHEMA_INVALID')).toBe(true);
108
- });
109
-
110
- it('[blocker] rejects non-numeric level (does not silently slip a string compare)', () => {
111
- const tree = {
112
- ...VALID_TREE,
113
- goals: [{ id: 1, name: 'A', type: 'Strategy', level: '5', parent_id: 0 }],
114
- };
115
- const r = validateGoalTree(tree);
116
- expect(r.valid).toBe(false);
117
- expect(r.errors.some(e => e.code === 'SCHEMA_INVALID' && /level/.test(e.message))).toBe(true);
118
- });
119
-
120
- it('[blocker] rejects missing level (does not silently slip undefined > N)', () => {
121
- const tree = {
122
- ...VALID_TREE,
123
- goals: [{ id: 1, name: 'A', type: 'Strategy', parent_id: 0 }],
124
- };
125
- const r = validateGoalTree(tree);
126
- expect(r.valid).toBe(false);
127
- expect(r.errors.some(e => e.code === 'SCHEMA_INVALID' && /level/.test(e.message))).toBe(true);
128
- });
129
-
130
- // GOALS-012 / GOALS-013 — N+1 parent/child hierarchy keyed on goal_types[]
131
- // (decision in vkgeorgia/strategy#66; spec in transitrix/methodology
132
- // notations/04-goals.md §6).
133
- it('GOALS-012/013: accepts a contiguous goal_types + N+1 parent/child tree', () => {
134
- const r = validateGoalTree(VALID_TREE);
135
- expect(r.valid).toBe(true);
136
- expect(r.errors.some(e => e.code === 'GOALS-012')).toBe(false);
137
- expect(r.errors.some(e => e.code === 'GOALS-013')).toBe(false);
138
- });
139
-
140
- it('GOALS-013: rejects a gap in goal_types[].level', () => {
141
- const tree = {
142
- goal_types: [
143
- { name: 'Strategy', level: 0 },
144
- { name: 'Strategic Goal', level: 2 },
145
- { name: 'Project Goal', level: 4 },
146
- ],
147
- goals: [
148
- { id: 1, name: 'Root', type: 'Strategy', level: 0, parent_id: 0 },
149
- ],
150
- };
151
- const r = validateGoalTree(tree);
152
- expect(r.valid).toBe(false);
153
- expect(r.errors.some(e => e.code === 'GOALS-013')).toBe(true);
154
- });
155
-
156
- it('GOALS-013: rejects goal_types[].level that does not start at 0', () => {
157
- const tree = {
158
- goal_types: [
159
- { name: 'Mid', level: 1 },
160
- { name: 'Deep', level: 2 },
161
- ],
162
- goals: [
163
- { id: 1, name: 'A', type: 'Mid', level: 1, parent_id: 0 },
164
- ],
165
- };
166
- const r = validateGoalTree(tree);
167
- expect(r.valid).toBe(false);
168
- expect(r.errors.some(e => e.code === 'GOALS-013')).toBe(true);
169
- });
170
-
171
- it('GOALS-012: rejects a parent–child level gap > 1', () => {
172
- const tree = {
173
- goal_types: [
174
- { name: 'Strategy', level: 0 },
175
- { name: 'Business Goal', level: 1 },
176
- { name: 'Project', level: 2 },
177
- ],
178
- goals: [
179
- { id: 1, name: 'Root', type: 'Strategy', level: 0, parent_id: 0 },
180
- // Skips level 1: a Project (level 2) attached directly to a Strategy
181
- // (level 0) violates N+1.
182
- { id: 2, name: 'Sub', type: 'Project', level: 2, parent_id: 1 },
183
- ],
184
- };
185
- const r = validateGoalTree(tree);
186
- expect(r.valid).toBe(false);
187
- expect(r.errors.some(e => e.code === 'GOALS-012')).toBe(true);
188
- });
189
-
190
- it('GOALS-012: does not fire when the parent reference is broken (BROKEN_PARENT_REF covers it)', () => {
191
- const tree = {
192
- ...VALID_TREE,
193
- goals: [
194
- { id: 1, name: 'Root', type: 'Strategy', level: 0, parent_id: 0 },
195
- { id: 2, name: 'Orphan', type: 'Project', level: 2, parent_id: 99 },
196
- ],
197
- };
198
- const r = validateGoalTree(tree);
199
- expect(r.errors.some(e => e.code === 'GOALS-012')).toBe(false);
200
- expect(r.warnings.some(w => w.code === 'BROKEN_PARENT_REF')).toBe(true);
201
- });
202
- });
@@ -1,203 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateIntegration } from '../validate.js';
3
-
4
- function valid(): Record<string, unknown> {
5
- return {
6
- notation: 'integration',
7
- id: 'INTEGRATION-OMS-CRM-1',
8
- source: 'APPLICATION-OMS-1',
9
- target: 'APPLICATION-CRM-1',
10
- direction: 'outbound',
11
- protocol: 'REST',
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
-
21
- function validWithInterface(): Record<string, unknown> {
22
- return {
23
- ...valid(),
24
- id: 'INTEGRATION-OMS-EVENTS-1',
25
- interface_semantics: true,
26
- payload_class: 'domain_event',
27
- sensitivity: 'internal',
28
- directionality: 'producer',
29
- };
30
- }
31
-
32
- const codes = (input: unknown): string[] =>
33
- validateIntegration(input).errors.map(e => e.code);
34
-
35
- describe('validateIntegration — positive', () => {
36
- it('accepts a well-formed integration without interface_semantics', () => {
37
- const r = validateIntegration(valid());
38
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
39
- });
40
-
41
- it('accepts integration with no optional fields except required ones', () => {
42
- const a = valid();
43
- delete a.direction;
44
- delete a.protocol;
45
- expect(validateIntegration(a).valid).toBe(true);
46
- });
47
-
48
- it('accepts a valid integration with interface_semantics: true and all required fields', () => {
49
- const r = validateIntegration(validWithInterface());
50
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
51
- });
52
-
53
- it('accepts valid_to as a date string', () => {
54
- expect(validateIntegration({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
55
- });
56
-
57
- it('accepts interface_semantics: false without requiring conditional fields', () => {
58
- expect(validateIntegration({ ...valid(), interface_semantics: false }).valid).toBe(true);
59
- });
60
-
61
- it('accepts all four directionality values', () => {
62
- for (const d of ['producer', 'consumer', 'request_reply', 'bidirectional_stream']) {
63
- expect(validateIntegration({ ...validWithInterface(), directionality: d }).valid).toBe(true);
64
- }
65
- });
66
-
67
- it('accepts all four sensitivity values', () => {
68
- for (const s of ['public', 'internal', 'confidential', 'restricted']) {
69
- expect(validateIntegration({ ...validWithInterface(), sensitivity: s }).valid).toBe(true);
70
- }
71
- });
72
- });
73
-
74
- describe('validateIntegration — INT-001 (shape / id grammar)', () => {
75
- it('flags a non-object input', () => {
76
- expect(codes(null)).toEqual(['INT-001']);
77
- expect(codes('string')).toEqual(['INT-001']);
78
- });
79
-
80
- it('flags an id that violates the grammar', () => {
81
- expect(codes({ ...valid(), id: 'INTEGRATION-001' })).toContain('INT-001');
82
- expect(codes({ ...valid(), id: 'INT-1' })).toContain('INT-001');
83
- expect(codes({ ...valid(), id: 'integration-oms-1' })).toContain('INT-001');
84
- });
85
-
86
- it('flags a wrong notation tag', () => {
87
- expect(codes({ ...valid(), notation: 'integrations' })).toContain('INT-001');
88
- expect(codes({ ...valid(), notation: 'application' })).toContain('INT-001');
89
- });
90
-
91
- it('flags a non-canon zone', () => {
92
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('INT-001');
93
- });
94
-
95
- it('flags a missing zone', () => {
96
- const a = valid();
97
- delete a.zone;
98
- expect(codes(a)).toContain('INT-001');
99
- });
100
-
101
- it('flags a missing source', () => {
102
- const a = valid();
103
- delete a.source;
104
- expect(codes(a)).toContain('INT-001');
105
- });
106
-
107
- it('flags a missing target', () => {
108
- const a = valid();
109
- delete a.target;
110
- expect(codes(a)).toContain('INT-001');
111
- });
112
-
113
- it('flags a missing admitted_at', () => {
114
- const a = valid();
115
- delete a.admitted_at;
116
- expect(codes(a)).toContain('INT-001');
117
- });
118
-
119
- it('flags a missing valid_to key', () => {
120
- const a = valid();
121
- delete a.valid_to;
122
- expect(codes(a)).toContain('INT-001');
123
- });
124
-
125
- it('flags missing gate_checks', () => {
126
- const a = valid();
127
- delete a.gate_checks;
128
- expect(codes(a)).toContain('INT-001');
129
- });
130
-
131
- it('flags an invalid direction value', () => {
132
- expect(codes({ ...valid(), direction: 'both' })).toContain('INT-001');
133
- });
134
- });
135
-
136
- describe('validateIntegration — INT-001 (interface_semantics conditional fields)', () => {
137
- it('flags missing protocol when interface_semantics is true', () => {
138
- const a = validWithInterface();
139
- delete a.protocol;
140
- expect(codes(a)).toContain('INT-001');
141
- });
142
-
143
- it('flags missing payload_class when interface_semantics is true', () => {
144
- const a = validWithInterface();
145
- delete a.payload_class;
146
- expect(codes(a)).toContain('INT-001');
147
- });
148
-
149
- it('flags missing sensitivity when interface_semantics is true', () => {
150
- const a = validWithInterface();
151
- delete a.sensitivity;
152
- expect(codes(a)).toContain('INT-001');
153
- });
154
-
155
- it('flags missing directionality when interface_semantics is true', () => {
156
- const a = validWithInterface();
157
- delete a.directionality;
158
- expect(codes(a)).toContain('INT-001');
159
- });
160
-
161
- it('flags all four missing at once', () => {
162
- const a = valid();
163
- a.interface_semantics = true;
164
- delete a.protocol;
165
- const errs = validateIntegration(a).errors.filter(e => e.code === 'INT-001');
166
- expect(errs.length).toBeGreaterThanOrEqual(4);
167
- });
168
-
169
- it('flags an invalid sensitivity value when interface_semantics is true', () => {
170
- expect(codes({ ...validWithInterface(), sensitivity: 'secret' })).toContain('INT-001');
171
- });
172
-
173
- it('flags an invalid directionality value when interface_semantics is true', () => {
174
- expect(codes({ ...validWithInterface(), directionality: 'both_ways' })).toContain('INT-001');
175
- });
176
-
177
- it('does not fire INT-001 conditional checks when interface_semantics is absent', () => {
178
- const a = valid();
179
- const errs = validateIntegration(a).errors.filter(e => e.code === 'INT-001' && e.path && ['protocol', 'payload_class', 'sensitivity', 'directionality'].includes(e.path));
180
- expect(errs).toHaveLength(0);
181
- });
182
- });
183
-
184
- describe('validateIntegration — INT-002 (endpoint APPLICATION type)', () => {
185
- it('flags a source that is not an APPLICATION-… id when interface_semantics is true', () => {
186
- expect(codes({ ...validWithInterface(), source: 'INTEGRATION-OTHER-1' })).toContain('INT-002');
187
- expect(codes({ ...validWithInterface(), source: 'ACTOR-SALES-1' })).toContain('INT-002');
188
- });
189
-
190
- it('flags a target that is not an APPLICATION-… id when interface_semantics is true', () => {
191
- expect(codes({ ...validWithInterface(), target: 'TECHNOLOGY_SERVICE-KAFKA-1' })).toContain('INT-002');
192
- expect(codes({ ...validWithInterface(), target: 'NODE-HOST-1' })).toContain('INT-002');
193
- });
194
-
195
- it('does not fire INT-002 when interface_semantics is absent', () => {
196
- const a = { ...valid(), source: 'ACTOR-OPS-1', target: 'NODE-HOST-1' };
197
- expect(codes(a)).not.toContain('INT-002');
198
- });
199
-
200
- it('does not fire INT-002 for valid APPLICATION-… endpoints', () => {
201
- expect(codes(validWithInterface())).not.toContain('INT-002');
202
- });
203
- });
@@ -1,127 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { validateLocation } from '../validate.js';
3
-
4
- function valid(): Record<string, unknown> {
5
- return {
6
- notation: 'location',
7
- id: 'LOCATION-TBILISI-1',
8
- name: 'Tbilisi Office',
9
- type: 'office',
10
- address: '14 Rustaveli Ave, Tbilisi 0108, Georgia',
11
- country_code: 'GE',
12
- timezone: 'Asia/Tbilisi',
13
- zone: 'canon',
14
- admitted_at: '2026-06-28',
15
- admitted_by: 'v.korobeinikov',
16
- gate_checks: { uniqueness: 'pass', consistency: 'pass', completeness: 'pass' },
17
- valid_from: '2024-01-01',
18
- valid_to: null,
19
- };
20
- }
21
-
22
- const codes = (input: unknown): string[] =>
23
- validateLocation(input).errors.map(e => e.code);
24
-
25
- describe('validateLocation — positive', () => {
26
- it('accepts a well-formed office location', () => {
27
- const r = validateLocation(valid());
28
- expect(r.valid, JSON.stringify(r.errors)).toBe(true);
29
- });
30
-
31
- it('accepts a country with no optional fields', () => {
32
- const a = valid();
33
- a.id = 'LOCATION-GE-1';
34
- a.name = 'Georgia';
35
- a.type = 'country';
36
- delete a.address;
37
- delete a.country_code;
38
- delete a.timezone;
39
- expect(validateLocation(a).valid).toBe(true);
40
- });
41
-
42
- it('accepts a virtual location', () => {
43
- const a = valid();
44
- a.id = 'LOCATION-VIRTUAL-1';
45
- a.name = 'Remote';
46
- a.type = 'virtual';
47
- expect(validateLocation(a).valid).toBe(true);
48
- });
49
-
50
- it('accepts a location with a valid parent reference', () => {
51
- expect(validateLocation({ ...valid(), parent: 'LOCATION-GE-1' }).valid).toBe(true);
52
- });
53
-
54
- it('accepts valid_to as a date string', () => {
55
- expect(validateLocation({ ...valid(), valid_to: '2026-12-31' }).valid).toBe(true);
56
- });
57
- });
58
-
59
- describe('validateLocation — LOC-001 (shape / id grammar)', () => {
60
- it('flags a missing required envelope field (name)', () => {
61
- const a = valid();
62
- delete a.name;
63
- expect(codes(a)).toContain('LOC-001');
64
- });
65
-
66
- it('flags an id that violates the grammar', () => {
67
- expect(codes({ ...valid(), id: 'LOCATION-001' })).toContain('LOC-001');
68
- expect(codes({ ...valid(), id: 'LOC-1' })).toContain('LOC-001');
69
- });
70
-
71
- it('flags a wrong notation tag', () => {
72
- expect(codes({ ...valid(), notation: 'place' })).toContain('LOC-001');
73
- });
74
-
75
- it('flags a non-canon zone', () => {
76
- expect(codes({ ...valid(), zone: 'sandbox' })).toContain('LOC-001');
77
- });
78
-
79
- it('flags a missing zone', () => {
80
- const a = valid();
81
- delete a.zone;
82
- expect(codes(a)).toContain('LOC-001');
83
- });
84
-
85
- it('flags a missing type', () => {
86
- const a = valid();
87
- delete a.type;
88
- expect(codes(a)).toContain('LOC-001');
89
- });
90
-
91
- it('flags a missing valid_to key', () => {
92
- const a = valid();
93
- delete a.valid_to;
94
- expect(codes(a)).toContain('LOC-001');
95
- });
96
-
97
- it('flags missing gate_checks', () => {
98
- const a = valid();
99
- delete a.gate_checks;
100
- expect(codes(a)).toContain('LOC-001');
101
- });
102
-
103
- it('rejects a non-object', () => {
104
- expect(codes(null)).toEqual(['LOC-001']);
105
- });
106
- });
107
-
108
- describe('validateLocation — LOC-002 (type enum)', () => {
109
- it('flags a type outside the allowed enum', () => {
110
- expect(codes({ ...valid(), type: 'building' })).toContain('LOC-002');
111
- expect(codes({ ...valid(), type: 'facility' })).toContain('LOC-002');
112
- });
113
- });
114
-
115
- describe('validateLocation — LOC-003 (parent grammar)', () => {
116
- it('flags a parent that is not a LOCATION-… id', () => {
117
- expect(codes({ ...valid(), parent: 'ACTOR-OPS-1' })).toContain('LOC-003');
118
- expect(codes({ ...valid(), parent: 'not-an-id' })).toContain('LOC-003');
119
- });
120
-
121
- it('accepts a null or absent parent without error', () => {
122
- expect(codes({ ...valid(), parent: undefined })).not.toContain('LOC-003');
123
- const a = valid();
124
- delete a.parent;
125
- expect(codes(a)).not.toContain('LOC-003');
126
- });
127
- });