@systemfsoftware/effect-sim-kernel 0.1.0 → 0.1.1
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/CHANGELOG.md +6 -0
- package/README.md +6 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +14 -19
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @systemfsoftware/effect-sim-kernel
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- The `nightly` profile is removed. `ProfileName` is now `'local' | 'per-change'`, and `CONFORMANCE_PROFILE=nightly` falls back to `per-change` (250 seeds) instead of deriving a seed count from a 1% miss rate. Callers passing `'nightly'` to `Kernel.seedsFor` no longer type-check.
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -105,3 +105,9 @@ pnpm --filter @systemfsoftware/effect-sim-kernel lint
|
|
|
105
105
|
pnpm --filter @systemfsoftware/effect-sim-kernel typecheck
|
|
106
106
|
pnpm --filter @systemfsoftware/effect-sim-kernel build
|
|
107
107
|
```
|
|
108
|
+
|
|
109
|
+
The kernel's behaviour suite lives in the private `packages/effect-sim-kernel-tests` package, because the Gherkin runner it is written in runs on this kernel:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pnpm --filter @systemfsoftware/effect-sim-kernel-tests test
|
|
113
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -271,12 +271,11 @@ declare const pct: {
|
|
|
271
271
|
//#region src/Kernel/Profile.d.ts
|
|
272
272
|
/**
|
|
273
273
|
* How much schedule exploration a run buys. `per-change` is the budget a pull
|
|
274
|
-
* request is judged on; `
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* checks run at the per-change budget in CI.
|
|
274
|
+
* request is judged on; `local` is a developer's own machine, which caps the
|
|
275
|
+
* preemption bound and the seed count so feedback stays fast. A local pass is
|
|
276
|
+
* not the verdict: the same checks run at the per-change budget in CI.
|
|
278
277
|
*/
|
|
279
|
-
type ProfileName = 'local' | 'per-change'
|
|
278
|
+
type ProfileName = 'local' | 'per-change';
|
|
280
279
|
declare const pctDepth = 3;
|
|
281
280
|
declare const perChangeSeeds = 250;
|
|
282
281
|
declare const localSeeds = 25;
|
package/dist/index.mjs
CHANGED
|
@@ -10,24 +10,15 @@ const unpruned = (disabledBy) => ({
|
|
|
10
10
|
enabled: false,
|
|
11
11
|
disabledBy
|
|
12
12
|
});
|
|
13
|
-
const
|
|
14
|
-
const PROFILES = {
|
|
15
|
-
local: "local",
|
|
16
|
-
nightly: "nightly"
|
|
17
|
-
};
|
|
13
|
+
const PROFILES = { local: "local" };
|
|
18
14
|
const profileOf = (name) => PROFILES[name] ?? "per-change";
|
|
19
15
|
const currentProfile = Effect.map(Config.option(Config.String("CONFORMANCE_PROFILE")), Option.match({
|
|
20
16
|
onNone: () => profileOf(""),
|
|
21
17
|
onSome: profileOf
|
|
22
18
|
}));
|
|
23
|
-
const bugProbability = (fibers, steps) => 1 / (fibers * steps ** 2);
|
|
24
|
-
const nightlyRuns = (fibers, steps) => Math.ceil(Math.log(nightlyMissRate) / Math.log(1 - bugProbability(fibers, steps)));
|
|
25
|
-
const nightlyOf = (budget) => nightlyRuns(budget.fibers, budget.steps);
|
|
26
|
-
const hasWork = (budget) => budget.fibers > 0 && budget.steps > 0;
|
|
27
19
|
const SEEDS = {
|
|
28
20
|
local: () => 25,
|
|
29
|
-
"per-change": () => 250
|
|
30
|
-
nightly: (budget) => hasWork(budget) ? nightlyOf(budget) : 250
|
|
21
|
+
"per-change": () => 250
|
|
31
22
|
};
|
|
32
23
|
const seedsForImpl = (budget, profile = "per-change") => SEEDS[profile](budget);
|
|
33
24
|
const isBudgetFirst = (args) => args.length === 0 || typeof args[0] !== "string";
|
|
@@ -1553,7 +1544,6 @@ const PRIMITIVES = {
|
|
|
1553
1544
|
const failKept$1 = (result) => "failure" in result;
|
|
1554
1545
|
const DEFAULT_PREEMPTIONS = 2;
|
|
1555
1546
|
const DEFAULT_MAX_SCHEDULES = 1e5;
|
|
1556
|
-
const branchable = (position, explored) => position >= explored;
|
|
1557
1547
|
const distinctFibers = (result) => new Set(result.steps.map((step) => step.fiberId)).size;
|
|
1558
1548
|
const preemptionsOf = (options) => options.preemptions ?? DEFAULT_PREEMPTIONS;
|
|
1559
1549
|
const maxSchedulesOf = (options) => options.maxSchedules ?? DEFAULT_MAX_SCHEDULES;
|
|
@@ -1613,7 +1603,14 @@ const runOptions = (state, choose) => {
|
|
|
1613
1603
|
maxSteps
|
|
1614
1604
|
};
|
|
1615
1605
|
};
|
|
1616
|
-
const
|
|
1606
|
+
const deviationsBefore = (steps) => {
|
|
1607
|
+
let spent = 0;
|
|
1608
|
+
return steps.map((step) => {
|
|
1609
|
+
const before = spent;
|
|
1610
|
+
spent += Number(step.deviation);
|
|
1611
|
+
return before;
|
|
1612
|
+
});
|
|
1613
|
+
};
|
|
1617
1614
|
const indices$1 = (count) => Array.from({ length: count }, (_value, index) => index);
|
|
1618
1615
|
const preemptableStep = (state, visible) => pruningLive(state) ? visible : true;
|
|
1619
1616
|
const branchCost = (fallback, alt, spent) => alt === fallback ? spent : spent + 1;
|
|
@@ -1629,20 +1626,18 @@ const visibleBranch = (state, step, position, choices, spent, alt) => {
|
|
|
1629
1626
|
if (branchSkipped(step, alt, preemptableStep(state, step.visible))) return void 0;
|
|
1630
1627
|
return altBranch(state, step.fallback, position, choices, spent, alt);
|
|
1631
1628
|
};
|
|
1632
|
-
const stepBranches = (state, result, position) => {
|
|
1629
|
+
const stepBranches = (state, result, position, spent) => {
|
|
1633
1630
|
const step = result.steps[position];
|
|
1634
1631
|
if (step === void 0) return [];
|
|
1635
|
-
const spent = spentAt(result, position);
|
|
1636
1632
|
return indices$1(step.options).flatMap((alt) => {
|
|
1637
1633
|
const branch = visibleBranch(state, step, position, result.decisions, spent, alt);
|
|
1638
1634
|
return branch === void 0 ? [] : [branch];
|
|
1639
1635
|
});
|
|
1640
1636
|
};
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1643
|
-
return stepBranches(state, result,
|
|
1637
|
+
const branchesOf = (state, result, explored) => {
|
|
1638
|
+
const spent = deviationsBefore(result.steps);
|
|
1639
|
+
return result.decisions.slice(explored).flatMap((_decision, offset) => stepBranches(state, result, explored + offset, spent[explored + offset] ?? 0));
|
|
1644
1640
|
};
|
|
1645
|
-
const branchesOf = (state, result, explored) => result.decisions.flatMap((_decision, position) => freshBranches(state, result, explored, position));
|
|
1646
1641
|
const absorb = (state, observed) => {
|
|
1647
1642
|
state.schedules += 1;
|
|
1648
1643
|
state.collected.push(...observed.unobserved);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-sim-kernel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@microsoft/api-extractor": "^7.59.1",
|
|
36
|
-
"@systemfsoftware/effect-gherkin-spec": "^5.0.0",
|
|
37
36
|
"@systemfsoftware/oxlint-config-recommended": "^3.1.0",
|
|
38
37
|
"@systemfsoftware/tsconfig": "^2.0.1",
|
|
39
38
|
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
40
|
-
"@systemfsoftware/vitest": "^0.
|
|
39
|
+
"@systemfsoftware/vitest": "^0.1.0",
|
|
41
40
|
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
42
41
|
"@types/node": "^26",
|
|
43
42
|
"effect": "4.0.0-rc.117",
|