Skip to content

feat!: total graph evaluation with Result-returning error handling (spec 06) - #24

Merged
minikin merged 2 commits into
mainfrom
spec/06-total-graph-evaluation
Jul 14, 2026
Merged

minikin merged 2 commits into
mainfrom
spec/06-total-graph-evaluation

Conversation

@minikin

@minikin minikin commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • ComputationNode::evaluate, evaluate_arithmetic, and evaluate_bool now return Result<_, UncertainError> instead of panicking on unsupported node/domain combinations. New error variant UncertainError::UnsupportedNode { expected, found }.
  • evaluate_arithmetic absorbs the former evaluate_conditional_with_arithmetic (now deleted) and is the total dispatcher for the arithmetic domain, including Conditional nodes.
  • evaluate_fresh keeps its infallible -> T signature (used by ~20 existing callers, mostly tests) via an internal .expect() justified by the invariant that graphs built through the public Uncertain<T> API are always well-formed.
  • GraphProfiler::get_stats's two now-unreachable .expect() calls replaced with direct indexing.
  • All #[should_panic] evaluation tests replaced with Result/error-variant assertions; added tests closing coverage gaps the rewrite exposed.
  • See specs/06-total-graph-evaluation.md for the full spec and an "Implementation notes" section documenting why this keeps three separate domain-scoped dispatchers (evaluate/evaluate_arithmetic/evaluate_bool) rather than one universal dispatcher — each is total over a different variant set dictated by T's trait bounds.
  • crap_baseline.json regenerated: the three rewritten methods show a higher CRAP score (CC +1 to +5) from the added Result plumbing, but all reached 100% line coverage in this change, so the increase is pure complexity, not a coverage gap.
  • This branch was cut before specs 05/18 merged; rebased cleanly onto current main (conflicts only in specs/README.md/MIGRATION_GUIDE.md/CHANGELOG.md, resolved by combining both specs' notes).

Test plan

  • just dev green (fmt, clippy -D warnings, tests default + parallel, doc tests, audit, deny, crap regression gate) — reconfirmed after rebase
  • Full test suite + doctests pass with --all-features and --features parallel
  • cargo bench sanity check on computation_graphs — all three benchmarks within noise
  • CHANGELOG.md/MIGRATION_GUIDE.md/specs/README.md updated

https://claude.ai/code/session_01Xw68NoMZnNRLkxjK6Razu7

minikin added 2 commits July 14, 2026 19:39
…pec 06)

ComputationNode::evaluate/evaluate_arithmetic/evaluate_bool now return
Result<_, UncertainError> instead of panicking on unsupported node/domain
combinations. evaluate_arithmetic absorbs evaluate_conditional_with_arithmetic
(removed) and is now the total dispatcher for the arithmetic domain, including
Conditional nodes. GraphProfiler::get_stats no longer relies on unreachable
.expect() calls.
@minikin
minikin merged commit 6f4feba into main Jul 14, 2026
9 checks passed
@minikin
minikin deleted the spec/06-total-graph-evaluation branch July 14, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant