cadrumo.application.flows.review module

The review projection: the flow’s summary surface and its submit gate.

The review surface is a substrate primitive every domain flow receives for free: an enumeration of the visible pages (plus any stale orphans no longer visible) with their PageStatus, per-section grouping, jump targets, and the single submit-eligibility verdict. Submission is possible only from review and only when every required visible page is validly answered, no staleness or deferral remains, and every section-exit and flow-scope validator passes — the substrate’s completeness gate.

class ReviewRow(**data)[source]

Bases: BaseModel

One page’s entry on the review surface.

Parameters:

data (Any)

key: str
section_id: str
status: PageStatus
required: bool
jumpable: bool
verdicts: tuple[ValidationVerdict, ...]
class ReviewProjection(**data)[source]

Bases: BaseModel

The full review surface: rows, blocking verdicts, submit eligibility.

blocking aggregates every reason submission is refused, each a typed verdict the frontend renders verbatim — the projection never collapses refusals into a bare boolean.

Parameters:

data (Any)

flow_id: str
rows: tuple[ReviewRow, ...]
flow_verdicts: tuple[ValidationVerdict, ...]
submit_eligible: bool
blocking: tuple[ValidationVerdict, ...]
answered_count: NonNegativeInt
required_remaining: NonNegativeInt
review(definition, state)[source]

Project the current state onto the review surface.

Visible pages appear in walk order; committed answers whose page is no longer visible (a gating change or a shrunk repeating group) appear after them as non-jumpable stale rows so nothing the operator entered ever silently disappears from the summary.

Return type:

ReviewProjection

Parameters:
assert_submit_eligible(definition, state)[source]

Return the review projection, refusing loudly when submission is blocked.

The domain flow calls this immediately before handing the typed answers to its persistence hook; the refusal enumerates every blocking verdict so the operator (or the driving agent) sees the complete remaining-work list, never a bare denial.

Return type:

ReviewProjection

Parameters: