Expand description
Per-file baseline cache for the preprocessing pipeline.
Every successful expansion writes a JSON record at
<cache_dir>/preprocessor/<pack>/<handler>/<filename>.json capturing
enough state to (a) detect drift on the deployed file, (b) decide
whether the source has changed, and (c) drive cache-backed
reverse-merge without re-rendering the template.
See docs/proposals/preprocessing-pipeline.lex §5.2 for the
field-level contract and docs/proposals/magic.lex §“Cache That
Makes It Cheap” for why the tracked_render field exists.
§Lifecycle
- Write:
preprocess_packcallsBaseline::writeafter every successful expansion. Re-runningdodot upoverwrites the file in place. - Read:
dodot transform checkand the clean filter callBaseline::loadto drive divergence detection. - Cleanup:
dodot downdeletes the per-pack subdirectory; the cache survivesdodot upfailures so partial deployments don’t strand baseline data for files that did succeed.
§Schema versioning
Records carry a version field. The current schema is 1. Future
changes that add fields can stay at v1 (serde-default fills in the
missing value); breaking changes bump the version, and load returns
a clean error so the user can clear the cache and re-baseline.
Structs§
- Baseline
- One baseline record — the cached state of a single processed file.
Constants§
- SCHEMA_
VERSION - Current baseline-cache schema version. Bump on incompatible changes.
Functions§
- cache_
filename_ for - Canonical filename for a baseline given a logical (stripped) pack path. Strips parent directories and uses the bare basename, which matches the cache-path convention specified in the pipeline doc.