Skip to content

diagrams: single source of truth + bin/regen-diagrams + CI staleness check#91

Merged
0bserver07 merged 1 commit into
mainfrom
docs/auto-diagrams
Apr 25, 2026
Merged

diagrams: single source of truth + bin/regen-diagrams + CI staleness check#91
0bserver07 merged 1 commit into
mainfrom
docs/auto-diagrams

Conversation

@0bserver07

Copy link
Copy Markdown
Collaborator

Summary

Implements option (C) — full overhaul. Both repo diagrams now regenerate from a single YAML.

What's new

  • docs/research/_diagrams.yaml — single source of truth. Layer titles, node labels, edges, tree groups, auto-count placeholders.
  • bin/regen-diagrams — Python generator. Reads YAML, computes auto-counts via globs, splices generated content between AUTOGEN markers in the two target files. Idempotent: running twice produces no diff. --check mode for CI.
  • docs/research/repo-tree.md + repo-layout.md — pan/zoom + container HTML untouched. Only the data blocks live between markers and get rewritten.
  • .github/workflows/diagram-staleness.yml — runs bin/regen-diagrams --check on PRs that touch the YAML or the generated files. Fails the build with a helpful "run bin/regen-diagrams locally and commit" message if regen would change anything.

Drift caught on first regen

What stayed untouched

  • Pan/zoom controls (svg-pan-zoom + d3-zoom buttons)
  • Container <div> and <button> HTML
  • Prose, ## Notes section, !!! info admonition

The generator never sees the JS/HTML — it only edits the marked data blocks.

Workflow for editing the diagrams

  1. Edit docs/research/_diagrams.yaml
  2. Run bin/regen-diagrams
  3. Commit both the YAML and the regenerated .md files

CI catches anyone who edits the YAML without running the regen.

Test plan

  • bin/regen-diagrams runs clean (idempotent on second invocation)
  • bin/regen-diagrams --check exits 0 after a fresh regen
  • python3 -m mkdocs build --strict passes (no new warnings)
  • Drift detection works (caught 5 stale entries on first run)
  • CI workflow passes on this PR

🤖 Generated with Claude Code

…check

Both docs/research/repo-tree.md (D3 tree) and repo-layout.md (Mermaid graph)
are now regenerated from docs/research/_diagrams.yaml by bin/regen-diagrams.

Pan/zoom code, container HTML, and prose around the diagrams are
untouched — only the data blocks (between AUTOGEN markers) get rewritten.

Caught real drift on first regen:
- findings_count: 38 → 41 (auto-counted via glob)
- task_count: "1-10 + INDEX" → 11 (auto-counted via glob)
- Added GEMINI.md to top-level docs (was missing in tree)
- Added challenges/ to sparse_parity (was missing in tree)
- Added complexity-check, score-all, regen-diagrams to bin/

Auto-counts:
- findings_count: glob "findings/exp_*.md"
- experiments_jsonl_count: lines of "research/log.jsonl"
- task_count: glob "docs/tasks/[0-9]*-*.md"

Generator is idempotent: running twice produces no diff.

CI workflow (.github/workflows/diagram-staleness.yml) runs
`bin/regen-diagrams --check` on PRs that touch the YAML or the
generated files; fails if a regen would change anything, with the fix
("run bin/regen-diagrams locally and commit") in the error message.

mkdocs --strict build: clean (no new warnings).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0bserver07 0bserver07 merged commit 0a0bc3e into main Apr 25, 2026
1 check passed
0bserver07 added a commit that referenced this pull request Apr 25, 2026
#92)

Changelog v0.29.0:
- New section "Auto-generated repo diagrams (PR #91)" with the drift it
  caught and the contributor workflow.
- PR #91 added to "Pull requests landed" table.

CONTRIBUTING.md:
- Branch protection note in PR process (1 approval required, admin
  override for hotfixes, force-push and deletion blocked).
- Diagram-staleness CI flagged as the only current CI gate.
- New "Updating the repo diagrams" section: edit YAML → run
  bin/regen-diagrams → commit, with a list of auto-counted placeholders.
- New "Releases and version tags" section: SemVer + Keep a Changelog,
  annotated tag at the merge commit, push pattern.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0bserver07 0bserver07 deleted the docs/auto-diagrams branch April 25, 2026 20:33
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