Repository navigation
feat(docs): add opt-in Typst guards and reproducible builds - #2005
Merged
Merged
Conversation
gerchowl
force-pushed
the
feature/1994-typst-guards
branch
from
November 3, 2026 10:57
7624c18 to
19b53ef
Compare
gerchowl
force-pushed
the
feature/1994-typst-guards
branch
from
November 3, 2026 12:03
19b53ef to
76ff671
Compare
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.
Description
Document projects can opt into formatting, compile, package-pin, and generated-PDF guards through the docs module. Scaffold upgrades reconcile committed hook configs and install reproducible build recipes while preserving consumer comments and exclusions.
Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance taskrefactor-- Code restructuringtest-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code styleModifiers
!)Changes Made
// devkit: entrymarkers, warn about suspicious unmarked entries, smoke-compile templates, and support DEVKIT_TYPST_SKIP globs.Reconciliation design decision
The docs hooks fit the existing exact feature-marker block model (#1654). Reversible per-fixer
excludemerges do not fit its version-gated whole-block tables. Extract the existinghook_block_range,splice_lines, anddelete_linesshell functions intoassets/preserved-hooks.sh, used by both legacy folds/inserts and docs. Route docs through the central preserved-hook pass and its insert/fold/drift reporting. Removetypst_scaffold.pyand its separate marker matcher and position-keyed base64 protocol.The small YAML-aware extension stages edits around those shared primitives, uses marker-only docs lookup while retaining structural lookup for legacy hooks, validates with prek, and rolls back on expected or unexpected failures. Restore exclusions by repository/hook ID and compare parsed values, allowing formatter re-quoting. Bounded state comments preserve original field bytes; derive indentation from the consumer structure and reuse an existing local hook sequence where available to avoid multiplying existing lint findings. Write and restore bytes in place to preserve the inode. Decline hand edits anywhere in the owned block, including comments, using the existing fold ownership rule. Failures print manual advice and let the installer continue. Existing pre-release blocks with the old state format require manual cleanup; they are left intact with a warning.
The installer owns
justfile.devkit-docsto avoid collisions with consumerjustfile.docsfiles, which are never touched or imported. Only docs ON with a managed recipe file emits the import; unmanaged files at the reserved name are retained without importing them. Preview reports hook and recipe/import changes. Inline comments on injected exclusion fields are refused before any text is dropped; deleted fixers, changed repository URLs, and relocated excludes receive precise recovery advice. See docs/NIX.md. Extended regex comments cannot swallow the generated-directory alternative.Changelog Entry
Added
Testing
PYTHONPATH="$PWD/packages/vig-utils/src:$PYTHONPATH" uv run --with pytest-xdist pytest tests/test_typst_reconcile.py tests/test_typst_docs.py tests/test_scaffold_preserved_hooks.py packages/vig-utils/tests/test_typst_guard.py -n 2 --basetemp=$HOME/.cache/devkit-pytest/1994a-r5-final2(exit 0). Initial RED: 18 failed, 86 passed (exit 1); failing regressions committed first. Five requested mutants M1/M6/M11/M12/M15 each produce pytest exit 1. Nix shell hooks pass on all commits.7f1ea5bb6894af6ca0ed6cfdf1d83fea6ac494fe, including Nix render/consumer fidelity gates, consumer matrix, BATS, image/integration tests, and Test Summary.gh pr checks 2005 --watchexited 0.Manual Testing Details
The real Nix canary rejects unformatted sources, compile errors, compiler warnings, invalid package versions, and uppercase indexed generated PDFs while accepting PDFs elsewhere. It exercises the actual installer docs gate, discovered system-font exclusion with and without project branding fonts, resolved tool identities, revision stamps, dependency output, and canonical PDF hash stability with project branding fonts. Ambient TYPST_FONT_PATHS points at a real font directory. Regression cases cover the review findings and five requested mutations: reordered hooks, re-quoting, ownership, hand edits, indentation, extended regex comments, and unexpected rollback. A direct nix eval also verifies that docs-only shellHook emits no generated-config refusal or installation.
Checklist
Additional Notes
Phase 1a only. The glossary, house-style package, content guards, and preview CI remain in their planned phases. Typstyle 0.15.2 uses its CLI default of 80 columns; no unsupported typstyle.toml is installed. The docs module retains the packages/env/shellHook contract: the scaffold owns committed configuration, and mkProjectShell owns generated configuration. Canonical documents must tolerate an absent revision input; preview-package downloading can require network access on first use.
Refs: #1994