aeat.domain.submission._preflight module

Preflight gating for the filing submission engine.

Preflight runs four ordered gates against a aeat.domain.submission._protocols.ModeloDraftLike before any browser work begins. Every failure raises SubmissionPreflightError; the happy path is silent.

See also

SubmissionEngine

Public read-only engine that owns this preflight runner.

DeadlineWindowChecker

Gate-3 protocol used only when the caller has not skipped the filing window check.

WorkflowPurpose

Application policy input that decides whether workflow callers pass skip_deadline_window for local verification or filing.

class Preflight(*, deadline_checker, auth_provider)[source]

Bases: object

Four-gate validator for a ModeloDraftLike.

Gates run in order:

  1. Draft status is ModeloDraftStatus.APROBADO.

  2. No ERROR-severity entries in draft.findings.

  3. Deadline window is open via DeadlineWindowChecker.is_window_open().

  4. Auth provider describes itself cleanly via AuthProviderProbe.describe().

The validator is pure: no I/O beyond the injected Protocol calls, no state beyond its dependencies.

Variables:
  • deadline_checker – Protocol implementation used for gate 3.

  • auth_provider – Protocol implementation used for gate 4.

Parameters:
check(draft, *, today, skip_deadline_window=False)[source]

Run the four preflight gates against draft.

Parameters:
  • draft (ModeloDraftLike) – The ModeloDraftLike to validate.

  • today (date) – Reference date for the deadline-window gate.

  • skip_deadline_window (bool) – When True, gate 3 (the AEAT filing-window check) is skipped. Workflow callers use this for local VERIFY and local FILE purposes: gates 1, 2, and 4 still confirm draft soundness and auth-provider readiness, while the redundant AEAT submission-window check remains disabled for paths that do not submit to AEAT.

Raises:

SubmissionPreflightError – If any gate fails. The exception message identifies the failing gate.

Return type:

None