Orchestrata Ultimate › Tests › Reference › prolog

Tests reference — tests/prolog

tests/prolog — 8 test modules, 56 test functions. Source tree: tests/prolog at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Modules

Module Tests Covers
test_ethics_vocabulary.py 3 3
test_explain.py 15 1
test_human_override_authority.py 5 3
test_intent_policy_constitutional_bridge.py 6 3
test_module_exports.py 4 1
test_requirement_whynot.py 13 3
test_rules_dir_convention.py 2 0
test_test_schedule_pl.py 8 1

Module details

tests/prolog/test_ethics_vocabulary.py

source · 3 tests · 126 lines

harm_category/1 is an enumeration; make it one.

Covers: core.paths, governance.prolog_client, infra.prolog_bridge

Kind Name Line Description
function test_every_assessed_harm_type_is_a_declared_category 63 The property that makes the vocabulary real.
function test_the_declared_vocabulary_is_not_silently_shrinking 84 Ten categories shipped 2026-08-21; four (environmental, financial,
function test_ethical_principles_are_declared_and_distinct 104 ethical_principle/1 has no consumer at all — unlike

tests/prolog/test_explain.py

source · 15 tests · 362 lines

ADR-0031 / SPEC-033: the explain.pl proof-tree / why-not meta-interpreter.

Covers: core.paths

Kind Name Line Description
function test_explain_call_names_rules_fired_and_facts_consumed_in_order 72 A 2-rule derivation (edible/1 -> is_fruit/1 -> base_fact/1, plus
function test_explain_call_records_builtins_as_leaves_not_descended_into 98 A goal whose body includes a built-in (arithmetic comparison) records
function test_explain_whynot_names_the_failing_precondition 117 allowed(apple) fails only on its last precondition (authorized/1 has
function test_explain_whynot_renders_free_variables_stably 136 One question must render as ONE answer, run after run.
function test_explain_whynot_still_reports_bound_witnesses 168 The stability fix must not cost the witnesses it sits next to.
function test_explain_whynot_respects_depth_bound_on_recursive_goal 188 blocked/1's second precondition (looping/1) never terminates natively;
function test_explain_whynot_default_bound_is_50 206 explain_whynot/2 (no explicit bound) must behave like explain_whynot/3
function test_tree_and_whynot_are_json_serializable 221 The nested dict/list shape crossing janus must be plain JSON -- no
function test_explain_call_fails_cleanly_for_a_failing_goal 237 explain_call is semidet on Goal succeeding; a failing Goal simply
function test_prolog_engine_query_explained_success_and_failure 255 PrologEngine.query_explained (the class method, a thin wrapper around
function test_query_explained_degrades_cleanly_on_a_malformed_goal 274 A syntactically-invalid goal string cannot even be parsed by Prolog
function test_explain_or_whynot_wraps_a_succeeding_goal_as_success 295 The bare success(Tree)/failure(Failures) wrapper is itself a Prolog
function test_explain_or_whynot_wraps_a_failing_goal_as_failure 312
function test_explain_or_whynot_success_wrapper_does_not_cross_janus_unbound 323 Documents WHY explain_or_whynot_json/2 exists: asking for the raw
function test_explain_or_whynot_json_renders_the_outer_wrapper_as_a_dict 336 The bare success(Tree)/failure(Failures) wrapper is itself a Prolog

tests/prolog/test_human_override_authority.py

source · 5 tests · 177 lines

A recorded human override must cross every constitutional article.

Covers: core.paths, governance.prolog_client, infra.prolog_bridge

Kind Name Line Description
function test_an_override_crosses_the_article_that_denied 97 Each pair is an article that genuinely denies the action WITHOUT an
function test_an_override_clears_every_article_at_once 116 Not article-by-article: one recorded override satisfies all twelve.
function test_an_override_is_scoped_to_its_own_action 135 An override is a decision about ONE action, not a global off-switch.
function test_no_override_recorded_changes_nothing 147 With no override, the articles deny exactly what they denied before.
function test_the_override_reaches_the_production_intent_gate 160 End to end, through the goal the live packet path actually issues.

tests/prolog/test_intent_policy_constitutional_bridge.py

source · 6 tests · 231 lines

The production intent gate must consult the constitution it ships with.

Covers: core.paths, governance.prolog_client, infra.prolog_bridge

Kind Name Line Description
function test_a_governed_intent_shape_is_denied 105 Each of these mapped to a constitutional action the rulebase ALREADY
function test_the_denial_names_what_denied_it 124 IntentValidator reports permission_denied's Reason straight back
function test_ordinary_volk_work_is_untouched 161 The bridge adds denial ONLY for the shapes governed_action/2
function test_an_unmapped_shape_reaches_no_constitutional_predicate 175 The mapping is the whole coupling surface: no governed_action/2
function test_the_mapping_is_a_visible_ratchet 190 IntentAction x IntentTarget is 10 x 11 = 110 pairs; the bridge
function test_every_mapped_action_is_one_the_rulebase_actually_names 207 A mapping to an action no constitutional or ethical clause mentions is

tests/prolog/test_module_exports.py

source · 4 tests · 107 lines

Cross-module export disjointness for src/orchestrata_ultimate/prolog/*.pl.

Covers: core.paths

Kind Name Line Description
function test_prolog_modules_are_discovered 53 The parser must actually find modules — an empty map would pass every
function test_no_predicate_is_exported_by_two_modules 63 No Name/Arity may be exported by more than one module.
function test_the_two_measured_collisions_stay_unexported 78 Regression pin for the pair that actually collided.
function test_dependent_predicates_stay_exported 100 The exported rules that CONSUME the unexported pair must survive.

tests/prolog/test_requirement_whynot.py

source · 13 tests · 407 lines

requirement_implemented/2 — the decomposable body why-not needs.

Covers: core.base.traces, core.paths, tools/ (package)

Kind Name Line Description
function test_a_fact_only_predicate_is_information_free_to_why_not 194 The defect REQ-114-FR4-004 exists to fix, pinned as a regression.
function test_a_fully_covered_requirement_is_implemented 217
function test_no_coverage_at_all_names_the_code_trace_conjunct 228 Conjunct order is the diagnostic order: a requirement with nothing
function test_code_traced_but_untested_names_the_test_conjunct 241
function test_traced_both_sides_but_unreachable_names_the_wiring_conjunct 251 The conjunct that makes this more than a trace count: code can carry
function test_the_answer_names_its_own_head 267 ADR-0031: the answer carries its derivation, so the head identifies
function test_a_stale_fact_base_refuses_to_answer_and_names_the_module 283 A checker has THREE answers, and this is the third one.
function test_a_stale_base_refuses_even_the_unknown_requirement_answer 311 "Never heard of it" is itself a claim about the fact base.
function test_an_empty_fact_base_is_unknown_not_fresh 331 An empty KB has no CHANGED modules — and is not fresh.
function test_a_fresh_base_does_answer 354 The precondition must GATE, not block: a fresh base still answers.
function test_tool_wrapper_returns_the_verdict_with_the_requirement_description 373
function test_tool_wrapper_reports_a_proof_tree_for_a_covered_requirement 388
function test_an_unknown_requirement_is_an_error_not_a_confident_no 399 "Never heard of it" and "known but uncovered" are different answers;

tests/prolog/test_rules_dir_convention.py

source · 2 tests · 70 lines

No test may point a Prolog bridge at the repo-root prolog/ directory.

Kind Name Line Description
function test_repo_root_prolog_dir_is_an_inert_marker 41
function test_no_test_source_joins_a_bare_prolog_path_segment 54

tests/prolog/test_test_schedule_pl.py

source · 8 tests · 200 lines

Tests for src/orchestrata_ultimate/prolog/test_schedule.pl -- the §9 row

Covers: core.paths

Kind Name Line Description
function test_trivial_two_worker_balance 65 Three tasks, two homogeneous workers: the optimum balances load.
function test_infra_eligibility_restricts_worker 82 A graph-requiring task never lands on the redis-only worker.
function test_no_eligible_worker_fails_cleanly 94 A task whose infra requirement no worker satisfies makes both
function test_conflict_pair_forced_onto_same_worker 111 THE CRUX: a conflict pair must land on the SAME worker (sequential
function test_non_conflicting_pair_may_split 129 The SAME two equal-duration tasks, with NO conflict declared, split
function test_budget_infeasible_fails_schedule_but_best_schedule_always_succeeds 146 schedule/5 fails cleanly when Budget is smaller than the achievable
function test_makespan_minimization_beats_naive_round_robin 169 A skewed duration set: the CLP(FD) optimum beats a naive round-robin
function test_empty_tasks_succeeds_trivially 195 Zero tasks: both predicates succeed immediately with an empty