aeat.application.modelo._profile_readiness_gate module¶
Profile readiness gate for filing-grade modelo work.
Loads the active domain.user_profile.UserProfileRecord, builds a
application.user_profile.ProfilePreflightReport, projects
local-work applicability through domain.deadlines.TaxpayerProfile,
and raises application.modelo.ModeloProfileReadinessError before
filing-grade work proceeds when required profile facts are missing. The
revision-specific preflight branch may receive a ModeloRevision that
has already been resolved by an operator-facing readiness surface. The same gate
also refuses Modelo 130 and Modelo 303 target periods whose date span ends
before the profile’s censo.activity_start_date; those pre-activity periods
have no filing obligation and must not produce stale work, calculation,
verification, filing, or export state.
See also
require_profile_ready_for_work_unit():Replays the same readiness checks for an existing
domain.modelos.WorkUnit.application.user_profile.ProfilePreflightReport:User-profile preflight result consumed by this application gate.
- modelo_work_profile_baseline_missing_paths(record)[source]¶
Return profile facts required before any filing-grade modelo work starts.
- Parameters:
record (
UserProfileRecord) – Activedomain.user_profile.UserProfileRecordprojected into schema-path values.- Return type:
- modelo_work_profile_baseline_validation_issues(record)[source]¶
Return validate-surface issues for the central modelo work profile baseline.
- Parameters:
record (
UserProfileRecord) – Activedomain.user_profile.UserProfileRecordchecked against the filing-grade baseline.- Return type:
- Returns:
Tuple of
application.user_profile.ProfileValidationIssueinstances for missing filing-grade baseline facts.
- modelo_work_profile_preflight_report(*, record, modelo, revision_id, filing_year, period, revision=None, resolve_revision_when_missing=True)[source]¶
Return the profile-field report enforced by the modelo work creation gate.
This combines the filing-grade baseline that every modelo work unit needs with the modelo/revision-specific profile selectors. Public readiness surfaces consume this function so they cannot claim profile readiness before
application.modelo.create_work_unit()would reject the same active profile.- Parameters:
record (
UserProfileRecord) – Activedomain.user_profile.UserProfileRecord.modelo (
str) – Modelo code being checked.revision_id (
str) – Registry revision identifier for the target modelo work.filing_year (
int) – Filing year for the target period.period (
Period) – Targetcore.Periodused for registry revision resolution and profile selector evaluation.revision (
ModeloRevision|None) – OptionalModeloRevisionsupplied when the caller has already resolved the target revision.resolve_revision_when_missing (
bool) – Whether to resolve the registry revision whenrevisionis not supplied.
- Return type:
- Returns:
application.user_profile.ProfilePreflightReportcombining baseline, validation, and modelo/revision-specific missing requirements.
- modelo_applicability_refusal(*, record, bucket_id, modelo)[source]¶
Return the local-work applicability refusal for a target, if any.
- Parameters:
record (
UserProfileRecord) – Activedomain.user_profile.UserProfileRecordprojected into taxpayer facts for the modelo applicability check.bucket_id (
str) – Active profile bucket identifier included in the refusal context.modelo (
str) – Modelo code being checked.
- Return type:
- pre_activity_period_refusal(*, record, bucket_id, modelo, filing_year, period)[source]¶
Return the pre-activity lifecycle refusal for a target, if any.
- Parameters:
record (
UserProfileRecord) – Activedomain.user_profile.UserProfileRecordcarrying the profile facts used to resolvecenso.activity_start_date.bucket_id (
str) – Active profile bucket identifier included in the refusal context.modelo (
str) – Modelo code being checked.filing_year (
int) – Filing year for the target period.period (
Period) – Targetcore.Periodwhose date span is compared against the profile activity-start date.
- Return type:
- require_profile_ready_for_modelo_work(*, bucket_id, modelo, revision_id, filing_year, period, enforce_applicability=True)[source]¶
Refuse filing-grade modelo work when the active profile is not eligible.
Loads the bucket’s
domain.user_profile.UserProfileRecord, evaluates modelo-specific profile requirements throughapplication.user_profile.ProfilePreflightReport, and then applies the pre-activity period check for lifecycle modelos whose obligation starts atcenso.activity_start_date.
- require_existing_profile_baseline_ready_for_modelo_work(*, bucket_id, modelo, filing_year, period, enforce_applicability=True)[source]¶
Refuse plainly incomplete existing profiles before registry work.
This early gate is used by
application.modelo.create_work_unit()before the registry revision and period are validated. It catches missing baseline profile facts, local-work applicability refusals, and pre-activity lifecycle periods without requiring a resolvableModeloRevision. Missing profiles still pass through so the later full readiness gate can raise the canonical missing-profile error.
- require_profile_ready_for_work_unit(work_unit, *, enforce_applicability=True)[source]¶
Run the profile readiness gate for an existing work unit.
Calculation, verification, filing, and export services call this wrapper so a previously created
domain.modelos.WorkUnitis rechecked against the currentdomain.user_profile.UserProfileRecordbefore any filing-grade mutation proceeds.