Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0026

ADR-0026: A governance predicate may not return a truncated answer set

field value
Status Accepted
Date 2026-07-24
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0026-no-truncated-answers-in-governance-predicates.md — permalink at bdafa201a (unchanged on master since that commit)
Wiki register entry ADR-0026 (wiki status: Accepted)

← ADR-0025 · ADR-0027 →

The record

Context

knowledge.pl:ownership_chain/3 was tabled as (incremental, max_answers(20)). The restraint existed for a real reason: a cyclic owns/depends_on graph generates chains of unbounded length, and without a bound the query does not terminate. SWI's max_answers(N) terminates evaluation and marks the overflow undefined, and REQ-106-066 required call sites to treat any undefined answer as deny + escalate.

So the cap was declared, spec-traced, and tested — not a silent truncation. But it bounded the answer set by truncating it, and that is the wrong shape for a predicate a governance gate reads:

The general principle was missing: termination must be achieved by making the answer set finite, never by cutting a finite prefix out of an infinite one.

Decision

No governance predicate may return a truncated answer set. Where recursion over a possibly-cyclic graph is required, terminate by construction — carry the set of already-visited nodes and refuse to revisit one, so every answer is a simple path and a finite graph admits finitely many simple paths.

Applied to ownership_chain/3:

Verified against SWI-Prolog 10.1.9: on a two-node cycle the answer set is complete and finite, every answer is ground, no undefined answer is produced, and incremental table invalidation still propagates correctly through the untabled helper (assert/retract of owns/2 invalidates and restores exactly the affected answers).

Alternatives rejected

Consequences

Provenance

Raised during the 2026-07-24 engine review while surveying the existing rulebases for the Prolog-vs-Datalog question (ADR-0027). Ratified by the human. Note the initial characterisation of the cap as a silent truncation was wrong — it was declared and tested; the defect is that it truncates at all.

Rulings cited

None.

Specs cited