pub fn preprocess_pack(
entries: Vec<PackEntry>,
registry: &PreprocessorRegistry,
pack: &Pack,
fs: &dyn Fs,
datastore: &dyn DataStore,
paths: &dyn Pather,
mode: PreprocessMode,
force: bool,
) -> Result<PreprocessResult>Expand description
Run the preprocessing pipeline for a pack’s file entries.
- Partition entries into preprocessor files vs regular files.
- In
PreprocessMode::Active(realdodot upruns): for each preprocessor file, expand, write results to datastore (unless the deployed file has diverged from the cached baseline — see step 5), write the baseline cache record. - Create virtual
PackEntrys pointing to the datastore files. - Check for collisions between virtual and regular entries.
- Divergence guard (Active only): unless
forceistrue, compare the prospective deployed file against the cached baseline before overwriting. When the deployed bytes have changed (the user edited the deployed file directly), skip the write and record aSkippedRenderso the caller can warn the user. Seedocs/proposals/preprocessing-pipeline.lex§6.4. - In
PreprocessMode::Passive(dodot status,up --dry-run): skip every disk-mutating step. Sources are never read for marker scans; preprocessors are never invoked (no provider calls); the datastore is not touched. Virtual entries are still produced so the rest of the planner can compute intents — their bytes come frombaseline.rendered_contentwhen a baseline exists. First-time pack templates with no baseline still surface a placeholder virtual entry (sododot statuscan render them as “pending” under the stripped name) but with emptyrendered_bytes. Handlers that need rendered content for sentinel hashing (install,homebrew) skip intent generation for those placeholders rather than erroring out — the next realdodot upplans them normally. SeePreprocessModeanddocs/proposals/secrets.lex§7.4. - Return the result for merging into the handler pipeline.
Set force = true to bypass the divergence guard. Surfaces as
dodot up --force in the CLI; needed when the user knows they want
to overwrite a divergent deployed file (e.g. after rotating an env
var that a template references). Ignored in Passive mode (no
writes happen there at all).