@mergesignal/shared 0.12.3 → 0.13.0

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 (172) hide show
  1. package/dist/assessment/authoredCommunication.d.ts +30 -0
  2. package/dist/assessment/authoredCommunication.d.ts.map +1 -0
  3. package/dist/assessment/authoredCommunication.js +18 -0
  4. package/dist/assessment/index.d.ts +6 -0
  5. package/dist/assessment/index.d.ts.map +1 -0
  6. package/dist/assessment/index.js +5 -0
  7. package/dist/assessment/literals.d.ts +44 -0
  8. package/dist/assessment/literals.d.ts.map +1 -0
  9. package/dist/assessment/literals.js +140 -0
  10. package/dist/assessment/schema.d.ts +311 -0
  11. package/dist/assessment/schema.d.ts.map +1 -0
  12. package/dist/assessment/schema.js +162 -0
  13. package/dist/assessment/types.d.ts +197 -0
  14. package/dist/assessment/types.d.ts.map +1 -0
  15. package/dist/assessment/types.js +1 -0
  16. package/dist/assessment/version.d.ts +11 -0
  17. package/dist/assessment/version.d.ts.map +1 -0
  18. package/dist/assessment/version.js +9 -0
  19. package/dist/assessmentLabels.d.ts +1 -1
  20. package/dist/assessmentLabels.d.ts.map +1 -1
  21. package/dist/assessmentPresentationUtils.d.ts +1 -1
  22. package/dist/assessmentPresentationUtils.d.ts.map +1 -1
  23. package/dist/assessmentProjection.d.ts +1 -1
  24. package/dist/assessmentProjection.d.ts.map +1 -1
  25. package/dist/deriveScanNarrative.d.ts.map +1 -1
  26. package/dist/deriveScanNarrative.js +2 -1
  27. package/dist/fixtures/assessmentFixtures.d.ts +1 -1
  28. package/dist/fixtures/assessmentScopeFixtures.d.ts +1 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -0
  32. package/dist/lockfileEvidence.d.ts +22 -0
  33. package/dist/lockfileEvidence.d.ts.map +1 -0
  34. package/dist/lockfileEvidence.js +32 -0
  35. package/dist/presentation/dto/assessmentPresentationFields.d.ts +1 -1
  36. package/dist/presentation/dto/assessmentPresentationFields.d.ts.map +1 -1
  37. package/dist/presentation/orchestration/buildScanPresentationBundle.d.ts.map +1 -1
  38. package/dist/presentation/orchestration/buildScanPresentationBundle.js +2 -1
  39. package/dist/presentation/orchestration/scanPresentationBundle.d.ts +2 -1
  40. package/dist/presentation/orchestration/scanPresentationBundle.d.ts.map +1 -1
  41. package/dist/presentation/profile/buildProfileFromAssessment.d.ts +1 -1
  42. package/dist/presentation/profile/buildProfileFromAssessment.d.ts.map +1 -1
  43. package/dist/presentation/profile/buildProfileFromAssessment.js +13 -5
  44. package/dist/repoIntelligenceSchema.d.ts +5 -5
  45. package/dist/scanResultSchema.d.ts +6 -6
  46. package/dist/scanResultSchema.js +1 -1
  47. package/dist/types.d.ts +6 -2
  48. package/dist/types.d.ts.map +1 -1
  49. package/package.json +2 -3
  50. package/dist/actionsStepSummary.test.d.ts +0 -2
  51. package/dist/actionsStepSummary.test.d.ts.map +0 -1
  52. package/dist/actionsStepSummary.test.js +0 -53
  53. package/dist/assessmentProjection.verificationChannel.test.d.ts +0 -2
  54. package/dist/assessmentProjection.verificationChannel.test.d.ts.map +0 -1
  55. package/dist/assessmentProjection.verificationChannel.test.js +0 -110
  56. package/dist/deriveScanNarrative.test.d.ts +0 -2
  57. package/dist/deriveScanNarrative.test.d.ts.map +0 -1
  58. package/dist/deriveScanNarrative.test.js +0 -274
  59. package/dist/engineWireRegression.test.d.ts +0 -2
  60. package/dist/engineWireRegression.test.d.ts.map +0 -1
  61. package/dist/engineWireRegression.test.js +0 -77
  62. package/dist/fixtures/engineAbi4Fixtures.d.ts +0 -16
  63. package/dist/fixtures/engineAbi4Fixtures.d.ts.map +0 -1
  64. package/dist/fixtures/engineAbi4Fixtures.js +0 -26
  65. package/dist/fixtures/legacyEngineRepoIntelligence.d.ts +0 -28
  66. package/dist/fixtures/legacyEngineRepoIntelligence.d.ts.map +0 -1
  67. package/dist/fixtures/legacyEngineRepoIntelligence.js +0 -28
  68. package/dist/fixtures/repoIntelligenceFixtures.d.ts +0 -8
  69. package/dist/fixtures/repoIntelligenceFixtures.d.ts.map +0 -1
  70. package/dist/fixtures/repoIntelligenceFixtures.js +0 -123
  71. package/dist/fixtures/repoIntelligenceTestHelpers.d.ts +0 -5
  72. package/dist/fixtures/repoIntelligenceTestHelpers.d.ts.map +0 -1
  73. package/dist/fixtures/repoIntelligenceTestHelpers.js +0 -28
  74. package/dist/formatInsight.test.d.ts +0 -2
  75. package/dist/formatInsight.test.d.ts.map +0 -1
  76. package/dist/formatInsight.test.js +0 -102
  77. package/dist/narrativeParity.test.d.ts +0 -2
  78. package/dist/narrativeParity.test.d.ts.map +0 -1
  79. package/dist/narrativeParity.test.js +0 -35
  80. package/dist/narrativePresentation.test.d.ts +0 -2
  81. package/dist/narrativePresentation.test.d.ts.map +0 -1
  82. package/dist/narrativePresentation.test.js +0 -54
  83. package/dist/normalizeGeneratedText.test.d.ts +0 -2
  84. package/dist/normalizeGeneratedText.test.d.ts.map +0 -1
  85. package/dist/normalizeGeneratedText.test.js +0 -18
  86. package/dist/prRiskBand.test.d.ts +0 -2
  87. package/dist/prRiskBand.test.d.ts.map +0 -1
  88. package/dist/prRiskBand.test.js +0 -68
  89. package/dist/prRiskWire.test.d.ts +0 -2
  90. package/dist/prRiskWire.test.d.ts.map +0 -1
  91. package/dist/prRiskWire.test.js +0 -106
  92. package/dist/prRiskWiringRegression.test.d.ts +0 -2
  93. package/dist/prRiskWiringRegression.test.d.ts.map +0 -1
  94. package/dist/prRiskWiringRegression.test.js +0 -102
  95. package/dist/presentation/abi3Expression.test.d.ts +0 -13
  96. package/dist/presentation/abi3Expression.test.d.ts.map +0 -1
  97. package/dist/presentation/abi3Expression.test.js +0 -392
  98. package/dist/presentation/buildGitHubCheckRunOutput.test.d.ts +0 -2
  99. package/dist/presentation/buildGitHubCheckRunOutput.test.d.ts.map +0 -1
  100. package/dist/presentation/buildGitHubCheckRunOutput.test.js +0 -163
  101. package/dist/presentation/bundleAccessorParity.test.d.ts +0 -9
  102. package/dist/presentation/bundleAccessorParity.test.d.ts.map +0 -1
  103. package/dist/presentation/bundleAccessorParity.test.js +0 -126
  104. package/dist/presentation/cliParity.test.d.ts +0 -2
  105. package/dist/presentation/cliParity.test.d.ts.map +0 -1
  106. package/dist/presentation/cliParity.test.js +0 -49
  107. package/dist/presentation/compose/narrativeChannels.test.d.ts +0 -2
  108. package/dist/presentation/compose/narrativeChannels.test.d.ts.map +0 -1
  109. package/dist/presentation/compose/narrativeChannels.test.js +0 -42
  110. package/dist/presentation/decisionSurface.test.d.ts +0 -2
  111. package/dist/presentation/decisionSurface.test.d.ts.map +0 -1
  112. package/dist/presentation/decisionSurface.test.js +0 -290
  113. package/dist/presentation/fixtures/dashboardCardGolden.test.d.ts +0 -2
  114. package/dist/presentation/fixtures/dashboardCardGolden.test.d.ts.map +0 -1
  115. package/dist/presentation/fixtures/dashboardCardGolden.test.js +0 -38
  116. package/dist/presentation/fixtures/presentationPersonaFixtures.d.ts +0 -11
  117. package/dist/presentation/fixtures/presentationPersonaFixtures.d.ts.map +0 -1
  118. package/dist/presentation/fixtures/presentationPersonaFixtures.js +0 -208
  119. package/dist/presentation/fixtures/scanResultFixtures.d.ts +0 -5
  120. package/dist/presentation/fixtures/scanResultFixtures.d.ts.map +0 -1
  121. package/dist/presentation/fixtures/scanResultFixtures.js +0 -123
  122. package/dist/presentation/intent/postureVocabularyGuard.test.d.ts +0 -2
  123. package/dist/presentation/intent/postureVocabularyGuard.test.d.ts.map +0 -1
  124. package/dist/presentation/intent/postureVocabularyGuard.test.js +0 -23
  125. package/dist/presentation/orchestration/buildScanPresentationBundle.test.d.ts +0 -2
  126. package/dist/presentation/orchestration/buildScanPresentationBundle.test.d.ts.map +0 -1
  127. package/dist/presentation/orchestration/buildScanPresentationBundle.test.js +0 -99
  128. package/dist/presentation/presentation.test.d.ts +0 -2
  129. package/dist/presentation/presentation.test.d.ts.map +0 -1
  130. package/dist/presentation/presentation.test.js +0 -126
  131. package/dist/presentation/presentationPersonas.test.d.ts +0 -2
  132. package/dist/presentation/presentationPersonas.test.d.ts.map +0 -1
  133. package/dist/presentation/presentationPersonas.test.js +0 -164
  134. package/dist/presentation/surfaceParity.test.d.ts +0 -2
  135. package/dist/presentation/surfaceParity.test.d.ts.map +0 -1
  136. package/dist/presentation/surfaceParity.test.js +0 -156
  137. package/dist/presentation/verificationChannelParity.test.d.ts +0 -2
  138. package/dist/presentation/verificationChannelParity.test.d.ts.map +0 -1
  139. package/dist/presentation/verificationChannelParity.test.js +0 -57
  140. package/dist/productMessaging.test.d.ts +0 -2
  141. package/dist/productMessaging.test.d.ts.map +0 -1
  142. package/dist/productMessaging.test.js +0 -97
  143. package/dist/repoIntelligenceSchema.contract.test.d.ts +0 -2
  144. package/dist/repoIntelligenceSchema.contract.test.d.ts.map +0 -1
  145. package/dist/repoIntelligenceSchema.contract.test.js +0 -51
  146. package/dist/repoIntelligenceSemantics.test.d.ts +0 -2
  147. package/dist/repoIntelligenceSemantics.test.d.ts.map +0 -1
  148. package/dist/repoIntelligenceSemantics.test.js +0 -63
  149. package/dist/repoIntelligenceValidation.persist.test.d.ts +0 -2
  150. package/dist/repoIntelligenceValidation.persist.test.d.ts.map +0 -1
  151. package/dist/repoIntelligenceValidation.persist.test.js +0 -44
  152. package/dist/riskSignals.test.d.ts +0 -2
  153. package/dist/riskSignals.test.d.ts.map +0 -1
  154. package/dist/riskSignals.test.js +0 -32
  155. package/dist/riskVocabulary.test.d.ts +0 -2
  156. package/dist/riskVocabulary.test.d.ts.map +0 -1
  157. package/dist/riskVocabulary.test.js +0 -14
  158. package/dist/scanPresentationBundle.golden.test.d.ts +0 -2
  159. package/dist/scanPresentationBundle.golden.test.d.ts.map +0 -1
  160. package/dist/scanPresentationBundle.golden.test.js +0 -78
  161. package/dist/scanResultSchema.test.d.ts +0 -2
  162. package/dist/scanResultSchema.test.d.ts.map +0 -1
  163. package/dist/scanResultSchema.test.js +0 -162
  164. package/dist/scanSurfaceCopy.test.d.ts +0 -2
  165. package/dist/scanSurfaceCopy.test.d.ts.map +0 -1
  166. package/dist/scanSurfaceCopy.test.js +0 -14
  167. package/dist/selectTopAffectedAreas.test.d.ts +0 -2
  168. package/dist/selectTopAffectedAreas.test.d.ts.map +0 -1
  169. package/dist/selectTopAffectedAreas.test.js +0 -179
  170. package/dist/trustedScanGuards.test.d.ts +0 -2
  171. package/dist/trustedScanGuards.test.d.ts.map +0 -1
  172. package/dist/trustedScanGuards.test.js +0 -151
@@ -1,274 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { deriveScanNarrative } from "./deriveScanNarrative.js";
3
- import { legacyEngineRepoIntelligenceJwt } from "./fixtures/legacyEngineRepoIntelligence.js";
4
- import { fixtureRepoIntelligenceFastify, fixtureRepoIntelligenceMultiPackage, fixtureRepoIntelligenceTypescript, } from "./fixtures/repoIntelligenceFixtures.js";
5
- import { analysisPreparationWithInvalidRepoIntel, analysisPreparationWithValidRepoIntel, } from "./fixtures/repoIntelligenceTestHelpers.js";
6
- import { assessmentFastifyRuntime } from "./fixtures/assessmentFixtures.js";
7
- const baseResult = {
8
- totalScore: 10,
9
- layerScores: {
10
- security: 1,
11
- maintainability: 2,
12
- ecosystem: 3,
13
- upgradeImpact: 4,
14
- },
15
- findings: [],
16
- generatedAt: "2026-01-01T00:00:00.000Z",
17
- };
18
- describe("deriveScanNarrative", () => {
19
- it("returns denormalized empty facts for null result", () => {
20
- const facts = deriveScanNarrative(null);
21
- expect(facts.availability.mode).toBe("denormalized");
22
- expect(facts.changedPackages.all).toEqual([]);
23
- });
24
- it("ignores repoIntelligence when validation status is not valid", () => {
25
- const result = {
26
- ...baseResult,
27
- changedPackages: ["fastify"],
28
- analysisPreparation: {
29
- codeIntelligenceAvailable: true,
30
- warnings: [],
31
- },
32
- repoIntelligence: fixtureRepoIntelligenceFastify,
33
- };
34
- const facts = deriveScanNarrative(result);
35
- expect(facts.availability.repoIntelligenceParse).toBe("absent");
36
- expect(facts.availability.tiersPresent.tier1).toBe(false);
37
- });
38
- it("treats worker-invalid repoIntelligence as untrusted (raw retained, not consumed)", () => {
39
- const result = {
40
- ...baseResult,
41
- changedPackages: ["jsonwebtoken"],
42
- analysisPreparation: analysisPreparationWithInvalidRepoIntel(),
43
- repoIntelligence: legacyEngineRepoIntelligenceJwt,
44
- };
45
- const facts = deriveScanNarrative(result);
46
- expect(facts.availability.repoIntelligenceParse).toBe("untrusted");
47
- expect(facts.availability.tiersPresent.tier1).toBe(false);
48
- expect(facts.packageUsage).toHaveLength(0);
49
- });
50
- it("populates tier1 from repoIntelligence when corpus available", () => {
51
- const result = {
52
- ...baseResult,
53
- changedPackages: ["fastify"],
54
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
55
- repoIntelligence: fixtureRepoIntelligenceFastify,
56
- };
57
- const facts = deriveScanNarrative(result);
58
- expect(facts.availability.mode).toBe("pr_intelligence");
59
- expect(facts.availability.repoIntelligenceParse).toBe("ok");
60
- expect(facts.availability.codeIntelligenceAvailable).toBe(true);
61
- expect(facts.changedPackages.primary).toBe("fastify");
62
- expect(facts.runtimeSurface?.kind).toBe("runtime");
63
- expect(facts.reachability?.kind).toBe("on_runtime_paths");
64
- expect(facts.blastRadius?.level).toBe("moderate");
65
- expect(facts.affectedAreas.map((a) => a.id)).toContain("api");
66
- expect(facts.hotspots[0]?.source).toBe("code");
67
- });
68
- it("changedPackages.primary follows reviewFocalPoint anchor, not changedPackages order", () => {
69
- const result = {
70
- ...baseResult,
71
- changedPackages: ["typescript", "fastify"],
72
- assessment: assessmentFastifyRuntime,
73
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
74
- repoIntelligence: fixtureRepoIntelligenceFastify,
75
- };
76
- const facts = deriveScanNarrative(result);
77
- expect(facts.changedPackages.primary).toBe("fastify");
78
- expect(result.changedPackages?.[0]).toBe("typescript");
79
- });
80
- it("prefers changed-scope insights for reviewer guidance ordering", () => {
81
- const result = {
82
- ...baseResult,
83
- changedPackages: ["lodash"],
84
- insights: [
85
- {
86
- type: "dependency_risk",
87
- priority: "medium",
88
- confidence: "likely",
89
- scope: "all",
90
- message: "Repository-wide duplicate paths",
91
- context: "c",
92
- remediation: "r",
93
- },
94
- {
95
- type: "usage_risk",
96
- priority: "high",
97
- confidence: "confirmed",
98
- scope: "changed",
99
- message: "lodash used in billing export",
100
- context: "c2",
101
- remediation: "r2",
102
- },
103
- ],
104
- };
105
- const facts = deriveScanNarrative(result);
106
- expect(facts.reviewerGuidance[0]?.scope).toBe("changed");
107
- expect(facts.reviewerGuidance[0]?.message).toContain("billing");
108
- });
109
- it("uses graph_fallback with structured repository context", () => {
110
- const result = {
111
- ...baseResult,
112
- explain: {
113
- reasons: [
114
- {
115
- id: "1",
116
- layer: "ecosystem",
117
- title: "graph.transitive volume",
118
- scoreImpact: 18,
119
- },
120
- ],
121
- },
122
- };
123
- const facts = deriveScanNarrative(result);
124
- expect(facts.availability.mode).toBe("graph_fallback");
125
- expect(facts.repositoryContext.length).toBeGreaterThan(0);
126
- expect(facts.repositoryContext[0]?.family).toBe("transitive_volume");
127
- });
128
- it("populates tooling semantics without runtime surface chips for typescript", () => {
129
- const result = {
130
- ...baseResult,
131
- changedPackages: ["typescript"],
132
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
133
- repoIntelligence: fixtureRepoIntelligenceTypescript,
134
- };
135
- const facts = deriveScanNarrative(result);
136
- expect(facts.availability.mode).toBe("pr_intelligence");
137
- expect(facts.runtimeSurface).toBeNull();
138
- expect(facts.reachability).toBeNull();
139
- expect(facts.packageSemantics?.runtimeImpact).toBe("none");
140
- expect(facts.packageSemantics?.expectedImpact).toBe("typecheck");
141
- expect(facts.packageSemantics?.suppressRuntimeNarrative).toBe(true);
142
- expect(facts.packageSemantics?.dependencyClass).toBe("tooling");
143
- expect(facts.packageSemantics?.packageRole).toBe("typechecker");
144
- expect(facts.changedPackageSemantics).toHaveLength(1);
145
- expect(facts.changedPackageSemantics[0]?.packageName).toBe("typescript");
146
- expect(facts.blastRadius?.level).toBe("narrow");
147
- });
148
- it("extracts packageUsage for all changed packages with blast factors and frameworks", () => {
149
- const result = {
150
- ...baseResult,
151
- changedPackages: ["lodash", "axios"],
152
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
153
- repoIntelligence: fixtureRepoIntelligenceMultiPackage,
154
- };
155
- const facts = deriveScanNarrative(result);
156
- expect(facts.packageUsage).toHaveLength(2);
157
- expect(facts.packageUsage.map((u) => u.packageName)).toEqual([
158
- "lodash",
159
- "axios",
160
- ]);
161
- expect(facts.packageUsage[0]?.paths).toContain("apps/billing/export.ts");
162
- expect(facts.blastRadius?.factors).toEqual([
163
- "multiple_runtime_consumers",
164
- "shared_middleware",
165
- ]);
166
- expect(facts.frameworks).toEqual(["express", "react"]);
167
- expect(facts.reachability?.evidence.frameworks).toEqual([
168
- "express",
169
- "react",
170
- ]);
171
- });
172
- it("merges graph hotspots without duplicating code hotspots", () => {
173
- const result = {
174
- ...baseResult,
175
- changedPackages: ["fastify"],
176
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
177
- repoIntelligence: fixtureRepoIntelligenceFastify,
178
- graphInsights: {
179
- maxDepth: 3,
180
- nodes: 10,
181
- edges: 12,
182
- hotspots: [
183
- {
184
- kind: "hotspot",
185
- packageName: "fastify",
186
- direct: true,
187
- depth: 2,
188
- },
189
- {
190
- kind: "hotspot",
191
- packageName: "transitive-only-pkg",
192
- direct: false,
193
- depth: 4,
194
- },
195
- ],
196
- },
197
- };
198
- const facts = deriveScanNarrative(result);
199
- expect(facts.hotspots.map((h) => h.packageName)).toContain("fastify");
200
- expect(facts.hotspots.map((h) => h.packageName)).toContain("transitive-only-pkg");
201
- expect(facts.hotspots.filter((h) => h.packageName === "fastify")).toHaveLength(1);
202
- });
203
- it("does not tier1 when repoIntelligence block is omitted", () => {
204
- const result = {
205
- ...baseResult,
206
- changedPackages: ["react"],
207
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
208
- };
209
- const facts = deriveScanNarrative(result);
210
- expect(facts.availability.repoIntelligenceParse).toBe("absent");
211
- expect(facts.availability.tiersPresent.tier1).toBe(false);
212
- });
213
- it("projects preparation warnings and corpus gate reason", () => {
214
- const result = {
215
- ...baseResult,
216
- changedPackages: ["lodash"],
217
- analysisPreparation: {
218
- codeIntelligenceAvailable: false,
219
- warnings: [
220
- {
221
- code: "base_lockfile_missing",
222
- message: "Base lockfile not available",
223
- },
224
- ],
225
- },
226
- };
227
- const facts = deriveScanNarrative(result);
228
- expect(facts.availability.preparationWarnings).toHaveLength(1);
229
- expect(facts.availability.preparationWarnings[0]?.code).toBe("base_lockfile_missing");
230
- expect(facts.availability.corpusGateReason).toBe("no_code_intelligence");
231
- expect(facts.confidence.limitedContext).toBe(true);
232
- });
233
- it("links affected areas to packages, findings, paths, and verification", () => {
234
- const result = {
235
- ...baseResult,
236
- changedPackages: ["fastify"],
237
- analysisPreparation: analysisPreparationWithValidRepoIntel(),
238
- repoIntelligence: fixtureRepoIntelligenceFastify,
239
- findings: [
240
- {
241
- id: "f1",
242
- title: "Auth middleware",
243
- description: "d",
244
- severity: "high",
245
- packageName: "fastify",
246
- },
247
- ],
248
- };
249
- const facts = deriveScanNarrative(result);
250
- const apiArea = facts.affectedAreas.find((a) => a.id === "api");
251
- expect(apiArea).toBeDefined();
252
- expect(apiArea?.packages).toContain("fastify");
253
- expect(apiArea?.findingIds).toContain("f1");
254
- expect(apiArea?.paths.length).toBeGreaterThan(0);
255
- expect(apiArea?.evidenceStrength).toBe("high");
256
- expect(apiArea?.hotspotPackages).toContain("fastify");
257
- expect(apiArea?.verificationFocus).toContain("routes");
258
- });
259
- it("derives riskSignals with PR Risk bands", () => {
260
- const facts = deriveScanNarrative(baseResult);
261
- expect(facts.riskSignals?.riskIndex).toBe(10);
262
- expect(facts.riskSignals?.band).toBe("very_low");
263
- expect(facts.riskSignals?.layers).toHaveLength(4);
264
- expect(facts.riskIndex).toBe(10);
265
- });
266
- it("projects assessment confidence verbatim", () => {
267
- const result = {
268
- ...baseResult,
269
- assessment: assessmentFastifyRuntime,
270
- };
271
- const facts = deriveScanNarrative(result);
272
- expect(facts.confidence.assessment).toBe("medium");
273
- });
274
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=engineWireRegression.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engineWireRegression.test.d.ts","sourceRoot":"","sources":["../src/engineWireRegression.test.ts"],"names":[],"mappings":""}
@@ -1,77 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { deriveScanNarrative } from "./deriveScanNarrative.js";
3
- import { fixtureRepoIntelligenceFastify, fixtureRepoIntelligenceMultiPackage, } from "./fixtures/repoIntelligenceFixtures.js";
4
- import { assessmentFastifyRuntime } from "./fixtures/assessmentFixtures.js";
5
- import { validateRepoIntelligenceWire } from "./repoIntelligenceSchema.js";
6
- import { buildScanPresentationBundle } from "./presentation/orchestration/buildScanPresentationBundle.js";
7
- import { presentDashboardCard } from "./presentation/presenters/presentDashboardCard.js";
8
- const baseScan = {
9
- totalScore: 55,
10
- layerScores: {
11
- security: 10,
12
- maintainability: 20,
13
- ecosystem: 30,
14
- upgradeImpact: 15,
15
- },
16
- findings: [],
17
- generatedAt: "2026-01-01T00:00:00.000Z",
18
- analysisPreparation: {
19
- codeIntelligenceAvailable: true,
20
- warnings: [],
21
- repoIntelligenceValidation: {
22
- status: "valid",
23
- abi: "1",
24
- validatedAt: "2026-01-01T00:00:00.000Z",
25
- },
26
- },
27
- };
28
- describe("engine wire regression (canonical fixtures)", () => {
29
- it("fastify fixture: parse → tier1 pr_intelligence → card usage lines", () => {
30
- validateRepoIntelligenceWire(fixtureRepoIntelligenceFastify);
31
- const result = {
32
- ...baseScan,
33
- changedPackages: ["fastify"],
34
- repoIntelligence: fixtureRepoIntelligenceFastify,
35
- assessment: assessmentFastifyRuntime,
36
- decision: {
37
- recommendation: "needs_review",
38
- confidence: "medium",
39
- reasoning: [
40
- "Changed package has confirmed usage on runtime application paths in this repository.",
41
- ],
42
- },
43
- };
44
- const facts = deriveScanNarrative(result);
45
- expect(facts.availability.tiersPresent.tier1).toBe(true);
46
- expect(facts.availability.mode).toBe("pr_intelligence");
47
- expect(facts.availability.repoIntelligenceParse).toBe("ok");
48
- expect(facts.packageUsage[0]?.packageName).toBe("fastify");
49
- const bundle = buildScanPresentationBundle({
50
- result,
51
- pipelineStatus: "done",
52
- });
53
- const card = presentDashboardCard(bundle);
54
- expect(card.insights.length).toBeGreaterThan(0);
55
- expect(card.verification.length).toBeGreaterThan(0);
56
- });
57
- it("multi-package fixture: both packages in packageUsage", () => {
58
- validateRepoIntelligenceWire(fixtureRepoIntelligenceMultiPackage);
59
- const result = {
60
- ...baseScan,
61
- changedPackages: ["lodash", "axios"],
62
- repoIntelligence: fixtureRepoIntelligenceMultiPackage,
63
- assessment: assessmentFastifyRuntime,
64
- decision: {
65
- recommendation: "needs_review",
66
- confidence: "medium",
67
- reasoning: [],
68
- },
69
- };
70
- const facts = deriveScanNarrative(result);
71
- expect(facts.availability.mode).toBe("pr_intelligence");
72
- expect(facts.packageUsage.map((u) => u.packageName)).toEqual([
73
- "axios",
74
- "lodash",
75
- ]);
76
- });
77
- });
@@ -1,16 +0,0 @@
1
- import type { LayerScores, ScanResult } from "../types.js";
2
- type Abi4SplitScores = {
3
- prRiskScore: number;
4
- repositoryHealthScore: number;
5
- layerScores?: LayerScores;
6
- };
7
- /**
8
- * Attach differentiated ABI-4 prRisk + repositoryHealth wire blocks.
9
- * `totalScore` mirrors repository health for legacy readers; presentation must
10
- * consume `prRisk.score` via `deriveRiskSignals()`.
11
- */
12
- export declare function withAbi4SplitScores<T extends ScanResult>(result: T, scores: Abi4SplitScores): T;
13
- /** Attach ABI-4 prRisk + repositoryHealth wire blocks for strict engine validation tests. */
14
- export declare function withAbi4EngineScores<T extends ScanResult>(result: T): T;
15
- export {};
16
- //# sourceMappingURL=engineAbi4Fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engineAbi4Fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/engineAbi4Fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG3D,KAAK,eAAe,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EACtD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,eAAe,GACtB,CAAC,CAeH;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAEvE"}
@@ -1,26 +0,0 @@
1
- import { normalizeEngineOutputAbi4 } from "../scanResultSchema.js";
2
- /**
3
- * Attach differentiated ABI-4 prRisk + repositoryHealth wire blocks.
4
- * `totalScore` mirrors repository health for legacy readers; presentation must
5
- * consume `prRisk.score` via `deriveRiskSignals()`.
6
- */
7
- export function withAbi4SplitScores(result, scores) {
8
- const layerScores = scores.layerScores ?? result.layerScores;
9
- return {
10
- ...result,
11
- totalScore: scores.repositoryHealthScore,
12
- layerScores,
13
- prRisk: {
14
- score: scores.prRiskScore,
15
- layerScores: result.prRisk?.layerScores ?? layerScores,
16
- },
17
- repositoryHealth: {
18
- totalScore: scores.repositoryHealthScore,
19
- layerScores,
20
- },
21
- };
22
- }
23
- /** Attach ABI-4 prRisk + repositoryHealth wire blocks for strict engine validation tests. */
24
- export function withAbi4EngineScores(result) {
25
- return normalizeEngineOutputAbi4(result);
26
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Pre-contract engine wire shape (Wave 1/2 drift). Used to assert strict schema rejection
3
- * and narrative fallback while preserving raw payload for forensics.
4
- */
5
- export declare const legacyEngineRepoIntelligenceJwt: {
6
- readonly packageUsage: readonly [{
7
- readonly name: "jsonwebtoken";
8
- readonly files: readonly ["src/auth/auth.service.ts", "src/auth/login.controller.ts"];
9
- readonly reachability: "moderate";
10
- readonly runtimeSurface: "runtime";
11
- readonly areas: readonly ["authentication"];
12
- readonly blastRadius: "moderate";
13
- }];
14
- readonly hotspots: readonly [{
15
- readonly file: "src/auth/auth.service.ts";
16
- readonly fanIn: 2;
17
- readonly areas: readonly ["authentication"];
18
- }];
19
- readonly frameworks: readonly [{
20
- readonly framework: "express";
21
- readonly roles: readonly ["middleware"];
22
- }];
23
- readonly blastRadius: {
24
- readonly level: "large";
25
- readonly factors: readonly ["reaches runtime application code"];
26
- };
27
- };
28
- //# sourceMappingURL=legacyEngineRepoIntelligence.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacyEngineRepoIntelligence.d.ts","sourceRoot":"","sources":["../../src/fixtures/legacyEngineRepoIntelligence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;CAuBlC,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Pre-contract engine wire shape (Wave 1/2 drift). Used to assert strict schema rejection
3
- * and narrative fallback while preserving raw payload for forensics.
4
- */
5
- export const legacyEngineRepoIntelligenceJwt = {
6
- packageUsage: [
7
- {
8
- name: "jsonwebtoken",
9
- files: ["src/auth/auth.service.ts", "src/auth/login.controller.ts"],
10
- reachability: "moderate",
11
- runtimeSurface: "runtime",
12
- areas: ["authentication"],
13
- blastRadius: "moderate",
14
- },
15
- ],
16
- hotspots: [
17
- {
18
- file: "src/auth/auth.service.ts",
19
- fanIn: 2,
20
- areas: ["authentication"],
21
- },
22
- ],
23
- frameworks: [{ framework: "express", roles: ["middleware"] }],
24
- blastRadius: {
25
- level: "large",
26
- factors: ["reaches runtime application code"],
27
- },
28
- };
@@ -1,8 +0,0 @@
1
- import type { RepoIntelligence } from "../repoIntelligenceSchema.js";
2
- /** Corpus-enabled runtime framework upgrade (auth/API paths). */
3
- export declare const fixtureRepoIntelligenceFastify: RepoIntelligence;
4
- /** Build-only toolchain change — no runtime paths. */
5
- export declare const fixtureRepoIntelligenceTypescript: RepoIntelligence;
6
- /** Multi-package PR with distinct usage per package. */
7
- export declare const fixtureRepoIntelligenceMultiPackage: RepoIntelligence;
8
- //# sourceMappingURL=repoIntelligenceFixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repoIntelligenceFixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/repoIntelligenceFixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,iEAAiE;AACjE,eAAO,MAAM,8BAA8B,EAAE,gBAgD5C,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,iCAAiC,EAAE,gBAqB/C,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,mCAAmC,EAAE,gBAgDjD,CAAC"}
@@ -1,123 +0,0 @@
1
- /** Corpus-enabled runtime framework upgrade (auth/API paths). */
2
- export const fixtureRepoIntelligenceFastify = {
3
- packages: {
4
- fastify: {
5
- runtimeSurface: "runtime",
6
- reachability: "on_runtime_paths",
7
- runtimeImpact: "confirmed",
8
- expectedImpact: "runtime",
9
- evidenceStrength: "high",
10
- suppressRuntimeNarrative: false,
11
- dependencyClass: "runtime",
12
- packageRole: "http_framework",
13
- verificationFocus: [
14
- "routes",
15
- "middleware",
16
- "auth_flow",
17
- "serialization",
18
- "error_handling",
19
- ],
20
- usage: {
21
- packageName: "fastify",
22
- files: [
23
- "apps/api/src/server.ts",
24
- "apps/api/src/routes/account.ts",
25
- "apps/api/src/middleware/auth.ts",
26
- ],
27
- paths: ["apps/api/src/server.ts", "apps/api/src/routes/account.ts"],
28
- criticalPaths: ["apps/api/src/middleware/auth.ts"],
29
- areas: ["API", "Auth middleware"],
30
- },
31
- },
32
- },
33
- blastRadius: {
34
- level: "moderate",
35
- factors: ["middleware_ordering", "route_handlers"],
36
- changedPackageCount: 1,
37
- },
38
- applicationAreas: [
39
- { id: "api", label: "API request handling" },
40
- { id: "auth", label: "Auth middleware" },
41
- ],
42
- hotspots: [
43
- {
44
- packageName: "fastify",
45
- source: "code",
46
- paths: ["apps/api/src/middleware/auth.ts"],
47
- },
48
- ],
49
- frameworks: ["fastify"],
50
- };
51
- /** Build-only toolchain change — no runtime paths. */
52
- export const fixtureRepoIntelligenceTypescript = {
53
- packages: {
54
- typescript: {
55
- runtimeSurface: "build",
56
- reachability: "build_only",
57
- runtimeImpact: "none",
58
- expectedImpact: "typecheck",
59
- evidenceStrength: "medium",
60
- suppressRuntimeNarrative: true,
61
- dependencyClass: "tooling",
62
- packageRole: "typechecker",
63
- verificationFocus: ["ci", "typecheck"],
64
- usage: {
65
- packageName: "typescript",
66
- files: ["tsconfig.json"],
67
- paths: [],
68
- },
69
- },
70
- },
71
- blastRadius: { level: "narrow", changedPackageCount: 1 },
72
- applicationAreas: [],
73
- };
74
- /** Multi-package PR with distinct usage per package. */
75
- export const fixtureRepoIntelligenceMultiPackage = {
76
- packages: {
77
- lodash: {
78
- runtimeSurface: "runtime",
79
- reachability: "on_runtime_paths",
80
- usage: {
81
- packageName: "lodash",
82
- files: ["apps/billing/export.ts"],
83
- paths: ["apps/billing/export.ts"],
84
- areas: ["Billing"],
85
- },
86
- },
87
- axios: {
88
- runtimeSurface: "runtime",
89
- reachability: "on_runtime_paths",
90
- usage: {
91
- packageName: "axios",
92
- files: ["apps/api/client.ts"],
93
- paths: ["apps/api/client.ts"],
94
- areas: ["API"],
95
- },
96
- },
97
- },
98
- packageUsage: [
99
- {
100
- packageName: "lodash",
101
- files: ["apps/billing/export.ts"],
102
- paths: ["apps/billing/export.ts"],
103
- },
104
- {
105
- packageName: "axios",
106
- files: ["apps/api/client.ts"],
107
- paths: ["apps/api/client.ts"],
108
- },
109
- ],
110
- blastRadius: {
111
- level: "moderate",
112
- factors: ["multiple_runtime_consumers", "shared_middleware"],
113
- changedPackageCount: 2,
114
- },
115
- frameworks: ["express", "react"],
116
- hotspots: [
117
- {
118
- packageName: "lodash",
119
- source: "code",
120
- paths: ["apps/billing/export.ts"],
121
- },
122
- ],
123
- };
@@ -1,5 +0,0 @@
1
- import type { AnalysisPreparation } from "../types.js";
2
- /** Worker-shaped preparation for tests that consume trusted repoIntelligence. */
3
- export declare function analysisPreparationWithValidRepoIntel(over?: Partial<AnalysisPreparation>): AnalysisPreparation;
4
- export declare function analysisPreparationWithInvalidRepoIntel(over?: Partial<AnalysisPreparation>): AnalysisPreparation;
5
- //# sourceMappingURL=repoIntelligenceTestHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repoIntelligenceTestHelpers.d.ts","sourceRoot":"","sources":["../../src/fixtures/repoIntelligenceTestHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,iFAAiF;AACjF,wBAAgB,qCAAqC,CACnD,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAClC,mBAAmB,CAWrB;AAED,wBAAgB,uCAAuC,CACrD,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAClC,mBAAmB,CAarB"}
@@ -1,28 +0,0 @@
1
- import { REPO_INTELLIGENCE_ABI } from "../repoIntelligenceSchema.js";
2
- /** Worker-shaped preparation for tests that consume trusted repoIntelligence. */
3
- export function analysisPreparationWithValidRepoIntel(over) {
4
- return {
5
- codeIntelligenceAvailable: true,
6
- warnings: [],
7
- repoIntelligenceValidation: {
8
- status: "valid",
9
- abi: REPO_INTELLIGENCE_ABI,
10
- validatedAt: "2026-01-01T00:00:00.000Z",
11
- },
12
- ...over,
13
- };
14
- }
15
- export function analysisPreparationWithInvalidRepoIntel(over) {
16
- return {
17
- codeIntelligenceAvailable: true,
18
- warnings: [],
19
- repoIntelligenceValidation: {
20
- status: "invalid",
21
- abi: REPO_INTELLIGENCE_ABI,
22
- issueCount: 1,
23
- representativeIssues: ["packages: at least one package required"],
24
- validatedAt: "2026-01-01T00:00:00.000Z",
25
- },
26
- ...over,
27
- };
28
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=formatInsight.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatInsight.test.d.ts","sourceRoot":"","sources":["../src/formatInsight.test.ts"],"names":[],"mappings":""}