@intentius/chant 0.72.0 → 0.72.2
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/discovery/fold-import.d.ts.map +1 -1
- package/dist/fold/fold.d.ts +15 -1
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +38 -1
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/discovery/fold-counters-public.test.ts +67 -0
- package/src/discovery/fold-div-depth.test.ts +104 -0
- package/src/discovery/fold-host-composite.test.ts +115 -0
- package/src/discovery/fold-import.ts +43 -7
- package/src/fold/fold.ts +23 -4
- package/src/fold/subset.ts +38 -1
- package/src/index.ts +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAkC,KAAK,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAyC7G,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,CAAC;AAElF,MAAM,MAAM,cAAc,GACtB;IACE,EAAE,EAAE,IAAI,CAAC;IACT;;;;;;;;OAQG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB;;;;;;;;;;;;;OAaG;IACH,c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AQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IAC3D,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAoC1C"}
|
package/dist/fold/fold.d.ts
CHANGED
|
@@ -334,7 +334,21 @@ export declare class FoldError extends Error {
|
|
|
334
334
|
readonly line: number;
|
|
335
335
|
readonly column: number;
|
|
336
336
|
readonly ruleId: SubsetRuleId;
|
|
337
|
-
|
|
337
|
+
/**
|
|
338
|
+
* This refusal is `F-Div-Depth` (chant#2441), not an ordinary fold failure.
|
|
339
|
+
*
|
|
340
|
+
* The distinction is load-bearing rather than informational. An ordinary
|
|
341
|
+
* failure to fold an imported call is allowed to fall back to importing and
|
|
342
|
+
* invoking the callee, which is `resolveCallExpression`'s pre-#1373 arm and
|
|
343
|
+
* is right for a helper that wraps a composite call. A depth refusal must
|
|
344
|
+
* NOT take that arm: the specification says the folder declines here, and
|
|
345
|
+
* invoking instead produces the envelope the fixture's own note warns about
|
|
346
|
+
* — a value the file's own declarators never produced. Unlike every other
|
|
347
|
+
* `F-Div` row this one is not a fallback, so papering over it is wrong
|
|
348
|
+
* output rather than a safe degradation.
|
|
349
|
+
*/
|
|
350
|
+
readonly refusedAtDepth: boolean;
|
|
351
|
+
constructor(message: string, line: number, column: number, ruleId?: SubsetRuleId, refusedAtDepth?: boolean);
|
|
338
352
|
}
|
|
339
353
|
/**
|
|
340
354
|
* A project-local function `fold()` can CALL — chant #1373.
|
package/dist/fold/fold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAoE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACjH,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,WAAW,EAAE,GACb;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GAC9B,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,uBAAuB,CAAC;AAE5B;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAuBvE;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEvE,+EAA+E;AAC/E,MAAM,WAAW,kBAAkB;IACjC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;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAClC,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,WAAW,CAmeb;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,EAAE,CAAC,aAAa,EACtB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAClC,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,cAAc,CA6BhB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAc,EACtB,UAAU,GAAE,SAAS,YAAY,EAAO,GACvC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CA6BjC"}
|
package/dist/fold/subset.d.ts
CHANGED
|
@@ -175,8 +175,45 @@ import { type IntrinsicDef } from "../lexicon.js";
|
|
|
175
175
|
*
|
|
176
176
|
* `spec/VERSION` in the specification repository carries the same string, and
|
|
177
177
|
* the conformance adapter reads this one to fill its `specVersion` field.
|
|
178
|
+
*
|
|
179
|
+
* ## Why 1.6, and what each version since 1.0 asked for (chant#2445)
|
|
180
|
+
*
|
|
181
|
+
* Raising this is the last step of adopting a rule set, so each version was
|
|
182
|
+
* checked against what chant does rather than against whether the suite is
|
|
183
|
+
* green:
|
|
184
|
+
*
|
|
185
|
+
* - **1.1** added the two profiles. Its own changelog says nothing in `full`
|
|
186
|
+
* changed, so an implementation of 1.0 implements 1.1's `full` unchanged.
|
|
187
|
+
* - **1.2** added `S-LocalFunction`, which chant already folded in both forms,
|
|
188
|
+
* and `S-CallLocal`, which chant's classifier rejected until `chant-v0.72.0`
|
|
189
|
+
* (#2435). `S-ExportDefault` is `data-host`; the profile table records it in
|
|
190
|
+
* `full` as permitted, not required.
|
|
191
|
+
* - **1.3** dropped the number from `F-Eval-CallLocal` step 2, which chant
|
|
192
|
+
* satisfies by reporting the engine's stack overflow as a fallback under
|
|
193
|
+
* `F-Depth`, and clarified `F-Eval-Ident` step 3 with the reading both
|
|
194
|
+
* implementations already had.
|
|
195
|
+
* - **1.4** added the `F-Rule-*` family, extracted from chant's own
|
|
196
|
+
* post-synthesis engine. The conformance bridge answers all five fixtures
|
|
197
|
+
* with no disagreements.
|
|
198
|
+
* - **1.5** added `F-Val-Source`, and this is the one that looks like a gap and
|
|
199
|
+
* is not. The rule says that for every value of the domain there is source in
|
|
200
|
+
* the subset whose fold is that value: a property of the subset, not a demand
|
|
201
|
+
* that an implementation ship a generator. The round trip's fidelity half is
|
|
202
|
+
* named in the specification's README as an obligation on generators and
|
|
203
|
+
* explicitly not a rule. Inventory rows `L12.1` to `L12.4` record chant's
|
|
204
|
+
* generators against it. The conformance adapter's unanswered `generate`
|
|
205
|
+
* hook is a harness capability, not a rule chant fails.
|
|
206
|
+
* - **1.6** was written from chant's behaviour and no further: `F-Call` step 7
|
|
207
|
+
* binding whatever an invoked factory returns is what chant never checked
|
|
208
|
+
* (`L8.19`), and a declarator reaching a call through a const alias is what
|
|
209
|
+
* chant resolves while refusing a call nested elsewhere (`L2.18`).
|
|
210
|
+
*
|
|
211
|
+
* `scripts/check-docs-citations.ts` refuses to run when this constant and the
|
|
212
|
+
* pinned specification disagree, so `.github/workflows/docs-check.yml` pins the
|
|
213
|
+
* `spec-1.6` commit and the two move together. That coupling is deliberate: it
|
|
214
|
+
* is what stops the docs being gated against a rule set nobody writes against.
|
|
178
215
|
*/
|
|
179
|
-
export declare const SPEC_VERSION = "1.
|
|
216
|
+
export declare const SPEC_VERSION = "1.6";
|
|
180
217
|
/** The two EVL rule ids a shape violation can be attributed to. */
|
|
181
218
|
export type SubsetRuleId = "EVL001" | "EVL003";
|
|
182
219
|
/** A located, shape-level rejection: the offending node, the EVL rule id it maps to, and a message. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subset.d.ts","sourceRoot":"","sources":["../../src/fold/subset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AAEH
|
|
1
|
+
{"version":3,"file":"subset.d.ts","sourceRoot":"","sources":["../../src/fold/subset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C,uGAAuG;AACvG,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,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MG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,EAAE,CAAC,wBAAwB,EACjC,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,GACnC,eAAe,GAAG,SAAS,CAc7B;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,GACnC,eAAe,GAAG,SAAS,CAkO7B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export * from "./detectLexicon.js";
|
|
|
40
40
|
export * from "./fold/fold.js";
|
|
41
41
|
export { findSubsetViolation, checkObjectMember, collectLocalCallables, type SubsetViolation, type SubsetRuleId } from "./fold/subset.js";
|
|
42
42
|
export { SPEC_VERSION } from "./fold/subset.js";
|
|
43
|
-
export { foldProject, planFoldTaintWithEdges, type FoldProjectOptions, type FoldProjectVerdict, type TaintPlan, type TaintEdgeKind, } from "./discovery/fold-import.js";
|
|
43
|
+
export { foldProject, planFoldTaintWithEdges, type FoldProjectOptions, type FoldProjectVerdict, type TaintPlan, type TaintEdgeKind, foldExecutionCounts, resetFoldExecutionCounts, type FoldExecutionCounts, } from "./discovery/fold-import.js";
|
|
44
44
|
export * from "./lint/parser.js";
|
|
45
45
|
export * from "./lint/rule.js";
|
|
46
46
|
export * from "./lint/rules/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cA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C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAClE,cAAc,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC5F,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach } from "vitest";
|
|
2
|
+
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
foldProject,
|
|
7
|
+
foldExecutionCounts,
|
|
8
|
+
resetFoldExecutionCounts,
|
|
9
|
+
type FoldExecutionCounts,
|
|
10
|
+
} from "../index";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* chant#2446 — F-Obs-Counters, reachable from the public entry.
|
|
14
|
+
*
|
|
15
|
+
* Both functions were already exported from `discovery/fold-import`, but the
|
|
16
|
+
* public entry re-exports that module by name rather than wholesale, so a
|
|
17
|
+
* consumer importing `@intentius/chant` could not reach them. The
|
|
18
|
+
* specification's harness reports the three integers per build
|
|
19
|
+
* (INTENTIUS/typescript-as-data#121) and had to hold the fixture out for that
|
|
20
|
+
* reason alone.
|
|
21
|
+
*
|
|
22
|
+
* This is a gate against the export being dropped, not a test of the counting
|
|
23
|
+
* itself, which `fold-import.test.ts` already covers. It imports from `../index`
|
|
24
|
+
* on purpose: importing from the module would still pass with the entry broken,
|
|
25
|
+
* which is exactly the failure it exists to catch.
|
|
26
|
+
*/
|
|
27
|
+
describe("the fold execution counters are on the public entry (chant#2446)", () => {
|
|
28
|
+
let root: string;
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
root = mkdtempSync(join(tmpdir(), "chant-counters-"));
|
|
32
|
+
resetFoldExecutionCounts();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("both functions are exported and the snapshot has F-Obs-Counters' three integers", () => {
|
|
36
|
+
const counts = foldExecutionCounts();
|
|
37
|
+
expect(Object.keys(counts).sort()).toEqual([
|
|
38
|
+
"factoryInterpretations",
|
|
39
|
+
"factoryInvocations",
|
|
40
|
+
"projectFactoryInvocations",
|
|
41
|
+
]);
|
|
42
|
+
for (const v of Object.values(counts)) expect(typeof v).toBe("number");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("reset zeroes them, which is what makes a per-build figure possible", async () => {
|
|
46
|
+
const file = join(root, "app.ts");
|
|
47
|
+
writeFileSync(file, 'export const n = 1 + 1;\n');
|
|
48
|
+
await foldProject([file], []);
|
|
49
|
+
|
|
50
|
+
resetFoldExecutionCounts();
|
|
51
|
+
|
|
52
|
+
// The counters are process-wide and monotonic, so "per build" means
|
|
53
|
+
// zeroing first. A caller that could not reset would read this process's
|
|
54
|
+
// whole history and call it one build.
|
|
55
|
+
expect(foldExecutionCounts()).toEqual<FoldExecutionCounts>({
|
|
56
|
+
factoryInvocations: 0,
|
|
57
|
+
projectFactoryInvocations: 0,
|
|
58
|
+
factoryInterpretations: 0,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("a snapshot is a copy, so a caller cannot move the counters by holding one", () => {
|
|
63
|
+
const snapshot = foldExecutionCounts() as FoldExecutionCounts;
|
|
64
|
+
snapshot.factoryInvocations = 9999;
|
|
65
|
+
expect(foldExecutionCounts().factoryInvocations).not.toBe(9999);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { foldProject } from "../index";
|
|
6
|
+
import type { IntrinsicDef } from "../lexicon";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* chant#2441 — `F-Div-Depth` is a refusal, and a refusal must not be
|
|
10
|
+
* papered over by invoking instead.
|
|
11
|
+
*
|
|
12
|
+
* `divergence.md`'s L3.16 says a `new`, tagged template, helper call,
|
|
13
|
+
* intrinsic call or `.step` is not foldable inside a folded function body.
|
|
14
|
+
* `fold()` has always guarded this, and the guard fires: `callFoldableFunction`
|
|
15
|
+
* raises `functionBodyDepth` and `insideFunctionBody` throws.
|
|
16
|
+
*
|
|
17
|
+
* What went wrong was downstream. `resolveCallExpression` catches a fold
|
|
18
|
+
* failure on an imported callee and falls back to importing and invoking it —
|
|
19
|
+
* right when the body merely did not fold, wrong here, because the folder has
|
|
20
|
+
* DECLINED and invoking produces the envelope the fixture's own note warns
|
|
21
|
+
* about: a value the file's own declarators never produced.
|
|
22
|
+
*
|
|
23
|
+
* That direction is the whole point. Every other `F-Div` row is a fallback and
|
|
24
|
+
* `divergence.md` says so outright, which is what makes the direction safe.
|
|
25
|
+
* This one was not: chant produced a value where the specification says it must
|
|
26
|
+
* decline, the one outcome the fold path exists never to have.
|
|
27
|
+
*/
|
|
28
|
+
describe("a refusal at depth is not rescued by invoking (chant#2441)", () => {
|
|
29
|
+
let root: string;
|
|
30
|
+
const ref: IntrinsicDef = { name: "ref", lexicon: "shapes", foldsAsCall: true } as unknown as IntrinsicDef;
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
root = mkdtempSync(join(tmpdir(), "chant-div-depth-"));
|
|
34
|
+
const pkg = join(root, "node_modules", "@tsad", "shapes");
|
|
35
|
+
mkdirSync(pkg, { recursive: true });
|
|
36
|
+
writeFileSync(
|
|
37
|
+
join(pkg, "package.json"),
|
|
38
|
+
JSON.stringify({ name: "@tsad/shapes", version: "0.0.0", type: "module", main: "index.js" }),
|
|
39
|
+
);
|
|
40
|
+
writeFileSync(join(pkg, "index.js"), 'export function ref(x) { return { Ref: x }; }\n');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterEach(() => rmSync(root, { recursive: true, force: true }));
|
|
44
|
+
|
|
45
|
+
const write = (name: string, source: string): string => {
|
|
46
|
+
const p = join(root, name);
|
|
47
|
+
writeFileSync(p, source);
|
|
48
|
+
return p;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
test("an intrinsic call inside a project-local function refuses, rather than folding to a revived envelope", async () => {
|
|
52
|
+
const fn = write("fn.ts", 'import { ref } from "@tsad/shapes";\nexport function r() { return ref("x"); }\n');
|
|
53
|
+
const app = write("app.ts", 'import { r } from "./fn";\nexport const v = r();\n');
|
|
54
|
+
|
|
55
|
+
const verdicts = await foldProject([app, fn], [ref], { lexiconPackages: ["@tsad/shapes"] });
|
|
56
|
+
|
|
57
|
+
// Before the fix this was `fold` with v = {"Ref":"x"} — the host's `ref`
|
|
58
|
+
// actually invoked, its result revived, and the envelope surfacing in a
|
|
59
|
+
// file whose own declarators never produced one.
|
|
60
|
+
expect(verdicts.get(app)!.verdict).toBe("run");
|
|
61
|
+
expect(verdicts.get(app)!.reason).toMatch(/inside a folded function body is not foldable/);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("the reason names the callee and the position inside it, not just the call site", async () => {
|
|
65
|
+
const fn = write("fn.ts", 'import { ref } from "@tsad/shapes";\nexport function r() { return ref("x"); }\n');
|
|
66
|
+
const app = write("app.ts", 'import { r } from "./fn";\nexport const v = r();\n');
|
|
67
|
+
|
|
68
|
+
const reason = (await foldProject([app, fn], [ref], { lexiconPackages: ["@tsad/shapes"] })).get(app)!.reason!;
|
|
69
|
+
|
|
70
|
+
// The point of the re-anchoring in `callFoldableFunction`: the `[fold:run]`
|
|
71
|
+
// line says which function to fix and where, not merely that this call
|
|
72
|
+
// failed.
|
|
73
|
+
expect(reason).toContain('call to "r"');
|
|
74
|
+
expect(reason).toContain("fn.ts");
|
|
75
|
+
expect(reason).toContain("intrinsic call `ref(...)`");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("the same intrinsic call at the top level still folds, so the guard is about depth and nothing else", async () => {
|
|
79
|
+
// The refusal must not spread to the direct case, which is the ordinary way
|
|
80
|
+
// an intrinsic reaches a declarator and is exactly what should keep working.
|
|
81
|
+
const app = write("app.ts", 'import { ref } from "@tsad/shapes";\nexport const v = ref("x");\n');
|
|
82
|
+
|
|
83
|
+
const verdict = (await foldProject([app], [ref], { lexiconPackages: ["@tsad/shapes"] })).get(app)!;
|
|
84
|
+
|
|
85
|
+
expect(verdict.verdict).toBe("fold");
|
|
86
|
+
expect(JSON.parse(JSON.stringify(Object.fromEntries(verdict.exports!)))).toEqual({ v: { Ref: "x" } });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("an ordinary fold failure in an imported callee still falls back to invoking it", async () => {
|
|
90
|
+
// The fallback that #2441 narrowed is otherwise load-bearing: a helper whose
|
|
91
|
+
// body simply does not fold keeps folding by invocation, as it did before.
|
|
92
|
+
// Narrowing it to depth refusals only is the whole of the change.
|
|
93
|
+
const fn = write(
|
|
94
|
+
"fn.ts",
|
|
95
|
+
'export function r() {\n const parts = ["a", "b"];\n return { joined: parts.join("-") };\n}\n',
|
|
96
|
+
);
|
|
97
|
+
const app = write("app.ts", 'import { r } from "./fn";\nexport const v = r();\n');
|
|
98
|
+
|
|
99
|
+
const verdict = (await foldProject([app, fn], [], {})).get(app)!;
|
|
100
|
+
|
|
101
|
+
expect(verdict.verdict).toBe("fold");
|
|
102
|
+
expect(JSON.parse(JSON.stringify(Object.fromEntries(verdict.exports!)))).toEqual({ v: { joined: "a-b" } });
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { foldProject } from "../index";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* chant#2442 — a host may supply the composite registration form.
|
|
9
|
+
*
|
|
10
|
+
* `findCompositeDefinition` required `Composite` to be chant's own, which is
|
|
11
|
+
* right for a chant project and is the provenance question #1082 settled: a
|
|
12
|
+
* project-local `function Composite(...)` shadowing the name is not chant's,
|
|
13
|
+
* and a call to it is not a registered composite.
|
|
14
|
+
*
|
|
15
|
+
* It had never had to consider a HOST supplying the form
|
|
16
|
+
* (`F-Host-Composite`), because a chant project's active packages are always
|
|
17
|
+
* lexicons and no lexicon exports a `Composite`. Reaching it at all requires a
|
|
18
|
+
* caller that named its own host packages
|
|
19
|
+
* (`FoldProjectOptions.lexiconPackages`, chant#2438), so nothing about a chant
|
|
20
|
+
* build changes.
|
|
21
|
+
*
|
|
22
|
+
* Two halves, and the second is the one with teeth. Recognising the form gets
|
|
23
|
+
* interpretation started; the members it produces are then the HOST's, and
|
|
24
|
+
* wrapping them in chant's `Composite` would run chant's member validation,
|
|
25
|
+
* which asks for chant's own `Declarable` and rejects an entity carrying a
|
|
26
|
+
* different marker — rejecting it for not being chant's rather than for being
|
|
27
|
+
* malformed.
|
|
28
|
+
*/
|
|
29
|
+
describe("a host's composite registration form (chant#2442)", () => {
|
|
30
|
+
let root: string;
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
root = mkdtempSync(join(tmpdir(), "chant-host-composite-"));
|
|
34
|
+
const pkg = join(root, "node_modules", "@tsad", "shapes");
|
|
35
|
+
mkdirSync(pkg, { recursive: true });
|
|
36
|
+
writeFileSync(
|
|
37
|
+
join(pkg, "package.json"),
|
|
38
|
+
JSON.stringify({ name: "@tsad/shapes", version: "0.0.0", type: "module", main: "index.js" }),
|
|
39
|
+
);
|
|
40
|
+
// An entity carrying its OWN marker, not chant's, and the host's own
|
|
41
|
+
// registration form. This is the shape the specification's `shapes` host
|
|
42
|
+
// has and the reason chant's member validation refused it.
|
|
43
|
+
writeFileSync(
|
|
44
|
+
join(pkg, "index.js"),
|
|
45
|
+
[
|
|
46
|
+
"const MARK = Symbol.for('tsad.conformance.declarable');",
|
|
47
|
+
"export class Bucket {",
|
|
48
|
+
" constructor(props = {}) {",
|
|
49
|
+
" this.entityType = 'Bucket'; this.lexicon = 'shapes'; this.props = props;",
|
|
50
|
+
" Object.defineProperty(this, MARK, { value: true, enumerable: false });",
|
|
51
|
+
" }",
|
|
52
|
+
"}",
|
|
53
|
+
"export function Composite(factory, name) {",
|
|
54
|
+
" const d = (props) => factory(props); d.compositeName = name; return d;",
|
|
55
|
+
"}",
|
|
56
|
+
].join("\n") + "\n",
|
|
57
|
+
);
|
|
58
|
+
writeFileSync(
|
|
59
|
+
join(root, "shapes.ts"),
|
|
60
|
+
'import { Bucket, Composite } from "@tsad/shapes";\n' +
|
|
61
|
+
'export const Store = Composite(({ name }) => ({ bucket: new Bucket({ name }) }), "Store");\n',
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
afterEach(() => rmSync(root, { recursive: true, force: true }));
|
|
66
|
+
|
|
67
|
+
const app = (source: string): string => {
|
|
68
|
+
const file = join(root, "app.ts");
|
|
69
|
+
writeFileSync(file, source);
|
|
70
|
+
return file;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
test("a call to the host's composite folds to the host's own members", async () => {
|
|
74
|
+
const file = app('import { Store } from "./shapes";\nexport const s = Store({ name: "a" });\n');
|
|
75
|
+
|
|
76
|
+
// `--sandbox` is what the specification calls isolated, and it is the
|
|
77
|
+
// setting that proves interpretation rather than invocation: invoking would
|
|
78
|
+
// import a project module, which the sandbox refuses.
|
|
79
|
+
const verdict = (
|
|
80
|
+
await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"], sandbox: true })
|
|
81
|
+
).get(file)!;
|
|
82
|
+
|
|
83
|
+
expect(verdict.verdict).toBe("fold");
|
|
84
|
+
expect(JSON.parse(JSON.stringify(Object.fromEntries(verdict.exports!)))).toEqual({
|
|
85
|
+
s: { bucket: { entityType: "Bucket", lexicon: "shapes", props: { name: "a" } } },
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("a factory outside the subset is still refused rather than invoked", async () => {
|
|
90
|
+
// `S-FactoryParams`: two parameters is outside it, so interpretation
|
|
91
|
+
// declines and the invocation arm refuses under the sandbox.
|
|
92
|
+
writeFileSync(
|
|
93
|
+
join(root, "shapes.ts"),
|
|
94
|
+
'import { Bucket, Composite } from "@tsad/shapes";\n' +
|
|
95
|
+
'export const Two = Composite((a, b) => ({ bucket: new Bucket({ name: a.name + b }) }), "Two");\n',
|
|
96
|
+
);
|
|
97
|
+
const file = app('import { Two } from "./shapes";\nexport const s = Two({ name: "a" }, "b");\n');
|
|
98
|
+
|
|
99
|
+
const verdict = (
|
|
100
|
+
await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"], sandbox: true })
|
|
101
|
+
).get(file)!;
|
|
102
|
+
|
|
103
|
+
expect(verdict.verdict).toBe("run");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("the form is only recognised when the caller named the package", async () => {
|
|
107
|
+
const file = app('import { Store } from "./shapes";\nexport const s = Store({ name: "a" });\n');
|
|
108
|
+
|
|
109
|
+
// Unnamed, the host package is not resolvable, so nothing about the
|
|
110
|
+
// registration form is reached and the sandbox refuses the invocation arm.
|
|
111
|
+
const verdict = (await foldProject([file], [], { sandbox: true })).get(file)!;
|
|
112
|
+
|
|
113
|
+
expect(verdict.verdict).toBe("run");
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -1459,6 +1459,16 @@ async function resolveCallExpression(node: ts.CallExpression, ctx: ResolveCtx):
|
|
|
1459
1459
|
foldFailure = err;
|
|
1460
1460
|
}
|
|
1461
1461
|
if (!binding) throw foldFailure;
|
|
1462
|
+
// chant#2441 — `F-Div-Depth` is a refusal, not a failure to try hard
|
|
1463
|
+
// enough. The fallback below imports the callee and invokes it, which is
|
|
1464
|
+
// right when its body merely did not fold; here the folder has DECLINED,
|
|
1465
|
+
// and invoking anyway produces exactly the envelope the specification says
|
|
1466
|
+
// must not appear — a value the file's own declarators never produced.
|
|
1467
|
+
//
|
|
1468
|
+
// Every other `F-Div` row is a fallback and `divergence.md` says so
|
|
1469
|
+
// outright, which is what makes the direction safe. This one is not, so it
|
|
1470
|
+
// propagates and the file runs, which is what the reference does.
|
|
1471
|
+
if (foldFailure instanceof FoldError && foldFailure.refusedAtDepth) throw foldFailure;
|
|
1462
1472
|
try {
|
|
1463
1473
|
return await resolveImportedCall(node, calleeName, binding, ctx);
|
|
1464
1474
|
} catch (err) {
|
|
@@ -1857,6 +1867,16 @@ interface InterpretableFactory {
|
|
|
1857
1867
|
fn: ts.ArrowFunction | ts.FunctionExpression;
|
|
1858
1868
|
/** `Composite()`'s second argument, or `"anonymous"` when it has none — matching {@link Composite}'s own default. */
|
|
1859
1869
|
compositeName: string;
|
|
1870
|
+
/**
|
|
1871
|
+
* chant#2442 — the registration form came from a HOST the caller named
|
|
1872
|
+
* ({@link FoldSession.lexiconPackages}), not from chant.
|
|
1873
|
+
*
|
|
1874
|
+
* The members are then the host's own, so they are returned as the factory
|
|
1875
|
+
* produced them rather than wrapped in chant's {@link Composite}, whose
|
|
1876
|
+
* member validation asks for chant's own `Declarable` and would reject an
|
|
1877
|
+
* entity carrying a different marker. Chant's own form is untouched.
|
|
1878
|
+
*/
|
|
1879
|
+
hostForm: boolean;
|
|
1860
1880
|
}
|
|
1861
1881
|
|
|
1862
1882
|
/**
|
|
@@ -1937,7 +1957,7 @@ function findCompositeDefinition(
|
|
|
1937
1957
|
scope: FactoryModuleScope,
|
|
1938
1958
|
exportName: string,
|
|
1939
1959
|
ctx: ResolveCtx,
|
|
1940
|
-
): { fn: ts.ArrowFunction | ts.FunctionExpression; compositeName: string } | undefined {
|
|
1960
|
+
): { fn: ts.ArrowFunction | ts.FunctionExpression; compositeName: string; hostForm: boolean } | undefined {
|
|
1941
1961
|
for (const statement of scope.sourceFile.statements) {
|
|
1942
1962
|
if (!ts.isVariableStatement(statement)) continue;
|
|
1943
1963
|
if (!hasExportModifier(statement)) continue;
|
|
@@ -1955,7 +1975,16 @@ function findCompositeDefinition(
|
|
|
1955
1975
|
// call to it is not a registered composite.
|
|
1956
1976
|
const compositeBinding = scope.imports.get(init.expression.text);
|
|
1957
1977
|
if (!compositeBinding || compositeBinding.imported !== "Composite") return undefined;
|
|
1958
|
-
|
|
1978
|
+
// chant's own is the answer for every chant project, and #1082's
|
|
1979
|
+
// provenance question is why: a project-local `function Composite(...)`
|
|
1980
|
+
// shadowing the name is not chant's. chant#2442 adds the case chant had
|
|
1981
|
+
// never had to consider, a HOST supplying the form (`F-Host-Composite`),
|
|
1982
|
+
// which only a caller that named its own host packages can reach. For a
|
|
1983
|
+
// chant build the set holds only `@intentius/chant-lexicon-*`, and no
|
|
1984
|
+
// lexicon exports a `Composite`, so nothing about a chant project moves.
|
|
1985
|
+
const chantOwned = isChantOwnedHelperBinding(compositeBinding, { ...ctx, file: scope.file });
|
|
1986
|
+
const hostOwned = activeLexiconPackage(compositeBinding.specifier, ctx.lexiconPackages) !== undefined;
|
|
1987
|
+
if (!chantOwned && !hostOwned) return undefined;
|
|
1959
1988
|
|
|
1960
1989
|
const [fnArg, nameArg] = init.arguments;
|
|
1961
1990
|
if (!fnArg || (!ts.isArrowFunction(fnArg) && !ts.isFunctionExpression(fnArg))) return undefined;
|
|
@@ -1963,7 +1992,7 @@ function findCompositeDefinition(
|
|
|
1963
1992
|
// COR017 requires the literal in practice; anything that is not a plain
|
|
1964
1993
|
// string literal is not something to guess at.
|
|
1965
1994
|
if (nameArg !== undefined && !ts.isStringLiteral(nameArg)) return undefined;
|
|
1966
|
-
return { fn: fnArg, compositeName: nameArg ? nameArg.text : "anonymous" };
|
|
1995
|
+
return { fn: fnArg, compositeName: nameArg ? nameArg.text : "anonymous", hostForm: !chantOwned };
|
|
1967
1996
|
}
|
|
1968
1997
|
}
|
|
1969
1998
|
return undefined;
|
|
@@ -2011,7 +2040,7 @@ async function resolveInterpretableFactory(
|
|
|
2011
2040
|
// Rules 3-5.
|
|
2012
2041
|
if (findFactorySubsetViolation(definition.fn) !== undefined) return undefined;
|
|
2013
2042
|
|
|
2014
|
-
return { scope, fn: definition.fn, compositeName: definition.compositeName };
|
|
2043
|
+
return { scope, fn: definition.fn, compositeName: definition.compositeName, hostForm: definition.hostForm };
|
|
2015
2044
|
}
|
|
2016
2045
|
|
|
2017
2046
|
/**
|
|
@@ -2365,10 +2394,17 @@ async function interpretCompositeFactory(
|
|
|
2365
2394
|
// one per module, as the run path has) is the single visible difference:
|
|
2366
2395
|
// `_id` is a fresh symbol, which nothing outside `CompositeRegistry` — used
|
|
2367
2396
|
// only by tests — reads.
|
|
2368
|
-
|
|
2369
|
-
|
|
2397
|
+
// chant#2442 — a HOST's registration form produces the host's own members,
|
|
2398
|
+
// so they are returned as the factory built them. Wrapping them in chant's
|
|
2399
|
+
// `Composite` would run chant's member validation, which asks for chant's
|
|
2400
|
+
// own `Declarable` and rejects an entity carrying a different marker —
|
|
2401
|
+
// rejecting it for not being chant's rather than for being malformed.
|
|
2402
|
+
// Chant's own form still goes through `Composite`, unchanged.
|
|
2403
|
+
const value = factory.hostForm
|
|
2404
|
+
? members
|
|
2405
|
+
: (Composite<void, CompositeMembers>(() => members as CompositeMembers, factory.compositeName))();
|
|
2370
2406
|
executionCounts.factoryInterpretations += 1;
|
|
2371
|
-
return { value
|
|
2407
|
+
return { value };
|
|
2372
2408
|
} catch (err) {
|
|
2373
2409
|
// Every other failure here means "this body did not interpret" and the
|
|
2374
2410
|
// caller invokes instead. Exhausting the depth bound means "we stopped
|
package/src/fold/fold.ts
CHANGED
|
@@ -383,8 +383,22 @@ export class FoldError extends Error {
|
|
|
383
383
|
readonly line: number;
|
|
384
384
|
readonly column: number;
|
|
385
385
|
readonly ruleId: SubsetRuleId;
|
|
386
|
+
/**
|
|
387
|
+
* This refusal is `F-Div-Depth` (chant#2441), not an ordinary fold failure.
|
|
388
|
+
*
|
|
389
|
+
* The distinction is load-bearing rather than informational. An ordinary
|
|
390
|
+
* failure to fold an imported call is allowed to fall back to importing and
|
|
391
|
+
* invoking the callee, which is `resolveCallExpression`'s pre-#1373 arm and
|
|
392
|
+
* is right for a helper that wraps a composite call. A depth refusal must
|
|
393
|
+
* NOT take that arm: the specification says the folder declines here, and
|
|
394
|
+
* invoking instead produces the envelope the fixture's own note warns about
|
|
395
|
+
* — a value the file's own declarators never produced. Unlike every other
|
|
396
|
+
* `F-Div` row this one is not a fallback, so papering over it is wrong
|
|
397
|
+
* output rather than a safe degradation.
|
|
398
|
+
*/
|
|
399
|
+
readonly refusedAtDepth: boolean;
|
|
386
400
|
|
|
387
|
-
constructor(message: string, line: number, column: number, ruleId: SubsetRuleId = "EVL001") {
|
|
401
|
+
constructor(message: string, line: number, column: number, ruleId: SubsetRuleId = "EVL001", refusedAtDepth = false) {
|
|
388
402
|
const prevStackTraceLimit = Error.stackTraceLimit;
|
|
389
403
|
Error.stackTraceLimit = 0;
|
|
390
404
|
super(`${line}:${column} - ${message}`);
|
|
@@ -393,6 +407,7 @@ export class FoldError extends Error {
|
|
|
393
407
|
this.line = line;
|
|
394
408
|
this.column = column;
|
|
395
409
|
this.ruleId = ruleId;
|
|
410
|
+
this.refusedAtDepth = refusedAtDepth;
|
|
396
411
|
}
|
|
397
412
|
}
|
|
398
413
|
|
|
@@ -690,7 +705,7 @@ const MAX_FUNCTION_CALL_DEPTH = 32;
|
|
|
690
705
|
|
|
691
706
|
function insideFunctionBody(node: ts.Node, what: string): FoldError | undefined {
|
|
692
707
|
if (functionBodyDepth === 0) return undefined;
|
|
693
|
-
return foldError(node, `${what} inside a folded function body is not foldable
|
|
708
|
+
return foldError(node, `${what} inside a folded function body is not foldable`, "EVL001", true);
|
|
694
709
|
}
|
|
695
710
|
|
|
696
711
|
function fileLabel(file: string): string {
|
|
@@ -769,6 +784,10 @@ function callFoldableFunction(
|
|
|
769
784
|
node,
|
|
770
785
|
`${label} is not foldable: ${fileLabel(callee.file)}:${err.line}:${err.column} - ${reason}`,
|
|
771
786
|
err.ruleId,
|
|
787
|
+
// chant#2441 — the refusal happened inside the callee's body and this
|
|
788
|
+
// frame is the CALL site, so without carrying the flag the caller sees
|
|
789
|
+
// an ordinary failure and falls back to invoking.
|
|
790
|
+
err.refusedAtDepth,
|
|
772
791
|
);
|
|
773
792
|
} finally {
|
|
774
793
|
functionBodyDepth -= 1;
|
|
@@ -823,9 +842,9 @@ export function locate(node: ts.Node): { line: number; column: number } {
|
|
|
823
842
|
return { line: line + 1, column: character + 1 };
|
|
824
843
|
}
|
|
825
844
|
|
|
826
|
-
function foldError(node: ts.Node, message: string, ruleId: SubsetRuleId = "EVL001"): FoldError {
|
|
845
|
+
function foldError(node: ts.Node, message: string, ruleId: SubsetRuleId = "EVL001", refusedAtDepth = false): FoldError {
|
|
827
846
|
const { line, column } = locate(node);
|
|
828
|
-
return new FoldError(message, line, column, ruleId);
|
|
847
|
+
return new FoldError(message, line, column, ruleId, refusedAtDepth);
|
|
829
848
|
}
|
|
830
849
|
|
|
831
850
|
/**
|
package/src/fold/subset.ts
CHANGED
|
@@ -178,8 +178,45 @@ import { intrinsicCallFolds, intrinsicCallFoldsEagerly, type IntrinsicDef } from
|
|
|
178
178
|
*
|
|
179
179
|
* `spec/VERSION` in the specification repository carries the same string, and
|
|
180
180
|
* the conformance adapter reads this one to fill its `specVersion` field.
|
|
181
|
+
*
|
|
182
|
+
* ## Why 1.6, and what each version since 1.0 asked for (chant#2445)
|
|
183
|
+
*
|
|
184
|
+
* Raising this is the last step of adopting a rule set, so each version was
|
|
185
|
+
* checked against what chant does rather than against whether the suite is
|
|
186
|
+
* green:
|
|
187
|
+
*
|
|
188
|
+
* - **1.1** added the two profiles. Its own changelog says nothing in `full`
|
|
189
|
+
* changed, so an implementation of 1.0 implements 1.1's `full` unchanged.
|
|
190
|
+
* - **1.2** added `S-LocalFunction`, which chant already folded in both forms,
|
|
191
|
+
* and `S-CallLocal`, which chant's classifier rejected until `chant-v0.72.0`
|
|
192
|
+
* (#2435). `S-ExportDefault` is `data-host`; the profile table records it in
|
|
193
|
+
* `full` as permitted, not required.
|
|
194
|
+
* - **1.3** dropped the number from `F-Eval-CallLocal` step 2, which chant
|
|
195
|
+
* satisfies by reporting the engine's stack overflow as a fallback under
|
|
196
|
+
* `F-Depth`, and clarified `F-Eval-Ident` step 3 with the reading both
|
|
197
|
+
* implementations already had.
|
|
198
|
+
* - **1.4** added the `F-Rule-*` family, extracted from chant's own
|
|
199
|
+
* post-synthesis engine. The conformance bridge answers all five fixtures
|
|
200
|
+
* with no disagreements.
|
|
201
|
+
* - **1.5** added `F-Val-Source`, and this is the one that looks like a gap and
|
|
202
|
+
* is not. The rule says that for every value of the domain there is source in
|
|
203
|
+
* the subset whose fold is that value: a property of the subset, not a demand
|
|
204
|
+
* that an implementation ship a generator. The round trip's fidelity half is
|
|
205
|
+
* named in the specification's README as an obligation on generators and
|
|
206
|
+
* explicitly not a rule. Inventory rows `L12.1` to `L12.4` record chant's
|
|
207
|
+
* generators against it. The conformance adapter's unanswered `generate`
|
|
208
|
+
* hook is a harness capability, not a rule chant fails.
|
|
209
|
+
* - **1.6** was written from chant's behaviour and no further: `F-Call` step 7
|
|
210
|
+
* binding whatever an invoked factory returns is what chant never checked
|
|
211
|
+
* (`L8.19`), and a declarator reaching a call through a const alias is what
|
|
212
|
+
* chant resolves while refusing a call nested elsewhere (`L2.18`).
|
|
213
|
+
*
|
|
214
|
+
* `scripts/check-docs-citations.ts` refuses to run when this constant and the
|
|
215
|
+
* pinned specification disagree, so `.github/workflows/docs-check.yml` pins the
|
|
216
|
+
* `spec-1.6` commit and the two move together. That coupling is deliberate: it
|
|
217
|
+
* is what stops the docs being gated against a rule set nobody writes against.
|
|
181
218
|
*/
|
|
182
|
-
export const SPEC_VERSION = "1.
|
|
219
|
+
export const SPEC_VERSION = "1.6";
|
|
183
220
|
|
|
184
221
|
/** The two EVL rule ids a shape violation can be attributed to. */
|
|
185
222
|
export type SubsetRuleId = "EVL001" | "EVL003";
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,16 @@ export {
|
|
|
61
61
|
type FoldProjectVerdict,
|
|
62
62
|
type TaintPlan,
|
|
63
63
|
type TaintEdgeKind,
|
|
64
|
+
// F-Obs-Counters' three integers: what a build invoked, what it invoked from
|
|
65
|
+
// project code, and what it interpreted instead. Already exported from the
|
|
66
|
+
// module; on the public entry so a conformance harness can report them per
|
|
67
|
+
// build (chant#2446, INTENTIUS/typescript-as-data#121). The counters are
|
|
68
|
+
// process-wide and monotonic, so a per-build figure means calling
|
|
69
|
+
// `resetFoldExecutionCounts()` first — which is why both travel together and
|
|
70
|
+
// neither is useful alone.
|
|
71
|
+
foldExecutionCounts,
|
|
72
|
+
resetFoldExecutionCounts,
|
|
73
|
+
type FoldExecutionCounts,
|
|
64
74
|
} from "./discovery/fold-import";
|
|
65
75
|
export * from "./lint/parser";
|
|
66
76
|
export * from "./lint/rule";
|