app.storage.values¶
Value types crossing the storage port.
Plain frozen dataclasses and enums, independent of any ORM. Import them
through app.storage.port, which re-exports everything here.
Public API:
enums
RecordState,PollStatus,IntakeKind,IntakeStatus,SearchSort; constantMAX_PAGE_SIZE; aliasJsonObjectvalues
RegistrationConfig,Registration,Revision,RecordWrite,StoredRecord,ErratumRow,UpsertResult,ChangeTokenEntry,SearchFilters,SearchItem,SearchPage,FacetEntry,NewDecision,DecisionEvent,IntakeRun
- app.storage.values.MAX_PAGE_SIZE = 50¶
Upper bound for
page_sizeinapp.storage.port.CatalogStore.search().
- class app.storage.values.RecordState(*values)¶
Bases:
StrEnumLifecycle state of a stored record row.
- PUBLISHED = 'published'¶
- CANDIDATE = 'candidate'¶
- class app.storage.values.PollStatus(*values)¶
Bases:
StrEnumOutcome of the latest poll of a registration.
- NEVER = 'never'¶
- OK = 'ok'¶
- PARTIAL = 'partial'¶
- FAILED = 'failed'¶
- DISABLED = 'disabled'¶
- class app.storage.values.IntakeKind(*values)¶
Bases:
StrEnumHow content entered the catalog.
- POLL = 'poll'¶
- PUSH = 'push'¶
- class app.storage.values.IntakeStatus(*values)¶
Bases:
StrEnumStatus of one intake run.
- RUNNING = 'running'¶
- OK = 'ok'¶
- PARTIAL = 'partial'¶
- FAILED = 'failed'¶
- class app.storage.values.SearchSort(*values)¶
Bases:
StrEnumResult order of
app.storage.port.CatalogStore.search().Every order ends with the lower-cased title and the record id, so pages are stable even when the leading key ties.
relevance: text rank, best first; without a text query it is the same astitle.title: lower-cased title A-Z.recent:record.updated_at(when the content digest last changed), newest first.
- RELEVANCE = 'relevance'¶
- TITLE = 'title'¶
- RECENT = 'recent'¶
- class app.storage.values.RegistrationConfig(*, id, type, config, enabled=True, config_error=None)¶
Bases:
objectOne source registration as read from
catalog.yaml.- Parameters:
- config: JsonObject¶
- class app.storage.values.Registration(*, id, type, config, enabled, config_error, last_attempt_at, last_success_at, last_status, last_error)¶
Bases:
objectA stored source registration with its poll status.
- Parameters:
id (
str) – Stable registration id.type (
str) – Source type.config (
JsonObject) – Type-specific settings, secrets excluded.enabled (
bool) – Whether the registration may be polled / pushed to.config_error (
str|None) – Why the registration is disabled, if invalid.last_attempt_at (
datetime|None) – Start of the latest poll attempt.last_success_at (
datetime|None) – Start of the latest fully successful poll.last_status (
PollStatus) – Outcome of the latest poll.last_error (
JsonValue) – Error details of the latest poll, if any.
- config: JsonObject¶
- last_status: PollStatus¶
- class app.storage.values.Revision(*, digest, content, created_at)¶
Bases:
objectAn immutable, content-addressed snapshot.
- Parameters:
- class app.storage.values.RecordWrite(*, source_id, project, path, ref, adr_uuid, record_key, digest, change_token, metadata, title, title_source, decision_date, decision_date_inferred, record_kind, links, rendered_html, issues, source_url=None, author=None, erratum=None)¶
Bases:
objectEverything ingest writes for one record row.
The revision for
digestmust have been stored first (app.storage.port.CatalogStore.put_revision()).- Parameters:
source_id (
str) – Owning registration id.project (
str) – Owning project path.path (
str) – File path inside the project.ref (
str) – Branch/ref the content came from.adr_uuid (
UUID|None) – Authored UUID,Noneif missing or invalid.record_key (
str) – Identity key (app.domain.values.record_key()).digest (
str) – Digest string of the current content.change_token (
str|None) – Source change token (Nonefor pushes).metadata (
JsonObject) – Parsed frontmatter.title (
str) – Display title.title_source (
TitleSource) – Where the title came from.decision_date_inferred (
bool) – Whether the date is only inferred from the filename.record_kind (
RecordKind) – Decision or erratum.links (
Links) – Validated outbound links.rendered_html (
str) – Sanitized HTML rendering of the body.source_url (
str|None) – Link to the content at the source, if any.erratum (
StoredErratum|None) – Rendered erratum content;Nonefor decisions.
- metadata: JsonObject¶
- title_source: TitleSource¶
- record_kind: RecordKind¶
- erratum: StoredErratum | None¶
- class app.storage.values.StoredRecord(*, source_id, project, path, ref, adr_uuid, record_key, digest, change_token, metadata, title, title_source, decision_date, decision_date_inferred, record_kind, links, rendered_html, issues, source_url=None, author=None, erratum=None, id, kind, previous_digest, first_seen_at, updated_at, last_seen_at)¶
Bases:
RecordWriteA stored record row.
- Parameters:
id (
UUID) – Surrogate id used in URLs.kind (
RecordState) – Published or candidate.previous_digest (
str|None) – Digest before the latest content change.first_seen_at (
datetime) – When the row was created.updated_at (
datetime) – When the content digest last changed.last_seen_at (
datetime) – When ingest last wrote the row.
- kind: RecordState¶
- class app.storage.values.ErratumRow(*, id, kind, source_id, project, path, ref, adr_uuid, record_key, digest, title, erratum, updated_at, issues)¶
Bases:
objectOne erratum row (published or candidate) correcting a decision.
- Parameters:
id (
UUID) – Record id.kind (
RecordState) – Published or candidate.source_id (
str) – Registration id.project (
str) – Project path.path (
str) – File path inside the project.ref (
str) – Branch/ref of the content.record_key (
str) – Identity key of the erratum.digest (
str) – Current digest.title (
str) – Display title.erratum (
StoredErratum|None) – Stored content;Noneonly for a row ingested before content was stored (the next ingest fills it).updated_at (
datetime) – When the content digest last changed.
- kind: RecordState¶
- erratum: StoredErratum | None¶
- class app.storage.values.UpsertResult(*, id, created, digest_changed, previous_digest)¶
Bases:
objectOutcome of a record upsert.
- Parameters:
- class app.storage.values.ChangeTokenEntry(*, id, project, path, change_token, digest)¶
Bases:
objectStored change state of one published file.
- Parameters:
- class app.storage.values.SearchFilters(*, source_id=None, project=None, kind=None, needs_approval=False, record_kind=None)¶
Bases:
objectSearch filters;
None/Falsemeans “no filter”.- Parameters:
kind (
RecordState|None) – Published or candidate.needs_approval (
bool) – Only records whose approval state needs approval (app.domain.approval.evaluate()).record_kind (
RecordKind|None) – Only decisions or only errata.
- kind: RecordState | None¶
- record_kind: RecordKind | None¶
- class app.storage.values.SearchItem(*, id, kind, source_id, project, path, ref, adr_uuid, record_key, digest, title, record_kind, decision_date, decision_date_inferred, issues, approval_state, corrects=None)¶
Bases:
objectOne search hit.
- Parameters:
id (
UUID) – Record id.kind (
RecordState) – Published or candidate.source_id (
str) – Registration id.project (
str) – Project path.path (
str) – File path inside the project.ref (
str) – Branch/ref of the content.record_key (
str) – Identity key.digest (
str) – Current digest.title (
str) – Display title.record_kind (
RecordKind) – Decision or erratum.decision_date_inferred (
bool) – Whether the date is inferred.approval_state (
ApprovalStateCode) – Approval state of the current digest, computed by the store with the same rules asapp.domain.approval.evaluate().corrects (
UUID|None) – UUID an erratum corrects (Nonefor decisions).
- kind: RecordState¶
- record_kind: RecordKind¶
- approval_state: ApprovalStateCode¶
- class app.storage.values.SearchPage(*, items, total, page, page_size)¶
Bases:
objectOne page of search results.
- Parameters:
- items: tuple[SearchItem, ...]¶
- class app.storage.values.FacetEntry(*, source_id, project, count)¶
Bases:
objectRow count for one
(source_id, project)pair.Used to populate the source/project filter select in the UI (
app.storage.port.CatalogStore.list_facets()); counts include both published and candidate decision rows, never errata.- Parameters:
- class app.storage.values.NewDecision(*, identity, adr_uuid, digest, action, actor_issuer, actor_subject, actor_display, actor_email, comment, policy_id, policy_version, provenance=dict())¶
Bases:
objectA decision to append.
- Parameters:
identity (
Identity) – Logical identity decided on.adr_uuid (
UUID) – The record UUID.digest (
str) – Digest of the decided content.action (
DecisionAction) – Accepted or rejected.actor_issuer (
str) – Reviewer token issuer.actor_subject (
str) – Reviewer token subject.actor_display (
str|None) – Reviewer display name, if known.actor_email (
str|None) – Reviewer verified email, if known.policy_id (
str) – Applied policy id.policy_version (
int) – Applied policy version.provenance (
JsonObject) – Record id, kind, ref, path and source URL at decision time.
- action: DecisionAction¶
- provenance: JsonObject¶
- class app.storage.values.DecisionEvent(*, identity, adr_uuid, digest, action, actor_issuer, actor_subject, actor_display, actor_email, comment, policy_id, policy_version, provenance=dict(), id, created_at)¶
Bases:
NewDecisionA stored, append-only decision event.
- as_view()¶
Convert to the domain view used by approval evaluation.
- Return type:
- Returns:
The event view.
- class app.storage.values.IntakeRun(*, id, source_id, kind, identity, delivery_id, started_at, finished_at, status, counts, errors)¶
Bases:
objectOne poll or push intake run.
- Parameters:
id (
UUID) – Run id.source_id (
str) – Registration id as requested.kind (
IntakeKind) – Poll or push.identity (
JsonValue) – Who triggered the run (no secrets).delivery_id (
str|None) – Client-supplied push delivery id, if any.started_at (
datetime) – Start time.finished_at (
datetime|None) – End time,Nonewhile running.status (
IntakeStatus) – Run status.counts (
JsonValue) – Outcome counters.errors (
JsonValue) – Error details.
- kind: IntakeKind¶
- status: IntakeStatus¶