-
feat: bounded self-recursion (transitive closure) for evidence
released this
2026-08-03 23:35:19 +00:00 | 4 commits to master since this releaseAn evidence whose config contains a chain step referencing ITSELF is now
unrolled at compile time into a bounded transitive closure: a union of paths
— base, hop+base, hop²+base, …, hop^N+base — wherehopis the recursive
chain's steps before the self-reference and the depth N comes from the
pattern'slimit N(or the compiler's maxRecursionDepth default, 3). The
base (the evidence's non-recursive statements) is verified as a condition
step at each path's terminal node, so the engine needs no new machinery.- Chain configs carry the pattern's
limitas maxDepth. - resolveEvidenceReferences detects a self-reference (_findSelfReference),
extracts the base (_extractBase), and unrolls (_unrollRecursiveEvidence). - Pure recursion with no base case is a compile-time error; mutual cycles
between distinct evidence remain a compile-time error.
Example: can_access_via = can_access OR (reports_to + can_access_via) up to
the declared limit grants access inherited up a reporting chain.Tests: Recursion (unroll shape, base + multi-hop grants, depth-limit
enforcement, default depth, pure-recursion error, mutual-cycle guard).Downloads
- Chain configs carry the pattern's