Skip to content

[T-003c] Generate configuration reference tables from settings models (scripts/gen_config_docs.py --check) #22

Closed

Description

@CodewithJha

Task T-003c · Milestone M1 — Foundation · Size S · Priority P1 · Epic #1

Implements NFR-CFG-003

Branch chore/t-003c-generate-configuration-reference-tables-from — one task = one branch = one PR (doc 32 §6)

Summary

Write the generator that renders doc 27 §4 tables, .env.example and roboprobe.example.toml from the pydantic models, with a --check mode that fails CI on drift.

Context / motivation

Doc 27 states that after T-003 the reference tables are generated. This keeps docs, templates and code in lock-step forever (NFR-CFG-003).

Scope

In scope

  • scripts/gen_config_docs.py walking RoboProbeSettings.model_fields recursively (key, type, default, env var, description/unit).
  • Writes between markers <!-- BEGIN GENERATED: config-tables --> / <!-- END GENERATED --> in docs/27-configuration-reference.md; regenerates .env.example and roboprobe.example.toml.
  • --check exits non-zero and prints a diff when files are stale.
  • make config-docs and make config-docs-check targets.

Out of scope

  • Wiring into CI (T-006a adds the config-docs-check job)

Implementation guidance

  • Keep hand-written prose of doc 27 (§1–§3, §5–§6) untouched; only the generated block is replaced. Domain-only sections without env vars (oracles, selection, analysis) are rendered as tables too (key, type, default, unit).
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • Running the generator twice is idempotent.
  • --check fails when a field description/default changes without regeneration.
  • Generated tables contain every settings key and match doc 27 values (any intentional difference documented in the PR).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/scripts/test_gen_config_docs.py (renders a tiny model, checks markers and --check).

Dependencies

Blocked by: #19 (T-003a)

Blocks: no other task (leaf)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • scripts/gen_config_docs.py
  • docs/27-configuration-reference.md (generated block only)
  • .env.example
  • roboprobe.example.toml
  • Makefile (2 targets)

Only touches the generated block of doc 27; later settings changes just rerun the script.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-003c (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 27 §4 · doc 27 §6 · doc 16 §7 · ADR-0015

Requirements: NFR-CFG-003 (traceability: doc 28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciCI/CD workflowsarea:configTyped settings / configurationarea:docsDocumentationmilestone:M1M1 — Foundationpriority:P1Required for milestone exitsize:S<= 1 daytaskChild task of a milestone epictype:choreMaintenance / scaffolding

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions