app.services.errata_view

Errata part of the record detail page (read-only).

Converts the erratum rows that belong to a record (resolved by app.services.record_relationships) into ErratumInfo values, each with the approval state of the erratum’s own identity and digest, and counts them in ErrataSummary for the page’s top notice. The corrected record’s own digest, approval state and history are never involved: an erratum is a separate record with its own accept/reject workflow.

Approval state per erratum uses app.domain.approval.evaluate() with the same approvable rule as the record detail (app.services.approval_view.is_approvable()). The decision events of all errata are read with one query (list_decisions_for()), so the detail endpoint’s query count does not grow with the number of errata.

Summary counts (published errata only; candidates are proposals and are counted in proposed):

  • accepted -> verified;

  • not_required -> verified as well: the policy requires no review, so a published erratum stands as published (the raw approval_state stays on each item so the UI can label it precisely);

  • rejected -> rejected;

  • changed_since_acceptance -> changed (verified content was edited; not counted as verified);

  • pending and policy_missing -> reported.

total is verified + reported + rejected + changed.

An erratum’s own page gets no rows (errata correct decisions, see app.services.record_relationships), so its summary is all zeros.

Public API: ErratumContentInfo, ErratumInfo, ErrataSummary, ErrataView, erratum_content(), build_errata().

class app.services.errata_view.ErrataSummary(*, total, verified, reported, rejected, changed, proposed)

Bases: object

Errata counts for the top notice; see the module docstring.

Parameters:
  • total (int) – Published errata.

  • verified (int) – Published errata accepted (or not requiring review).

  • reported (int) – Published errata awaiting review.

  • rejected (int) – Published errata rejected.

  • changed (int) – Published errata changed since acceptance.

  • proposed (int) – Candidate (proposed) errata.

total: int
verified: int
reported: int
rejected: int
changed: int
proposed: int
class app.services.errata_view.ErrataView(*, errata, summary)

Bases: object

The errata of one record with their summary.

Parameters:
errata: tuple[ErratumInfo, ...]
summary: ErrataSummary
class app.services.errata_view.ErratumContentInfo(*, type, section, reported_by, reported_date, original_html, corrected_html, notes_html)

Bases: object

The structured content of one erratum.

Parameters:
  • type (ErratumType | None) – technical or editorial, None if invalid.

  • section (str | None) – Where in the decision the error is, if given.

  • reported_by (str | None) – Free-text reporter (informational only).

  • reported_date (date | None) – Authored report date, if valid.

  • original_html (str | None) – Sanitized “Original text” HTML, if any.

  • corrected_html (str) – Sanitized “Corrected text” HTML.

  • notes_html (str | None) – Sanitized notes HTML, if any.

type: ErratumType | None
section: str | None
reported_by: str | None
reported_date: date | None
original_html: str | None
corrected_html: str
notes_html: str | None
class app.services.errata_view.ErratumInfo(*, id, kind, ref, source_id, project, path, title, type, section, reported_by, reported_date, original_html, corrected_html, notes_html, approval_state, approvable, digest, updated_at, has_content)

Bases: object

One erratum (published or candidate) of the viewed record.

Content fields are None (and corrected_html empty) when the row was stored before erratum content was (has_content false).

Parameters:
  • id (UUID) – Erratum record id.

  • kind (RecordState) – published or candidate (a proposal).

  • ref (str) – Branch/ref of the erratum content.

  • source_id (str) – Registration id of the erratum.

  • project (str) – Project path of the erratum.

  • path (str) – File path of the erratum.

  • title (str) – Erratum display title.

  • type (ErratumType | None) – Erratum type.

  • section (str | None) – Section of the decision, if given.

  • reported_by (str | None) – Free-text reporter.

  • reported_date (date | None) – Report date.

  • original_html (str | None) – “Original text” HTML.

  • corrected_html (str) – “Corrected text” HTML.

  • notes_html (str | None) – Notes HTML.

  • approval_state (ApprovalStateCode) – Approval state of the erratum’s own digest.

  • approvable (bool) – Whether the erratum’s content can be decided.

  • digest (str) – The erratum’s current digest.

  • updated_at (datetime) – When the erratum’s content last changed.

  • has_content (bool) – Whether structured content is stored.

id: UUID
kind: RecordState
ref: str
source_id: str
project: str
path: str
title: str
type: ErratumType | None
section: str | None
reported_by: str | None
reported_date: date | None
original_html: str | None
corrected_html: str
notes_html: str | None
approval_state: ApprovalStateCode
approvable: bool
digest: str
updated_at: datetime
has_content: bool
app.services.errata_view.build_errata(store, rows, policy)

Evaluate the approval state of each erratum and count them.

Parameters:
  • store (CatalogStore) – Store of the caller’s unit of work.

  • rows (Sequence[ErratumRow]) – Erratum rows that belong to the viewed record.

  • policy (Policy | None) – The configured policy, or None.

Return type:

ErrataView

Returns:

The errata and their summary.

app.services.errata_view.erratum_content(erratum)

Convert stored erratum content for the API.

Parameters:

erratum (StoredErratum | None) – Stored content, or None.

Return type:

ErratumContentInfo | None

Returns:

The content, or None.