cadrumo.entrypoints.tui.ledger.action_guards module

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

The route factory and the workspace controller each validated the injected actions against the same canonical command keys. Writing the guard twice let the two copies drift, and they had: the factory rejected a review_action that does not resolve to ledger.review, while the controller did not check it at all. Every caller constructing the controller directly – the devtools workbench fixture and the flow tests – therefore skipped that refusal.

Consolidating the guard closes that gap by construction: there is one place a check can be added, so a new one cannot land on a single path.

require_canonical_ledger_actions(*, review_action, classify_action=None, evidence_action=None, link_action=None)[source]

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

review_action is mandatory; the rest are checked only when supplied, because an absent action means the area is not offered rather than misconfigured.

Parameters:
Raises:

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

Return type:

None