feat(docs): add failure recovery to build and deploy docs (closes #930) - #1015
Open
arcgod-design wants to merge 1 commit into
Open
feat(docs): add failure recovery to build and deploy docs (closes #930)#1015arcgod-design wants to merge 1 commit into
arcgod-design wants to merge 1 commit into
Conversation
…arshanGK#930) Adds a zero-dependency docs build failure-recovery utility (scripts/recover_docs_build.py) that detects 9 documented failure modes in the build and deploy docs tree and offers automated repairs for the ones that are safe to fix in place: Auto-repairable: - bom_detected (strip + re-encode as UTF-8 LF) - crlf_line_endings (normalise CRLF -> LF) - trailing_whitespace (strip per detected line) - missing_final_newline (append \n) - duplicate_heading_anchor (rename with (<file> <idx>) suffix) Manual (informational — runbook provided): - empty_file (zero-byte markdown file) - circular_link (A -> B -> A or self-loop) - unicode_replacement_chars (U+FFFD byte corruption) - baseline_sha_mismatch (tree sha256 drift vs --baseline json) Modes: --check CI gate (exit 1 on any failure) --apply execute auto-repairs; idempotent --json machine-readable plan (incl. applied_repairs audit trail) --baseline <json> also detect sha drift against issue imDarshanGK#929 snapshot Plugs into the existing docs-regression.yml workflow as two new steps after the markdown-lint + link-check: 1. python scripts/recover_docs_build.py --check 2. python -m pytest tests/test_recover_docs_build.py -q Adds docs/failure-recovery.md as the operator-facing runbook: per-mode table with Auto/Manual tags, recovery CLI snippet (apply / check / json), on-call resolution steps (editor config for prevention), and the baseline-drift triage flow paired with the issue imDarshanGK#929 metrics collector. Adds tests/test_recover_docs_build.py with 46 pytest cases covering slugify, every detector (BOM utf-8/16, CRLF, trailing whitespace, final newline, in-file / cross-file duplicate anchors, empty file, U+FFFD, circular self + 2-file + acyclic chains, baseline match + mismatch), every apply pass (BOM strip, CRLF normalise, WS strip, newline append, heading rename, idempotence over multi-failure seed, side-effect isolation across untouched files), and the full CLI surface (default scan, --check pass/fail, --apply --check green path, --json parseable, --baseline match + mismatch + missing sha256 key, missing root, missing baseline). Acceptance criteria from issue imDarshanGK#930: [x] Implement the change in the build and deploy docs [x] Add or update tests, docs, or validation for the touched path
|
@arcgod-design is attempting to deploy a commit to the Darshan's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Adds failure recovery to the LocalMind build and deploy docs pipeline (
.github/workflows/docs-regression.yml), addressing the Hard-level issue #930. Completes the build-and-deploy docs pipeline trilogy with the #928 dedupe gate (PR #1009) and the #929 observability metrics collector (PR #1013).Why
The existing pipeline lints markdown + checks broken links. Both are silent to content-level failure modes that break deploys:
\r\nendings → every future edit produces unstable diffs and noisy rebases.cat.## Configurationheading → the[docs/file.md#configuration](…)deep-link target silently switches to whichever file the slugger picks first.docs/that links to nothing → dead-end page in production.docs/a.md → docs/b.md → docs/a.mdcycles → endless redirect loop in sitemap crawlers.U+FFFDreplacement chars.The recovery utility enumerates those modes, auto-repairs what's safe in-place (idempotent), and on the rest emits a structured plan with a documented runbook so an on-call maintainer can resolve the failure in minutes.
What changed
New files
scripts/recover_docs_build.py— 645-line zero-dependency utility (Python stdlib) that scansdocs/**/*.md+README.md+*.mdand detects 9 documented failure modes:bom_detectedcrlf_line_endings\r\nsequencestrailing_whitespacemissing_final_newline\nduplicate_heading_anchor(<file> <idx>)empty_filecircular_linkunicode_replacement_charsbaseline_sha_mismatch--baselinesnapshot shaModes:
--check(CI gate; exit 1 on any failure)--apply(execute auto-repairs; idempotent — running twice leaves the tree unchanged)--json(machine-readable plan + applied_repairs audit log)--baseline <json>(also detect tree-level sha drift against a Add observability metrics to build and deploy docs #929 metrics snapshot)tests/test_recover_docs_build.py— 46 pytest cases covering:--checkpass/fail,--apply --checkgreen path,--jsonparseable,--baselinematch / mismatch / missingdocs_sha256_totalkey, missing root, missing baseline)docs/failure-recovery.md— 245-line operator-facing runbook: per-mode catalogue table with Auto/Manual tags, recovery CLI snippets (apply/check/json), on-call resolution steps + prevention editor configs (VS Code settings to set), the baseline-drift triage flow paired with the Add observability metrics to build and deploy docs #929 metrics collector, the local-link cycle explanation (why a 2-file cycle produces 2 reports), and a CI integration example for an opt-in auto-repair-and-commit bot.Modified files
.github/workflows/docs-regression.yml— added 2 new steps after the existing markdown-lint + link-check:python scripts/recover_docs_build.py --check— CI gate.python -m pytest tests/test_recover_docs_build.py -q— keep the recovery util under regression.Extends the
paths:trigger filter to include the new files.Verification
Running
--applyagainstmaincleanly auto-repairs all 12 detected failures — Idempotency verified (a seconddetect_failures()pass afterapply_repairs()returns only failures that #928's PR independently renames).No existing backend or frontend tests were modified. No markup content in
docs/was touched on this branch — the heading renames belong to the #928 PR.Acceptance criteria
Issue #930 acceptance criteria:
Closes #930.