Repository navigation
Realm production A2a: Set bucket contract, array element storage, realm-diff gate - #13793
Merged
Merged
Conversation
added 7 commits
November 2, 2026 22:23
None until the insertion that crosses SMALL_SET_SCAN_MAX, then the index built from the insertions in order. The runtime's threshold crossing and the realm image's Set emitter both call it.
…ertions The generated test every_image_set_index_equals_the_runtime_add_path fills an empty Set through js_set_add for every Set declaration with Set storage and compares it with from_insertions bucket for bucket, live and occupied counts included. Compaction keeps its own sizing.
The emitter no longer sizes a Set index itself.
Fails by name on a cell with no owner or with two.
The producer writes the elements of every static array birth (the elements_source arrays and the util.inspect.colors pairs) as storage of kind array; the holder keeps length and its named properties. The array emitter reads elements only from storage, and an index key among the holder's properties is an error.
Since #13666 a null [[Prototype]] is the shape's identity, not header bit 0x40; the derivation emits no such bit and three producer tests still pinned it. They now assert the birth facts: null_prototype and the absent prototype with the header word of the ordinary birth of the same members, callable as the layout's header bit, the frozen word from the ABI constants. The GcHeader bit table lists bit 6 as free.
PERRY_REALM_REACH_NAMES is a test-only compiler-driver input (keyed by path in compile_env): R becomes the file's names with top dropped, closed under the birth relation, and the driver prints the file it used. scripts/realm_diff_gate.py compares the realm dumper with main's checked-in dumps in realm-dumps/, byte for byte: plainly built (full) and restricted to the reach of hello, lad-04-classes and lad-07-json, asserting the input took effect. A names file next to the dumper limits the roots it walks. References change only through --regenerate on main. The restricted mode does not pass yet: the dumper's own imports birth layouts outside the witness R, so it is not wired into CI in this commit.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Part of the realm production switch (DESIGN §3.2). This PR (A2a) carries items 2, 3 (storage half) and 4's gate script, references and test-only
input. Items 1 (owners), 3 (member order), the R-restricted mode and the CI step follow in A2b (its design is
settled; the build phases run on the same branch and open their own PR).
Item 1: every native cell has exactly one owner
Placeholder: the WRT3p-A2-design phase settles the owner facts (every owner declared at the birth; the 20
unresolved
.defaultnamespaces root-caused) and the test definition. The owners test currently in this branch(
perry-runtime-manifest/src/realm_owners.rs) passes on the present facts and is rewritten by that phase.Item 2: one Set index sizing (
perry_abi::OwnedSetIndex::from_insertions)OwnedSetIndex::from_insertions(hashes)is the one place that sizes and fills a Set index:Noneuntil theinsertion that crosses
SMALL_SET_SCAN_MAX, then the index built from the insertions in order.set/index.rs::insert_value) builds through it over the live elements; therealm image's Set emitter (
realm_image/sets.rs) and the runtime build script call the same function.Compaction (
rebuild_index) is unchanged.every_image_set_index_equals_the_runtime_add_path: for every Set declaration with Set storage in themanifest, an empty Set filled through
js_set_addequalsfrom_insertionsbucket for bucket, live andoccupied counts included; a Set of at most 8 has no index. Sabotage (post-crossing slot + 1 in
from_insertions) fails it:node:process.allowedNodeEnvironmentFlags: buckets.Item 3 (storage): static array elements are array storage
RealmStorageFacts::Array { elements }(kind = "array"). The producer writes the elements of every staticarray birth there: the three
elements_sourcearrays (node:http.METHODS,node:module.builtinModules,node:module.Module.wrapper) and the 44util.inspect.colorspairs. The holder keepslengthand its namedproperties; its
own_key_orderlists those (index keys come first by the array own-keys rule).ArrayParts::from_cell) reads elements only from storage; an index key among the holder'sproperties is an error (a second home). Integrity stays in the header, as before.
properties into array storage with the same values in the same order (checked by script over the full
manifest); no declaration added or removed.
Item 3 (member order)
Placeholder: the WRT3p-A2-design phase decides the one home of native namespace member order (the
declaration;
module_keystables derived from it where the runtime reads them) and corrects DESIGN §3.2 item 7.Item 4: the realm-diff gate in CI
PERRY_REALM_REACH_NAMES=<names.json>: a test-only compiler-driver input, read once inrun_pipeline.rswhere reach is computed, inert when unset. It sets R to exactly the file's names, top dropped
(
RealmReach::restrict_to), then closes it under the birth relation, and prints[realm-reach-names] <path> <n>.scripts/realm_diff_gate.py: R-restricted mode forhello,lad-04-classes,lad-07-json(
realm-dumps/programs/): the witness's R must equal the checked-in<p>.names.json; the dumper(
scripts/realm_dump.ts) is compiled with the input and the gate asserts it took effect (the printed line namesthis file and count, and the dumper's R has no top reason and is exactly those names), so a dumper built
without it fails by construction. Given a
realm-dump.namesfile, the dumper walks only the roots in R; itsdump restricted to the names must equal
<p>.jsonl(main's full walk restricted to the same names). Fullmode: the dumper compiled plainly (R is top) must equal
full.jsonl. Every dump runs as/tmp/perry-realm-diff/realm-dumpin a fixed environment (execPath, argv and module paths are realm values).--self-testfeeds the plain dumper's compile log to the restricted check, which must refuse it.PERRY_REALM_REACH_NAMESis keyed incompile_env(by path); the gate compiles withPERRY_NO_CACHE=1.PERRY_RUNTIME_DIR=<main>/target/release python3 scripts/realm_diff_gate.py --perry <main perry> --regenerate./root/WRT/tmp/a2/ci-step.patch: "Realm diff (full and R-restricted, test-only PERRY_REALM_REACH_NAMES)" intest.yml, Linux, after "Realm link graph"). The dumper compiled with hello's R aborts at startup:Perry internal error: runtime layout EVENT_EMITTER_PROTOTYPE is born, but the program's realm does not reach it.Its own static imports (57
node:*namespaces) and intrinsic seeds need cells outside the witness's R. DESIGN§3.2 says R = the file's names united with the dumper's own named builtins, but a top program's scan is
closed to the whole catalog before the knob runs, so its own names are gone (
RealmReach::close). Decisionpending (see the report). Ruling (coordinator): (a). The compiler keeps a top program's own pre-closure
names; the test-only input unites the file's names with them before closure; the gate asserts that the dumper's R
is exactly that union, that no cell outside the union is born, and that the dump restricted to the file's names
equals the reference. It lands in A2b together with the CI step, before the owner changes it must guard.
its one home.
Verification
--features target-wasirealm_image+realm_planrealm_reachrestricting_drops_top_and_closes_the_given_names)set::,every_image_set,manifest_set), debug, 1 threadcompile_env(env audit)scripts/realm_*_tests.py--self-test--checkon touched filescargo checkof the 6 touched crates)PERRY_REALM_REACH_NAMES), head SHA,set.rsline numbers of main's findings, test timings, a UDP-peer test timing out identically in both.text/ binary.text+896 bytes (runtime Set threshold crossing throughfrom_insertions), binary -80 to -88 bytes; link padding convergedgit merge-tree --write-tree origin/main wrt3p(b585330)Failures that were main's
realm_source::birth::tests::null_births_and_runtime_objects_derive_their_storage_facts,realm_source::layout_birth::tests::prototype_layout_is_required_and_controls_null_and_callable_flags,realm_source::tests::frozen_tables_order_their_rows_and_index_keys_first) failed on main 61f513a (85/3 at3f65172, 88/0 at ffcd118) since fix(runtime): the shape is the one record of [[Prototype]] (null links, function links) #13666 (69bd0cf) made the shape the one record of
[[Prototype]]: thederivation rightly no longer emits header bit 0x40, the tests pinned it. They now assert the mechanism: a null
prototype is the birth's
null_prototypefact and the absent prototype, with the same header word as theordinary birth of the same members; callable is the layout's header bit; the frozen word is spelled from the
ABI constants. No producer path writes 0x40 (searched); the
gc/types.rsbit table still listed bit 6 asNULL_PROTO and now says it is free.
function_metadata::tests::layouts_and_native_identity_are_pinnedfailsidentically at 3f65172, ffcd118 and 61f513a (stale pin after the DCE layer-0 commit 1dde139); fixed by
test(abi): the FunctionMetadataOwner pin follows the DCE layer-0 layout (count 0, flags 4, state 8, bounds 16) #13786.