gdp-wired 0.50.4 → 0.50.6
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/core/extract-check.d.ts +1 -0
- package/dist/core/extract-check.js +4 -4
- package/dist/core/extract-py.js +11 -1
- package/dist/core/extract-step.js +3 -3
- package/dist/core/fixtures/peterson-search.json +1453 -0
- package/dist/core/machine.js +3 -7
- package/dist/core/py/harness.py +125 -16
- package/package.json +1 -1
|
@@ -645,7 +645,7 @@ export function drive(m, r, sorts, code, opts = {}) {
|
|
|
645
645
|
}
|
|
646
646
|
// Result fields in a prover witness are not state held by a pure
|
|
647
647
|
// function. Compare the returned value below, never carry those fields.
|
|
648
|
-
res = c.ok ? { snap: { leaves: {}, maps: {} }, out: c.value } : { refused: c.error };
|
|
648
|
+
res = c.ok ? { snap: { leaves: {}, maps: {} }, out: c.value, nativeFailed: c.nativeFailed } : { refused: c.error };
|
|
649
649
|
}
|
|
650
650
|
else if (isClass) {
|
|
651
651
|
const self = side.self, c = code.call(self, e, args);
|
|
@@ -657,7 +657,7 @@ export function drive(m, r, sorts, code, opts = {}) {
|
|
|
657
657
|
if (!c.ok)
|
|
658
658
|
res = { refused: c.error };
|
|
659
659
|
else
|
|
660
|
-
res = { snap: code.snapOf(self, params), out: c.value, self };
|
|
660
|
+
res = { snap: code.snapOf(self, params), out: c.value, self, nativeFailed: c.nativeFailed };
|
|
661
661
|
}
|
|
662
662
|
else {
|
|
663
663
|
const c = code.reduce(side.snap, e, args, params);
|
|
@@ -789,7 +789,7 @@ export function drive(m, r, sorts, code, opts = {}) {
|
|
|
789
789
|
});
|
|
790
790
|
const rk = m.results?.[e.call];
|
|
791
791
|
journal.observations.push({ where, method: e.call, before, after, params: { ...params }, inputs: { ...inputs }, bindings: bindings ?? fallback,
|
|
792
|
-
args: nativeArgs ?? [], result, failed: false, ...(observed ? { observed } : {}), ...(code.nativeEquality ? { nativeEquality: code.nativeEquality } : {}), legacyResult: !standalone && rk?.k === 'rec' && rk.fields.some(([field]) => field === 'value') });
|
|
792
|
+
args: nativeArgs ?? [], result, failed: res.nativeFailed ?? false, ...(observed ? { observed } : {}), ...(code.nativeEquality ? { nativeEquality: code.nativeEquality } : {}), legacyResult: !standalone && rk?.k === 'rec' && rk.fields.some(([field]) => field === 'value') });
|
|
793
793
|
}
|
|
794
794
|
next.side = afterSide;
|
|
795
795
|
next.st = rule.st;
|
|
@@ -1055,7 +1055,7 @@ export function drive(m, r, sorts, code, opts = {}) {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
if (!journal.reason)
|
|
1057
1057
|
journal.observations.push({ where: `exhaustive native input ${++ordinal}`, method: event.call,
|
|
1058
|
-
before: {}, after: {}, params: {}, inputs: {}, bindings, args: savedArgs, result, failed: false, ...(observed ? { observed } : {}), ...(code.nativeEquality ? { nativeEquality: code.nativeEquality } : {}) });
|
|
1058
|
+
before: {}, after: {}, params: {}, inputs: {}, bindings, args: savedArgs, result, failed: returned.nativeFailed ?? false, ...(observed ? { observed } : {}), ...(code.nativeEquality ? { nativeEquality: code.nativeEquality } : {}) });
|
|
1059
1059
|
return;
|
|
1060
1060
|
}
|
|
1061
1061
|
for (const value of finite[at])
|
package/dist/core/extract-py.js
CHANGED
|
@@ -26,6 +26,16 @@ export function extractPython(at, opts = {}) {
|
|
|
26
26
|
return { ok: false, refusals: [{ where: e.where, what: e.what }], notes: [] };
|
|
27
27
|
throw e;
|
|
28
28
|
}
|
|
29
|
-
const harness = () =>
|
|
29
|
+
const harness = (read) => {
|
|
30
|
+
const methods = read.cls ? mod.recs[read.cls]?.methods : Object.fromEntries(mod.entries.flatMap(e => e.k === 'func' ? [[mod.funcs[e.id].name, e.id]] : []));
|
|
31
|
+
const nativeMethods = Object.fromEntries(Object.keys(read.args).flatMap(name => {
|
|
32
|
+
const id = methods?.[name], f = id ? mod.funcs[id] : undefined;
|
|
33
|
+
if (!f)
|
|
34
|
+
return [];
|
|
35
|
+
const decorators = f.decorators.map(d => Number(/:(\d+):\d+$/.exec(d.p)?.[1])).filter(Number.isFinite);
|
|
36
|
+
return [[name, { file: f.span[0], line: Math.min(f.span[1], ...decorators) }]];
|
|
37
|
+
}));
|
|
38
|
+
return { cmd: opts.python ?? 'python3', args: [here('harness.py')], env: { PYTHONDONTWRITEBYTECODE: '1', ...(opts.djangoSettings ? { DJANGO_SETTINGS_MODULE: opts.djangoSettings } : {}) }, hello: { root: mod.root, path: mod.path, module: mod.module, nativeMethods } };
|
|
39
|
+
};
|
|
30
40
|
return extractStep(mod, harness, opts);
|
|
31
41
|
}
|
|
@@ -6708,9 +6708,9 @@ function checkStepOnce(h, read, r, sorts, opts) {
|
|
|
6708
6708
|
const out = res.out;
|
|
6709
6709
|
const rk = m.results?.[e.call];
|
|
6710
6710
|
if (!rk)
|
|
6711
|
-
return { ok: true, value: undefined };
|
|
6711
|
+
return { ok: true, value: undefined, nativeFailed: failed };
|
|
6712
6712
|
if (rk.k === 'scalar')
|
|
6713
|
-
return { ok: true, value: value(out) };
|
|
6713
|
+
return { ok: true, value: value(out), nativeFailed: failed };
|
|
6714
6714
|
const o = {};
|
|
6715
6715
|
for (const [f] of rk.fields) {
|
|
6716
6716
|
if (f === 'failed')
|
|
@@ -6724,7 +6724,7 @@ function checkStepOnce(h, read, r, sorts, opts) {
|
|
|
6724
6724
|
if (f.startsWith('effect:'))
|
|
6725
6725
|
o[f] = !!res.effects?.[f.slice(7)];
|
|
6726
6726
|
}
|
|
6727
|
-
return { ok: true, value: o };
|
|
6727
|
+
return { ok: true, value: o, nativeFailed: failed };
|
|
6728
6728
|
},
|
|
6729
6729
|
...(native ? { nativeState: (self) => {
|
|
6730
6730
|
const result = ask({ op: 'native', id: self });
|