orchestrata_ultimate.factory.formalization.dor_bridge

Reference › orchestrata_ultimate › factory › formalization › dor_bridge

dor_bridge renders C4 results for the Definition-of-Ready gate (SPEC-033 row B26, REQ-033-C4, ADR-0022). c4_blocking_findings turns a C4Report from c4 into human-readable lines; because C4 runs ahead of C2, a contradiction or an under-constraint finding blocks. The module only produces the lines. Wiring them into the gate is the job of the decision phase, which imports it along with the scripts.factory_c4 CLI. No test module imports it directly.

At a glance

Source src/orchestrata_ultimate/factory/formalization/dor_bridge.py
Lines of code 46
Classes 0
Functions 1
Imports (internal) orchestrata_ultimate.factory.formalization.c4
Imported by orchestrata_ultimate.factory.decision.phase, scripts.factory_c4
Tests that import it none

Class diagram

No classes; see Functions.

Dependency diagram

Dependency diagram orchestrata_ultimate.factory.formalization.dor_bridge

API

Functions

Function Signature Summary
c4_blocking_findings c4_blocking_findings(report: C4Report) -> list[str] Render report's findings as human-readable, blocking lines.

Source

Permalink: https://gitlab.com/MSamy/orchestrata-ultimate-architecture/-/blob/a4cbc2bdf/src/orchestrata_ultimate/factory/formalization/dor_bridge.py

"""DoR integration bridge for SPEC-033 C4 findings (B26, REQ-033-C4).

:func:`c4_blocking_findings` renders a
:class:`~orchestrata_ultimate.factory.formalization.c4.C4Report` as
human-readable, blocking finding lines for the DoR construction procedure
(B8) to consume. Per spec §6 / ADR-0022, C4 "runs ahead of C2" -- a
contradiction or under-constraint finding IS blocking. Wiring this bridge
into the actual DoR gate is B8's job, not this module's; this only produces
the lines B8 will surface.
"""

from __future__ import annotations

from orchestrata_ultimate.factory.formalization.c4 import C4Report


def c4_blocking_findings(report: C4Report) -> list[str]:
    """Render ``report``'s findings as human-readable, blocking lines.

    An empty list means neither C4 detector fired for this declared
    formalization -- NOT a completeness certificate for the requirement
    (see :class:`~orchestrata_ultimate.factory.formalization.c4.C4Report`'s
    docstring: C4 speaks only about the declared formalization).
    """
    lines: list[str] = []

    contradiction = report.contradiction
    if contradiction is not None:
        ids = ", ".join(contradiction.conflicting_constraint_ids)
        sources = ", ".join(contradiction.conflicting_sources)
        lines.append(
            f"CONTRADICTION requirement={report.requirement_id}: constraints "
            f"[{ids}] admit no solution (conflicting sources: {sources})"
        )

    under_constraint = report.under_constraint
    if under_constraint is not None:
        differing = ", ".join(under_constraint.differing_observable_vars)
        lines.append(
            f"UNDER-CONSTRAINT requirement={report.requirement_id}: >=2 material "
            f"solutions differing on observable variable(s) [{differing}] "
            f"(witness A: {under_constraint.witness_a}; "
            f"witness B: {under_constraint.witness_b})"
        )

    return lines