@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.
- package/dist/analysis-registry.d.ts +22 -11
- package/dist/analysis-registry.d.ts.map +1 -1
- package/dist/analysis-registry.js +36 -39
- package/dist/analyzer.d.ts +38 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +115 -83
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +72 -1
- package/dist/extends-resolution.d.ts +41 -0
- package/dist/extends-resolution.d.ts.map +1 -1
- package/dist/extends-resolution.js +68 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/invocation-contract.d.ts +100 -0
- package/dist/invocation-contract.d.ts.map +1 -0
- package/dist/invocation-contract.js +208 -0
- package/dist/schema-compat.d.ts +12 -4
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +185 -9
- package/dist/validate-base-mapping.js +11 -1
- package/dist/validate-cel-context.d.ts +0 -6
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +51 -4
- package/dist/validate-invocation-contract.d.ts +30 -0
- package/dist/validate-invocation-contract.d.ts.map +1 -0
- package/dist/validate-invocation-contract.js +394 -0
- package/dist/validate-step-inputs.d.ts +24 -0
- package/dist/validate-step-inputs.d.ts.map +1 -0
- package/dist/validate-step-inputs.js +87 -0
- package/dist/validate-throws-coverage.d.ts +1 -1
- package/dist/validate-throws-coverage.d.ts.map +1 -1
- package/dist/validate-throws-coverage.js +9 -1
- package/package.json +2 -2
- package/src/analysis-registry.ts +44 -34
- package/src/analyzer.ts +171 -100
- package/src/builtins.ts +74 -1
- package/src/extends-resolution.ts +86 -0
- package/src/index.ts +13 -1
- package/src/invocation-contract.ts +275 -0
- package/src/schema-compat.ts +191 -8
- package/src/validate-base-mapping.ts +14 -1
- package/src/validate-cel-context.ts +49 -4
- package/src/validate-invocation-contract.ts +450 -0
- package/src/validate-step-inputs.ts +117 -0
- 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
|
|
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 ? "
|
|
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 {
|