cadrumo.entrypoints.tui.declarations.action_guards module

One home for the Declarations workspace’s injected-action checks.

The route factory and the workspace controller each validated the same three read actions against the same canonical command keys, in two copies that were byte-identical and therefore looked safe. The Ledger workspace carried exactly that shape until its two copies drifted — the factory refused a non-canonical review action while the controller checked nothing — and every caller building the controller directly skipped the refusal. This consolidation is the same remedy applied before the same divergence happens here.

What the guard prevents is not a crash. An action wired to another command gives the workspace an affordance labelled for one operation that dispatches another, so an operator reading their declarations could run a different application door than the one the screen names.

REQUIRED_DECLARATIONS_TARGETS: Final[tuple[tuple[str, str], ...]]

Injected action attribute -> the command key it must resolve to. All three are mandatory: the Declarations workspace offers no partial read surface, so unlike the Ledger guard there is no “absent means not offered” state here.

require_canonical_declarations_actions(*, work_action, revisions_action, filing_action)[source]

Refuse an injected read action that does not resolve to its canonical command.

Parameters:
Raises:

ValueError – If any supplied action resolves to a different command.

Return type:

None