Source code for cadrumo.application.user_profile.acquisition_sources
"""The known explicit profile acquisition sources: what exists, never how to run it.Every operator-facing surface offering a "get data" launch action reads thiscatalogue rather than hand-listing sources, so a new acquisition source isdeclared once. It submits nothing: a launch is always the caller's owncomposed operation door. Operator-facing copy is a presentation concern andis resolved by the adapter rendering the source, not declared here.Credential posture is the one exception: whether a source needs a held AEATcredential to run, and whether the operator currently has one on file, arefacts an operator needs BEFORE pressing launch, so this module also declaresthat contract -- derived from the real owning authority(:class:`~cadrumo.application.auth.models.AuthState`), never apresentation-local guess. Both currently declared sources(:mod:`~cadrumo.application.live.censo`,:mod:`~cadrumo.application.live.filed_data_capture`) route through:func:`~cadrumo.application.live.session.active_verified_session`, the sharedAEAT live-read gate, so both require the same posture; a source that readonly locally-held facts would declare `requires_aeat_authentication=False`."""from__future__importannotationsfromenumimportStrEnumfrompydanticimportBaseModelfrom...core.modelsimportSTRICT_FROZEN_CONFIG__all__=["AcquisitionSourceCredentialPostureV1","ProfileAcquisitionSourceKey","ProfileAcquisitionSourceV1","known_profile_acquisition_sources",]
[docs]classProfileAcquisitionSourceKey(StrEnum):"""Every acquisition source an operator may explicitly launch from a profile."""CENSAL_REVIEW="censal_review"FILED_HISTORY="filed_history"
[docs]classProfileAcquisitionSourceV1(BaseModel):"""One acquisition source's identity, never resolved prose. ``requires_aeat_authentication`` is read from the source's own implementation, not asserted for presentation convenience: both declared sources call :func:`~cadrumo.application.live.session .active_verified_session` before touching AEAT, so both are `True` today. A future source resolving only already-held local facts would declare `False` here rather than inheriting a blanket default. """model_config=STRICT_FROZEN_CONFIGkey:ProfileAcquisitionSourceKeyrequires_aeat_authentication:bool
[docs]defknown_profile_acquisition_sources()->tuple[ProfileAcquisitionSourceV1,...]:"""Return every declared acquisition source, in a stable declaration order."""return_KNOWN_SOURCES
[docs]classAcquisitionSourceCredentialPostureV1(BaseModel):"""Whether one source's declared authentication requirement is currently met. ``credential_held`` and ``provider_id`` are read straight from :class:`~cadrumo.application.auth.models.AuthState` -- the same persisted workflow-state fact the status page and every auth CLI surface already read. This model states only what the source needs and what is on file; it does not claim the on-file credential is still valid against AEAT right now, which only a live probe can know. """model_config=STRICT_FROZEN_CONFIGsource:ProfileAcquisitionSourceKeyrequires_aeat_authentication:boolcredential_held:boolprovider_id:str|None