On this page
A subsystems blast radius๏
๐ต Expert ยท Lesson 32
ASK A WHOLE SUBSYSTEM WHAT IT WOULD BREAK. Expert 14 built compositions - a set of versions pinned as one unit. This asks the two questions you actually have about one: how far does it reach, and has the ground moved under it.
research_group_impact(group_id) the union blast radius research_group_drift(group_id) recorded-vs-disk, narrowed
IMPACT IS A UNION WITH CLOSURE MATH, NOT A SUM. It merges every member's radius and then splits the result INTERNAL vs OUTBOUND: how much of the blast lands back inside the composition, and how much escapes it. The closure fraction is the number that matters - a subsystem with high closure is one you can change on its own terms, and a low one is a subsystem in name only, whose edges are really everyone else's problem. It also lifts to composition grain: the radius names the other compositions it touches (affected_compositions), so "what else does this subsystem hit" is answerable in subsystem vocabulary rather than as a flat list of spells.
DRIFT IS THE SAME REPORT AS research_source_drift, NARROWED TO THE FOOTPRINT - and the narrowing is the point. A whole-world drift report on a real repository is mostly other people's churn. Asked about ONE subsystem, the counts are recomputed over that subsystem's modules only, so the answer is about your area rather than about the repository's mood.
COMPOSITIONS ARE INFORMATIONAL, WHICH IS WHY THESE ARE CHEAP TO ASK. A composition pins members by reference; it carries no custody crystal of its own, gates nothing and never executes. Both of these verbs are derived reads over the members' recorded material - there is no subsystem-shaped thing at runtime to disturb.
AND THE FOOTPRINT IS HONEST ABOUT WHAT IT CANNOT SEE. A member whose custody is unknown is reported as unknown rather than silently contributing nothing - a shadow with a hole in it that claimed to be complete would be worse than no shadow.
EVOLVING ONE IS ADD/REMOVE, NOT REPLACEMENT. recompose says it outright - "unlisted members are retained" - so dropping a member is a one-word ask rather than a re-declaration of the roster. The previous composition is untouched by it, because identity is content-addressed over the members: a different roster is simply a DIFFERENT composition, not an edited one.
AND IT COMPLETES EXPERT 30'S DIFF LAW. There you met research_diff on two SPELLS, where the room pins structural for you. Hand the same verb two COMPOSITIONS and it pins NOTHING - it stands back and lets the engine's members default answer, because the useful question about two subsystems is which MEMBERS changed, not how their text reads. One verb, two vocabularies, chosen by kind.
Before you run๏
Use the Expert 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/04_expert/32_a_subsystems_blast_radius.py
py -3.14t UX_and_AIX_experiences/04_expert/32_a_subsystems_blast_radius.py
Public surface๏
validate_codegen / materialize_codegen, research_group_register / research_group_recompose / research_group_impact / research_group_drift / research_group_footprint / research_group_view / research_group_diff / research_diff
Code๏
1"""
2TIER: expert (32)
3GOAL: ASK A WHOLE SUBSYSTEM WHAT IT WOULD BREAK. Expert 14 built
4 compositions - a set of versions pinned as one unit. This asks the
5 two questions you actually have about one: how far does it reach,
6 and has the ground moved under it.
7
8 research_group_impact(group_id) the union blast radius
9 research_group_drift(group_id) recorded-vs-disk, narrowed
10
11 IMPACT IS A UNION WITH CLOSURE MATH, NOT A SUM. It merges every
12 member's radius and then splits the result INTERNAL vs OUTBOUND:
13 how much of the blast lands back inside the composition, and how
14 much escapes it. The closure fraction is the number that matters -
15 a subsystem with high closure is one you can change on its own
16 terms, and a low one is a subsystem in name only, whose edges are
17 really everyone else's problem.
18 It also lifts to composition grain: the radius names the other
19 compositions it touches (`affected_compositions`), so "what else
20 does this subsystem hit" is answerable in subsystem vocabulary
21 rather than as a flat list of spells.
22
23 DRIFT IS THE SAME REPORT AS `research_source_drift`, NARROWED TO
24 THE FOOTPRINT - and the narrowing is the point. A whole-world drift
25 report on a real repository is mostly other people's churn. Asked
26 about ONE subsystem, the counts are recomputed over that
27 subsystem's modules only, so the answer is about your area rather
28 than about the repository's mood.
29
30 COMPOSITIONS ARE INFORMATIONAL, WHICH IS WHY THESE ARE CHEAP TO
31 ASK. A composition pins members by reference; it carries no custody
32 crystal of its own, gates nothing and never executes. Both of these
33 verbs are derived reads over the members' recorded material - there
34 is no subsystem-shaped thing at runtime to disturb.
35
36 AND THE FOOTPRINT IS HONEST ABOUT WHAT IT CANNOT SEE. A member
37 whose custody is unknown is reported as unknown rather than
38 silently contributing nothing - a shadow with a hole in it that
39 claimed to be complete would be worse than no shadow.
40
41 EVOLVING ONE IS ADD/REMOVE, NOT REPLACEMENT. `recompose` says it
42 outright - "unlisted members are retained" - so dropping a member is
43 a one-word ask rather than a re-declaration of the roster. The
44 previous composition is untouched by it, because identity is
45 content-addressed over the members: a different roster is simply a
46 DIFFERENT composition, not an edited one.
47
48 AND IT COMPLETES EXPERT 30'S DIFF LAW. There you met `research_diff`
49 on two SPELLS, where the room pins `structural` for you. Hand the
50 same verb two COMPOSITIONS and it pins NOTHING - it stands back and
51 lets the engine's `members` default answer, because the useful
52 question about two subsystems is which MEMBERS changed, not how
53 their text reads. One verb, two vocabularies, chosen by kind.
54SURFACE EXERCISED: validate_codegen / materialize_codegen,
55 research_group_register / research_group_recompose /
56 research_group_impact / research_group_drift /
57 research_group_footprint / research_group_view /
58 research_group_diff / research_diff
59VERIFY: rides the owner's 3.14t harness; asserts are the contract.
60"""
61import importlib
62
63import melder as md
64
65
66FRAME = "subsystem-world"
67
68# THREE GENERATED MODULE WORLDS. A subsystem whose members all live in one
69# file has a ONE-module footprint, and a union over one module is not a
70# union - the internal/outbound split has nothing to split. Generating
71# three gives the radius something real to measure.
72MEMBERS = (
73 ("sub_intake", "Intake", "intake"),
74 ("sub_ledger", "Ledger", "ledger"),
75 ("sub_report", "Report", "report"),
76)
77
78MEMBER_TEMPLATE = '''"""Generated subsystem member."""
79
80
81class {class_name}:
82 def __init__(self) -> None:
83 self.name = "{label}"
84
85 def run(self) -> str:
86 return "{label}:ok"
87'''
88
89
90def _show(label: str, value: object) -> None:
91 if isinstance(value, dict):
92 print(" %-24s -> dict, keys: %s" % (label, sorted(value)[:5]))
93 elif isinstance(value, list):
94 print(" %-24s -> list, %d row(s)" % (label, len(value)))
95 else:
96 print(" %-24s -> %s" % (label, type(value).__name__))
97
98
99def main() -> None:
100 crystallizer = md.Crystallizer()
101 crystallizer.activate(
102 md.CrystallizerConfigurationBuilder().with_defaults().activate(),
103 )
104 research = md.MutationResearch()
105 configuration = research.create_configuration()
106 configuration.with_defaults().activate()
107 research.activate(configuration)
108
109 spellbook_configuration = (
110 md.SpellbookConfiguration(FRAME).with_defaults().finalize()
111 )
112 book = md.Spellbook(aetheric_frame=FRAME,
113 configuration=spellbook_configuration)
114 book.configure_aether_frame(
115 system_state="dynamic",
116 disposal=None,
117 disposal_method_names=None,
118 rift_enabled=True,
119 ai_native=True,
120 )
121 # AN EMPTY FRAME IS A REAL FRAME. `configure_aether_frame` declares the
122 # frame's LAW; `conjure` REALIZES it by giving it a root conduit, and
123 # that realization is what publishes it to the Nexus. Publication is
124 # gated on `rift_enabled` ALONE - the spell loop it runs iterates
125 # whatever the book holds, including nothing. So the frame below is
126 # conjured EMPTY and is immediately linkable; spells are cargo, not a
127 # precondition, and everything bound after this arrives incrementally.
128 book.conjure(name="subsystem-root")
129
130 nexus = md.Nexus()
131 system_configuration = nexus.create_configuration()
132 system_configuration.with_rift_creation_enabled(True)
133 system_configuration.with_allowed_target_frame_names([FRAME])
134 nexus.activate(system_configuration)
135 rift_configuration = nexus.create_rift_configuration()
136 rift_configuration.with_space_type("codegen")
137 rift = nexus.create_rift(configuration=rift_configuration,
138 rift_name="subsystem")
139 rift.mark_active()
140 rift.create_frame_link(FRAME)
141
142 # THE RIFT OWNS EXACTLY ONE SPACE. `RiftSpace` is a type you RECEIVE,
143 # never one you construct - which is why the same object comes back
144 # every time rather than a fresh space per read.
145 assert isinstance(rift.space, md.RiftSpace)
146 assert rift.space is rift.space
147 commands = rift.space.command_system
148
149 # THREE members, each its own module world, so the footprint is three
150 # modules and the union has something to be a union OF.
151 member_ids = []
152 for module_name, class_name, label in MEMBERS:
153 source = MEMBER_TEMPLATE.format(class_name=class_name, label=label)
154 commands.validate_codegen(source, frame_name=FRAME)
155 kept = commands.materialize_codegen(
156 source, module_name=module_name, frame_name=FRAME,
157 )
158 assert kept["materialized"] is True, kept
159 module = importlib.import_module(module_name)
160 member_ids.append(book.bind(
161 spell=getattr(module, class_name), existence="unique",
162 permissions="create", binding_name=module_name.replace("_", "-"),
163 ))
164 intake, ledger, report = member_ids
165 print("three versions declared from three module worlds:",
166 intake[:10], ledger[:10], report[:10])
167
168 # PIN THEM AS ONE UNIT. Identity is content-addressed over the
169 # canonical member list, so the same roster is the same composition.
170 composition = commands.research_group_register(
171 [intake, ledger, report],
172 reason="the intake -> ledger -> report subsystem",
173 )
174 # THE TAG IS THE DISPATCH. A payload carrying node_type "group"
175 # rehydrates as a composition; an UNTAGGED one is a spell node. That
176 # is back-compat by ABSENCE - payloads sealed before compositions
177 # existed carry no tag and correctly rebuild as spell nodes.
178 assert composition["node_type"] == "group"
179 assert set(composition["member_spell_ids"]) == {intake, ledger, report}
180 group_id = composition["group_id"]
181 print("composition registered:", group_id[:14], "... over 3 members")
182 print(" identity is recomputed from the members on rehydration, so a")
183 print(" tampered roster cannot enter the record wearing the same id")
184
185 print()
186 print("THE TWO QUESTIONS YOU ACTUALLY HAVE:")
187 try:
188 _show("group_impact", commands.research_group_impact(group_id))
189 _show("group_drift", commands.research_group_drift(group_id))
190 except RuntimeError as custody:
191 print(" custody read REFUSED:", str(custody)[:100])
192 print(" both are derived over the members' RECORDED material, so")
193 print(" without custody there is nothing to union or compare")
194 return
195
196 print(" impact is a UNION with closure math, not a sum: it splits")
197 print(" the radius INTERNAL vs OUTBOUND, and the closure fraction is")
198 print(" the number that matters - high closure is a subsystem you can")
199 print(" change on its own terms, low closure is a subsystem in name")
200 print(" only whose edges are everyone else's problem")
201
202 # The supporting reads, for context on what those two are computed over.
203 _show("group_footprint", commands.research_group_footprint(group_id))
204 _show("group_view", commands.research_group_view(group_id))
205 print(" footprint is the PHYSICAL shadow the drift report narrows to,")
206 print(" and it is honest about members whose custody it cannot see -")
207 print(" a shadow with a hole in it that claimed to be complete would")
208 print(" be worse than no shadow at all")
209
210 # EVOLVING ONE IS ADD/REMOVE, NOT REPLACEMENT. `recompose` states this
211 # outright: "unlisted members are retained". So dropping one member is
212 # a one-word ask, not a re-declaration of the roster - and the original
213 # composition is untouched, because a new roster is a NEW identity.
214 print()
215 print("EVOLVING A SUBSYSTEM:")
216 evolved = commands.research_group_recompose(
217 group_id, remove=[report], reason="report split out",
218 )
219 assert evolved["node_type"] == "group"
220 evolved_id = evolved["group_id"]
221 assert set(evolved["member_spell_ids"]) == {intake, ledger}
222 assert evolved_id != group_id, "a different roster is a different id"
223 print(" recompose(remove=[report]) ->", evolved_id[:14], "...")
224 print(" intake and ledger were never mentioned and were RETAINED")
225
226 # AND THIS IS WHERE THE KIND-AWARE DIFF DEFAULT SHOWS ITS OTHER HALF.
227 # Expert 30 met `research_diff` on two SPELLS, where the room pins
228 # `structural` for you. Hand it two COMPOSITIONS and it pins nothing -
229 # it stands back and lets the engine's own `members` default answer,
230 # because the useful question about two subsystems is which MEMBERS
231 # changed, not how their text differs.
232 _show("diff(compositions)",
233 commands.research_diff(group_id, evolved_id))
234 _show("group_diff(explicit)",
235 commands.research_group_diff(group_id, evolved_id))
236 print(" same verb as expert 30, different vocabulary - chosen by KIND")
237 print(" `members` answers added/removed plus lane-evidenced version")
238 print(" moves; each moved pair descends into the spell grains on your")
239 print(" NEXT call, so the subsystem answer stays a subsystem answer")
240
241 print()
242 print("a composition is INFORMATIONAL - it pins members by reference,")
243 print("carries no custody of its own, gates nothing and never executes")
244 print("which is exactly why asking it these questions is cheap")
245
246
247if __name__ == "__main__":
248 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.