Skip to content

just_dna_enricher.verdict

just_dna_enricher.verdict

A gate's verdict, with the reasons it is a no travelling beside it.

Why this is not the house tri-state. Everything else that answers a question here is true / false / unknown and withholds on the third arm (CLAUDE.md, @tri-state-is-the-house-algebra). A gate is the one shape that cannot: check-acmg --strict and check-identifiers --strict have to choose an exit code, and a build that could not be certified is a no — the same way a 500 fails a request rather than leaving it pending. So the unknown does not go into the verdict; it goes beside it, as the reason the verdict is no. Verdict is falsy exactly when it carries codes, and the empty set is the pass.

The set holds errors, not non-answers, which is the line that decides every member below. A registry that refused, a list nobody could obtain, a table that carries identifiers and will not parse — those are errors and they make the verdict false. A check the caller switched off, or a module that simply has no row the check applies to, is not an error and does not: a run that asked nothing because there was nothing to ask is a true, with its own denominator printed beside it. Conflating the two is how --strict --no-traits would start failing builds for doing what it was told.

Bool-like rather than a tuple, because these are @property returns and a caller already writes if report.clean:. __bool__ keeps every such caller correct across the change, and a caller that wants the reasons reads .codes instead of making a second call. The codes are ordered on the way out (sorted), never iterated as a set, so a message built from one is stable between runs — the deterministic-ordering rule applies to anything that reaches a user, not only to parquet bytes.

Verdict dataclass

Verdict(codes: frozenset[str] = frozenset())

A yes/no with its reasons. Falsy when it carries any code; the empty set is the pass.

of classmethod

of(**reasons: object) -> Verdict

Verdict.of(offline=..., tables_unreadable=...) — a code is carried when its value is truthy.

The call site then reads as the sentence it implements, and the codes are checked against the vocabulary by __post_init__ rather than at each caller.

Source code in enricher/src/just_dna_enricher/verdict.py
@classmethod
def of(cls, **reasons: object) -> "Verdict":
    """`Verdict.of(offline=..., tables_unreadable=...)` — a code is carried when its value is truthy.

    The call site then reads as the sentence it implements, and the codes are checked against the
    vocabulary by `__post_init__` rather than at each caller.
    """
    return cls(frozenset(code for code, holds in reasons.items() if holds))