Orchestrata Ultimate › Tests › Reference › factory

Tests reference — tests/factory

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

Prose pending.

Modules

Module Tests Covers
test_adjudicator.py 14 2
test_amendment_classify.py 14 3
test_amendment_coupling.py 30 2
test_amendment_syntactic.py 22 2
test_anchor_evaluation.py 34 2
test_anchor_gate.py 9 4
test_anchor_intake.py 8 5
test_anchor_models.py 14 1
test_anchor_source.py 5 4
test_anchor_store.py 24 2
test_attestation.py 19 2
test_attestation_store.py 15 4
test_c4_detectors.py 17 2
test_cascade.py 20 5
test_conformance_engine.py 20 2
test_conformance_gate.py 17 9
test_contracts_models.py 16 1
test_decision_phase.py 10 10
test_design_authority.py 7 3
test_design_authority_live.py 1 1
test_detector_c1_bridge.py 5 5
test_detector_clause.py 11 1
test_detector_engine.py 10 3
test_detector_models.py 10 1
test_detector_rules.py 36 2
test_dispatch_gates.py 20 4
test_dor.py 5 3
test_dor_anchors_export.py 9 2
test_dor_artifact.py 10 2
test_dor_axes.py 7 1
test_dor_models.py 19 1
test_dor_validate.py 33 4
test_enforcement_bootstrap.py 13 2
test_enforcement_enforce.py 11 4
test_enforcement_ledger.py 22 2
test_fastpath_classifier.py 18 4
test_formalization_models.py 32 1
test_ledger.py 25 2
test_merge_queue.py 6 6
test_models.py 19 1
test_mutation.py 10 1
test_prefilter.py 9 3
test_projection_analyzer.py 28 1
test_projection_completeness.py 9 2
test_promotion_store.py 27 4
test_red_first.py 16 2
test_scheduler_dag.py 12 3
test_scheduler_pipeline.py 4 7
test_scheduler_worktrees.py 7 2
test_sources.py 13 3
test_trace_validation.py 20 2

Module details

tests/factory/test_adjudicator.py

source · 14 tests · 130 lines

Tests for orchestrata_ultimate.factory.assumptions.adjudicator (stage 2).

Covers: factory.assumptions.adjudicator, factory.assumptions.models

Kind Name Line Description
function test_parse_verdict_plain_json 26
function test_parse_verdict_tolerates_fenced_json 35
function test_parse_verdict_tolerates_bare_fence_no_language_tag 45
function test_parse_verdict_unparseable_fails_closed_to_needs_human 51
function test_parse_verdict_invalid_ruling_value_fails_closed 60
function test_parse_verdict_missing_ruling_key_fails_closed 66
function test_parse_verdict_uppercase_ruling_is_normalized 72
function test_parse_verdict_non_list_questions_coerced_to_list 78
function test_parse_verdict_missing_questions_defaults_empty 84
function test_build_prompt_includes_text_requirement_and_candidates 95
function test_build_prompt_no_requirement_id 108
function test_build_prompt_no_candidates_says_none 113
function test_build_prompt_never_includes_out_of_band_author_rationale 118 ADR-0024 independence: the prompt is built only from text/requirement/
function test_llm_adjudicator_identity_is_tier_prefixed 128

tests/factory/test_amendment_classify.py

source · 14 tests · 168 lines

Tests for orchestrata_ultimate.factory.amendment.classify (B16, ADR-0009/0020/0021).

Covers: factory.amendment.classify, factory.amendment.models, factory.assumptions.models

Kind Name Line Description
function test_direction_verdict_rejects_inconsistent_requires_human 28 The invariant DirectionVerdict.post_init enforces: requires_human
function test_ledger_screen_returns_none_with_no_evidence 48
function test_ledger_screen_returns_none_when_fingerprint_not_in_accepted_set 52
function test_ledger_screen_refutes_a_syntactically_tightening_change 58 The ADR-0020 crux: this new_text's fingerprint is a KNOWN case the
function test_ledger_screen_never_returns_tightening 67 The screen can refute (LOOSENING) or abstain (None) -- it must never
function test_classify_amendment_pure_conjunct_add_is_tightening_with_no_ledger 82
function test_classify_amendment_clause_add_is_loosening 90
function test_classify_amendment_mixed_change_is_undetermined 96
function test_classify_amendment_downgrades_on_ledger_refutation 104 The crux, end to end: syntactically a pure conjunct-add (would be
function test_classify_amendment_boundary_change_downgrades_tightening 122
function test_classify_amendment_pure_coupling_growth_does_not_downgrade 134 Coupling growth alone is reported, not auto-loosening (ADR-0021) --
function test_classify_amendment_mixed_coupling_downgrades_tightening 148
function test_classify_amendment_no_coupling_info_provided_does_not_downgrade 160
function test_classify_amendment_no_changes_is_tightening 165

tests/factory/test_amendment_coupling.py

source · 30 tests · 266 lines

Tests for orchestrata_ultimate.factory.amendment.coupling (B16, ADR-0021).

Covers: factory.amendment.coupling, factory.amendment.models

Kind Name Line Description
function test_resolve_import_absolute_with_no_module_returns_none 22 Defensive branch: level==0 with an empty module name has no valid
function test_component_of_first_two_segments_under_src 37
function test_component_of_accepts_path_object 42
function test_component_of_falls_back_without_src_segment 47
function test_import_edges_absolute_import_cross_component 63
function test_import_edges_same_component_produces_no_edge 77
function test_import_edges_unresolvable_import_is_skipped 90
function test_import_edges_plain_import_statement 101
function test_import_edges_relative_import_cross_component 109
function test_import_edges_bare_relative_import_resolves_within_own_component 122 from . import helper (module=None) resolves to the package's own
function test_import_edges_relative_import_unresolvable_is_skipped 134
function test_import_edges_non_python_file_skipped 145
function test_import_edges_missing_file_skipped 151
function test_import_edges_syntax_error_skipped 156
function test_transitive_coupling_surfaces_indirection_through_existing_hop 167
function test_transitive_coupling_no_self_loops 175
function test_transitive_coupling_empty_edges 182
function test_transitive_coupling_disconnected_components 186
function test_boundary_change_true_on_merge 197
function test_boundary_change_false_when_set_unchanged 203
function test_coupling_verdict_boundary_change_is_loosening 213
function test_coupling_verdict_unchanged_closure_is_tightening 217
function test_coupling_verdict_pure_shrink_is_tightening 222
function test_coupling_verdict_pure_growth_is_still_tightening_compatible 228 Growth alone is reported, not auto-loosening (ADR-0021: budgeted
function test_coupling_verdict_mixed_growth_and_shrink_is_undetermined 237
function test_coupling_note_boundary_changed_text 243
function test_coupling_note_unchanged_text 248
function test_coupling_note_mixed_text 254
function test_coupling_note_growth_text 259
function test_coupling_note_shrink_text 264

tests/factory/test_amendment_syntactic.py

source · 22 tests · 199 lines

Tests for orchestrata_ultimate.factory.amendment.syntactic (B16, ADR-0020 step 1).

Covers: factory.amendment.models, factory.amendment.syntactic

Kind Name Line Description
function test_parse_clauses_fact_has_no_body 20
function test_parse_clauses_arity_from_nested_parens 28
function test_parse_clauses_arity_zero_for_bare_atom_head 33
function test_parse_clauses_body_goals_ordered 38
function test_parse_clauses_directive_has_no_head 44
function test_parse_clauses_ignores_comment_content 49
function test_parse_clauses_comma_inside_parens_is_one_goal 56
function test_parse_clauses_tail_without_terminating_dot_is_still_a_clause 62 A file with no trailing '.'-terminated clause (malformed, but the
function test_parse_clauses_empty_parens_is_arity_zero 69
function test_pure_conjunct_add_classifies_tightening 79
function test_conjunct_add_in_the_middle_is_still_a_subsequence_extension 88
function test_clause_add_classifies_loosening 97
function test_clause_removed_classifies_tightening 106
function test_conjunct_removed_classifies_loosening 115
function test_mixed_add_and_remove_classifies_undetermined 124 A genuinely mixed case: one predicate tightens (conjunct added), a
function test_body_other_when_argument_pattern_changes 137
function test_body_other_when_new_longer_but_not_a_superset_sequence 146 New body is longer, but the old goal does not appear in it at all --
function test_body_other_when_goals_permuted_not_extended 156 A true permutation (same goals, different order) is not a pure
function test_reformatted_but_unchanged_body_produces_no_false_body_other 168 Reflowing a clause across lines/whitespace must NOT register as a
function test_no_changes_at_all_is_vacuously_tightening 180
function test_unrelated_predicate_untouched_produces_no_changes 186
function test_repeated_head_clauses_matched_positionally 192 Two clauses sharing an identical head (rare guard-style clauses) are

tests/factory/test_anchor_evaluation.py

source · 34 tests · 370 lines

Tests for orchestrata_ultimate.factory.anchors.evaluation (B15b).

Covers: factory.anchors.evaluation, factory.anchors.models

Kind Name Line Description
function test_example_evaluator_klass_is_example 66
function test_example_evaluator_satisfied_on_matching_key_value 70
function test_example_evaluator_unsatisfied_names_both_values 84
function test_example_evaluator_inconclusive_when_key_absent 93
function test_example_evaluator_inconclusive_when_statement_unparseable 101
function test_example_evaluator_inconclusive_when_expect_has_no_separator 108
function test_example_evaluator_inconclusive_when_key_is_not_a_valid_identifier 115
function test_property_evaluator_klass_is_property 127
function test_property_evaluator_satisfied_single_clause 131
function test_property_evaluator_satisfied_multi_clause_and 138
function test_property_evaluator_unsatisfied_on_failing_clause 146
function test_property_evaluator_inconclusive_when_var_absent 154
function test_property_evaluator_in_operator_satisfied 162
function test_property_evaluator_in_operator_unsatisfied 169
function test_property_evaluator_string_literal_comparison 176
function test_property_evaluator_not_equal_operator 183
function test_property_evaluator_le_ge_operators 190
function test_property_evaluator_malformed_statement_is_inconclusive_not_a_call 197 A statement crafted to look like it could invoke import must be a
function test_parse_property_clause_rejects_call_syntax_directly 211 White-box proof: the tokenizer itself raises PropertyParseError on
function test_parse_property_clause_accepts_dunder_name_as_bare_identifier 219 A bare (non-call) identifier named like a dunder is just a variable
function test_property_evaluator_empty_statement_is_inconclusive 230
function test_property_evaluator_bool_literal_comparison 237
function test_property_evaluator_bool_literal_in_list 244
function test_property_evaluator_empty_in_list_is_never_satisfied 251
function test_property_evaluator_in_operator_skips_uncoercible_items 258 One list item that fails to coerce (e.g. non-numeric raw value against
function test_property_evaluator_ordering_op_with_uncoercible_value_is_unsatisfied 269 A '>' comparison against a non-numeric observed value must not raise
function test_property_evaluator_in_operator_without_bracket_literal_is_malformed 281
function test_oracle_evaluator_klass_is_differential_oracle 294
function test_oracle_evaluator_satisfied_when_unchanged 298
function test_oracle_evaluator_unsatisfied_names_first_divergent_key 308
function test_oracle_evaluator_inconclusive_when_differential_empty 321
function test_evaluate_all_dispatches_by_class 333
function test_evaluate_all_never_silently_skips_unhandled_class 353 An anchor whose class has no evaluator registered is INCONCLUSIVE --
function test_evaluate_all_empty_anchor_list_returns_empty 367

tests/factory/test_anchor_gate.py

source · 9 tests · 246 lines

Tests for orchestrata_ultimate.factory.anchors.gate (B15b, ADR-0023).

Covers: factory.anchors.evaluation, factory.anchors.gate, factory.anchors.models, factory.anchors.store

Kind Name Line Description
function test_satisfied_and_unchanged_is_eligible 50
function test_satisfied_but_changed_is_not_eligible_laundering_via_edit 71 The laundering-via-edit case (ADR-0013/ADR-0023): even though the
function test_unsatisfied_anchor_blocks_fast_path 94
function test_inconclusive_anchor_blocks_fast_path 112 An INCONCLUSIVE anchor blocks the fast path exactly like an
function test_oracle_anchor_needs_differential_else_blocks 134
function test_only_ratified_anchors_are_considered 173 A PROPOSED (not yet ratified) anchor must not gate the fast path --
function test_multiple_requirement_ids_are_combined_and_deduped 199
function test_gate_never_mutates_registry 218
function test_verdict_is_a_frozen_dataclass_instance 238

tests/factory/test_anchor_intake.py

source · 8 tests · 166 lines

Tests for orchestrata_ultimate.factory.anchors.intake.

Covers: factory.anchors.intake, factory.anchors.models, factory.anchors.store, factory.dor_procedure.anchors_export, factory.dor_procedure.models

Kind Name Line Description
function test_import_dor_candidates_count_matches_export 90
function test_import_dor_candidates_carries_requirement_id_and_source 99
function test_import_dor_candidates_keeps_boundary_for_boundary_candidates 108
function test_import_dor_candidates_statement_carries_given_and_expect 116
function test_import_dor_candidates_is_idempotent_on_reimport 125
function test_import_dor_candidates_empty_export_yields_nothing 136
function test_propose_oracle_creates_differential_oracle_anchor 144
function test_propose_oracle_empty_observed_ref_raises 158

tests/factory/test_anchor_models.py

source · 14 tests · 205 lines

Tests for orchestrata_ultimate.factory.anchors.models.

Covers: factory.anchors.models

Kind Name Line Description
function test_independence_rank_orders_oracle_strongest 20
function test_anchor_id_is_deterministic_for_same_inputs 29
function test_anchor_id_differs_for_different_requirement 46
function test_anchor_id_differs_for_different_class 62
function test_new_anchor_is_always_proposed 78
function test_oracle_requires_observed_source_prefix 90
function test_oracle_with_observed_source_prefix_succeeds 100
function test_example_class_does_not_require_observed_prefix 110
function test_ratified_requires_non_empty_ratified_by 120
function test_ratified_with_ratified_by_succeeds 131
function test_superseded_requires_non_empty_superseded_by 148
function test_superseded_with_superseded_by_succeeds 162
function test_anchor_is_frozen 179
function test_boundary_defaults_to_empty_and_can_be_set 190

tests/factory/test_anchor_source.py

source · 5 tests · 73 lines

Tests for orchestrata_ultimate.factory.anchors.source.

Covers: factory.anchors.models, factory.anchors.source, factory.anchors.store, factory.assumptions.models

Kind Name Line Description
function test_pinnings_empty_registry_yields_nothing 23
function test_pinnings_excludes_proposed_anchors 29
function test_pinnings_includes_only_ratified_anchors 36
function test_pinnings_excludes_superseded_anchors 52
function test_pinnings_multiple_ratified_anchors 66

tests/factory/test_anchor_store.py

source · 24 tests · 277 lines

Tests for orchestrata_ultimate.factory.anchors.store.

Covers: factory.anchors.models, factory.anchors.store

Kind Name Line Description
function test_propose_persists_and_get_round_trips 29
function test_propose_forces_status_to_proposed_regardless_of_input 39
function test_propose_duplicate_raises_value_error 58
function test_get_unknown_returns_none 68
function test_ratify_transitions_proposed_to_ratified 73
function test_ratify_empty_by_raises 85
function test_ratify_unknown_id_raises 92
function test_ratify_already_ratified_raises 98
function test_supersede_transitions_ratified_to_superseded 106
function test_supersede_not_ratified_raises 121
function test_supersede_empty_by_raises 129
function test_supersede_empty_replacement_raises 137
function test_supersede_unknown_id_raises 145
function test_supersede_appends_weakening_ledger_entry 151
function test_weakening_ledger_never_rewritten_across_multiple_supersedes 170
function test_no_update_method_on_registry 189 ADR-0013: any edit to a ratified anchor is a loosening -- the API
function test_read_records_whitespace_only_file_returns_empty_list 196
function test_write_records_cleans_up_tmp_file_on_serialization_failure 203 A set is not JSON-serializable -- json.dump raises mid-write, and the
function test_anchors_filters_by_requirement_id 214
function test_anchors_filters_by_status 223
function test_anchors_with_no_filters_returns_all 235
function test_empty_registry_returns_empty_list 242
function test_storage_is_a_json_array_on_disk 247
function test_concurrent_propose_from_multiple_threads_never_corrupts_file 256 Free-threaded 3.14t: real threads proposing concurrently must

tests/factory/test_attestation.py

source · 19 tests · 204 lines

Tests for orchestrata_ultimate.factory.enforcement.attestation (B20,

Covers: factory.enforcement.attestation, factory.enforcement.models

Kind Name Line Description
function test_link_from_record_maps_writer_name_to_step_name 47
function test_link_from_record_prefixes_material_and_product_hashes 53
function test_link_from_record_carries_byproducts_unchanged 60
function test_link_from_record_environment_carries_worktree_and_commit 66
function test_link_from_record_leaves_deletion_marker_unprefixed 72 The B1a deletion sentinel is not a hash -- it must never be prefixed
function test_link_from_record_empty_materials_and_products 81
function test_canonical_json_is_deterministic_across_calls 93
function test_canonical_json_ignores_dict_insertion_order 98 Two links equal except for dict insertion order must canonicalize
function test_canonical_json_has_no_whitespace 114
function test_canonical_json_is_valid_utf8_json 121
function test_canonical_json_round_trips_field_values 128
function test_canonical_json_works_for_slsa_provenance_too 138
function test_declared_slsa_level_is_honestly_one 151
function test_provenance_for_uses_declared_slsa_level 155
function test_provenance_for_builder_id_is_the_platform_not_the_agent 161 ADR-0008/ADR-0030 no-self-report: builder_id must be the CALLER's
function test_provenance_for_invocation_references_the_record 171
function test_provenance_for_build_type_is_stable_and_nonempty 180
function test_slsa_provenance_is_frozen 187
function test_intoto_link_is_frozen 197

tests/factory/test_attestation_store.py

source · 15 tests · 277 lines

Tests for orchestrata_ultimate.factory.enforcement.attestation_store

Covers: factory.enforcement.attestation, factory.enforcement.attestation_store, factory.enforcement.models, factory.enforcement.signing

Kind Name Line Description
function test_attest_signs_and_appends 59
function test_attest_verify_round_trip_succeeds 72
function test_verify_fails_with_wrong_signer 82
function test_attested_link_and_provenance_are_stored_correctly 93
function test_tampered_product_hash_fails_verification 108 The whole point of signing: mutate one product hash in a stored
function test_tampered_provenance_fails_verification 127
function test_tampered_signature_fails_verification 141
function test_mismatched_key_id_fails_closed 152
function test_attestations_for_filters_by_worktree_and_commit 168
function test_attestations_for_unknown_worktree_commit_is_empty 181
function test_all_returns_every_attestation_insertion_order 189
function test_attestation_file_is_valid_jsonl 206
function test_all_on_empty_store_returns_empty_list 222
function test_stored_attestation_round_trips_through_all 232
function test_concurrent_attest_no_corruption 253 Real threads (3.14t, no GIL) attesting concurrently must not corrupt

tests/factory/test_c4_detectors.py

source · 17 tests · 342 lines

Tests for orchestrata_ultimate.factory.formalization.c4 (B26, REQ-033-C4).

Covers: factory.formalization.c4, factory.formalization.models

Kind Name Line Description
function test_solutions_yields_every_assignment_when_unconstrained 32
function test_solutions_filters_by_require_constraint 45
function test_solutions_filters_by_forbid_constraint 63
function test_solutions_filters_by_implies_constraint 81
function test_solutions_raises_over_boundary 101
function test_solutions_does_not_raise_at_exact_boundary 119
function test_check_contradiction_none_when_satisfiable 139
function test_check_contradiction_names_actual_conflicting_pair_only 156 3 constraints; only c1/c2 conflict. c3 is a no-op that must NOT appear
function test_check_contradiction_carries_traces 197
function test_check_under_constraint_none_when_fully_pinned 207
function test_check_under_constraint_witnesses_differ_on_named_observable_var 224
function test_check_under_constraint_none_when_difference_is_non_observable_only 241 Materiality test: status is pinned (fully constrained observable var);
function test_check_under_constraint_carries_traces 268
function test_run_c4_clean_report_when_satisfiable_and_pinned 278
function test_run_c4_reports_contradiction_and_zero_solution_count 299
function test_run_c4_reports_under_constraint 326
function test_run_c4_carries_traces 338

tests/factory/test_cascade.py

source · 20 tests · 497 lines

Tests for orchestrata_ultimate.factory.assumptions.cascade.

Covers: factory.assumptions.adjudicator, factory.assumptions.cascade, factory.assumptions.ledger, factory.assumptions.models, factory.assumptions.prefilter

Kind Name Line Description
function test_stage0_kb_matched_hit_pins 92
function test_stage0_kb_unpinned_hit_is_blocking_question_no_reresolve 118
function test_ac_033_c1_04_stage2_resolution_recurs_without_second_pass 144 AC-033-C1-04: an assumption resolved at stage 2, recurring later, is
function test_no_adjudicator_configured_fails_closed_to_needs_human 199
function test_independence_violation_when_adjudicator_is_the_author 211
function test_stage2_matched_ref_among_candidates_pins 226
function test_stage2_matched_ref_not_among_candidates_disagreement 249
function test_stage2_unpinned_no_strong_candidate_is_blocking_question 270
function test_stage2_unpinned_but_strong_candidate_exists_disagreement 294
function test_stage2_needs_human_verdict_passthrough 313
function test_resolve_all_resolves_pending_and_persists 340
function test_resolve_all_skips_non_pending 366
function test_human_adjudicate_matched_pins_and_promotes 398
function test_human_adjudicate_unpinned_blocks 421
function test_human_adjudicate_rejects_empty_by 436
function test_human_adjudicate_rejects_needs_human_ruling 445
function test_human_adjudicate_matched_requires_pinning 454
function test_human_adjudicate_unknown_assumption_raises 463
function test_human_adjudicate_carries_requirement_id_override 472
function test_human_adjudicate_defaults_requirement_id_from_assumption 489

tests/factory/test_conformance_engine.py

source · 20 tests · 663 lines

Tests for orchestrata_ultimate.factory.conformance.engine (SPEC-033 B2).

Covers: factory.conformance.engine, factory.contracts.models

Kind Name Line Description
function test_conformant_fixture_zero_findings 50 2 nodes, owned modules, matching symbols, only a declared cross-node edge.
function test_missing_module_finding 103
function test_unowned_module_finding 130
function test_missing_symbol_finding 157
function test_undeclared_public_symbol_finding 188
function test_signature_mismatch_finding 220 Also proves the grammar's param-rename mismatch case.
function test_new_outbound_edge_finding 252 Cross-node undeclared import -> new_outbound_edge; same-node import -> clean.
function test_signature_grammar_full_spec_matches 304 "fn(a, b=1, *, c)" against an identical real signature -> zero findings.
function test_signature_grammar_plain_name_ignores_signature 331 A bare "fn" entry checks existence only -- the real signature can differ freely.
function test_conformance_is_structural_not_semantic 363 ADR-0008: a wrong-body-right-signature module is CONFORMANT.
function test_symbol_grammar_class_method_matches 401
function test_symbol_grammar_class_method_mismatch 427
function test_symbol_signature_spec_on_a_class_name_is_a_defensive_noop 454 A signature spec attached to a CLASS name (not callable) is a no-op, not a crash.
function test_unparsable_signature_spec_is_a_defensive_noop 479 A syntactically-broken signature spec never crashes or false-positives.
function test_symbol_check_skips_a_missing_module_it_still_owns 502 A node with a missing module AND symbols: the symbol check skips the missing file.
function test_declared_dependency_package_is_not_an_outbound_edge 530
function test_malformed_pyproject_toml_falls_back_to_no_declared_deps 557
function test_head_sha_is_none_when_repo_root_does_not_exist 587 The provenance head_sha degrades to None instead of raising.
function test_head_sha_is_populated_in_a_real_git_repo 598 Provenance carries the real git rev-parse HEAD when one exists.
function test_stdlib_import_is_not_an_outbound_edge 645

tests/factory/test_conformance_gate.py

source · 17 tests · 468 lines

Tests for orchestrata_ultimate.factory.dispatch.conformance_gate (SPEC-033

Covers: factory.dispatch.conformance_gate, factory.dispatch.gates, factory.enforcement.ledger, factory.promotion.models, factory.promotion.store, factory.scheduler.dag, factory.scheduler.queue, factory.scheduler.scheduler, factory.scheduler.worktrees

Kind Name Line Description
function test_scope_gate_passes_and_returns_changed_paths_within_declared_scope 95
function test_scope_gate_raises_scope_violation_naming_the_out_of_scope_file 104
function test_scope_gate_allows_a_file_under_a_declared_directory_prefix 116
function test_scope_gate_covers_a_committed_in_worktree_change_too 126
function test_scope_gate_covers_a_tracked_modification_to_an_existing_file 137
function test_scope_gate_empty_declared_paths_refuses_any_change_fail_closed 146
function test_scope_gate_no_changes_is_a_clean_pass 156
function test_review_gate_no_py_paths_is_a_silent_pass_no_subprocess_needed 169
function test_review_gate_passes_a_clean_python_file 178
function test_review_gate_raises_on_code_review_failure_unused_import 189
function test_review_gate_raises_on_test_review_failure_forbidden_mock 204
function test_conformance_regate_passes_a_conforming_worktree 230
function test_conformance_regate_rejects_an_out_of_scope_change 258
function test_conformance_regate_rejects_a_review_gate_failure 287
function test_synthetic_dispatch_out_of_scope_edit_is_rejected_naming_the_file 337 A builder's returned diff touches a file outside its assigned
function test_synthetic_dispatch_mock_in_test_file_is_rejected_by_review_gate 381 A builder's returned test file introduces a mock -- the test-review
function test_synthetic_dispatch_conforming_change_passes_to_integration 428 A builder's returned diff stays in scope and is review-clean -- the

tests/factory/test_contracts_models.py

source · 16 tests · 222 lines

Tests for orchestrata_ultimate.factory.contracts.models (SPEC-033 B3).

Covers: factory.contracts.models

Kind Name Line Description
function test_save_and_load_contract_round_trips_exactly 39
function test_save_contract_writes_valid_json 47
function test_save_contract_creates_parent_directories 58
function test_save_contract_leaves_no_temp_file_behind 65
function test_load_contract_unknown_schema_version_raises 73
function test_load_contract_empty_nodes_is_valid 86
function test_validate_contract_accepts_well_formed_contract 94
function test_validate_contract_rejects_duplicate_node_ids 98
function test_load_contract_rejects_duplicate_node_ids 111
function test_validate_contract_rejects_module_claimed_by_two_nodes 126
function test_load_contract_rejects_module_claimed_by_two_nodes 139
function test_validate_contract_rejects_malformed_requirement_ids 158
function test_validate_contract_accepts_well_formed_requirement_ids 178
function test_design_node_and_contract_are_frozen 194
function test_design_node_default_tuples_are_empty 204
function test_save_contract_cleans_up_temp_file_on_replace_failure 211

tests/factory/test_decision_phase.py

source · 10 tests · 602 lines

Tests for orchestrata_ultimate.factory.decision.phase (B8, ADR-0015/0028).

Covers: factory.anchors.models, factory.anchors.store, factory.assumptions.ledger, factory.assumptions.models, factory.decision.phase, factory.dor_procedure.axes, factory.dor_procedure.models, factory.dor_procedure.rulings, factory.dor_procedure.validate, factory.formalization.models

Kind Name Line Description
function test_ready_path_reports_no_blocking_defects_found 248
function test_shape_violation_blocks_alone 296
function test_c4_contradiction_blocks 331
function test_c4_under_constraint_blocks 357
function test_c3_blocking_detector_blocks 383
function test_assumption_residue_blocks 409
function test_assumption_for_other_requirement_is_not_blocking 453 An assumption in the ledger for a DIFFERENT requirement must be
function test_residual_gap_blocks 486
function test_unratified_anchor_blocks_and_queues_proposals 522
function test_ordering_shape_invalid_reports_only_shape_blocks 558 A shape-invalid artifact must report ONLY shape blocks — later stages

tests/factory/test_design_authority.py

source · 7 tests · 260 lines

Fast (network-free) tests for orchestrata_ultimate.factory.decision.authority.

Covers: factory.decision.authority, factory.dor_procedure.models, factory.dor_procedure.rulings

Kind Name Line Description
function test_construct_parses_valid_response_into_artifact 162
function test_construct_raises_on_malformed_json 174
function test_construct_raises_when_response_is_not_a_json_object 183
function test_construct_raises_on_unsupported_schema_version 190
function test_construct_raises_on_missing_required_field 200
function test_construct_uses_configured_volk_alias_by_default 210
function test_construct_shows_the_model_the_real_ruling_ids 231 Step 6.3: validate_artifact rejects any ruling id outside the canon,

tests/factory/test_design_authority_live.py

source · 1 tests · 52 lines

Default-path wiring test for the SPEC-033 design authority (B8, ADR-0028).

Covers: factory.decision.authority

Kind Name Line Description
function test_llm_design_authority_construct_live_two_requirement_toy_spec 39 Default call_llm path engages the synth layer and fails loudly.

tests/factory/test_detector_c1_bridge.py

source · 5 tests · 102 lines

Tests for orchestrata_ultimate.factory.detectors.c1_bridge.

Covers: factory.assumptions.dor, factory.assumptions.ledger, factory.assumptions.models, factory.detectors.c1_bridge, factory.detectors.engine

Kind Name Line Description
function test_tier3_questions_land_as_pending_assumptions_with_detector_identity 22
function test_non_question_findings_are_never_bridged 39 Tier 1/2 findings have no question -- they must never become assumptions.
function test_rerun_over_unchanged_text_adds_nothing 53
function test_same_question_at_a_different_design_node_is_a_separate_assumption 67
function test_c3_to_c1_to_dor_chain_fails_naming_the_pending_assumptions 83 The full chain: C3 detector -> C1 ledger -> DoR fails, naming them.

tests/factory/test_detector_clause.py

source · 11 tests · 94 lines

Tests for orchestrata_ultimate.factory.detectors.clause.

Covers: factory.detectors.clause

Kind Name Line Description
function test_sentences_splits_on_period_and_newline 11
function test_sentences_does_not_split_on_eg_abbreviation 21
function test_sentences_does_not_split_on_ie_abbreviation 30
function test_sentences_no_split_when_followed_by_lowercase 39 A period not followed by whitespace+capital/digit is not a boundary.
function test_sentences_blank_lines_produce_no_entries 46
function test_segment_main_kind_for_plain_sentence 52
function test_segment_splits_on_comma_and_classifies_conditional 59
function test_segment_classifies_rationale 67
function test_segment_mid_segment_conditional_marker_starts_new_segment 73 "X, and if Y then Z" style: a conditional marker mid-piece splits further.
function test_segment_offsets_locate_text_in_original_sentence 84
function test_segment_empty_pieces_are_dropped 91 Double punctuation ("X,, Y") must not yield an empty segment.

tests/factory/test_detector_engine.py

source · 10 tests · 133 lines

Tests for orchestrata_ultimate.factory.detectors.engine.

Covers: factory.detectors.engine, factory.detectors.models, factory.detectors.rules

Kind Name Line Description
function test_run_detectors_finds_blocking_and_advisory_and_question_findings 21
function test_run_detectors_disabled_rule_produces_no_findings_for_it 38
function test_run_detectors_restricted_rule_subset 48
function test_tier1_gate_returns_only_undismissed_blocking_findings 56
function test_tier1_gate_empty_for_defect_free_text 65
function test_blacklist_dismiss_moves_finding_out_of_findings_on_rerun 70
function test_blacklist_contains_reflects_dismissed_state 88
function test_blacklist_persists_across_instances 95
function test_blacklist_parallel_append_is_safe_under_threads 102 Concurrent dismissals from multiple threads must all survive (fcntl lock).
function test_run_detectors_repo_root_override_used_for_incomplete_reference 122

tests/factory/test_detector_models.py

source · 10 tests · 140 lines

Tests for orchestrata_ultimate.factory.detectors.models.

Covers: factory.detectors.models

Kind Name Line Description
function test_tier_values_say_what_they_do 20
function test_rule_meta_is_frozen 26
function test_rule_meta_allows_none_precision_for_unmeasured_rules 43
function test_finding_fingerprint_is_stable_and_normalizes 53
function test_finding_fingerprint_differs_by_rule_id 60
function test_finding_new_derives_fingerprint_and_defaults 66
function test_finding_new_accepts_explicit_weight_and_question 84
function test_finding_is_frozen 100
function test_detector_report_has_no_completeness_verdict_field 118 ADR-0011's boundary: no detector may issue a completeness verdict.
function test_detector_report_defect_free_text_is_empty_findings_not_a_pass 134 No detector issues a "pass" -- an empty list is the shape of "nothing found".

tests/factory/test_detector_rules.py

source · 36 tests · 379 lines

Tests for orchestrata_ultimate.factory.detectors.rules.

Covers: factory.detectors.models, factory.detectors.rules

Kind Name Line Description
function test_all_rules_registered_across_all_three_tiers 38
function test_every_rule_meta_matches_its_registry_key 44
function test_subjective_language 54
function test_ambiguous_adverb_adjective 61
function test_loophole 70
function test_open_ended_term 79
function test_weak_modal 86
function test_unresolved_placeholder 95
function test_missing_unit 104
function test_missing_unit_exempts_ids_versions_and_list_markers 113
function test_missing_unit_skips_markdown_headings 119 Wave-B review: headings are titles, not acceptance criteria — a bare
function test_missing_unit_exempts_port_numbers 127 Wave-B review: a number after 'port' is an identifier, not an
function test_exact_duplicate 134
function test_template_violation 148
function test_incomplete_reference 174
function test_incomplete_reference_known_refs_resolve 183
function test_incomplete_reference_multi_segment_req_id_resolves 189 Wave-B review regression: the B13 heading capture stopped at the first
function test_superlative 208
function test_comparative_no_baseline_true_positives 215
function test_comparative_no_baseline_false_positive_with_named_artifact 224
function test_comparative_no_baseline_exempts_conditional_clauses 229 ADR-0029's own measured case: exempted inside a condition, fires outside.
function test_negative_statement_true_positives 239
function test_negative_statement_exempts_conditional_clauses 246
function test_non_atomic_criterion 255
function test_coordination_ambiguity 265
function test_solution_language 274
function test_vague_pronoun_subject_position 286
function test_quantifier_scope 294
function test_operator_placement 302
function test_boundary_word 310
function test_temporal_nonspecific 318
function test_underspecified_head_noun 328
function test_deictic_reference 339
function test_every_tier3_finding_populates_question 347
function test_rationale_clause_downweights_a_finding 369
function test_main_clause_finding_has_full_weight 376

tests/factory/test_dispatch_gates.py

source · 20 tests · 362 lines

Tests for orchestrata_ultimate.factory.dispatch.gates (B21) and the

Covers: factory.dispatch.gates, factory.enforcement.ledger, factory.promotion.models, factory.promotion.store

Kind Name Line Description
function test_no_self_merge_refuses_equal_identities 52
function test_no_self_merge_passes_distinct_identities 59
function test_no_self_merge_is_case_sensitive 63
function test_no_self_merge_refuses_empty_or_none_identity 79
function test_task_key_deterministic_regardless_of_path_order 91
function test_task_key_differs_for_different_requirement_or_paths 98
function test_duplication_gate_refuses_second_claim_naming_holder 108
function test_release_by_non_holder_is_a_noop 121
function test_release_by_holder_then_reclaim_works 132
function test_ttl_expiry_frees_the_key 145
function test_holder_of_unclaimed_key_is_none 157
function test_staleness_gate_raises_when_trunk_touched_declared_path 202
function test_staleness_gate_passes_when_trunk_moved_on_disjoint_paths 210
function test_staleness_gate_directory_prefix_match 215
function test_staleness_gate_raises_on_unreachable_base_commit 222
function test_promote_refuses_self_merge_before_any_write 244
function test_promote_refuses_unknown_identity_before_any_write 270
function test_promote_distinct_identities_promotes_and_ledger_carries_both 290
function test_promote_omitted_identities_is_legacy_behavior 319 Regression pin: omitting BOTH identities must leave the ledger event's
function test_promote_single_identity_given_is_also_legacy_behavior 343 Only ONE of the two identities given: no_self_merge is not invoked

tests/factory/test_dor.py

source · 5 tests · 105 lines

Tests for orchestrata_ultimate.factory.assumptions.dor (AC-033-C1-02).

Covers: factory.assumptions.dor, factory.assumptions.ledger, factory.assumptions.models

Kind Name Line Description
function test_dor_ready_when_no_assumptions 22
function test_dor_ready_when_all_pinned 29
function test_dor_not_ready_fails_and_names_assumption_and_design_node 45 AC-033-C1-02: DoR fails and names the assumption and its design node.
function test_dor_lists_every_non_pinned_assumption 56
function test_dor_result_is_frozen 102

tests/factory/test_dor_anchors_export.py

source · 9 tests · 164 lines

Tests for orchestrata_ultimate.factory.dor_procedure.anchors_export.

Covers: factory.dor_procedure.anchors_export, factory.dor_procedure.models

Kind Name Line Description
function test_export_anchor_candidates_count_matches_classes_count 87
function test_export_anchor_candidates_boundary_classes_are_boundary_kind 93
function test_export_anchor_candidates_class_without_boundary_is_example_kind 102
function test_export_anchor_candidates_carries_expect_from_step3 116
function test_export_anchor_candidates_expect_empty_when_step3_missing_behavior 123
function test_export_anchor_candidates_carries_requirement_id_and_given 130
function test_export_anchor_candidates_serializable_via_asdict 139
function test_export_anchor_candidates_empty_step2_yields_no_candidates 147
function test_anchor_candidate_is_frozen 153

tests/factory/test_dor_artifact.py

source · 10 tests · 232 lines

Tests for orchestrata_ultimate.factory.dor_procedure.artifact.

Covers: factory.dor_procedure.artifact, factory.dor_procedure.models

Kind Name Line Description
function test_save_and_load_artifact_round_trips_exactly 117
function test_save_and_load_artifact_round_trips_rulings_checklist 125
function test_load_artifact_missing_rulings_checklist_key_defaults_empty 137 A pre-Step-6.3 artifact JSON has no rulings_checklist key at all —
function test_save_artifact_writes_valid_json 153
function test_save_artifact_refuses_to_overwrite_by_default 163
function test_save_artifact_overwrite_true_replaces_existing_file 171
function test_save_artifact_creates_parent_directories 193
function test_load_artifact_unknown_schema_version_raises 200
function test_save_artifact_leaves_no_temp_file_behind 213
function test_save_artifact_cleans_up_temp_file_on_replace_failure 221

tests/factory/test_dor_axes.py

source · 7 tests · 79 lines

Tests for orchestrata_ultimate.factory.dor_procedure.axes.

Covers: factory.dor_procedure.axes

Kind Name Line Description
function test_residual_axes_has_exactly_ten_axes 32
function test_residual_axes_ids_match_adr_0028_step_7_list 36
function test_residual_axes_ids_are_unique 40
function test_provenance_tier_values 45
function test_residual_axis_provenance_tier 66
function test_residual_axes_every_axis_has_nonempty_source 71
function test_axis_is_frozen 76

tests/factory/test_dor_models.py

source · 19 tests · 168 lines

Tests for orchestrata_ultimate.factory.dor_procedure.models.

Covers: factory.dor_procedure.models

Kind Name Line Description
function test_input_spec_is_frozen 33
function test_step1_inputs_defaults_empty 39
function test_class_kind_values 45
function test_equivalence_class_boundary_defaults_empty 52
function test_step2_classes_defaults_empty 57
function test_step3_behaviors_defaults_empty 61
function test_step4_state_walk_defaults 65
function test_failure_mode_values 73
function test_step5_failure_envelope_defaults 82
function test_limit_kind_values 89
function test_step6_limits_defaults_empty 97
function test_axis_answer_kind_values 101
function test_axis_answer_defaults 107
function test_step7_residual_defaults_empty 113
function test_ruling_checklist_entry_is_frozen 117
function test_rulings_checklist_defaults_empty 123
function test_construction_artifact_defaults_schema_version_1 129
function test_construction_artifact_is_frozen 146
function test_construction_artifact_carries_traces 164

tests/factory/test_dor_validate.py

source · 33 tests · 623 lines

Tests for orchestrata_ultimate.factory.dor_procedure.validate.

Covers: factory.dor_procedure.axes, factory.dor_procedure.models, factory.dor_procedure.rulings, factory.dor_procedure.validate

Kind Name Line Description
function test_ready_artifact_has_zero_violations_and_is_ready 185
function test_step1_unused_inputs_not_subset_violation 194
function test_step2_missing_invalid_class_violation 204
function test_step2_missing_entry_for_declared_input_violation 218
function test_step2_set_membership_valid_plus_complement_is_sufficient 227
function test_step3_class_without_behaviour_violation 261
function test_step4_state_input_hole_violation 273
function test_step4_na_without_reason_violation 287
function test_step4_no_input_case_empty_violation 300
function test_step5_missing_failure_mode_violation 309
function test_step5_na_without_reason_violation 322
function test_step5_empty_dependencies_without_reason_violation 333
function test_step5_empty_dependencies_with_stated_reason_is_valid 347
function test_step6_missing_limit_kind_violation 361
function test_step6_na_without_reason_violation 370
function test_step7_unanswered_axis_violation 381
function test_step7_specified_without_where_violation 391
function test_step7_not_applicable_without_reason_violation 406
function test_step7_extra_unknown_axis_violation 423
function test_step7_duplicate_answer_for_same_axis_violation 438
function test_rulings_checklist_present_and_derived_has_zero_violations 454 The ready fixture's checklist entries are absent (PRESENT) with a
function test_rulings_checklist_missing_section_violation_names_what_is_missing 466 A DoR artifact whose rulings checklist is completely absent (empty
function test_rulings_checklist_empty_with_stated_reason_is_valid 480
function test_rulings_checklist_unknown_ruling_id_violation 492 A ruling_id that is not in the DERIVED canon set is a violation —
function test_rulings_checklist_known_ruling_id_from_canon_is_not_flagged 516 A ruling_id that IS a real, currently-cloned canon id is never
function test_rulings_checklist_entry_empty_applies_because_violation 538
function test_rulings_checklist_ids_are_derived_not_hardcoded 558 Direct proof that the catalogue is DERIVED from the filesystem, not a
function test_rulings_checklist_ids_empty_directory_returns_empty_tuple 571
function test_gaps_returns_only_gap_kind_answers 576
function test_procedure_ready_refuted_by_a_single_gap 591
function test_shape_violation_is_frozen 608
function test_no_public_symbol_in_validate_module_claims_complete 614
function test_procedure_ready_docstring_states_necessary_not_sufficient 620

tests/factory/test_enforcement_bootstrap.py

source · 13 tests · 174 lines

Tests for orchestrata_ultimate.factory.enforcement.bootstrap.

Covers: factory.enforcement.bootstrap, factory.enforcement.ledger

Kind Name Line Description
function test_classify_delta_first_commit_all_added 62
function test_classify_delta_modified 71
function test_classify_delta_deleted 77
function test_classify_delta_unchanged 82
function test_classify_delta_mixed 87
function test_bootstrap_baseline_empty_tree_is_empty 102
function test_bootstrap_baseline_content_exact_sha256 107
function test_bootstrap_baseline_multiple_files_and_subdirs 114
function test_bootstrap_baseline_matches_git_object_id_not_used 123 Hash is sha256 of BLOB CONTENT, not git's own (sha1) object id.
function test_bootstrap_baseline_first_commit_yields_all_added 134
function test_record_bootstrap_writes_human_writer_record 148
function test_record_bootstrap_requires_non_empty_by 165
function test_record_bootstrap_requires_non_empty_paths 171

tests/factory/test_enforcement_enforce.py

source · 11 tests · 369 lines

Tests for orchestrata_ultimate.factory.enforcement.enforce.

Covers: factory.enforcement.bootstrap, factory.enforcement.enforce, factory.enforcement.ledger, factory.enforcement.models

Kind Name Line Description
function test_happy_path_record_then_commit_then_verify_passes 79
function test_unregistered_new_file_cannot_launder_through_no_prior_state 104 A NEW file with NO ledger record must fail even though no registered
function test_content_exact_mismatch_names_both_hashes 126
function test_modified_path_with_no_ledger_coverage_is_hash_mismatch 153
function test_unregistered_writer_names_writer_that_almost_matched 184 Hash matches exactly, but the producing writer was never registered.
function test_declared_deletion_passes 218
function test_undeclared_deletion_violates 253
function test_deletion_declared_by_unregistered_writer_violates 278
function test_fail_closed_empty_ledger_nonempty_delta 319
function test_no_truncation_every_violating_path_named 332 ADR-0026: no violating path is ever truncated out of the report.
function test_unchanged_paths_never_produce_violations 345

tests/factory/test_enforcement_ledger.py

source · 22 tests · 308 lines

Tests for orchestrata_ultimate.factory.enforcement.models + ledger.

Covers: factory.enforcement.ledger, factory.enforcement.models

Kind Name Line Description
function test_writer_identity_is_frozen 33
function test_deletion_marker_constant 39
function test_governed_write_record_new_generates_id_and_timestamp 43
function test_governed_write_record_new_with_byproducts 58
function test_governed_write_record_ids_are_unique 70
function test_locked_file_read_json_empty_file_returns_none 85
function test_locked_file_write_json_cleans_up_tmp_on_serialization_error 92
function test_record_and_records_for_round_trip 105
function test_records_for_filters_by_worktree_and_commit 119
function test_records_for_unknown_worktree_commit_is_empty 148
function test_all_returns_every_record 153
function test_ledger_file_is_valid_jsonl 164
function test_ledger_no_temp_files_left_behind 181
function test_concurrent_record_no_corruption 189 Real threads (3.14t, no GIL) appending concurrently must not corrupt the file.
function test_register_and_registered_round_trip 222
function test_registered_returns_false_when_never_registered 229
function test_register_requires_non_empty_by 235
function test_same_name_different_config_hash_is_not_registered 242 ADR-0017 confused-deputy case: identity is the (binary-hash,
function test_identity_match_ignores_name_field 255 Identity is the hash pair, not the name (ADR-0017) -- a differently
function test_entries_returns_registered_identities 269
function test_registry_file_no_temp_files_left_behind 283
function test_concurrent_register_no_corruption 291 Real threads registering concurrently must not corrupt the registry file.

tests/factory/test_fastpath_classifier.py

source · 18 tests · 434 lines

Tests for orchestrata_ultimate.factory.fastpath.classifier (B12, ADR-0023).

Covers: factory.anchors.evaluation, factory.anchors.models, factory.anchors.store, factory.fastpath.classifier

Kind Name Line Description
function test_body_only_edit_is_within_contract 117
function test_public_function_gains_a_parameter_forces_slow_and_names_it 135
function test_new_public_symbol_forces_slow 148
function test_removed_public_symbol_forces_slow 159
function test_new_outbound_import_to_another_top_level_package_forces_slow 171
function test_changed_non_python_file_forces_slow 182
function test_new_module_absent_at_base_is_never_within_contract 192
function test_relative_import_never_counts_as_new_outbound 202
function test_absolute_from_import_new_outbound_edge_forces_slow 218
function test_private_class_methods_never_affect_public_surface_or_signatures 229 A private (underscore-prefixed) class's methods are not part of the
function test_keyword_only_parameter_default_change_is_a_signature_change 253
function test_structural_proof_is_frozen 268
function test_eligible_fast_path_when_structural_and_anchors_both_pass 280
function test_structural_failure_short_circuits_anchor_evaluation 312 When structural fails, anchor_verdict is None and anchors_seconds is
function test_changed_anchor_id_disqualifies_fast_path_laundering_via_edit 341 ADR-0023's laundering-via-edit case: structural passes, but the
function test_unsatisfied_anchor_blocks_even_though_structural_passes 374
function test_classify_never_mutates_registry 401
function test_cost_trace_to_dict_is_json_serializable 422

tests/factory/test_formalization_models.py

source · 32 tests · 449 lines

Tests for orchestrata_ultimate.factory.formalization.models (B26, REQ-033-C4).

Covers: factory.formalization.models

Kind Name Line Description
function test_domain_frozen 32
function test_domain_rejects_empty 38
function test_domain_rejects_duplicate_values 43
function test_variable_accepts_lower_snake_name 51
function test_variable_rejects_non_lower_snake_name 60
function test_require_constraint_needs_vars 68
function test_require_constraint_needs_tuples 79
function test_constraint_needs_source_provenance 90
function test_constraint_needs_constraint_id 101
function test_implies_constraint_needs_antecedent 112
function test_implies_constraint_needs_consequent_var 123
function test_implies_constraint_needs_consequent_values 134
function test_formalization_satisfiable_and_pinned_constructs_cleanly 149
function test_formalization_rejects_empty_requirement_id 169
function test_formalization_rejects_duplicate_variable_names 178
function test_formalization_rejects_duplicate_constraint_ids 187
function test_formalization_rejects_constraint_referencing_unknown_variable 211
function test_formalization_rejects_tuple_arity_mismatch 228
function test_formalization_rejects_literal_outside_domain 245
function test_formalization_rejects_implies_antecedent_unknown_variable 262
function test_formalization_rejects_implies_antecedent_value_outside_domain 280
function test_formalization_rejects_implies_unknown_consequent_var 298
function test_formalization_rejects_implies_consequent_value_outside_domain 316
function test_formalization_rejects_zero_observable_variables 334
function test_implies_constraint_round_trips_through_formalization 340
function test_formalization_to_dict_and_back_round_trips 388
function test_formalization_to_dict_is_json_serializable 395
function test_save_and_load_formalization_round_trips 403
function test_save_formalization_refuses_overwrite_without_flag 411
function test_save_formalization_overwrite_true_replaces 419
function test_load_formalization_rejects_unknown_schema_version 429
function test_save_formalization_cleans_up_tmp_file_on_replace_failure 440 A real (non-mocked) failure: target is a directory, so the final

tests/factory/test_ledger.py

source · 25 tests · 358 lines

Tests for orchestrata_ultimate.factory.assumptions.ledger.

Covers: factory.assumptions.ledger, factory.assumptions.models

Kind Name Line Description
function test_add_and_get_round_trip 36
function test_get_unknown_returns_none 44
function test_add_duplicate_raises_value_error 49
function test_update_rewrites_record 59
function test_update_unknown_id_raises 75
function test_assumptions_lists_all_in_insertion_order 82
function test_add_disclosure_and_list_all 92
function test_disclosures_filtered_by_design_node 107
function test_ledger_mixes_assumptions_and_disclosures_without_cross_contamination 130
function test_ledger_file_is_valid_jsonl 146
function test_ledger_no_temp_files_left_behind 158
function test_concurrent_add_distinct_assumptions_no_corruption 168 Real threads (3.14t, no GIL) appending concurrently must not corrupt the file.
function test_concurrent_add_same_assumption_exactly_one_wins 192 Two threads racing to add the SAME assumption: exactly one succeeds.
function test_promote_assigns_sequential_ids 244
function test_promote_tolerates_malformed_existing_id 252 A corrupted/non-numeric ADJ- id in the file must not crash promote --
function test_lookup_exact_fingerprint_match 268
function test_lookup_fuzzy_jaccard_match 278
function test_lookup_below_threshold_returns_none 288
function test_lookup_returns_none_when_kb_empty 296
function test_superseded_adjudication_never_matches 302
function test_supersede_sets_superseded_by 313
function test_supersede_unknown_id_raises 322
function test_kb_all_returns_every_record 328
function test_kb_fuzzy_threshold_constant 335
function test_concurrent_promote_no_duplicate_ids 339 Real threads promoting concurrently must not collide on ADJ- ids.

tests/factory/test_merge_queue.py

source · 6 tests · 218 lines

Tests for orchestrata_ultimate.factory.scheduler.queue (B9, ADR-0004/0033).

Covers: factory.enforcement.ledger, factory.promotion.models, factory.promotion.store, factory.scheduler.dag, factory.scheduler.queue, factory.scheduler.worktrees

Kind Name Line Description
function test_three_entries_promote_in_exact_enqueue_order 85
function test_regate_fail_rejects_and_leaves_namespace_intact 118
function test_mixed_pass_and_fail_only_passing_entries_promote 147
function test_enqueue_is_thread_safe_and_drain_empties_the_queue 177
function test_drain_on_empty_queue_returns_empty_list 201
function test_merge_entry_and_regate_verdict_are_frozen 206

tests/factory/test_models.py

source · 19 tests · 172 lines

Tests for orchestrata_ultimate.factory.assumptions.models.

Covers: factory.assumptions.models

Kind Name Line Description
function test_fingerprint_normalizes_case_punctuation_whitespace 27
function test_fingerprint_is_full_sha256_hex 33
function test_fingerprint_differs_for_different_text 39
function test_assumption_new_computes_deterministic_id 43
function test_assumption_new_id_depends_on_design_node 51
function test_assumption_new_id_matches_documented_derivation 57
function test_assumption_new_rejects_empty_author_identity 65
function test_assumption_defaults 70
function test_assumption_carries_requirement_id 80
function test_assumption_is_frozen 85
function test_assumption_replace_produces_new_instance 91
function test_pinning_kind_values_are_lowercase_no_weasel_words 99
function test_assumption_status_values 106
function test_ruling_values 113
function test_pinning_is_frozen 119
function test_candidate_is_frozen 125
function test_adjudication_only_matched_unpinned_are_meant_to_be_promoted 132
function test_interpretation_disclosure_fields 148
function test_cascade_outcome_fields 160

tests/factory/test_mutation.py

source · 10 tests · 277 lines

Tests for orchestrata_ultimate.factory.evidence.mutation.

Covers: factory.evidence.mutation

Kind Name Line Description
function test_affected_units_finds_the_function 43
function test_affected_units_excludes_class_rows 52
function test_pinning_test_kills_the_comparison_swap_mutant 65
function test_vacuous_test_lets_mutants_survive 92
function test_limit_caps_mutants_and_logs_what_was_skipped 125
function test_working_tree_untouched_after_a_mutation_run 157
function test_mutation_on_a_class_method 186
function test_no_mutants_generated_for_an_unknown_unit_name 215 A unit whose name doesn't resolve to any function/method in its file
function test_no_mutants_generated_for_an_unknown_method_name 239 Same as above but for the kind == "method" lookup branch: no
function test_hard_per_mutant_timeout_is_recorded_as_timeout 264

tests/factory/test_prefilter.py

source · 9 tests · 102 lines

Tests for orchestrata_ultimate.factory.assumptions.prefilter.

Covers: factory.assumptions.models, factory.assumptions.prefilter, factory.assumptions.sources

Kind Name Line Description
function test_constants 37
function test_prefilter_returns_high_overlap_candidate 43
function test_prefilter_excludes_below_min_score 51
function test_prefilter_sorted_descending_by_score 57
function test_prefilter_caps_at_max_candidates 68
function test_prefilter_queries_multiple_sources 75
function test_prefilter_empty_sources_returns_empty 83
function test_prefilter_stopwords_do_not_inflate_score 87
function test_prefilter_never_sets_status_it_only_returns_candidates 94 Stage-1 candidates are informational only (ADR-0024) -- prefilter

tests/factory/test_projection_analyzer.py

source · 28 tests · 346 lines

Tests for orchestrata_ultimate.factory.projection.analyzer (B5, ADR-0006/0025).

Covers: factory.projection.analyzer

Kind Name Line Description
function test_pred_id_parse_round_trips_through_str 32
function test_pred_id_parse_accepts_module_qualifier 38
function test_pred_id_parse_rejects_missing_arity 44
function test_pred_id_parse_rejects_non_numeric_arity 49
function test_closure_resolves_three_levels_transitively 59 root -> helper -> leaf; leaf is never defined in the file, so it
function test_negated_goal_is_still_required 74 ADR-0006's false-green scenario: a predicate consulted ONLY under
function test_goal_under_findall_is_still_required 86 findall/3's own Goal argument is a required read, not just findall
function test_goal_under_forall_is_still_required 96
function test_module_qualified_call_preserves_qualifier 108
function test_zero_arity_predicate_closure 118 Arity-0 predicates via explicit empty parens resolve correctly, both
function test_fact_only_predicate_computes_arity_without_body 131 A ground FACT (no ':-' body) must still get correct head arity from
function test_disjoint_root_not_reachable_is_excluded 142
function test_unterminated_paren_call_does_not_crash 154 A malformed clause with an unterminated '(' must not crash the
function test_required_set_is_frozen 164
function test_undecidable_on_nonground_call 177
function test_undecidable_on_module_qualified_nonground_call 184
function test_undecidable_on_assert_in_rule_body 194
function test_undecidable_on_retract_in_rule_body 201
function test_undecidable_on_univ_goal_construction 208 =.. (univ) alone, with no accompanying call(Var, ...) in the
function test_dynamic_directive_alone_is_not_undecidable 221 A bare ':- dynamic foo/1.' directive is fine (ADR-0025 bans
function test_verify_declaration_detects_under_declaration 239
function test_verify_declaration_detects_over_declaration 249
function test_verify_declaration_both_directions_at_once 260
function test_verify_declaration_clean_header_has_no_mismatches 271
function test_verify_declaration_ignores_malformed_header_entries 280 A malformed entry in the '%! requires:' header (no parseable
function test_verify_declaration_ignores_trailing_comma_in_header 295 A trailing comma in the '%! requires:' header yields an empty spec
function test_derived_set_unchanged_by_under_or_over_declared_header 308 The manual header is a CROSS-CHECK ONLY -- required_predicates()'s
function test_real_rulebase_smoke_policy_layers 337 The analyzer must run over an ACTUAL shipped governance rulebase

tests/factory/test_projection_completeness.py

source · 9 tests · 107 lines

Tests for orchestrata_ultimate.factory.projection.completeness (B5, ADR-0006).

Covers: factory.projection.analyzer, factory.projection.completeness

Kind Name Line Description
function test_missing_extensional_predicate_raises_with_exact_pred_named 34
function test_multiple_missing_predicates_all_named_and_sorted 42
function test_complete_projection_passes_without_raising 52
function test_complete_projection_tolerates_extra_provided_predicates 57 Over-provisioning is fine -- the gate only cares about what is
function test_intensional_predicates_never_demanded_from_provided 66 A predicate defined BY the rulebase's own clauses needs no fact
function test_empty_required_set_always_completes 76
function test_incomplete_projection_message_is_stable_and_readable 80
function test_projection_manifest_is_json_able_and_sorted 90
function test_projection_manifest_empty_required_set 105

tests/factory/test_promotion_store.py

source · 27 tests · 800 lines

Tests for orchestrata_ultimate.factory.promotion.{models,store} (B4a).

Covers: factory.enforcement.ledger, factory.promotion.models, factory.promotion.store, knowledge_graph.sync

Kind Name Line Description
function test_fact_namespace_key_format 110
function test_fact_namespace_trunk_sentinel 115
function test_fact_namespace_is_frozen 122
function test_retention_policy_is_frozen 128
function test_promotion_record_is_frozen 134
function test_isolation_facts_invisible_across_namespaces 152
function test_promote_moves_facts_to_trunk_and_deletes_source 181
function test_promote_unknown_or_empty_namespace_fails_loudly 212
function test_promote_requires_nonempty_gate_token 219
function test_promote_rejects_trunk_as_source 232
function test_gc_deletes_dead_worktree_beyond_retention_keeps_newest 243
function test_gc_trunk_is_never_eligible 277
function test_await_watermark_returns_promptly_for_a_visible_watermark 301
function test_await_watermark_raises_watermark_timeout_on_an_unknown_watermark 316 ADR-0019 is fail-CLOSED: a watermark the read view cannot see must
function test_promote_watermark_is_visible_and_distinct_from_the_write 336 promote mints its own watermark on the SURVIVING trunk control node,
function test_every_watermark_of_a_shared_commit_stays_visible 356 Two promotions of the SAME commit must both remain observable.
function test_syncer_full_sync_without_namespace_is_byte_identical 393 namespace=None (the default) must leave the un-namespaced write shape
function test_tag_namespace_noop_on_empty_module_ids 447 _tag_namespace guards the empty-module-ids case (an AST subset with
function test_promote_dequalifies_syncer_namespace_facts 465 Promoting a namespace containing GraphSyncer-synced (id-qualified)
function test_promote_a_then_b_last_promoted_wins_on_shared_id 534 Promoting namespace A, then namespace B, for the SAME overlapping
function test_write_fact_hub_links_fact_and_control_node_to_project 595 After write_fact, the fact node must be reachable from (:Project)
function test_promote_leaves_every_fact_reachable_from_project_via_trunk 631 After promote, EVERY promoted fact -- a generic write_fact fact
function test_delete_namespace_leaves_no_orphaned_fact_or_edge 695 After _delete_namespace (the primitive gc calls), no HAS_FACT
function test_gc_trunk_control_nodes_are_never_gc_candidates 738 gc() already excludes worktree <> 'trunk' from its candidate scan
function test_store_with_injected_driver_does_not_own_or_close_it 768
function test_write_fact_rejects_invalid_label 789
function test_every_write_mints_a_distinct_watermark 796 Tokens must be collision-free: two writes sharing one token would let

tests/factory/test_red_first.py

source · 16 tests · 362 lines

Tests for orchestrata_ultimate.factory.evidence.red_first.

Covers: factory.enforcement.ledger, factory.evidence.red_first

Kind Name Line Description
function test_red_then_green_across_commits_is_red_first 59
function test_green_with_no_prior_red_is_never_red 75
function test_red_and_green_same_commit_is_green_only 87 The change can't be what flipped a test never seen failing before it
function test_unobserved_when_no_green_recorded 103
function test_red_first_requires_ancestor_not_just_any_earlier_record 115 A red recorded against a commit that is NOT an ancestor of the green
function test_failure_digest_scrubs_numbers 151
function test_failure_digest_differs_for_different_message 157
function test_digest_stable_across_differing_trailing_line_numbers 163 Same assertion failing from a different embedded line number in the
function test_parse_failure_extracts_explicit_exception_type 186
function test_parse_failure_falls_back_to_bare_assert 197
function test_parse_failure_ultimate_fallback_with_no_e_lines 204 No line in the longrepr starts with E at all (a malformed/partial
function test_iter_test_outcomes_reads_call_phase_as_authoritative 225
function test_iter_test_outcomes_uses_setup_failure_when_call_never_runs 283
function test_iter_test_outcomes_tolerates_malformed_lines 304
function test_iter_test_outcomes_skips_blank_lines 316
function test_record_from_report_populates_red_and_green 328

tests/factory/test_scheduler_dag.py

source · 12 tests · 137 lines

Tests for orchestrata_ultimate.factory.scheduler.dag (B9).

Covers: factory.promotion.models, factory.scheduler.dag, factory.scheduler.worktrees

Kind Name Line Description
function test_build_levels_diamond_shuffled_input 43
function test_build_levels_single_independent_task 56
function test_build_levels_empty_input 62
function test_build_levels_deterministic_order_within_level 66
function test_build_levels_linear_chain 73
function test_build_levels_unknown_dependency_raises_value_error 81
function test_build_levels_cycle_raises_naming_members 87
function test_build_levels_cycle_names_downstream_task_too 97 A task depending on a cyclic task can never reach zero in-degree
function test_build_levels_self_dependency_is_a_cycle 108
function test_task_spec_is_frozen 115
function test_build_context_and_result_are_frozen 121
function test_build_result_default_detail_is_empty_string 135

tests/factory/test_scheduler_pipeline.py

source · 4 tests · 387 lines

End-to-end tests for orchestrata_ultimate.factory.scheduler.scheduler (B9).

Covers: factory.dispatch.gates, factory.enforcement.ledger, factory.promotion.models, factory.promotion.store, factory.scheduler.dag, factory.scheduler.queue, factory.scheduler.scheduler

Kind Name Line Description
function test_pipeline_e2e_diamond_stale_duplicate_and_gc 80
function test_pipeline_linear_dag_promotion_order_is_exact 249
function test_pipeline_build_raising_is_recorded_build_failed 294 A build callable that RAISES (not just returns a failing
function test_pipeline_regate_rejection_is_recorded_and_namespace_intact 341 A task that builds successfully but fails the integration re-gate

tests/factory/test_scheduler_worktrees.py

source · 7 tests · 149 lines

Tests for orchestrata_ultimate.factory.scheduler.worktrees (B9, ADR-0004).

Covers: factory.promotion.models, factory.scheduler.worktrees

Kind Name Line Description
function test_lease_creates_real_detached_checkout_at_base_commit 58
function test_lease_supports_multiple_concurrent_task_worktrees 86
function test_release_removes_the_real_worktree_and_returns_lease_when_abandoned 102
function test_release_returns_none_when_not_abandoned 114
function test_release_cleans_up_a_branch_created_inside_the_worktree 124
function test_release_is_a_noop_safe_double_call 135 Releasing an already-released lease must not raise (best-effort,
function test_worktree_lease_is_frozen 145

tests/factory/test_sources.py

source · 13 tests · 223 lines

Tests for orchestrata_ultimate.factory.assumptions.sources.

Covers: factory.assumptions.ledger, factory.assumptions.models, factory.assumptions.sources

Kind Name Line Description
function test_ac_source_extracts_ac_lines 60
function test_ac_source_extracts_req_headings 73
function test_ac_source_req_heading_without_title_falls_back_to_ref 83
function test_ac_source_missing_dir_returns_empty 92
function test_ac_source_captures_multi_segment_req_heading 96 Wave-B review regression: the ref capture must run to the END of a
function test_ac_source_scans_multiple_spec_dirs 110
function test_adr_source_extracts_title_and_decision 124
function test_adr_source_title_only_when_no_decision_section 139
function test_adr_source_skips_readme 149
function test_adr_source_missing_dir_returns_empty 160
function test_adr_source_ignores_non_numbered_files 164
function test_kb_source_only_yields_matched_non_superseded 171
function test_kb_source_empty_kb_yields_nothing 221

tests/factory/test_trace_validation.py

source · 20 tests · 605 lines

Tests for orchestrata_ultimate.factory.contracts.trace_validation (SPEC-033 B3).

Covers: factory.contracts.models, factory.contracts.trace_validation

Kind Name Line Description
function test_exempt_prefixes_are_exactly_the_specified_set 36
function test_happy_path_direct_import_passes 41
function test_happy_path_transitive_one_hop_import_passes 75
function test_two_hop_import_does_not_reach 115 Only ONE level of transitivity counts — a two-hop chain must still fail.
function test_citing_test_that_does_not_import_the_unit_is_a_violation 166 A test that CITES the requirement but never imports the changed unit
function test_requirement_with_no_citing_test_anywhere_is_untested 206
function test_changed_file_not_claimed_by_any_node_is_a_violation 244
function test_exempt_prefix_changed_files_are_not_flagged 289
function test_changed_script_is_not_exempt 330 scripts/ is explicitly NOT in the exempt-prefix list — a changed
function test_script_claimed_by_a_node_is_accepted 373
function test_node_with_no_changed_modules_is_skipped_entirely 403 A node whose modules didn't change contributes no violations even if
function test_multiple_violations_all_enumerated_none_truncated 442
function test_non_py_changed_files_are_ignored 480
function test_path_to_dotted 513
function test_parse_imported_modules_handles_syntax_error 517
function test_parse_imported_modules_plain_import_statement 521
function test_parse_imported_modules_relative_import_is_skipped 526
function test_test_reaches_module_skips_unreadable_intermediate_file 531 A candidate intermediate module that exists but can't be read (a real
function test_node_reaches_requirement_skips_unreadable_citing_file 554 A citing file that's unreadable at read-time (a real permission
function test_node_reaches_requirement_skips_non_py_changed_module 586 A node's modules entry that isn't a .py path has no dotted