Repository navigation
refactor: page prop, Page event and page method registries (WP-00 R4) - #74
Merged
Merged
Conversation
Pin, for every built-in page prop key and every entry point that assigns one (set_view_props, which the DSL's page(...) calls, the public setters, the method_missing setter and update(:page, ...)), whether it lands on the Page control, on the implicit View, or on both; that dialog slots are not props; where page.on_x = and page.on(:x) put event subscription flags and how they clear; and the exact invoke_control_method payloads (control, name, args, timeout) of get_device_info, get_device_info_sync, set_allowed_device_orientations, the drawer methods and scroll_to. These pass on the current hard-coded tables; the appendable registries that replace them must keep them green.
WP-00 R4. Three Page decisions were hard-coded in page.rb, so every feature that adds a page prop (RT-02), a Page event (RT-01, RT-32) or a page method (RT-04, the image-cache methods) would edit the same lines. Ruflet::Page::Registry now holds them as appendable tables: * register_prop(key, view: false): the prop travels on the Page control's patch (view: true also mirrors it on the page View). assign_split_prop, the one routing point for page.x =, set_view_props / the DSL's page(...) and update(:page, ...), reads it instead of PAGE_PROP_KEYS and the inline vertical_alignment/horizontal_alignment/scroll check. * register_event(name): Page#on subscribes the Page control (on_<name>: true, cleared by on without a block). View events keep their View flag. * register_method(name, target:): the control a Page method invokes (:page, :top_view, :root_view). get_device_info(_sync), set_allowed_device_orientations, the drawer methods and scroll_to dispatch through it. page.rb seeds the tables with exactly what it handled before: the PAGE_PROP_KEYS constant (unchanged, still frozen) with the three View-mirrored keys, no Page#on event, and the seven methods with their targets. Lookups match keys exactly, as the old include? did. Nothing changes until a feature registers an entry. mruby-safe (checked with the embedded VM's mruby 3.4).
This was referenced Nov 8, 2026
refactor: dispatch Page invoke methods through a handler table (WP-00 R4)
AdamMusa/ruflet-engine#103
Merged
This was referenced Nov 17, 2026
With only the implicit View, the top and root View are both control 20, so retargeting close_drawer to :root_view or scroll_to to :top_view passed every base-passing pin test; only the seed snapshot caught it. Two explicit Views tell them apart: drawers go to the top (last) View, scroll_to to the root (first) View, get_device_info to the Page. The test passes on main's pre-refactor page.rb as well.
prop_target and event? matched the name exactly, while method_target and every register_* call took a String or a Symbol, so Registry.event?(:resize) was false right after register_event(:resize). The three lookups now all take a String or a Symbol (to_s). Page's own lookups are unchanged: assign_split_prop always gets the String key from normalize_props or method_missing, and Page#on passes the String event name.
AdamMusa
added a commit
that referenced
this pull request
Nov 20, 2026
#75 split build_command.rb into cli/build/ modules and turned prepare_flutter_client's steps into registered contributors. The seam is carried into that layout: - build_command.rb requires client_bootstrap and includes ClientBootstrap next to FlutterSdk, as before. - The write_client_bootstrap call, which ran right after the extension selection was applied and verified, is now the startup_hooks contributor (cli/build/contributors/startup_hooks.rb), registered after :extensions, so it still runs at that point, before assets and before Flutter. - build_contributors_test pins startup_hooks in that place in BUILT_IN and checks that the contributor passes the build on and always continues.
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.
WP-00 R4, the Ruby half. The engine half is AdamMusa/ruflet-engine#103.
Three Page decisions were hard-coded in
page.rb. They now live in appendable tables inRuflet::Page::Registry(new filepage_registry.rb), andpage.rbseeds each table with exactly what it handled before:register_prop(key, view: false)assign_split_prop, which handlespage.x =,set_view_props(and so the DSL'spage(...)) andupdate(:page, ...)PAGE_PROP_KEYS;vertical_alignment,horizontal_alignmentandscrollalso go on the Viewregister_event(name)Page#on: a registered event getson_<name>: trueon the Page, andonwithout a block sets it tonilPage#onflags View events onlyregister_method(name, target: :page | :top_view | :root_view)invoke_page_methodprop_target,event?andmethod_targetaccept a String or a Symbol.ArgumentError: conflicting options, anon_*or dialog-slot prop key, an empty name, and an unknown target.PAGE_PROP_KEYSandDIALOG_PROP_KEYSkeep their values and stay frozen.Later packages register entries here instead of editing
page.rb: RT-01, RT-02, RT-04, RT-32 and WP-18.Behavior changes
None. The only new public name is the constant
Ruflet::Page::Registry.Changes since the Nov 8 review
main(fix: keep helpers added after v0.0.23 off Kernel #67 and the final test: CLI and page compatibility goldens (WP-00 H1) #73) with a merge commit. There were no conflicts.test_page_methods_on_explicit_views_invoke_the_top_and_root_view, using two explicit Views. Drawers must go to the top View,scroll_toto the root View, andget_device_infoto the Page. It also passes against main's pre-refactorpage.rb.prop_targetandevent?now accept a Symbol, asmethod_targetand everyregister_*already did. Page's own routing is unchanged, because Page always passes a String:normalize_propsandmethod_missingproduce String keys, andPage#onpasses a String event name.Proof (head
6ae4f5ef)H1 goldens:
cd packages/ruflet && ruby test/compat/compat.rb --jobs 8checks 234 goldens and exits 0, on Ruby 4.0.5 and on 3.4.5.Suites: every test file in its own process, as CI runs them (
cd packages/<pkg> && ruby -Ilib -Itest test/<file>), across ruflet, ruflet_core, ruflet_server, ruflet_rails and ruflet_record.compat_goldens_test.rb(242 runs) andpage_registries_test.rb(13 runs).RUFLET_ENGINE_ROOT.Planted bugs: each one was planted alone in a copy of this head. Every plant changed 0 of the 234 goldens, because the fixtures never route a prop through the table (as found on Nov 8). The tests caught every plant:
theme_modefrom the seedtitlefrom the seedscrollon the Viewclose_drawer→:root_viewscroll_to→:top_viewPage#onflags every Page eventget_device_info→:top_viewonwithout a block keeps the flagprop_targetexact againmruby:
page_registry.rbrun on the embedded VM's mruby 3.4 (host_vm) gives the same output as CRuby for lookups, Symbol lookups and every validation error.Other open PRs:
git merge-treereports no conflicts with any other open PR (fix: report hot reload readiness for apps that start the server directly #70, fix: read client-synced control state like event.control.value #71, refactor: split build_command.rb into cli/build modules (WP-00 R1) #75–CLI: cover every command and option, fix what the tests exposed #84, Test every control, service and shipped extension against its wire contract #86–ruflet_record: fix six bugs the coverage tests exposed; test the untested public API #90).CI on
6ae4f5ef: every check passes. In thepull_requestrun, the Linux Explorer job hung for 30 minutes at "Install Linux desktop dependencies", so it was cancelled and re-run once, and then it passed. The same job in thepushrun passed on the first attempt.Carried over from Nov 8, not re-run: all 183 doc examples gave byte-identical output, and a Page smoke run on a full-framework VM gave identical output.
Notes
ruflet-frameworkmrbgem picks uppage_registry.rbbecause it globs every lib file. Therequire_relativeonly makes sure it loads beforepage.rb.Registrywould shadow a top-level::Registryreferenced inside a subclass or reopening ofRuflet::Page. Nothing in the code, the docs or the doc snippets does that.