app.services.seed_synthetic_text

Word lists and text rendering for the synthetic benchmark ADR corpus.

Pure, no I/O: title/body/slug text pieces built from fixed word lists and sentence templates over an injected random.Random, used by app.services.seed_synthetic_gen. Split out to keep that module under the project’s module-size limit.

Public API: VOCABULARY, CONTEXT_SENTENCES, DECISION_SENTENCES, CONSEQUENCE_SENTENCES, sentence(), body(), title(), slug(), decision_date(), signoff_emails(), reporter_email(), render_document().

app.services.seed_synthetic_text.VOCABULARY = ('PostgreSQL', 'Redis', 'Kafka', 'GraphQL', 'gRPC', 'Kubernetes', 'Terraform', 'feature flags', 'circuit breakers', 'event sourcing', 'the monolith', 'microservices', 'OAuth2', 'rate limiting', 'blue-green deployments', 'canary releases', 'the message queue', 'distributed tracing', 'the API gateway', 'multi-tenancy', 'connection pooling', 'read replicas', 'the cache layer', 'structured logging', 'feature toggles', 'the job scheduler', 'idempotency keys', 'the retry policy', 'schema migrations', 'the search index')

Also used as the benchmark’s free-text search vocabulary.

app.services.seed_synthetic_text.body(rng)

Build a realistic ADR body, 300-3000 characters.

Parameters:

rng (Random) – Random source.

Return type:

str

Returns:

The Markdown body (without frontmatter).

app.services.seed_synthetic_text.decision_date(rng, today)

Pick a decision date within the last ~6 years of today.

Parameters:
  • rng (Random) – Random source.

  • today (date) – Anchor date.

Return type:

date

Returns:

The date.

app.services.seed_synthetic_text.render_document(fields, body_text)

Render frontmatter and body to the raw document bytes.

Shared by decision and erratum generation (app.services.seed_synthetic_gen and app.services.seed_synthetic_errata).

Parameters:
  • fields (dict[str, object]) – Frontmatter fields.

  • body_text (str) – Markdown body.

Return type:

bytes

Returns:

The encoded document.

app.services.seed_synthetic_text.reporter_email(rng)

Build one fake erratum reported-by address.

Parameters:

rng (Random) – Random source.

Return type:

str

Returns:

The address.

app.services.seed_synthetic_text.signoff_emails(rng)

Build 1-2 fake legacy sign-off addresses.

Parameters:

rng (Random) – Random source.

Return type:

list[str]

Returns:

The addresses.

app.services.seed_synthetic_text.slug(text)

Turn a title or sentence into a filename/ref-safe slug.

Parameters:

text (str) – The text.

Return type:

str

Returns:

A lowercase, hyphenated slug, at most 60 characters.

app.services.seed_synthetic_text.sentence(rng, pool)

Render one random sentence template.

Parameters:
Return type:

str

Returns:

The filled-in sentence.

app.services.seed_synthetic_text.title(rng)

Build a realistic ADR title from the word lists.

Parameters:

rng (Random) – Random source.

Return type:

str

Returns:

The title.