Repository navigation
fix: hold nested self writes to the module ownership rule (#625) - #628
Merged
Merged
Conversation
Contributor
Author
|
Auto-normalized PR title: rewrote PR title to match the highest-priority commit type (
If this isn't what you want, edit the title — the normalizer won't re-fire as long as the title stays conventional. |
This was referenced Oct 18, 2026
Shinrai
force-pushed
the
fix/nested-self-assign-ownership
branch
from
October 18, 2026 22:30
9b69534 to
8122c3c
Compare
This was referenced Oct 19, 2026
) A top-level `self.X = …` is refused outside the writing module's mount point, but a write below it (`self.X.Y = …`) reaches the wrapper at `self.X` and landed unchecked: a module could replace another module's member or plant new code under its mount point. The ownership check now lives in ApiManager#assertOwnedWrite and runs for the top-level write and for assignment, defineProperty and delete on any wrapper node, against the member's full api path. Host code, base-module code, modules sharing a mount point, symbol keys and the framework's own build keep their existing freedom. A module's own api.add / remove / reload runs as a framework mutation for that module, so the framework's writes on its behalf are not taken for the module's.
…red nested nodes under the ownership rule (#625) A module's own code running while an api.add or remove it started is still in flight, a second call of the same leaf, and another module writing while the host runs an api.add are all checked. Setting the prototype of, sealing, or freezing another module's node is refused with no change made, and a write through a nested node a module captured, made later with no active context, is refused as the top-level one is. The framework's own add, reload, remove, and routine stack installs a module starts below another module's mount point keep working.
…ites (#625) The exemption for a module's api.add / remove / reload was a per-leaf count held until the operation settled, and the build marker exempted every module for as long as any build ran. Both let module code through: the caller's own code after a non-awaited add, a second call of the same leaf, and any other module writing while the host built. The framework now marks each write it makes for the node it writes, for that write's synchronous extent only, in both runtimes. Mounting, removal, rebuild, array integrity sync, and routine stack installs go through it; nothing a module runs meanwhile can see it. Setting a node's prototype and making it non-extensible are held to the same rule as writing its members, checked before anything changes, so a refused freeze or seal leaves the node as it was.
…dule is executing (#625) A write through self with no module executing throws RUNTIME_NO_ACTIVE_CONTEXT_SELF, but a node a module read through self and wrote into later, outside any call, reached the node with no caller, which is the host's standing, so it landed. A node read through self is now a view of it: reads, calls, and enumeration behave as on the node, and nodes read through it come back as views. A write, definition, deletion, prototype change, or seal through it is refused while no module is executing, and otherwise reaches the node, whose own ownership rule decides. Storing a view stores the node, and the host's api nodes are untouched. One view per node keeps repeated reads identical.
…ost run/scope writes, unattributable live writes (#625)
…wnership, view descriptors and returns, refuse unattributable live writes (#625) - One view per (node, reader). With no module executing and outside a host-opened run()/scope(), a write through the view goes through only under a path the reading module owns (host reader owns all, unattributable reader owns none). A module's own node stays writable from a callback it hands out. - The view gains getOwnPropertyDescriptor/ownKeys traps, views what a call returns (also once a plain promise settles), and passes itself as the receiver, so the raw node no longer leaks through descriptors or `this`. - A host run()/scope() callback writing through self below the top level is the host's, as at the top. - runtime_assertOwnedWrite refuses with LOOSE_SET_UNATTRIBUTED when the live runtime cannot attribute the code, instead of falling back to the store's last-entered caller. - ApiManager.ownsPath: the non-throwing ownership check assertOwnedWrite now uses.
… receivers held to the caller, removed and restarted readers own nothing (#625)
…ws and live-identity receivers for the caller, keep views across restart, and give a module no longer mounted no ownership (#625)
…caller passed them, and what it keeps or returns stays held to the caller (#625)
… was read from, pass arguments and steered receivers as given, and document the reload ownership window (#625)
…ycle impl and diag hand it views, never another module's node (#625)
…s hooks, lifecycle subscribers and diag calls its own views instead of the api's nodes (#625)
…nd a frozen unloaded node, behave as in eager mode (#625)
…s to in lazy mode, and close an unloaded node with the prototype it reports (#625)
Brings in #656 (#655) and #666 (#661). Two adjustments where the merged code meets: - runtime_isConstructor asks through a proxy whose construct trap answers, so a class (whose prototype is fixed) is a constructor again and nothing of the function is read; #625's own copy of the function is dropped. - A self view over a module's captured view stands over that view's shadow and forwards every trap to it, so the engine's invariant checks never ask the captured view for a fixed member its reader may not read.
…625) A member a node holds fixed (an element of a frozen array, a member of a frozen node) is handed out exactly as the node holds it, so the view a module read it through never saw a later change made through it. A view of such a member now holds a change made with no standing of its own to the module that read it, as the module's view of any other member does. - Captured views refuse such a change outside what their reader owns. - With permissions or capture off, a module's view of a node works through a view that only applies that rule; storing it stores the node itself. - A closed node lists its keys for a reader denied one of its members. - The framework's own integrity step on a frozen array is exempt while the node is built, so module code can mount a module that exports one.
…625) A view of a member a node holds fixed reaches module code with no view of `self` over it. It now hands out every node it reads as a view of the same kind, and what a call through it returns as the caller's view, as a call through `self` does, so the ownership rule follows the value down.
This was referenced Oct 26, 2026
…ons are on (#625) Ownership is still recorded for every path, but a module is refused a write because of it only while the permission system is on. With no permissions configured, a module writes anywhere, as before. Tests that pinned a refusal with permissions off now either run with permissions on (where the refusal is the point) or assert that the write lands.
… keep a module's view holding across a toggle, and keep the permission namespace and reserved names (#625) A member a module places through the api a framework payload hands it is recorded as that module's whether or not permissions are on, so enabling the system later holds it to the module's ownership. A module's view of a node is built the same way whether permissions are on or off, and asks at each change whether ownership applies, so a view read while the system was off holds once it is enabled. With permissions off, module code still never changes the permission system's own namespace, so it cannot drop rules the host registers before enabling the system, and slothlet, shutdown and destroy are refused when defined or deleted through self, as when assigned. Freezing a view of a lazy node not loaded yet now fixes the view's own inspect hook instead of failing.
…e an isolated scope, and refuse unattributed changes through a module's api with permissions off (#625) Inside a full-isolation scope, module code now reads the framework namespace through the same view as outside it, over the scope's own copy, so a function kept from it still runs as the module and the permission namespace stays out of reach. Assigning slothlet, shutdown or destroy through a scope's self is refused as outside one. With permissions off, a change the live runtime cannot attribute, made through the api a module is handed, is refused as it is through self, rather than recorded as the host's.
…it is reached, and keep an isolated scope's writes and views to the scope (#625) The permission system's namespace and every member of it are now known by identity, through the framework's own route proxies too, so module code cannot change it after storing it under another member of the namespace and reaching it there. Inside an isolated scope, a member's descriptor hands out the scope's own copy, so a write through it stays in the scope, and the scope's views of self refuse to be closed rather than breaking.
…here it is held, whatever reached it (#625) A change to the permission system's namespace is now refused on the route proxies the framework serves it through, so module code reaching the raw namespace as `this` of a function or getter it placed on self.slothlet is refused like any other. A member that merely holds a reference to the namespace is no longer kept from being replaced or deleted. The docs note the limits of a full-isolation scope (#674).
…amework namespace the module's view as this (#625) A function called through a module's view of the framework namespace now gets the receiver it was called on, the view, and a getter read through it runs with the view as this. Kept and used later, outside any call, it still acts as the module, so it cannot change the permission namespace or turn the system off. The permission namespace is recognised as the framework's own member, not by route, so a module's own symbol-keyed object may hold a member named permissions.
… as that module, and call hook handlers with no receiver (#625) A function or accessor module code places on the framework namespace now runs as that module whoever calls it, the host included, with the module's view of what it is called on as this, so it is never handed the host's namespace. Module code no longer changes the prototype of the framework's own objects. Hook handlers are called as plain functions, so a handler is never handed its own registration. The permission namespace is again recognised by identity only, and symbol-keyed changes are judged by the member they are made on.
…eeping the framework namespace from module code unless disabled (#625) The permission system now has three modes, set with `permissions.mode`: "on" applies every rule; "off", the default with no permissions config (and what `enabled: false` and `control.disable()` mean), evaluates no rule and refuses no write on ownership, but still keeps module code from changing the framework's own namespace, root functions, and keys on api nodes; "disabled" checks nothing. `control.mode` reports the mode. Calls behave in "off" as they did with the system off before. With the namespace kept from module code in "off", the identity tracking and wrapping of what a module placed on it are no longer needed, and are removed.
… path, keep the host's mode across a reload, and keep framework keys from a kept view while off (#625) Whether a write is the framework's own is now decided from the path's first and last segments, so a write in "off" costs no more than with the system disabled and nothing is cached per path. A mode the host switched to with control.enable() / control.disable() holds across reload(). A framework key on a node changed through a module's view kept and used later is refused while the system is off, as through a direct write. The permission docs describe what "off" and "disabled" still evaluate.
Shinrai
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
selfassignments skip the ownership check #625) (fe8e8cf)🐛 Bug Fixes
selfassignments skip the ownership check #625) (bd4da73)selfassignments skip the ownership check #625) (25de06c)selfassignments skip the ownership check #625) (338fc44)selfassignments skip the ownership check #625) (f62cb17)selfassignments skip the ownership check #625) (53f985c)selfassignments skip the ownership check #625) (60cd545)selfassignments skip the ownership check #625) (66dca87)selfassignments skip the ownership check #625) (dab2e9d)selfassignments skip the ownership check #625) (94cbc37)selfassignments skip the ownership check #625) (3a8da22)selfassignments skip the ownership check #625) (a0da303)selfassignments skip the ownership check #625) (8152a9c)selfassignments skip the ownership check #625) (088b4bb)selfassignments skip the ownership check #625) (f0895c2)selfassignments skip the ownership check #625) (b7deacd)selfassignments skip the ownership check #625) (4f4486c)selfassignments skip the ownership check #625) (7ac7b5c)selfassignments skip the ownership check #625) (d407404)selfassignments skip the ownership check #625) (2eee6e4)selfassignments skip the ownership check #625) (0ffe312)selfassignments skip the ownership check #625) (2323843)selfassignments skip the ownership check #625) (917e86d)selfassignments skip the ownership check #625) (b0da8cd)selfassignments skip the ownership check #625) (98a79bc)selfassignments skip the ownership check #625) (7eb28da)selfassignments skip the ownership check #625) (49ccd62)selfassignments skip the ownership check #625) (481de7a)selfassignments skip the ownership check #625) (f5deb7c)selfassignments skip the ownership check #625) (4388eb6)selfassignments skip the ownership check #625) (7116565)selfassignments skip the ownership check #625) (1a8e101)selfassignments skip the ownership check #625) (1bd1628)selfassignments skip the ownership check #625) (38a6d37)selfassignments skip the ownership check #625) (52f8da6)selfassignments skip the ownership check #625) (0653fd9)selfassignments skip the ownership check #625) (1760812)selfassignments skip the ownership check #625) (76c9b0b)selfassignments skip the ownership check #625) (8368e5f)selfassignments skip the ownership check #625) (4ff890f)selfassignments skip the ownership check #625) (05e4631)selfassignments skip the ownership check #625) (8e45668)selfassignments skip the ownership check #625) (de05723)selfassignments skip the ownership check #625) (1bc6608)selfassignments skip the ownership check #625) (8f72b28)selfassignments skip the ownership check #625) (d21f9c0)selfassignments skip the ownership check #625) (64b9ba9)selfassignments skip the ownership check #625) (33b0827)selfassignments skip the ownership check #625) (7795173)selfassignments skip the ownership check #625) (977fc39)📦 Dependencies
No dependency updates
🔧 Other Changes
selfassignments skip the ownership check #625) (bd4912c)selfassignments skip the ownership check #625) (0ccc36a)selfassignments skip the ownership check #625) (4c24d3c)selfassignments skip the ownership check #625) (65a7819)selfassignments skip the ownership check #625) (586e5cb)selfassignments skip the ownership check #625) (8956935)selfassignments skip the ownership check #625) (674ca50)selfassignments skip the ownership check #625) (1569723)selfassignments skip the ownership check #625) (cecf73d)selfassignments skip the ownership check #625) (4c3be97)selfassignments skip the ownership check #625) (a8fa231)selfassignments skip the ownership check #625) (f535d57)selfassignments skip the ownership check #625) (5480831)selfassignments skip the ownership check #625) (33709d5)selfassignments skip the ownership check #625) (30ed480)selfassignments skip the ownership check #625) (c2e079f)selfassignments skip the ownership check #625) (0be5171)selfassignments skip the ownership check #625) (2f855de)selfassignments skip the ownership check #625) (35a6daa)selfassignments skip the ownership check #625) (e2ebee3)selfassignments skip the ownership check #625) (05b9a58)selfassignments skip the ownership check #625) (9241f22)selfassignments skip the ownership check #625) (d1977bd)selfassignments skip the ownership check #625) (8edf1c7)selfassignments skip the ownership check #625) (b8fb765)selfassignments skip the ownership check #625) (08e0ff7)selfassignments skip the ownership check #625) (2dc78ae)selfassignments skip the ownership check #625) (ffe2f01)selfassignments skip the ownership check #625) (41f0fd3)selfassignments skip the ownership check #625) (a1228a9)selfassignments skip the ownership check #625) (f9dd6bb)selfassignments skip the ownership check #625) (215ae6f)selfassignments skip the ownership check #625) (411bb9c)selfassignments skip the ownership check #625) (a9116fe)selfassignments skip the ownership check #625) (2e085b2)selfassignments skip the ownership check #625) (bdaf3b9)selfassignments skip the ownership check #625) (5dd5a82)selfassignments skip the ownership check #625) (5444188)selfassignments skip the ownership check #625) (39028c8)selfassignments skip the ownership check #625) (7161d2b)selfassignments skip the ownership check #625) (2c19826)selfassignments skip the ownership check #625) (7e89472)selfassignments skip the ownership check #625) (8ed9c20)selfassignments skip the ownership check #625) (f04ca1b)selfassignments skip the ownership check #625) (bf0fc51)selfassignments skip the ownership check #625) (7da848d)selfassignments skip the ownership check #625) (66dd8af)selfassignments skip the ownership check #625) (48f4975)selfassignments skip the ownership check #625) (1e31f49)selfassignments skip the ownership check #625) (5ab16c1)selfassignments skip the ownership check #625) (022ba2b)selfassignments skip the ownership check #625) (dfa47f3)selfassignments skip the ownership check #625) (fc138b1)selfassignments skip the ownership check #625) (b0a7c96)selfassignments skip the ownership check #625) (89c246d)selfassignments skip the ownership check #625) (7ce8ac8)selfassignments skip the ownership check #625) (2e9b825)selfassignments skip the ownership check #625) (1827553)selfassignments skip the ownership check #625) (6cf9776)selfassignments skip the ownership check #625) (620de51)selfassignments skip the ownership check #625) (542668f)selfassignments skip the ownership check #625) (5a12326)selfassignments skip the ownership check #625) (061cada)selfassignments skip the ownership check #625) (26be735)selfassignments skip the ownership check #625) (f85e860)selfassignments skip the ownership check #625) (a5ccd38)selfassignments skip the ownership check #625) (b947794)selfassignments skip the ownership check #625) (19e1f4d)selfassignments skip the ownership check #625) (45bd357)selfassignments skip the ownership check #625) (5f29add)selfassignments skip the ownership check #625) (cdfb48f)selfassignments skip the ownership check #625) (0f2868e)selfassignments skip the ownership check #625) (5400682)selfassignments skip the ownership check #625) (3043457)selfassignments skip the ownership check #625) (1609ef8)selfassignments skip the ownership check #625) (f9bd044)selfassignments skip the ownership check #625) (1d78c3e)👥 Contributors