On this page

Frames as worlds๏ƒ

๐ŸŸ  Advanced ยท Lesson 02

Aetheric frames are WORLDS - the categories arc, act three. Act 1 (beginner 25): spellframes categorize spells WITHIN a world. Act 2 (intermediate 26): conduits categorize worlds of resolution. Act 3: aetheric_frame= names an ENTIRE ISOLATED WORLD - its own registries, its own control plane, its own posture, its own singletons.

AND THE LINE THAT WALL DOES NOT CROSS, which is the real lesson:

A FRAME IS A WORLD FOR INSTANCES AND RESOLUTION. IT IS NOT A NAMESPACE FOR IDENTITY.

A spell_id is a SHA256 over the BIND FINGERPRINT - structural profile, lookup signature, existence, resolved disposal metadata. READ THAT LIST AGAIN AND NOTICE WHAT IS ABSENT: the frame. So two books on two different frames binding the same class with the same parameters mint THE SAME ID, and the second conjure is refused process-wide. Moving to another frame is not a fix, because the id follows the fingerprint and the fingerprint has no frame in it.

The fix is to make the BINDINGS different, not the worlds: binding_name= or spellframe=. Once you do, everything you expect from a world wall holds - unique is one instance PER FRAME, each world reuses its own singleton forever, and nothing leaks across.

WHY IT IS BUILT THIS WAY: one spell_id names one spell, everywhere. An id that silently meant different things in different frames would make every checkpoint, every crystal and every research lane ambiguous the moment two frames existed.

Before you run๏ƒ

Use the Advanced guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.

Run the saved script๏ƒ

python UX_and_AIX_experiences/03_advanced/02_frames_as_worlds.py
py -3.14t UX_and_AIX_experiences/03_advanced/02_frames_as_worlds.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

Spellbook(aetheric_frame=...), binding_name as the identity differentiator, per-frame instance isolation

Code๏ƒ

 1"""
 2TIER: advanced (02)
 3GOAL: Aetheric frames are WORLDS - the categories arc, act three.
 4      Act 1 (beginner 25): spellframes categorize spells WITHIN a world.
 5      Act 2 (intermediate 26): conduits categorize worlds of resolution.
 6      Act 3: aetheric_frame= names an ENTIRE ISOLATED WORLD - its own
 7      registries, its own control plane, its own posture, its own
 8      singletons.
 9
10      AND THE LINE THAT WALL DOES NOT CROSS, which is the real lesson:
11
12        A FRAME IS A WORLD FOR INSTANCES AND RESOLUTION.
13        IT IS NOT A NAMESPACE FOR IDENTITY.
14
15      A spell_id is a SHA256 over the BIND FINGERPRINT - structural
16      profile, lookup signature, existence, resolved disposal metadata.
17      READ THAT LIST AGAIN AND NOTICE WHAT IS ABSENT: the frame. So two
18      books on two different frames binding the same class with the same
19      parameters mint THE SAME ID, and the second conjure is refused
20      process-wide. Moving to another frame is not a fix, because the id
21      follows the fingerprint and the fingerprint has no frame in it.
22
23      The fix is to make the BINDINGS different, not the worlds:
24      `binding_name=` or `spellframe=`. Once you do, everything you
25      expect from a world wall holds - `unique` is one instance PER
26      FRAME, each world reuses its own singleton forever, and nothing
27      leaks across.
28
29      WHY IT IS BUILT THIS WAY: one spell_id names one spell, everywhere.
30      An id that silently meant different things in different frames
31      would make every checkpoint, every crystal and every research lane
32      ambiguous the moment two frames existed.
33SURFACE EXERCISED: Spellbook(aetheric_frame=...), binding_name as the
34                   identity differentiator, per-frame instance isolation
35VERIFY: rides the owner's 3.14t run; asserts are the contract.
36
37HISTORY: this lesson used to teach that two frames could bind the same
38class under the same name "with zero collision", and it carried a note
39warning that S2 of EPIC-2026-08-02-process-wide-spell-id-uniqueness would
40retire exactly that claim. S2 landed. The claim is retired, and the
41lesson now teaches the line instead of the half of it that survived.
42"""
43import melder as md
44
45
46class TenantCache:
47    pass
48
49
50def main() -> None:
51    # Two books, two WORLDS. Naming the frame births it (lazy frames).
52    book_a = md.Spellbook(aetheric_frame="tenant-a")
53    book_b = md.Spellbook(aetheric_frame="tenant-b")
54
55    # THE SAME CLASS IN BOTH WORLDS - but the BINDINGS must differ.
56    # Bind these two identically and the second conjure is refused: the
57    # fingerprint would be byte-identical and the frame is not in it.
58    book_a.bind(spell=TenantCache, existence="unique", binding_name="tenant-a")
59    book_b.bind(spell=TenantCache, existence="unique", binding_name="tenant-b")
60
61    conduit_a = book_a.conjure(name="cache-a")
62    conduit_b = book_b.conjure(name="cache-b")
63
64    cache_a = conduit_a.meld(spell=TenantCache, binding_name="tenant-a")
65    cache_b = conduit_b.meld(spell=TenantCache, binding_name="tenant-b")
66
67    # "unique" = one instance per FRAME. Two frames, two singletons.
68    assert type(cache_a) is type(cache_b) is TenantCache
69    assert cache_a is not cache_b
70    print("one class, two worlds, two singletons:", cache_a is not cache_b)
71
72    # Each world reuses ITS OWN singleton, forever.
73    assert conduit_a.meld(spell=TenantCache, binding_name="tenant-a") is cache_a
74    assert conduit_b.meld(spell=TenantCache, binding_name="tenant-b") is cache_b
75    print("per-frame reuse holds; nothing leaked across the wall")
76
77    # THE LINE, PROVEN. A third world binding the SAME class the SAME way
78    # as tenant-a is refused - and the refusal names the id, not the
79    # frame, because the frame was never what made them different.
80    book_c = md.Spellbook(aetheric_frame="tenant-c")
81    try:
82        book_c.bind(spell=TenantCache, existence="unique",
83                    binding_name="tenant-a")
84        book_c.conjure(name="cache-c")
85        raise AssertionError("expected a process-wide spell_id refusal")
86    except RuntimeError as error:
87        assert "spell_id" in str(error) or "Spell ID" in str(error)
88        print()
89        print("a third frame with an IDENTICAL binding was refused:")
90        print("  frames isolate instances; they do not namespace identity")
91
92
93if __name__ == "__main__":
94    main()

Check the outcome๏ƒ

The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.

More advanced examples ยท Level guide

API contracts๏ƒ