app.storage.postgres.errata

Erratum queries of the PostgreSQL store.

The reverse lookup “errata of one decision” filters on the expression (links ->> 'corrects'), written with a literal key so it matches the partial expression index ix_record_links_corrects (migration 0003_erratum_content) exactly. A bound key (SQLAlchemy’s links["corrects"].astext) would not match the index in a generic plan.

The title lookup for erratum search hits (list_published_by_uuid()) returns only published rows: a link resolves against published rows (plus the linking record’s own identity, which never applies to a decision an erratum corrects), see app.services.record_relationships. It deliberately does not filter on record_kind: the detail page resolves erratum-for against rows of every kind (so a decision and an erratum sharing a UUID are ambiguous there), and the search titles must resolve the same way. Callers must therefore expect erratum rows (an erratum of an erratum, or the hit itself when its erratum-for is its own UUID) and full links on every returned summary.

Public API: CORRECTS_TARGET, list_errata_for(), list_published_by_uuid().

app.storage.postgres.errata.CORRECTS_TARGET: ColumnElement[str] = <sqlalchemy.sql.elements.BinaryExpression object>

(links ->> 'corrects'): the corrected decision’s UUID as text, identical to the expression of ix_record_links_corrects.

app.storage.postgres.errata.list_errata_for(session, target_uuid)

List published and candidate errata that correct one decision UUID.

Parameters:
  • session (Session) – Unit-of-work session.

  • target_uuid (UUID) – UUID of the corrected decision.

Return type:

list[ErratumRow]

Returns:

Published rows first, then by source, project, path, ref and id.

app.storage.postgres.errata.list_published_by_uuid(session, uuids)

List the published rows holding any of uuids, with their titles.

Parameters:
  • session (Session) – Unit-of-work session.

  • uuids (Collection[UUID]) – Authored UUIDs; empty means no query.

Return type:

list[LinkTarget]

Returns:

One entry per matching published row of any record kind, with its full links, ordered by id.