cadrumo.entrypoints.tui.modelo.view.models module

Frozen, callback-free view models for the Modelo workspace read destinations.

Every model here is a PRESENTATION NARROWING over a public Workspace V1 projection. Nothing in this module computes, derives, classifies or re-verifies a tax value, a readiness verdict, a capability disposition or a causal edge: each of those is a producer’s answer, copied through and keyed by the semantic identity the producer already assigned. A renderer consumes these models alone, so a truth the projection declared cannot be reclassified downstream of it.

Two shapes, following the tree’s existing convention rather than a new one: row structs are frozen slotted dataclasses (as the application-owned censal review projection and the status_projection rows are), and projection narrowings are pydantic models on the canonical STRICT_FROZEN_CONFIG.

Every model that narrows a producer record retains that record, so a renderer can always reach the canonical truth rather than only this module’s reading of it. The pydantic narrowings additionally re-check their derived fields against the retained source in a validator that deliberately does NOT call the builder’s helpers – sharing them would make the check agree with the builder by construction, so a defect inside a helper would pass unseen. The remaining structs (section, constraint, action) carry no retained record because they narrow a FIELD of a record rather than a record, and there is nothing further to reach through to.

class ModeloWorkspaceDisplayTextV1(text, translated)[source]

Bases: object

One display string that says honestly whether a translation happened.

translated is read from the label’s own discriminator, never guessed from whether the text looks like prose: a registry identifier shown as itself is not a translation that happened, and ModeloWorkspaceTechnicalLabelV1 exists to say so.

Parameters:
text: str
translated: bool
display_text(label)[source]

Narrow a canonical record label to its display string and honesty flag.

Return type:

ModeloWorkspaceDisplayTextV1

Parameters:

label (ModeloWorkspaceRecordLabelV1)

class ModeloWorkspaceCompletePageV1(**data)[source]

Bases: _ViewModel

A page that is the whole set: nothing was left unrendered.

Parameters:

data (Any)

kind: Literal['complete']
class ModeloWorkspaceBoundedPageV1(**data)[source]

Bases: _ViewModel

A page the producer bounded: more rows exist beyond what is shown.

Carried as its own arm rather than a nullable “next” field so a renderer cannot show a bounded page as though it were the complete set. That distinction is load-bearing for provenance in particular, where one source reference fans out to one row per casilla it names – so a page can overflow without the revision growing at all, and record count tells an operator nothing about completeness.

Parameters:

data (Any)

kind: Literal['bounded']
shown: int
page_size: int
class ModeloWorkspaceCapabilityRowV1(**data)[source]

Bases: _ViewModel

One capability answer, keyed by capability, with its distinguishing glyph.

Copies the producer’s disposition; never infers one. glyph is the only derived field and is re-checked below against the disposition read straight off the retained source.

Parameters:

data (Any)

capability: ModeloWorkspaceCapabilityName
disposition: ModeloWorkspaceCapabilityDisposition
glyph: ModeloWorkspaceDispositionGlyphV1
producer_owner: str
producer: str
source: ModeloWorkspaceCapabilityV1
capability_row(capability)[source]

Narrow one canonical capability answer to its presentation row.

Return type:

ModeloWorkspaceCapabilityRowV1

Parameters:

capability (ModeloWorkspaceCapabilityV1)

disposition_label(disposition)[source]

Name a capability disposition in words, glyph first.

The glyph stays so a greyscale reading still tells the four apart; the words keep “not measured”, “does not apply” and “refused” as distinct sentences rather than one blank.

Return type:

str

Parameters:

disposition (ModeloWorkspaceCapabilityDisposition)

capability_label(capability)[source]

Name one workspace capability in words.

Return type:

str

Parameters:

capability (ModeloWorkspaceCapabilityName)

assertion_label(disposition)[source]

Say in words whether a revision was asserted and whether it matched.

Return type:

str

Parameters:

disposition (ModeloWorkspaceRevisionAssertionDisposition)

review_status_label(status)[source]

Say in words how far the revision’s review has progressed.

Return type:

str

Parameters:

status (RevisionReviewStatus)

work_state_label(state)[source]

Name a work unit’s state with the words the Declarations area uses.

Return type:

str

Parameters:

state (WorkUnitState)

input_kind_label(kind)[source]

Say in words how the registry declares a casilla’s value is supplied.

Return type:

str

Parameters:

kind (InputKind)

finding_severity_label(severity)[source]

Name a verification finding’s severity in words.

Return type:

str

Parameters:

severity (ModeloVerificationFindingSeverity)

finding_kind_label(kind)[source]

Name a verification finding’s kind in words.

Return type:

str

Parameters:

kind (ModeloVerificationFindingKind)

finding_message(finding)[source]

Render the finding’s own message from its locale key and typed facts.

Return type:

str

Parameters:

finding (ModeloVerificationFinding)

class ModeloWorkspaceChromeV1(**data)[source]

Bases: _ViewModel

The frame around one destination: which it is, and what it is showing.

Address disclosure is carried as the resolved coordinates the projection already settled – never re-resolved here, and never a revision chronology, which Workspace V1 does not expose.

Parameters:

data (Any)

destination: ModeloWorkspaceDestinationIdV1
modelo: str
filing_year: int
period_token: str
law_selected_revision_id: str
work_unit_id: str | None