Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

stale record detection

This notebook demonstrates check_stale() against the record notebook 02 built; after running it you can show that loosening the lemma’s own bound makes that record stale.

Evidence records are only as good as the model they reference. check_stale() compares a ReviewRecord’s stored content_hash against a model’s current source text. This notebook loads the AS-C08 record Ch8-02 persisted with save_record(), via load_record(), confirms it is current against ch08-cumulative.sysml, then loosens the lemma’s own bound and shows the record go stale.

A record with an empty identifier fails validation outright, distinct from staleness: it was never a valid record to begin with, regardless of which model it references.

Negative control ok: errors=['identifier is empty']

AS-C08 is loaded here from the record notebook 02 persisted with save_record(), already hashed against the ch08-cumulative.sysml source it was built from, so check_stale() has something to compare against.

Record is current: check_stale=False

Loosening deliveredEnergyBoundedBySupply’s own bound from <= 1.0 to <= 1.2 is exactly the kind of change that should invalidate a record built against the tighter bound: the model still loads, but it no longer says what the record claims it says. This is the same partial safeguard the lemma’s own doc comment names: the record’s content_hash is computed from the whole model file, so any edit anywhere in it, including to HeatGenerator’s own efficiencyBounded or deliveredEnergy, would also stale this record, even though nothing automatically checks that the restated lemma still matches whatever changed.

After loosening the bound: check_stale=True
Record requires re-review: the stored hash no longer matches the current model.

The record printed above, current against the model it was built from, went stale the moment the bound it cites changed underneath it: exactly the mismatch the loop is built to catch, whether the change is to the model or to the property a record depends on. Ch8-02 shows the same loosened bound reported undecided by verify_holds() itself, a second, independent way this exact change is caught.

Try the chapter exercise in exercises/ch08/exercise.ipynb: it works through the same verify_satisfaction() and stale-detection pattern on its own, separate coffee-maker exercise model.