P178 · Context management

Derivation-Order Staleness Check

Track dependency fingerprints so regenerated upstream inputs invalidate derived artifacts.

Editorially reviewed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

A search index is generated from metadata and bilingual bodies. Copying can preserve modification times even after content changes, making an old index seem current. The teaching dependency list includes metadata.json, bodies, generator revision and relevant configuration. The source uses remote cache validators; this fixture adapts source-change checking to local derived artifacts.

Mechanism

List dependencies that actually affect output and record their fingerprints plus generator/configuration identity during generation. Recompute before reuse. Any meaningful mismatch requires regeneration and validation. Existence or unchanged timestamps alone do not establish freshness. Hash identity does not establish semantic correctness.

Bad example

After copying the index, assume it matches current bodies because its timestamp did not change. Reuse it even after generator or configuration changes.

Good example

Record fingerprints for metadata.json, every consumed bilingual body, generator revision and relevant configuration. Before using the index, recompute and compare with its derivation record. Regenerate in dependency order and validate on any mismatch; reuse only when all match. Do not replace content comparison with preserved timestamps. An unreadable dependency remains unverified rather than current.

Why the change matters

Timestamps can be preserved, restored or coarse. Binding output to actual dependency identity gives upstream changes an explicit invalidation path and prevents checks that cover bodies but forget the generator.

Observable expectation

Generate an index and record inputs, then change one body while preserving its timestamp. A consistency check should identify the mismatch and require regeneration. Changing an output-relevant setting should also invalidate reuse.

An illustrative report names the dependency and next generation step without fabricated hash values. Equal bytes support a reuse condition, not correct search semantics.

Limits

Missing dependencies undermine the check; nondeterministic generation also needs its input sources handled. Local content hashes differ from the source’s ETag/Last-Modified validators. Do not treat every ETag as a byte digest or a cache hit as permanent freshness.

Sources and evidence

Read the editorial criteria

Related methods