app.services.seed_synthetic_errata

Synthetic erratum generation for the benchmark ADR corpus.

Split out of app.services.seed_synthetic_gen to keep that module under the project’s module-size limit. build_erratum_document() is the only entry point that module calls; everything else here is a private helper over an injected random.Random, so a fixed seed reproduces the exact same erratum (see app.services.seed_synthetic_gen for the full determinism contract – this module makes no calls of its own to random.Random outside the one it is given).

An erratum is a small RFC-style report against an earlier decision – never a full ADR body (see app.domain.errata): a type (mostly technical, some editorial), a section taken from the target’s own headings, a sentence quoted from that section as “Original text”, a “Corrected text” and sometimes “Notes”.

Public API: build_erratum_document().

app.services.seed_synthetic_errata.build_erratum_document(rng, *, index, path_prefix, target, target_body, today)

Build one synthetic erratum reporting against an earlier decision.

The body is a small RFC-style report (## Original text, ## Corrected text and sometimes ## Notes), never a full ADR body; see app.domain.errata.

Parameters:
  • rng (Random) – Random source.

  • index (int) – Global record index (guarantees a unique filename).

  • path_prefix (str) – ADR directory inside the project.

  • target (UUID) – UUID of the decision this erratum corrects.

  • target_body (str) – The target’s rendered Markdown body, quoted from.

  • today (date) – Anchor date for the report date.

Return type:

tuple[str, bytes, UUID]

Returns:

The document’s path (inside the project), its rendered content, and the erratum’s own UUID.