ADR-002: Diátaxis Four-Quadrant Documentation and Versioned MkDocs Publishing¶
| Attribute | Value |
|---|---|
| Status | Accepted |
| Date | 2026-11-23 |
| Deciders | FileCleaner Core Engineering, LightPath Documentation |
| Supersedes | None (Issue #38) |
Context¶
FileCleaner documentation originated as paired English and French manuals (README.md, README.fr.md,
docs/en/{HOWTO,USER_GUIDE,COOKBOOK_EXAMPLES,SPECIFICATIONS}.md,
docs/fr/{HOWTO,GUIDE_UTILISATEUR,EXEMPLES_RECETTES,SPECIFICATIONS}.md) alongside CHANGELOG.md,
docs/RELEASE_NOTES_v1.0.1.md, docs/ACTION_LOGBOOK.md, and docs/RCA_REGISTER.md. As adoption scaled past v1.0.0
and v1.0.1 toward v1.1.0 and public hosting on https://filecleaner.lightpath.fr/ (IONOS Apache), four structural
constraints emerged:
- Genre Mixing in Monolithic Manuals: Guided tutorials, production systemd/Docker operations, parameter reference
tables, and mathematical invariants lived inside single long files (
USER_GUIDE.md,SPECIFICATIONS.md), forcing operators during incidents to filter architectural prose before finding actionable steps. - Immutable Historical Release Snapshots: Git release tags
v1.0.0andv1.0.1predatemkdocs.yml, KaTeX scripts, CSS theme files, and Diátaxis directories (01-tutorials/..04-explanation/);v1.0.0even predatesdocs/en/HOWTO.md. - Static Apache Hosting & Secret Hygiene: IONOS shared hosting serves static HTML/CSS/JS bundles only, requiring
subpath-preserving
.htaccessredirects (/,/latest/,/dev/), aversions.jsonmanifest for Material'smikeversion selector, and ironclad exclusion of.kdbx,.keyx,.fc-tmp,.pid,.log, and.envartifacts. - Dual-Mode Link & CI Enforcement: Relative Markdown links must resolve identically on GitHub, inside
diataxis_check.py/pytest, and across MkDocs directory URLs, while GitHub Actions workflows must maintain FileCleaner's strict supply-chain rules (40-char SHA action pinning, zero${{ ... }}interpolation insiderun:blocks,permissions: contents: read, and Rust-validated TOML/YAML doc snippets).
Multi-Version Build and Publishing Pipeline¶
flowchart LR
GIT["Git Tags (v1.0.0, v1.0.1, v*)<br/>+ main / WORKTREE"] --> BLD["scripts/build_versioned_docs.py<br/>git archive + ALWAYS/FALLBACK Overlay"]
BLD --> HOOKS["scripts/mkdocs_hooks.py<br/>GFM Alerts & Slugify · Link Rewrite<br/>EN/FR Isolation & Tag Fallback"]
HOOKS --> MK["mkdocs build --strict<br/>mkdocs.yml (EN) + mkdocs.fr.yml (FR)"]
MK --> GUARD["assert_no_private_files<br/>Block .kdbx, .keyx, .fc-tmp, .pid, .env"]
GUARD --> DIST["site_dist/<br/>versions.json · .htaccess · /ver/ · /ver/fr/"]
DIST --> SFTP["SHA-Pinned GitHub Actions SFTP<br/>https://filecleaner.lightpath.fr/"]
Options Considered and Trade-Offs¶
| Option | Genre Separation & Procedural Clarity | Historical Release Versioning | Static IONOS Hosting & Security | CI & Test Integration | Verdict |
|---|---|---|---|---|---|
Option A: Bilingual Flat Markdown Only (docs/en/, docs/fr/) |
Low: mixes tutorials, runbooks, parameters, and proofs in long manuals | None: GitHub web UI shows only one branch at a time | None: no unified search, version selector, or KaTeX web portal | No Vale/STE procedural enforcement on runbooks | Rejected |
Option B: Unversioned MkDocs Material (main Only) |
Medium: adds tabs and search, but lacks quadrant guardrails without restructuring | None: v1.0.0/v1.0.1 binary users see unreleased v1.1.0 flags (upload_s3) |
Static HTML works, but lacks /latest/ and /v*/ Apache routing |
Requires custom handling for root README.md, README.fr.md, and CHANGELOG.md |
Rejected |
| Option C: Diátaxis 4-Quadrant Tree + Versioned MkDocs Material Overlay | High: isolates 01-tutorials/, 02-how-to-guides/ (ASD-STE100 Issue 9), 03-reference/, and 04-explanation/ while keeping EN/FR manuals in nav: |
Full: builds main (/dev/) and all semver tags (v1.0.0, v1.0.1, v*, /latest/) via git archive overlay |
Full: static site_dist/ with .htaccess 301/302 redirects, versions.json, exclude_docs, and post-build privacy guard |
Automated via pytest (test_diataxis_documentation.py, test_mkdocs_publishing.py), Rust governance_and_docs_test.rs, .vale.ini, .markdownlint.json, and docs-ci.yml |
Selected |
Decision¶
Adopt Option C: organize active operational and architectural documentation into parallel English and French
four-quadrant Diátaxis trees (docs/01-tutorials/..docs/04-explanation/ and
docs/fr/01-tutoriels/..docs/fr/04-explications/), separate English and French MkDocs Material builds via
mkdocs.yml (language: en) and mkdocs.fr.yml (language: fr) with a dynamic extra.alternate switcher, and
publish versioned static sites to https://filecleaner.lightpath.fr/ using scripts/build_versioned_docs.py and
scripts/mkdocs_hooks.py.
Key implementation mechanisms include:
- Non-Destructive Historical Tag Overlay:
scripts/build_versioned_docs.pyextracts each semver tag viagit archive, overlaysALWAYS_OVERLAY_FILES(mkdocs.yml,mkdocs.fr.yml,scripts/mkdocs_hooks.py,docs/stylesheets/extra.css,docs/javascripts/katex.js) andFALLBACK_OVERLAY_FILES(docs/index.md,docs/fr/index.md,docs/assets/logo.svg,docs/assets/header-banner.svg), and compiles EN into<ver>/plus FR into<ver>/fr/undermkdocs build --strict. - Language-Isolated Hooks & Historical Fallback (
scripts/mkdocs_hooks.py): - Injects language-scoped virtual root documents (
overview-en.mdoroverview-fr.md, plusCHANGELOG.md), remapsdocs/fr/to the French sub-site root/<ver>/fr/, converts GitHub[!NOTE|TIP|IMPORTANT|WARNING|CAUTION]alerts, attaches GFM heading slugs (gfm_slugify), and synchronizesextra.alternatelinks per version slug. - Rewrites both Markdown links and HTML
<img src>/<a href>attributes using exact depth calculations (md_dvshtml_d), normalizes historicalv1.0.1docs/docs/paths, redirects external repo paths (src/,tests/,examples/,Cargo.toml) to pinned GitHub ref URLs, and maps missing historical quadrant directories (v1.0.0,v1.0.1) toen/HOWTO.md,en/COOKBOOK_EXAMPLES.md,en/USER_GUIDE.md,en/SPECIFICATIONS.md, oroverview-en.md. - Lazily imports
mkdocsandpathspecinside hook entrypoints so unit tests import and verify hook logic even when MkDocs is absent. - Triple-Layer Quality & Supply-Chain Gates:
- Action-Quadrant STE Gate:
.vale.iniandtests/test_diataxis_documentation.pyenforce ASD-STE100 Issue 9 structural rules (<= 20words/sentence, active imperative, zero contractions/semicolons/passive voice) on all non-indexdocs/02-how-to-guides/**/*.md. - Rust Config & Math Parity Gate:
tests/governance_and_docs_test.rsvalidates TOML/YAML[[rules]]blocks indocs/01-tutorials/anddocs/02-how-to-guides/viafilecleaner::Config::validate(), enforces LaTeX delimiter integrity across all Markdown files, verifies EN/FR heading parity across all 5 legacy bilingual pairs, and checks 40-char SHA pinning pluspermissions: contents: readondocs-ci.ymlanddocs-publish.yml. - Build-Time Privacy Guard:
exclude_docsinmkdocs.ymlpaired withassert_no_private_filesinscripts/build_versioned_docs.pyblocks sensitive extensions (.kdbx,.keyx,.fc-tmp,.pid,.env) from enteringsite_dist/.
Consequences¶
Positive¶
- Incident-Ready Separation of Concerns: Operators resolve freezes and S3 errors using terse ASD-STE100 runbooks
(
02-how-to-guides/) cross-linked with exact error matrices (03-reference/), without scrolling past mathematical proofs. - Zero-Drift Versioned Documentation: Users pinned to
v1.0.0,v1.0.1, orv1.1.0view documentation matching their binary capabilities via/latest/and tag selectors, while contributors preview unreleased work under/main/(/dev/). - Verified Code Examples: Every documented
[[rules]]TOML/YAML snippet in tutorials and how-to guides is compiled and validated againstfilecleaner::Config::validate()during Rust tests.
Negative and Operational Risks¶
- Historical Tag Regression Coupling: Modifying
mkdocs.ymlordocs/index.mdrequires checkingprune_nav_for_existing_filesand historical-tag fallbacks acrossv1.0.0andv1.0.1somkdocs build --strictdoes not break older snapshots. - Cross-File Relative Link Fragility: Relocating quadrant pages breaks cross-links unless
scripts/mkdocs_hooks.pydepth rules andtest_diataxis_documentation.pypass together in CI. - External KaTeX CDN Reliance: Rendered HTML pages load KaTeX
0.16.11assets fromcdn.jsdelivr.net; strictly air-gapped deployments require local vendored assets underdocs/javascripts/anddocs/stylesheets/.
Related Reference and Operational Guides¶
- Script CLI options,
FILECLEANER_DOCS_*environment variables, and CI workflows: CLI Commands & Exit Codes - Configuration schema and
INV-CFG-*invariants: Configuration Schema & Invariants - Container and service deployment procedures: Deploy FileCleaner with Docker and systemd
- Backup retention and S3 archival operations: Configure Backup Retention and S3 Archival
- Engine design rationale: ADR-001: Pure-Rust Fail-Closed Engine