js-rigor: the partial graph carries the temporal context
The partial graph is the caller's self-contained view of the world — so the time belongs in it. partialGraph.now becomes the evaluation clock for that check (TTL gates, proof expiry, decay all honor it), with an explicit options.now taking precedence. The explain rerun replays the SAME partial graph object and reproduces the original decision; the serializer records request.temporal.now for the record. Pins: partialGraph.now driving a challenge decision both sides of the window, the explicit-override precedence, and the explain rerun with the same object.
This commit is contained in:
@@ -4,6 +4,13 @@ import { validateReducerConfig, getAllowedRelationsForLayer } from './partial-gr
|
||||
export class PartialGraphContext {
|
||||
constructor(arbiter, partialGraph) {
|
||||
this.arbiter = arbiter;
|
||||
// The caller's view of the world at a moment in time: the partial graph
|
||||
// may carry that time. When present it becomes the evaluation clock for
|
||||
// this check, so a rerun that replays the same partial graph reproduces
|
||||
// the same decision (TTL gates, proof expiry, decay all honor it).
|
||||
this.now = (partialGraph && partialGraph.now !== undefined && partialGraph.now !== null)
|
||||
? partialGraph.now
|
||||
: null;
|
||||
const policy = arbiter?.partialGraphPolicy || null;
|
||||
this.nodeIdByKey = new Map();
|
||||
this.keyByNodeId = new Map();
|
||||
|
||||
@@ -28,6 +28,9 @@ export class ArbiterChecks {
|
||||
throw new Error(`Partial graph exceeds max nodes: ${nodes.length} > ${maxNodes}`);
|
||||
}
|
||||
options.partialGraphContext = this.arbiter._createPartialGraphContext(options.partialGraph);
|
||||
if (options.now === undefined && options.partialGraphContext.now !== null) {
|
||||
options.now = options.partialGraphContext.now;
|
||||
}
|
||||
}
|
||||
|
||||
const { returnHints = false, _visited = new Set(), _currentRelation = null, binary = false, epsilon, delta, clientStateId } = options;
|
||||
@@ -115,6 +118,9 @@ export class ArbiterChecks {
|
||||
|
||||
if (options.partialGraph && !options.partialGraphContext) {
|
||||
options.partialGraphContext = this.arbiter._createPartialGraphContext(options.partialGraph);
|
||||
if (options.now === undefined && options.partialGraphContext.now !== null) {
|
||||
options.now = options.partialGraphContext.now;
|
||||
}
|
||||
}
|
||||
|
||||
const explainOptions = {
|
||||
|
||||
Reference in New Issue
Block a user