1.13.0: measure + evidence compose; value-graph now a registry dep
CI / test (push) Successful in 24s
CI / publish (push) Failing after 10s

- DSLValueGraph integrates the evidence DSL with @arbiter/value-graph: measures
  become typed value-graph nodes; attach() wires runtime.measure through the graph.
- DSLRuntime.check() now retrieves required MEASURE values and injects them as
  value-carrying self-edges, so an evidence comparator over a measure (e.g.
  budget_used(user) <= budget_limit(user)) evaluates — measure and evidence
  compose (provider-sourced AND value-graph-sourced), with 3 new composition tests.
- BUILTIN_TYPES: bigint → buffer (the value-graph wire is JSON-free/bigint-free).
- @arbiter/value-graph: file:../value-graph → ^0.1.0 (registry); CI auth adds
  @push-stream-std registry for the transitive dep.
- rigor core ^3.1.2 / probe ^0.0.8.
This commit is contained in:
2026-08-04 17:51:13 -07:00
parent b145c979ab
commit 7898a7990a
14 changed files with 1421 additions and 87 deletions
+26
View File
@@ -0,0 +1,26 @@
// DSLValueGraph measure hotpath (async retrieval for authorization checks).
import { performance } from 'node:perf_hooks';
import { DSLRuntime, DSLValueGraph } from '../src/index.js';
import { Arbiter } from '@arbiter/core';
const rt = new DSLRuntime(new Arbiter()).compile('measure budget(user: string) { } PROVIDES number', 'bench');
const dvg = new DSLValueGraph(rt);
dvg.attach();
dvg.setValue('budget', { __subject: 'u:1', user: 'u:1' }, 1250);
async function measureCached() { return dvg.measure('budget', { __subject: 'u:1', user: 'u:1' }); }
await measureCached(); // warm
let t0 = performance.now();
let N = 20_000;
for (let i = 0; i < N; i++) await measureCached();
console.log(`dvg.measure cached (async) ${(((performance.now() - t0) / N) * 1e6).toFixed(0).padStart(8)} ns/op ${Math.round(N / ((performance.now() - t0) / 1000)).toLocaleString()} ops/sec`);
// cold: a fresh measure with an external resolver computing on the fly
const cold = new DSLValueGraph(new DSLRuntime(new Arbiter()).compile('measure b(user: string) { } PROVIDES number', 'b'));
cold.resolve('b', (s) => 99);
async function measureCold() { return cold.measure('b', { __subject: 'u:1', user: 'u:1' }); }
await measureCold();
t0 = performance.now();
N = 20_000;
for (let i = 0; i < N; i++) await measureCold();
console.log(`dvg.measure cold (resolver) ${(((performance.now() - t0) / N) * 1e6).toFixed(0).padStart(8)} ns/op`);