2.9 KiB
2.9 KiB
Unified Deterministic Resolver (DeterministicResolver)
Module
__Libraries
Status
IMPLEMENTED
Description
Full deterministic resolver with 4-phase resolution (validate, order, evaluate, digest), immutable evidence graph with content-addressed GraphDigest, Tarjan's SCC cycle detection, implicit data detection, and integration with trust lattice engine. Guarantees pure evaluation with no IO in the compute phase.
Implementation Details
- DeterministicResolver:
src/__Libraries/StellaOps.Resolver/DeterministicResolver.cs--ResolveAsync(graph, evaluator, context)orchestrates 4-phase resolution: Phase 1Validate(graph)runs cycle detection and implicit data detection; Phase 2OrderNodes(graph)produces deterministic topological ordering; Phase 3EvaluatePure(orderedNodes, evaluator, context)evaluates each node with predecessor verdicts (no IO); Phase 4 computes final resolution digest from all node verdicts; usesPureEvaluationContextto enforce runtime purity - EvidenceGraph:
src/__Libraries/StellaOps.Resolver/EvidenceGraph.cs-- immutable record with sortedNodes(IReadOnlyList) andEdges(IReadOnlyList);GraphDigest(content-addressed viaCanonicalJsonSerializer.SerializeWithDigest);AddNode(node)andAddEdge(edge)return new immutable instances; nodes and edges sorted for deterministic digest - GraphValidation:
src/__Libraries/StellaOps.Resolver/GraphValidation.cs--DefaultGraphValidatorcombiningTarjanCycleDetector(Tarjan's SCC algorithm withIsCycleCutedge exclusion) andDefaultImplicitDataDetector(detects dangling edges, duplicate IDs);TarjanCycleDetectoruses index/lowlink tracking, stack-based DFS, reports strongly connected components with >1 node as cycles - RuntimePurity:
src/__Libraries/StellaOps.Resolver/Purity/RuntimePurity.cs--PureEvaluationContextwithCreateStrict()(all prohibited accessors) andCreate(injectedNow, envVars)(deterministic providers);ProhibitedTimeProvider,ProhibitedNetworkAccessor,ProhibitedFileSystemAccessor,ProhibitedEnvironmentAccessorall throwAmbientAccessViolationException;InjectedTimeProviderandInjectedEnvironmentAccessorfor deterministic evaluation - Source: Feature matrix scan
E2E Test Plan
- Verify DeterministicResolver.ResolveAsync produces deterministic results for same graph
- Test Phase 1: Validate detects cycles via Tarjan's SCC and reports them
- Verify Phase 2: OrderNodes produces stable topological ordering
- Test Phase 3: EvaluatePure runs without IO access (PureEvaluationContext enforced)
- Verify Phase 4: final resolution digest is content-addressed and deterministic
- Test EvidenceGraph is immutable (AddNode/AddEdge return new instances)
- Verify GraphDigest changes when any node or edge changes
- Test DefaultImplicitDataDetector catches dangling edges and duplicate node IDs