@telorun/analyzer 0.48.0 → 0.49.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 (46) hide show
  1. package/dist/analysis-registry.d.ts +22 -11
  2. package/dist/analysis-registry.d.ts.map +1 -1
  3. package/dist/analysis-registry.js +36 -39
  4. package/dist/analyzer.d.ts +38 -1
  5. package/dist/analyzer.d.ts.map +1 -1
  6. package/dist/analyzer.js +115 -83
  7. package/dist/builtins.d.ts.map +1 -1
  8. package/dist/builtins.js +72 -1
  9. package/dist/extends-resolution.d.ts +41 -0
  10. package/dist/extends-resolution.d.ts.map +1 -1
  11. package/dist/extends-resolution.js +68 -0
  12. package/dist/index.d.ts +4 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -1
  15. package/dist/invocation-contract.d.ts +100 -0
  16. package/dist/invocation-contract.d.ts.map +1 -0
  17. package/dist/invocation-contract.js +208 -0
  18. package/dist/schema-compat.d.ts +12 -4
  19. package/dist/schema-compat.d.ts.map +1 -1
  20. package/dist/schema-compat.js +185 -9
  21. package/dist/validate-base-mapping.js +11 -1
  22. package/dist/validate-cel-context.d.ts +0 -6
  23. package/dist/validate-cel-context.d.ts.map +1 -1
  24. package/dist/validate-cel-context.js +51 -4
  25. package/dist/validate-invocation-contract.d.ts +30 -0
  26. package/dist/validate-invocation-contract.d.ts.map +1 -0
  27. package/dist/validate-invocation-contract.js +394 -0
  28. package/dist/validate-step-inputs.d.ts +24 -0
  29. package/dist/validate-step-inputs.d.ts.map +1 -0
  30. package/dist/validate-step-inputs.js +87 -0
  31. package/dist/validate-throws-coverage.d.ts +1 -1
  32. package/dist/validate-throws-coverage.d.ts.map +1 -1
  33. package/dist/validate-throws-coverage.js +9 -1
  34. package/package.json +2 -2
  35. package/src/analysis-registry.ts +44 -34
  36. package/src/analyzer.ts +171 -100
  37. package/src/builtins.ts +74 -1
  38. package/src/extends-resolution.ts +86 -0
  39. package/src/index.ts +13 -1
  40. package/src/invocation-contract.ts +275 -0
  41. package/src/schema-compat.ts +191 -8
  42. package/src/validate-base-mapping.ts +14 -1
  43. package/src/validate-cel-context.ts +49 -4
  44. package/src/validate-invocation-contract.ts +450 -0
  45. package/src/validate-step-inputs.ts +117 -0
  46. package/src/validate-throws-coverage.ts +12 -2
@@ -1,6 +1,10 @@
1
1
  import type { ASTNode, Environment } from "@marcbachmann/cel-js";
2
2
  import { isTaggedSentinel } from "@telorun/templating";
3
- import type { ResourceManifest } from "@telorun/sdk";
3
+ import {
4
+ AMBIENT_CONTRACT_ERROR_CODES,
5
+ isAmbientContractErrorCode,
6
+ type ResourceManifest,
7
+ } from "@telorun/sdk";
4
8
  import { scopeResolverForModule, type AliasResolver } from "./alias-resolver.js";
5
9
  import type { DefinitionRegistry } from "./definition-registry.js";
6
10
  import {
@@ -250,12 +254,18 @@ function checkCatchesCoverage(
250
254
  const { proven, codes } = extractCoveredCodes(e.when, env);
251
255
  if (proven) {
252
256
  for (const c of codes) {
257
+ // An ambient kernel code (contract violations) is raised by the kernel,
258
+ // not declared by the kind, so naming it is legal and still typo-checked
259
+ // — but it is NOT part of the declared union, so it never counts toward
260
+ // coverage. Folding these into every union would make every bounded
261
+ // catches: block in the standard library incomplete overnight.
262
+ if (isAmbientContractErrorCode(c)) continue;
253
263
  if (!declaredCodes.has(c)) {
254
264
  diagnostics.push({
255
265
  severity: DiagnosticSeverity.Error,
256
266
  code: "UNDECLARED_THROW_CODE",
257
267
  source: SOURCE,
258
- message: `catches[${i}] references code '${c}' which is not in the handler's declared throw union {${[...declaredCodes].sort().join(", ") || "∅"}}${union.unbounded ? " (union is unbounded a catch-all is required)" : ""}.`,
268
+ message: `catches[${i}] references code '${c}' which is not in the handler's declared throw union {${[...declaredCodes].sort().join(", ") || "∅"}} (ambient kernel codes ${AMBIENT_CONTRACT_ERROR_CODES.join(", ")} may also be named)${union.unbounded ? "; the union is unbounded, so a catch-all is required" : ""}.`,
259
269
  data: { resource, filePath, path: `${arrayPath}[${i}].when` },
260
270
  });
261
271
  } else {