Skip to main content

Module baseline

Module baseline 

Source
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_pack calls Baseline::write after every successful expansion. Re-running dodot up overwrites the file in place.
  • Read: dodot transform check and the clean filter call Baseline::load to drive divergence detection.
  • Cleanup: dodot down deletes the per-pack subdirectory; the cache survives dodot up failures 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.
SecretsSidecar
Per-file secrets sidecar — the on-disk shape of secret_line_ranges.

Constants§

SCHEMA_VERSION
Current baseline-cache schema version. Bump on incompatible changes.
SECRETS_SIDECAR_VERSION
Current sidecar schema version.

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.