On this page
Restore and cold boot๏
Prerequisite: persistence and custody. Keep the record operations separate from rebuilding a runtime:
create_checkpointrecords the checkpoint in the in-process ledger.flush_checkpointseals it to the local cache.reload_cached_checkpointbrings cached record data back into the ledger.load_checkpointattempts to rebuild the selected world through its public operations.
Inspect the report๏
A restore report carries status, built counts, shortfalls, and identity translation. Runtime identities are rebuilt; the translation information connects recorded and new identities. The separate research-record JSON lesson preserves the identity of the record it hydrates. Those are different contracts.
Preflight can refuse an incomplete chain before construction. Preserve the full required profile chain when preparing a cold start; reloading a single checkpoint does not imply every predecessor has been reloaded.
Follow both demonstrations๏
Expert 24 walks the checkpoint verbs while holding the existing world. Expert 27 flushes, tears down the root, creates a new runtime, and reads the cache again. The latter deliberately reports an admission refusal if the bundle is incomplete. A script finishing successfully therefore does not, on its own, prove a complete world was restored. Read the reported status, built resources, and shortfalls.
CrystallizerBootstrap packages the restart sequence into a one-shot operation:
activate, attach configured storage, reload, verify, load, report. Its empty-history
case differs from a broken chain. Use the pod-boot lesson for its complete setup.
The workflow in code๏
These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.
1def main() -> None:
2 crystallizer, conduit, commands = build_world()
3 vault = conduit.meld(spell=Vault, binding_name="outlive-vault")
4 vault.contents.append("written before any codegen")
5 print("world up; custody recording:", crystallizer.activated)
6
7 # Two codegen edits, each materialized - running is not keeping, so
8 # each gets an address of its own.
9 for label, code in (("edit-1", FIRST_EDIT), ("edit-2", SECOND_EDIT)):
10 commands.validate_codegen(code, frame_name=FRAME)
11 commands.execute_codegen(code, frame_name=FRAME)
12 commands.materialize_codegen(
13 code,
14 module_name="outlive_policy_%s" % label.replace("-", "_"),
15 frame_name=FRAME,
16 )
17 vault.contents.append(label)
18 print("two edits materialized; vault holds", len(vault.contents),
19 "entries")
20
21 # SEAL. Minting puts it in the LEDGER - memory, which the next step
22 # destroys.
23 checkpoint_id = crystallizer.create_checkpoint()
24 assert checkpoint_id in crystallizer.list_checkpoint_ids()
25
26 # FLUSH. THIS is what survives. Skip it and the rest of this script
27 # has nothing to load, with no error to say why.
28 flushed = crystallizer.flush_checkpoint(checkpoint_id)
29 assert checkpoint_id in flushed
30 assert checkpoint_id in crystallizer.list_cached_checkpoint_ids()
31 print("checkpoint", checkpoint_id[:14], "minted and flushed to cache")
32
33 # ---------------- THE TEARDOWN ----------------
34 aether = md.Aether()
35 del vault, conduit, commands, crystallizer
36
37 aether.cleanup()
38 collected = gc.collect()
39 print()
40 print("aether.cleanup() + gc.collect() ->", collected, "objects collected")
41
42 fresh_aether = md.Aether()
43 assert fresh_aether is not aether, (
44 "cleanup() must clear the singleton - a fresh Aether() may never "
45 "return the cleaned instance"
46 )
47 print("md.Aether() now returns a NEW root")
48 del aether
49
50 # ------- AFTER: a runtime that has never seen this world -------
51 reborn = md.Crystallizer()
52 reborn.activate(
53 md.CrystallizerConfigurationBuilder().with_defaults().activate(),
54 )
55 research = md.MutationResearch()
56 configuration = research.create_configuration()
57 configuration.with_defaults().activate()
58 research.activate(configuration)
59
60 assert checkpoint_id in reborn.list_cached_checkpoint_ids(), (
61 "the flushed checkpoint must survive the singleton teardown - if "
62 "this fails, the cache is not bytes at rest"
63 )
64 print("the cache crossed the teardown; our checkpoint is still there")
65
66 # Cache back into the ledger: bookkeeping, not a boot.
67 summary = reborn.reload_cached_checkpoint(checkpoint_id)
68 assert isinstance(summary, dict)
69 print("reload_cached_checkpoint -> summary keys:", sorted(summary)[:5])
70
71 # THE BOOT VERB. Refuses if the folded chain is incomplete.
72 try:
73 report = reborn.load_checkpoint(checkpoint_id)
74 except RuntimeError as refusal:
75 print()
76 print("load_checkpoint REFUSED at admission:")
77 print(" ", str(refusal)[:130])
78 print(" preflight ran BEFORE any replay and the message ends")
79 print(" `nothing was built` - the chain folded incomplete")
80 else:
81 assert isinstance(report, dict)
82 print()
83 print("load_checkpoint -> RestoreReport keys:", sorted(report))
84 for key in ("identity_translation", "identity_translation_map",
85 "translation_map", "identity_map"):
86 if key in report:
87 print(" %s: %d remapped" % (key, len(report[key])))
88 print(" rebuilt objects get NEW ids - the world that comes")
89 print(" back is EQUIVALENT, not identical")
90 break
91
92 print()
93 print("the CACHE outlived the runtime that minted it; ledger is memory")
94 print("cleanup() IS the reset, and it is public")
95 print("the last rung wants a COMPLETE bundle, checked before it builds")
Runnable examples๏
A world that outlives its own runtime โ Expert 27
Loading a whole world back โ Expert 24
Pod boot the order is the product โ Expert 01