Revision: 11 Last modified: 2026-12-04T14:04:20Z
scripts/testing/sync_issues_docs.sh is the single doc-sync entry point for the
workable-items document set. §11.4.22 / §11.4.60 require one command that brings
the whole set back into sync from the SQLite single source of truth so no human
has to remember stage order — and until 2026-12-03 no such scripts/ entry point
existed (a sync_issues_docs.sh was expected but absent), which is how the
committed summaries drifted 581/12 against a database holding 569/24
open/closed items.
Three stages, in this exact order; any stage failure stops the run:
| Stage | Command | Writes |
|---|---|---|
| 1. trackers | workable-items sync db-to-md |
docs/Issues.md, docs/Fixed.md |
| 2. summaries | scripts/testing/generate_summaries.sh |
docs/Issues_Summary.md, docs/Fixed_Summary.md |
| 3. formats | workable-items export --formats (gated) |
.html / .pdf / .docx siblings |
Stage 3 never fakes an export. It resolves the one formats-export switch
(scripts/formats_export_lib.sh) and probes for pandoc / weasyprint; when
the switch is OFF or a tool is missing it prints an explicit honest line, leaves
the Markdown as canonical, and the run still exits 0 (§11.4.6).
bash,python3, theworkable-itemsengine binary (resolution order as ingenerate_summaries.sh:$WORKABLE_ITEMS_BIN→scripts/workable-items/bin/workable-items→PATH).docs/workable_items.db.- Stage 3 only: the formats switch ON and
pandoc(andweasyprintfor PDF) onPATH.
# full sync: trackers -> summaries -> gated formats
scripts/testing/sync_issues_docs.sh
# staleness gate (implies --skip-trackers; writes nothing, but DOES verify
# the HTML/PDF siblings read-only: exit 1 when stale, exit 7 when unverifiable)
scripts/testing/sync_issues_docs.sh --check
# regenerate the summaries only, leaving docs/Issues.md and docs/Fixed.md alone
scripts/testing/sync_issues_docs.sh --skip-trackers --skip-formats
# one-run switch override for the formats stage
DOCS_EXPORT=1 scripts/testing/sync_issues_docs.shExit codes: 0 success (including an honest formats skip) · 1 stale
(--check only: a summary OR an HTML/PDF sibling) · 2 usage / missing binary ·
3 stage 1 failed · 4 stage 2 failed · 5 missing input · 6 stage 3 failed ·
7 formats UNVERIFIED (--check only: the switch is OFF or the exporter's
toolchain is absent, so the .html/.pdf legs were NOT verified — deliberately
not 0, because a run that could not verify must not inherit the compliance the
skipped stage implied).
--checkmutates nothing but verifies everything it can. It forces--skip-trackers(no tracker rewrite) and passes--checkto the exporter, which compares mtimes and writes nothing. It exits1when a sibling is missing or older than its.md, and7when the format legs cannot be verified at all (switch OFF, toolchain absent). Earlier revisions exited0unconditionally here — a green--checkthat had checked no format artefact was the silent-green defect this stage now refuses.- Trackers mid-write elsewhere.
--skip-trackersprotectsIssues.md/docs/Fixed.mdwhen another owner is writing them; the summaries are still regenerated from the database, which is the source of truth either way. - Formats switch OFF. Operator order 2026-10-26 sets
config/formats_export.conftoformats_export=false. A normal run reportsstage 3/3 formats: SKIPPED (UNVERIFIED)naming the source and exits0(the.mdfiles are complete and nothing is faked);--checkexits7instead, because a check must not report compliance it could not verify. This repository opts in throughdocs/context/doc_export.policy(enabled=1), so the exports are produced here. - Switch ON but tools absent. Reports
SKIPPED (UNVERIFIED)naming the missing tools (exporter exit4); nothing is written.--checkexits7. - Stage 3 never lies about what it did. It prints
EXPORTED(with the exporter's own count line) when it wrote siblings,CHECK PASSfor a read-only verification, andSKIPPEDwith a reason ONLY when it produced and checked nothing. - Engine absent. Exit
2with the resolution instructions; nothing is written. - Database absent. Exit
5; the Markdown is never parsed to compensate.
- Parse flags; validate DB + docs dir; resolve the engine.
- Stage 1 (unless skipped):
sync db-to-md --db <db> --out-dir <docs>; non-zero is a hard stop (3). - Stage 2:
generate_summaries.sh --write(or--check), forwarding--db,--docs-dir,--quiet; staleness exits1, other failures4. - Stage 3 (unless skipped): delegate to
scripts/testing/export_docs_formats.sh, which owns the switch, the class set and the pandoc/weasyprint legs for ALL eight §11.4.60 classes (the engine'sexport --formatscovers only the four tracker docs). Its exit code is mapped explicitly:0→EXPORTED/CHECK PASS;1→ exit1(stale siblings);3(switch OFF) and4(toolchain absent) →SKIPPED (UNVERIFIED), and under--checkexit7; other → stage failure (6).
The switch is read from exactly one place — this script does not re-implement
the precedence (env DOCS_EXPORT > docs/context/doc_export.policy >
config/formats_export.conf > false); export_docs_formats.sh asks
scripts/formats_export_lib.sh.
scripts/testing/generate_summaries.sh— stage 2 (the summaries).scripts/testing/generate_summaries.py— §11.4.44 header reconciler.scripts/formats_export_lib.sh— the single formats-switch reader.scripts/testing/export_docs_formats.sh— stage 3's exporter (all eight §11.4.60 classes) + its guidedocs/scripts/export_docs_formats.md.scripts/gates/cm_docs_composite_sync.sh— the §11.4.60 parity gate (+ paired mutation test) anddocs/scripts/cm_docs_composite_sync.md.docs/notes/export-toolchain.md— measured toolchain, before/after evidence.scripts/workable-items/cmd/workable-items/export.go—export/sync db-to-mdimplementations.docs/scripts/generate_summaries.md— the stage-2 companion guide.
2026-12-04 — stage 3 re-pointed at export_docs_formats.sh: a full run reports
stage 3/3 formats: EXPORTED with the exporter's count, --check reports
CHECK PASS on a fresh tree (exit 0), exits 1 with a backdated sibling, and
exits 7 with DOCS_EXPORT=0 (UNVERIFIED). All eight class instances have
.html + .pdf siblings that validate clean.
2026-12-03 — --check on the real tree: exit 0 after regeneration, exit 1
before it. --skip-trackers --skip-formats regenerated both summaries and stage
3 printed EXPORT STEP SKIPPED -- formats switch is OFF (source: constitution-default) with exit 0. The full pipeline (stage 1 rewriting
docs/Issues.md + docs/Fixed.md) was deliberately NOT executed in this
session because those two files are outside the task's write scope.