Skip to content

Make template/ the source of truth for documented directory trees - #16

Merged
ortizeg merged 2 commits into
developfrom
fix-readme-template-trees
Jul 24, 2026
Merged

Make template/ the source of truth for documented directory trees#16
ortizeg merged 2 commits into
developfrom
fix-readme-template-trees

Conversation

@ortizeg

@ortizeg ortizeg commented Jul 24, 2026

Copy link
Copy Markdown
Owner

The last item on the review's tail.

The problem

Each archetype's directory tree was hand-maintained in two places — the archetype README and the published docs page — so both drifted independently of the actual template.

#11 and #15 corrected the archetype READMEs, which left the docs pages as the only stale copy. They documented 78 files no template generates:

Page Ghosts
data-processing-pipeline 21 (base.py, dataset.py, download.py, configs/, …)
cv-inference-service 13 (serve.py, predictor.py, preprocessing.py, schemas/, docker-compose.yml, …)
model-zoo 13 (MODEL_CARD.md, benchmarks/, model_configs.py, …)
library-package 11 (helpers.py, module.py, api/, guides/, …)
pytorch-training-project 10 (datamodule.py, detector.py, metrics.py, coco.yaml, …)
research-notebook 10 (three example notebooks, utils.py, plots.py, …)

The fix

Regenerated every docs/archetypes/*.md tree directly from the rendered template, so each now describes exactly what whet init produces. 78 → 0 documented-but-absent files.

Also normalized placeholder syntax across the archetype READMEs. Three different spellings were in use:

  • ${var} — correct, what string.Template substitutes
  • {{var}}inert; the engine never substitutes it, so cv-inference-service's README was actively misleading
  • <var> — invented

All now use ${var}.

Guards

Three tests so the trees can't silently drift again:

  • test_readme_tree_matches_template
  • test_docs_page_tree_matches_template
  • test_readme_uses_real_placeholder_syntax

I verified the tree guard actually bites by planting a ghost entry — it failed with model-zoo README documents files its template does not ship: ['ghost_file.py'] — then restored the file.

Verification

  • uv run pytest tests/279 passed (3 new guards)
  • ruff / format / mypy --strict / mkdocs build --strict → clean

🤖 Generated with Claude Code

ortizeg and others added 2 commits July 24, 2026 07:02
The last item on the review's tail. Each archetype's directory tree was
hand-maintained in two places — the archetype README and the published docs
page — so both drifted independently of the template.

The archetype READMEs were corrected in #11/#15, which left the docs pages as
the only stale copy. They documented 78 files that no template generates:
serve.py, predictor.py, preprocessing.py, schemas/, docker-compose.yml,
benchmarks/, MODEL_CARD.md, three example notebooks, and so on.

- Regenerated every docs/archetypes/*.md tree directly from the rendered
  template, so they now describe exactly what `whet init` produces. 78 -> 0
  documented-but-absent files.
- Normalized placeholder syntax across archetype READMEs. Three different
  spellings were in use: ${var} (correct), {{var}} (INERT — the engine never
  substitutes it, so cv-inference-service's README was actively misleading),
  and <var> (invented). All now use ${var}.

Three guards so the trees cannot silently drift again:
- test_readme_tree_matches_template
- test_docs_page_tree_matches_template
- test_readme_uses_real_placeholder_syntax

Verified the tree guard bites by planting a ghost entry: it failed with
"model-zoo README documents files its template does not ship: ['ghost_file.py']".

279 tests pass; ruff, format, mypy --strict, and mkdocs --strict clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CI caught a real packaging bug that local runs could not see.

The repo's root .gitignore has `data/`, which silently excluded template files
living under a data/ path:

  archetypes/research-notebook/template/data/raw/.gitkeep
  archetypes/research-notebook/template/data/processed/.gitkeep
  archetypes/pytorch-training-project/template/configs/data/default.yaml

They existed on disk, so every local test passed. They were never committed, so
a clean checkout — CI, or any user cloning the repo — got templates missing
those paths. `whet init research-notebook` produced a project without the
data/raw and data/processed directories its README documents, and
`whet init pytorch-training-project` shipped a Hydra config tree missing its
entire `data` config group, which @hydra.main composes by name.

The new tree-accuracy guards from this PR are what surfaced it: they compare
documented paths against a freshly rendered template, so in CI the documented
data/ entries had nothing to match.

- Negate the ignore for archetypes/*/template/**/data/ so template scaffolding
  is committed while real datasets stay ignored.
- Track the three affected files.

279 tests pass locally; the guards now have the same view in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ortizeg
ortizeg merged commit 4dae138 into develop Jul 24, 2026
3 checks passed
@ortizeg
ortizeg deleted the fix-readme-template-trees branch July 24, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant