js-rigor: reliability flows through every rule kind; multi_hop value collection fixed

Systemic reliability gap found by the probe sweep: the compiled evaluation
paths never emitted the reliability the engine computes.

- Compiled _evaluateDirect omitted the relation's reliability, and the
  chain/multi_hop rules hardcoded reliability: 1.0 — so check() results
  reported 1.0 for any rule whose decision came through a chain, multi_hop,
  union, intersection, exclusion, or defeasible combination.
- The chain and multi_hop traversals now track per-path reliability (product
  of edge reliabilities) and report the winning path's value; the compiled
  and fallback logical operators (union/intersection/exclusion, direct_list
  fast path, early exits) report the selected child's reliability
  (max/min child or OWA trace index; exclusion multiplies both legs), and
  normal-mode defeasible combines base x requires x defeater reliabilities.
- The checker's logical fast path dropped collectedValues from union/
  intersection/exclusion results; it now passes them through.
- MultiHopRule.valueManager was read off relationManager where the real
  arbiter keeps it on the arbiter — collectValues: true on a multi_hop rule
  with a value-carrying edge crashed the evaluation (error result, silent
  denial). Now resolved at the arbiter level with a relationManager
  fallback for stubs.

Campaign pins: reliability per kind (chain/multi_hop product, union/intersection
selected child, exclusion/defeasible product), and multi_hop value collection
through persistent and partial contexts.
This commit is contained in:
John Dvorak
2026-08-01 09:52:31 -07:00
parent f0dc14fb72
commit 4fd4e20bd0
53 changed files with 361 additions and 187 deletions
+15 -7
View File
@@ -121,6 +121,7 @@ export class MultiHopRule extends BaseRule {
new Set(),
[],
1.0,
1.0,
reverse,
collectValuesEnabled,
trackPaths,
@@ -162,7 +163,7 @@ export class MultiHopRule extends BaseRule {
}
// Aggregate paths to get final possibility
const { finalPossibility, bestPath } = this._aggregatePaths(
const { finalPossibility, finalReliability = 1.0, bestPath } = this._aggregatePaths(
pathsWithValues, pathAggregation, owaWeights, evaluation, options.trackEvaluation
);
@@ -215,7 +216,7 @@ export class MultiHopRule extends BaseRule {
const authResult = {
possibility: finalPossibility,
reliability: 1.0,
reliability: finalReliability,
...(includeMeta && {
meta: allowMeta
}),
@@ -231,7 +232,7 @@ export class MultiHopRule extends BaseRule {
* @private
*/
_findPathsAndCollectValues(startId, endId, relation, maxDepth,
visited, currentPath = [], currentPoss = 1.0,
visited, currentPath = [], currentPoss = 1.0, currentReliability = 1.0,
reverse = false, collectValues = true,
trackPaths = true,
stopSignal = null,
@@ -250,6 +251,7 @@ export class MultiHopRule extends BaseRule {
nodeIds: trackPaths ? [...currentPath.map(step => step.nodeId), endId] : [endId],
hops: currentPath.length,
possibility: currentPoss,
reliability: currentReliability,
collectedValues: [],
pathSteps: trackPaths ? [...currentPath] : null
};
@@ -300,6 +302,7 @@ export class MultiHopRule extends BaseRule {
if (!nextKey) continue;
const nextPoss = Math.min(currentPoss, edge.possibility ?? 1.0);
const nextReliability = currentReliability * (edge.reliability !== undefined ? edge.reliability : 1.0);
if (fastPath && nextPoss < minPossibility) continue;
const pathStep = (collectValues || trackPaths) ? {
@@ -321,6 +324,7 @@ export class MultiHopRule extends BaseRule {
visited,
nextPath,
nextPoss,
nextReliability,
reverse,
collectValues,
trackPaths,
@@ -346,6 +350,9 @@ export class MultiHopRule extends BaseRule {
*/
_collectValuesFromPath(pathSteps, defaultRelation, valueFilters, valueContext) {
const collectedValues = [];
// Get blurred interval from ValueManager (arbiter-level; some stubs and
// older layouts keep it on the relation manager)
const valueManager = this.arbiter.valueManager || this.arbiter.relationManager?.valueManager;
for (let stepIndex = 0; stepIndex < pathSteps.length; stepIndex++) {
const step = pathSteps[stepIndex];
@@ -375,8 +382,7 @@ export class MultiHopRule extends BaseRule {
continue;
}
// Get blurred interval from ValueManager
const blurred = this.arbiter.relationManager.valueManager.getBlurredValue(step.edge);
const blurred = valueManager.getBlurredValue(step.edge);
if (blurred.interval) {
const collectedValue = this._createCollectedValue(
@@ -439,7 +445,7 @@ export class MultiHopRule extends BaseRule {
changed_last_at: contextValue.timestamp
};
const blurred = this.arbiter.relationManager.valueManager.getBlurredValue(tempRelation);
const blurred = valueManager.getBlurredValue(tempRelation);
if (blurred.interval) {
const collectedValue = this._createCollectedValue(
@@ -503,6 +509,7 @@ export class MultiHopRule extends BaseRule {
const path = pathsWithValues[0];
return {
finalPossibility: path.possibility,
finalReliability: path.reliability !== undefined ? path.reliability : 1.0,
bestPath: path
};
}
@@ -597,7 +604,8 @@ export class MultiHopRule extends BaseRule {
}
return {
finalPossibility: possibilityResult.value,
finalPossibility: possibilityResult.value,
finalReliability: bestPath ? (bestPath.reliability !== undefined ? bestPath.reliability : 1.0) : 1.0,
bestPath
};
}