kibi-cli 2.38.0 → 2.40.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 (222) hide show
  1. package/dist/cli-json-command.d.ts.map +1 -1
  2. package/dist/cli-json-command.js +4 -0
  3. package/dist/cli-register-foundation.js +2 -2
  4. package/dist/cli-register-reporting.d.ts.map +1 -1
  5. package/dist/cli-register-reporting.js +1 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +3 -0
  8. package/dist/commands/check.d.ts.map +1 -1
  9. package/dist/commands/check.js +33 -9
  10. package/dist/commands/coverage.d.ts +1 -0
  11. package/dist/commands/coverage.d.ts.map +1 -1
  12. package/dist/commands/coverage.js +40 -0
  13. package/dist/commands/doctor.d.ts +5 -0
  14. package/dist/commands/doctor.d.ts.map +1 -1
  15. package/dist/commands/doctor.js +29 -0
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +4 -0
  18. package/dist/commands/migrate-plan-record.d.ts +18 -0
  19. package/dist/commands/migrate-plan-record.d.ts.map +1 -0
  20. package/dist/commands/migrate-plan-record.js +112 -0
  21. package/dist/commands/migrate.d.ts +11 -2
  22. package/dist/commands/migrate.d.ts.map +1 -1
  23. package/dist/commands/migrate.js +60 -8
  24. package/dist/commands/prove.d.ts.map +1 -1
  25. package/dist/commands/prove.js +18 -3
  26. package/dist/commands/sync/manifest.d.ts.map +1 -1
  27. package/dist/commands/sync/manifest.js +17 -4
  28. package/dist/commands/sync/persistence.d.ts.map +1 -1
  29. package/dist/commands/sync/persistence.js +6 -0
  30. package/dist/commands/sync.d.ts.map +1 -1
  31. package/dist/commands/sync.js +8 -0
  32. package/dist/commands/telemetry.d.ts.map +1 -1
  33. package/dist/commands/telemetry.js +12 -2
  34. package/dist/extractors/markdown.d.ts +6 -0
  35. package/dist/extractors/markdown.d.ts.map +1 -1
  36. package/dist/extractors/markdown.js +21 -0
  37. package/dist/extractors/symbol-title-match.d.ts +31 -0
  38. package/dist/extractors/symbol-title-match.d.ts.map +1 -0
  39. package/dist/extractors/symbol-title-match.js +133 -0
  40. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  41. package/dist/extractors/symbols-coordinator.js +81 -12
  42. package/dist/operations/bootstrap/discovery-evidence.d.ts.map +1 -1
  43. package/dist/operations/bootstrap/discovery-evidence.js +44 -2
  44. package/dist/operations/bootstrap/discovery.d.ts.map +1 -1
  45. package/dist/operations/bootstrap/discovery.js +1 -0
  46. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  47. package/dist/operations/bootstrap/guidance-actions.js +12 -1
  48. package/dist/operations/bootstrap/plugin-offers.d.ts +7 -1
  49. package/dist/operations/bootstrap/plugin-offers.d.ts.map +1 -1
  50. package/dist/operations/bootstrap/plugin-offers.js +73 -3
  51. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  52. package/dist/operations/modeling/logic-modeling.js +2 -1
  53. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  54. package/dist/operations/modeling/model-requirement.js +2 -1
  55. package/dist/operations/mutation/symbol-refresh.d.ts +2 -0
  56. package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
  57. package/dist/operations/mutation/symbol-refresh.js +6 -1
  58. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  59. package/dist/operations/mutation/upsert.js +7 -0
  60. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  61. package/dist/operations/planning/compile-intent.js +2 -1
  62. package/dist/operations/proof/claim-bindings.d.ts +11 -0
  63. package/dist/operations/proof/claim-bindings.d.ts.map +1 -1
  64. package/dist/operations/proof/claim-bindings.js +144 -1
  65. package/dist/operations/proof/code-certificates.d.ts +10 -3
  66. package/dist/operations/proof/code-certificates.d.ts.map +1 -1
  67. package/dist/operations/proof/code-certificates.js +65 -13
  68. package/dist/operations/proof/code-languages.d.ts +104 -0
  69. package/dist/operations/proof/code-languages.d.ts.map +1 -0
  70. package/dist/operations/proof/code-languages.js +119 -0
  71. package/dist/operations/proof/code-models.d.ts +2 -0
  72. package/dist/operations/proof/code-models.d.ts.map +1 -1
  73. package/dist/operations/proof/code-models.js +11 -5
  74. package/dist/operations/proof/code-runner.d.ts +12 -9
  75. package/dist/operations/proof/code-runner.d.ts.map +1 -1
  76. package/dist/operations/proof/code-runner.js +81 -38
  77. package/dist/operations/proof/code-scope.d.ts +8 -0
  78. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  79. package/dist/operations/proof/code-scope.js +30 -1
  80. package/dist/operations/proof/explain.d.ts +76 -0
  81. package/dist/operations/proof/explain.d.ts.map +1 -1
  82. package/dist/operations/proof/explain.js +228 -0
  83. package/dist/operations/proof/ingest-proof.d.ts +2 -0
  84. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  85. package/dist/operations/proof/ingest-proof.js +1 -0
  86. package/dist/operations/proof/java-package-shadow.d.ts +14 -0
  87. package/dist/operations/proof/java-package-shadow.d.ts.map +1 -0
  88. package/dist/operations/proof/java-package-shadow.js +389 -0
  89. package/dist/operations/proof/prolog-evaluator.d.ts +14 -0
  90. package/dist/operations/proof/prolog-evaluator.d.ts.map +1 -0
  91. package/dist/operations/proof/prolog-evaluator.js +247 -0
  92. package/dist/operations/proof/prolog-source-reader.d.ts +20 -0
  93. package/dist/operations/proof/prolog-source-reader.d.ts.map +1 -0
  94. package/dist/operations/proof/prolog-source-reader.js +1123 -0
  95. package/dist/operations/proof/source-code-readers.d.ts +6 -0
  96. package/dist/operations/proof/source-code-readers.d.ts.map +1 -1
  97. package/dist/operations/proof/source-code-readers.js +879 -75
  98. package/dist/operations/semantic-advisor/analyze-prose.d.ts +9 -1
  99. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  100. package/dist/operations/semantic-advisor/analyze-prose.js +21 -0
  101. package/dist/operations/semantic-advisor/case-preview.d.ts +24 -0
  102. package/dist/operations/semantic-advisor/case-preview.d.ts.map +1 -0
  103. package/dist/operations/semantic-advisor/case-preview.js +216 -0
  104. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  105. package/dist/operations/semantic-advisor/shared.js +3 -0
  106. package/dist/operations/semantic-advisor/types.d.ts +23 -0
  107. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  108. package/dist/plugins/approved-source-analyzers.generated.d.ts +15 -34
  109. package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -1
  110. package/dist/plugins/approved-source-analyzers.generated.js +15 -34
  111. package/dist/plugins/plugin-install-check.d.ts +21 -0
  112. package/dist/plugins/plugin-install-check.d.ts.map +1 -0
  113. package/dist/plugins/plugin-install-check.js +62 -0
  114. package/dist/plugins/proof-reference-extractors.d.ts +20 -0
  115. package/dist/plugins/proof-reference-extractors.d.ts.map +1 -0
  116. package/dist/plugins/proof-reference-extractors.js +104 -0
  117. package/dist/plugins/reference-language-suggestion.d.ts +51 -0
  118. package/dist/plugins/reference-language-suggestion.d.ts.map +1 -0
  119. package/dist/plugins/reference-language-suggestion.js +277 -0
  120. package/dist/plugins/registry.d.ts.map +1 -1
  121. package/dist/plugins/registry.js +3 -1
  122. package/dist/plugins/source-analysis-service.d.ts.map +1 -1
  123. package/dist/plugins/source-analysis-service.js +4 -0
  124. package/dist/plugins/source-change-analysis.d.ts +26 -1
  125. package/dist/plugins/source-change-analysis.d.ts.map +1 -1
  126. package/dist/plugins/source-change-analysis.js +77 -5
  127. package/dist/plugins/source-classification.d.ts +2 -2
  128. package/dist/plugins/source-classification.d.ts.map +1 -1
  129. package/dist/plugins/source-classification.js +45 -1
  130. package/dist/public/operations/catalog.d.ts +62 -7
  131. package/dist/public/operations/catalog.d.ts.map +1 -1
  132. package/dist/public/operations/check-executor.d.ts.map +1 -1
  133. package/dist/public/operations/check-executor.js +3 -0
  134. package/dist/public/operations/evidence-floor.d.ts +8 -0
  135. package/dist/public/operations/evidence-floor.d.ts.map +1 -1
  136. package/dist/public/operations/evidence-floor.js +19 -1
  137. package/dist/public/operations/repair-plan.d.ts +46 -0
  138. package/dist/public/operations/repair-plan.d.ts.map +1 -1
  139. package/dist/public/operations/repair-plan.js +110 -1
  140. package/dist/public/operations/schema6-check-actions.js +1 -1
  141. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  142. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  143. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  144. package/dist/public/operations/specs/check.d.ts +1 -1
  145. package/dist/public/operations/specs/mutation-schemas.d.ts +61 -6
  146. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  147. package/dist/public/operations/specs/mutation-schemas.js +30 -0
  148. package/dist/public/operations/specs/reporting.d.ts +8 -0
  149. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  150. package/dist/public/operations/specs/reporting.js +26 -3
  151. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  152. package/dist/public/operations/specs/semantic.js +2 -1
  153. package/dist/public/operations/specs/upsert.d.ts +61 -6
  154. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  155. package/dist/public/operations/symbol-coordinates-check.d.ts +11 -0
  156. package/dist/public/operations/symbol-coordinates-check.d.ts.map +1 -0
  157. package/dist/public/operations/symbol-coordinates-check.js +66 -0
  158. package/dist/public/proof-protocol.d.ts +31 -6
  159. package/dist/public/proof-protocol.d.ts.map +1 -1
  160. package/dist/public/proof-protocol.js +45 -15
  161. package/dist/public/proof-sources.d.ts +4 -2
  162. package/dist/public/proof-sources.d.ts.map +1 -1
  163. package/dist/public/proof-sources.js +43 -4
  164. package/dist/public/schemas/entity.d.ts.map +1 -1
  165. package/dist/public/schemas/entity.js +59 -0
  166. package/dist/public/skills/kibi-commit-review/SKILL.md +6 -2
  167. package/dist/public/skills/kibi-decisions/SKILL.md +7 -2
  168. package/dist/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
  169. package/dist/public/skills/kibi-usage/SKILL.md +14 -3
  170. package/dist/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
  171. package/dist/public/skills/kibi-usage/resources/proof.md +44 -3
  172. package/dist/schemas/entity.schema.json +126 -6
  173. package/dist/search-answer.d.ts +3 -2
  174. package/dist/search-answer.d.ts.map +1 -1
  175. package/dist/search-answer.js +56 -3
  176. package/dist/traceability/analysis-gate.d.ts +3 -1
  177. package/dist/traceability/analysis-gate.d.ts.map +1 -1
  178. package/dist/traceability/analysis-gate.js +9 -1
  179. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  180. package/dist/traceability/impact-knowledge.js +2 -0
  181. package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
  182. package/dist/traceability/staged-file-coverage.js +7 -2
  183. package/dist/traceability/symbol-extract.d.ts +17 -0
  184. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  185. package/dist/traceability/symbol-extract.js +69 -15
  186. package/dist/traceability/temp-kb.d.ts.map +1 -1
  187. package/dist/traceability/temp-kb.js +11 -1
  188. package/dist/traceability/validate.d.ts.map +1 -1
  189. package/dist/traceability/validate.js +5 -7
  190. package/dist/types/entities.d.ts +12 -0
  191. package/dist/types/entities.d.ts.map +1 -1
  192. package/dist/usage-telemetry.d.ts +9 -0
  193. package/dist/usage-telemetry.d.ts.map +1 -1
  194. package/dist/usage-telemetry.js +50 -4
  195. package/dist/utils/first-sentence.d.ts +9 -0
  196. package/dist/utils/first-sentence.d.ts.map +1 -0
  197. package/dist/utils/first-sentence.js +52 -0
  198. package/dist/utils/rule-registry.generated.d.ts +11 -0
  199. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  200. package/dist/utils/rule-registry.generated.js +13 -0
  201. package/package.json +5 -5
  202. package/schema/entities.pl +12 -0
  203. package/src/public/operations/check-executor.ts +8 -0
  204. package/src/public/operations/evidence-floor.ts +29 -1
  205. package/src/public/operations/repair-plan.ts +152 -1
  206. package/src/public/operations/schema6-check-actions.ts +1 -1
  207. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  208. package/src/public/operations/specs/mutation-schemas.ts +34 -0
  209. package/src/public/operations/specs/reporting.ts +38 -3
  210. package/src/public/operations/specs/semantic.ts +2 -1
  211. package/src/public/operations/symbol-coordinates-check.ts +79 -0
  212. package/src/public/proof-protocol-types.d.ts +22 -5
  213. package/src/public/proof-protocol.ts +78 -19
  214. package/src/public/proof-sources.ts +51 -3
  215. package/src/public/schemas/entity.ts +65 -0
  216. package/src/public/skills/kibi-commit-review/SKILL.md +6 -2
  217. package/src/public/skills/kibi-decisions/SKILL.md +7 -2
  218. package/src/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
  219. package/src/public/skills/kibi-usage/SKILL.md +14 -3
  220. package/src/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
  221. package/src/public/skills/kibi-usage/resources/proof.md +44 -3
  222. package/src/schemas/entity.schema.json +126 -6
@@ -148,13 +148,218 @@ export function projectRequirementExplain(proof) {
148
148
  }),
149
149
  }
150
150
  : {}),
151
+ ...refutationFields(proof, stages),
151
152
  ...claimFields(proof),
152
153
  scenarios,
154
+ ...negativePathField(stages.negativePath),
155
+ ...dimensionField(stages.dimension),
156
+ ...casesField(stages.cases),
153
157
  tests,
154
158
  productionSymbols: explanations.filter((item) => !structuralIds.has(item.symbolId)),
155
159
  structuralSymbols: explanations.filter((item) => structuralIds.has(item.symbolId)),
156
160
  };
157
161
  }
162
+ // implements REQ-kibi-happy-path-gap
163
+ function negativePathField(stage) {
164
+ if (stage === undefined)
165
+ return {};
166
+ const record = asRecord(stage);
167
+ const suggestions = Array.isArray(record.suggestedNegatives)
168
+ ? record.suggestedNegatives.map((item) => {
169
+ const entry = asRecord(item);
170
+ return {
171
+ claimKey: asString(entry.claimKey),
172
+ factId: asString(entry.factId),
173
+ assumption: asRecord(entry.assumption),
174
+ };
175
+ })
176
+ : [];
177
+ return {
178
+ negativePath: {
179
+ status: asString(record.status),
180
+ negativeScenarios: asStringArray(record.negativeScenarios),
181
+ claims: asStringArray(record.claims),
182
+ suggestedNegatives: suggestions,
183
+ ...waiverField(record.waiver),
184
+ },
185
+ };
186
+ }
187
+ function waiverField(raw) {
188
+ const waiver = asRecord(raw);
189
+ const reason = asString(waiver.reason);
190
+ const approvedBy = asString(waiver.approvedBy);
191
+ return reason === ""
192
+ ? {}
193
+ : { waiver: { reason, ...(approvedBy === "" ? {} : { approvedBy }) } };
194
+ }
195
+ // implements REQ-kibi-dimension-gap
196
+ function dimensionField(stage) {
197
+ if (stage === undefined)
198
+ return {};
199
+ const record = asRecord(stage);
200
+ const claims = (raw) => Array.isArray(raw)
201
+ ? raw.map((item) => {
202
+ const entry = asRecord(item);
203
+ return {
204
+ claimKey: asString(entry.claimKey),
205
+ claimText: asString(entry.claimText),
206
+ quantifier: asString(entry.quantifier),
207
+ factIds: asStringArray(entry.factIds),
208
+ rewrites: asStringArray(entry.rewrites),
209
+ ...waiverField(entry.waiver),
210
+ };
211
+ })
212
+ : [];
213
+ return {
214
+ dimension: {
215
+ status: asString(record.status),
216
+ claims: claims(record.claims),
217
+ waivedClaims: claims(record.waivedClaims),
218
+ },
219
+ };
220
+ }
221
+ // implements REQ-kibi-case-coverage
222
+ function casesField(stage) {
223
+ if (stage === undefined)
224
+ return {};
225
+ const record = asRecord(stage);
226
+ const cases = Array.isArray(record.cases)
227
+ ? record.cases.map((item) => {
228
+ const entry = asRecord(item);
229
+ return {
230
+ caseId: asString(entry.caseId),
231
+ claimKey: asString(entry.claimKey),
232
+ factId: asString(entry.factId),
233
+ generator: asString(entry.generator),
234
+ constraint: asString(entry.constraint),
235
+ predicted: asString(entry.predicted),
236
+ coverage: asString(entry.coverage),
237
+ scenarios: asStringArray(entry.scenarios),
238
+ assumption: asRecord(entry.assumption),
239
+ ...waiverField(entry.waiver),
240
+ };
241
+ })
242
+ : [];
243
+ const summary = asRecord(record.summary);
244
+ return {
245
+ cases: {
246
+ status: asString(record.status),
247
+ cases,
248
+ summary: Object.fromEntries(Object.entries(summary).filter((entry) => typeof entry[1] === "number")),
249
+ limitReached: record.limitReached === true,
250
+ },
251
+ };
252
+ }
253
+ function renderCases(view) {
254
+ const cases = view.cases;
255
+ if (cases === undefined || cases.cases.length === 0)
256
+ return [];
257
+ const summary = cases.summary;
258
+ const lines = [
259
+ "",
260
+ `Edge cases: ${cases.status} (${summary.covered ?? 0} covered, ${summary.uncovered ?? 0} uncovered, ${summary.unspecified ?? 0} unspecified, ${summary.waived ?? 0} waived)`,
261
+ ];
262
+ for (const row of cases.cases) {
263
+ const where = row.coverage === "covered" ? ` by ${row.scenarios.join(", ")}` : "";
264
+ lines.push(` ${row.caseId} ${row.factId} ${row.constraint} -> ${row.predicted}: ${row.coverage}${where}`);
265
+ if (row.coverage === "uncovered" && row.predicted === "rejection")
266
+ lines.push(` add a scenario that assumes ${JSON.stringify(row.assumption)} and expects rejection`);
267
+ if (row.waiver !== undefined && row.waiver.approvedBy === undefined)
268
+ lines.push(` waiver awaiting approval (set case_waiver_approved_by to the person who accepts it, in this pull request): ${row.waiver.reason}`);
269
+ }
270
+ if (cases.limitReached)
271
+ lines.push(" (some facts have more cases than the per-fact limit of 12)");
272
+ return lines;
273
+ }
274
+ const DIMENSION_REWRITES = {
275
+ bound: "an integer property with the bound (lte, gte or eq)",
276
+ rule: "a rule over a variable (every X with P must Q)",
277
+ count: "an integer count of what varies",
278
+ set: "a set fact over the members",
279
+ };
280
+ function renderDimension(view) {
281
+ const dimension = view.dimension;
282
+ if (dimension === undefined || dimension.status === "not_required")
283
+ return [];
284
+ const lines = ["", `Quantified claims: ${dimension.status}`];
285
+ for (const claim of dimension.claims) {
286
+ lines.push(` ${claim.claimKey} (${claim.factIds.join(", ")}): "${claim.quantifier.replaceAll("_", " ")}" is grounded on a boolean: ${claim.claimText}`);
287
+ const rewrites = claim.rewrites
288
+ .map((rewrite) => DIMENSION_REWRITES[rewrite] ?? rewrite)
289
+ .join("; or ");
290
+ if (rewrites !== "")
291
+ lines.push(` ground it on ${rewrites}`);
292
+ if (claim.waiver !== undefined)
293
+ lines.push(` waiver awaiting approval (set dimension_waiver_approved_by to the person who accepts it, in this pull request): ${claim.waiver.reason}`);
294
+ }
295
+ for (const claim of dimension.waivedClaims) {
296
+ lines.push(` ${claim.claimKey} waived by ${claim.waiver?.approvedBy ?? ""}: ${claim.waiver?.reason ?? ""}`);
297
+ }
298
+ return lines;
299
+ }
300
+ function renderNegativePath(view) {
301
+ const negative = view.negativePath;
302
+ if (negative === undefined || negative.status === "not_required")
303
+ return [];
304
+ const lines = ["", `Failure side: ${negative.status}`];
305
+ if (negative.waiver !== undefined) {
306
+ lines.push(negative.waiver.approvedBy === undefined
307
+ ? ` waiver awaiting approval (set failure_side_waiver_approved_by to the person who accepts it, in this pull request): ${negative.waiver.reason}`
308
+ : ` waived by ${negative.waiver.approvedBy}: ${negative.waiver.reason}`);
309
+ }
310
+ for (const scenarioId of negative.negativeScenarios) {
311
+ lines.push(` ${scenarioId} expects rejection or error`);
312
+ }
313
+ for (const suggestion of negative.suggestedNegatives) {
314
+ lines.push(` ${suggestion.claimKey} (${suggestion.factId}): assume ${JSON.stringify(suggestion.assumption)} and expect rejection`);
315
+ }
316
+ return lines;
317
+ }
318
+ // implements REQ-kibi-claim-bound-proofs
319
+ function refutationFields(proof, stages) {
320
+ const refutations = Array.isArray(proof.claimBindingRejections)
321
+ ? proof.claimBindingRejections.map((row) => {
322
+ const entry = asRecord(row);
323
+ return {
324
+ test: asString(entry.test),
325
+ claimKey: asString(entry.claimKey),
326
+ reason: asString(entry.reason),
327
+ };
328
+ })
329
+ : [];
330
+ const missing = asStringArray(asRecord(stages.sourceCoordinates).missingSymbols);
331
+ return {
332
+ ...(refutations.length > 0 ? { refutations } : {}),
333
+ ...(missing.length > 0 ? { missingCoordinateSymbols: missing } : {}),
334
+ };
335
+ }
336
+ /** Why each gap keeps a requirement from being tested end to end. */
337
+ const GAP_REASONS = {
338
+ missing_passing_e2e: "no scenario-backed test has a passing end-to-end receipt (a test whose verification_scope is not end_to_end does not count)",
339
+ missing_proof_receipt: "a scenario-backed test has no proof receipt yet",
340
+ stale_proof_receipt: "a proof receipt is older than the current code",
341
+ failed_proof_receipt: "a proof receipt records a failed run",
342
+ invalid_proof_receipt: "a proof receipt cannot be checked",
343
+ proof_contract_mismatch: "a proof receipt was recorded for an older proof contract",
344
+ missing_production_symbol: "no production symbol implements the requirement",
345
+ missing_production_symbol_coverage: "a production symbol is not covered by a qualifying end-to-end test (a test whose verification_scope is not end_to_end does not qualify)",
346
+ missing_executable_test_symbol: "a scenario test has no test code linked executable_for",
347
+ missing_scenario: "the requirement has no scenario",
348
+ missing_scenario_test: "a scenario has no test",
349
+ happy_path_only: "no scenario exercises the failure side",
350
+ uncovered_case: "an edge case of the claim has no scenario",
351
+ };
352
+ /** One plain clause per gap, naming what it is about where Kibi knows. */
353
+ // implements REQ-kibi-claim-bound-proofs
354
+ export function gapReason(gap, view) {
355
+ if (gap === "missing_symbol_coordinates") {
356
+ const symbols = view.missingCoordinateSymbols ?? [];
357
+ const named = symbols.length > 0 ? `${symbols.slice(0, 3).join(", ")} ` : "a symbol ";
358
+ return `${gap}: ${named}${symbols.length > 1 ? "have" : "has"} no source coordinates, so Kibi cannot tie the proof to its code (kibi sync --refresh-symbol-coordinates places ${symbols.length > 1 ? "them" : "it"}; kibi check says why a symbol cannot be placed)`;
359
+ }
360
+ const reason = GAP_REASONS[gap];
361
+ return reason ? `${gap}: ${reason}` : gap;
362
+ }
158
363
  function claimFields(proof) {
159
364
  const summary = asRecord(proof.claimSummary);
160
365
  const count = (key) => typeof summary[key] === "number" ? summary[key] : 0;
@@ -185,6 +390,9 @@ function claimFields(proof) {
185
390
  ...(typeof entry.blocker === "string"
186
391
  ? { blocker: entry.blocker }
187
392
  : {}),
393
+ ...(typeof entry.notProved === "string"
394
+ ? { notProved: entry.notProved }
395
+ : {}),
188
396
  bindings: (Array.isArray(entry.bindings)
189
397
  ? entry.bindings
190
398
  : []).map((raw) => {
@@ -205,6 +413,19 @@ function claimFields(proof) {
205
413
  : {}),
206
414
  };
207
415
  }
416
+ /** Gaps a refuted claim leaves that a derived proof would have covered. */
417
+ const CERTIFIED_GAPS = new Set(["happy_path_only", "uncovered_case"]);
418
+ // implements REQ-kibi-claim-bound-proofs
419
+ function renderRefutations(view) {
420
+ const refutations = view.refutations ?? [];
421
+ if (refutations.length === 0)
422
+ return [];
423
+ const lines = refutations.map((row) => `refuted: ${row.test} refutes ${row.claimKey}: ${row.reason}. The code breaks the claim, so it is not proved; fix the code (or, with the person who owns the rule, the requirement) and run kibi prove`);
424
+ const covered = view.proofGaps.filter((gap) => CERTIFIED_GAPS.has(gap));
425
+ if (covered.length > 0)
426
+ lines.push(` ${covered.join(" and ")} ${covered.length > 1 ? "follow" : "follows"} from the refutation: a proof that derives the claim covers its failure side and edge cases, a refuted one covers none`);
427
+ return lines;
428
+ }
208
429
  function renderClaims(view) {
209
430
  if (view.claims === undefined)
210
431
  return [];
@@ -223,6 +444,9 @@ function renderClaims(view) {
223
444
  : ` ${claim.claimKey} not applicable (${claim.status})`);
224
445
  for (const binding of claim.bindings)
225
446
  lines.push(` ${binding.test} ${binding.kind}: ${binding.binding}${binding.binding === "derived" ? ` (${binding.scope})` : ""}${binding.reason ? `: ${binding.reason}` : ""}`);
447
+ // implements REQ-kibi-claim-bound-proofs
448
+ if (claim.notProved === "requirement_not_tested")
449
+ lines.push(` not proved: the certificate derives the claim, but a claim is proved only once the requirement is tested end to end, and it is not (proofStatus ${view.proofStatus})${view.proofGaps.length > 0 ? `: ${view.proofGaps.map((gap) => gapReason(gap, view)).join("; ")}` : ""}`);
226
450
  }
227
451
  return lines;
228
452
  }
@@ -258,6 +482,7 @@ function renderRequirementExplain(view) {
258
482
  ? []
259
483
  : [`evidenceLevel: ${view.evidenceLevel}`]),
260
484
  ...(view.certificateRejections ?? []).map((row) => `certificate rejected for ${row.test}: ${row.reason}`),
485
+ ...renderRefutations(view),
261
486
  ...renderClaims(view),
262
487
  "",
263
488
  "Scenarios",
@@ -267,6 +492,9 @@ function renderRequirementExplain(view) {
267
492
  for (const scenario of view.scenarios) {
268
493
  lines.push(` ${scenario.id} -> ${scenario.tests.join(", ") || "(no tests)"}`);
269
494
  }
495
+ lines.push(...renderNegativePath(view));
496
+ lines.push(...renderDimension(view));
497
+ lines.push(...renderCases(view));
270
498
  lines.push("");
271
499
  for (const test of view.tests) {
272
500
  lines.push(`TEST ${test.testId}`);
@@ -24,6 +24,8 @@ export type IngestProofTestResult = Readonly<{
24
24
  evidenceLevel?: string;
25
25
  /** Why the test's certificate did not re-check, for a certificate kind. */
26
26
  certificateRejection?: string;
27
+ /** The receipt's verification scope (unit, integration or end_to_end). */
28
+ scope?: string;
27
29
  }>;
28
30
  export type IngestProofResult = Readonly<{
29
31
  artifactDigest: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ingest-proof.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/ingest-proof.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,QAAQ,EAEd,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAkBjF,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EAGlB,MAAM,+BAA+B,CAAC;AAoBvC,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,QAAQ,EAA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AA+nBF,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAuC5B"}
@@ -328,6 +328,7 @@ async function executeIngestProofUnlocked(args, context, lifecycle) {
328
328
  ...(typeof entry.receipt.certificate_rejection === "string"
329
329
  ? { certificateRejection: entry.receipt.certificate_rejection }
330
330
  : {}),
331
+ scope: entry.receipt.scope,
331
332
  },
332
333
  ]));
333
334
  const pendingCommits = [];
@@ -0,0 +1,14 @@
1
+ interface Row {
2
+ readonly line: number;
3
+ readonly text: string;
4
+ }
5
+ /** Java source with comments, string, char and text-block contents removed. */
6
+ export declare function javaCode(text: string): string;
7
+ /**
8
+ * A filter for one read: keeps every row, except a marked row whose
9
+ * declaration the project's files rule out. Directory scans are shared by
10
+ * the files of the read.
11
+ */
12
+ export declare function createShadowRowFilter(workspaceRoot: string): (file: string, rows: readonly Row[]) => Row[];
13
+ export {};
14
+ //# sourceMappingURL=java-package-shadow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"java-package-shadow.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/java-package-shadow.ts"],"names":[],"mappings":"AAoDA,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAgBD,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8B7C;AAmND;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,KAAK,GAAG,EAAE,CAgG1G"}