Repository navigation
feat(vm): bind batch 4 wave 2 — actionview/actionpack/actionmailer/rails - #197
Merged
Merged
Conversation
Layer github.com/go-ruby-rails/rails onto the railties binding already in place. The `rails` gem ships almost no code of its own: it ties the framework components together and vends the top-level Rails module. This extends the Rails module registerRailties created (never recreating it) with: - The singleton accessors: Rails.application / application=, env / env=, root, public_path, configuration, autoloaders, logger / logger=, cache / cache=, groups, version / gem_version, backtrace_cleaner, error. - Rails::VERSION (STRING/MAJOR/MINOR/TINY/PRE; targets 8.1.3) and Rails::EnvironmentInquirer (< Rails::StringInquirer) so Rails.env.production? and Rails.env.local? read naturally. - require "rails/all", wired as a feature hook that triggers a require of every shipped (Available) catalog component whose feature the VM provides. Application state (root/public_path/configuration/autoloaders/cache) delegates to the meta-gem, which resolves it against the bound railties Application through its App seam, bridged by railsAppAdapter. Rails.application keeps returning the Ruby Application wrapper (*RailsAppVal) Ruby registered. RailsEnvVal is added to classOf and to hasCustomEq (so `Rails.env == "production"` dispatches the wrapper's == rather than pointer identity). "rails/all" is added to providedFeatures; "rails" stays owned by railties. 100% coverage of the new files; full internal/vm + internal/object suites green; gofmt/vet clean; builds on all six 64-bit Linux arches. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `require "action_mailer"` support backed by github.com/go-ruby-actionmailer/actionmailer, so mailer classes compose and deliver mail with no .rb file, mirroring the existing Mail / ActiveJob bindings. Surface (ActionMailer::Base subclass model): - class DSL: `default`, `delivery_method=`/`delivery_method`, `perform_deliveries=`, `raise_delivery_errors=`, `register_interceptor`, `register_observer`, the shared `deliveries` sink and the `renderer=`/ `enqueuer=` injection points; - each mailer action method (`def welcome`) becomes a class method via the method_added hook, returning an ActionMailer::MessageDelivery (`deliver_now` / `deliver` / `deliver_later` / `message`); - the mailer instance surface a `def welcome` body runs against: `mail(...)`, `attachments` (regular + `attachments.inline`) and `headers(hash)`. Four Ruby-dispatch seams, all run INLINE under the GVL: - Action: the mailer method body is sent to a freshly allocated mailer instance bound to the library *Mailer; a raise maps to an error the delivery proxy re-raises faithfully; - RenderBody: body rendering sends #render to the configured Ruby renderer (Action View in the consolidated binary; a stub in tests); a nil renderer or nil result skips the format; - DeliveryMethod: defaults to the :test method (append to ActionMailer::Base.deliveries); a #deliver object plugs in a custom transport; - EnqueueJob: deliver_later sends #enqueue to the configured Ruby enqueuer (Active Job in the consolidated binary; a stub in tests), else runs inline. 100% coverage of the new files (compose/alternative/related/mixed, attachments, interceptors/observers, deliver_now/later, delivery-error raise paths, all seams via injected stubs). gofmt + go vet clean; builds on all six 64-bit arches. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bind github.com/go-ruby-actionview/actionview as a native module so
`require "action_view"` works with no .rb file. ActionView::Base is the
view context exposing the pure tag/url/form/text/number helpers
(delegating to the library package functions) alongside the stateful
helpers (button_to, form_tag, form_with, current_page?, render) that
build a fresh library Context per call from the instance configuration.
Surface bound:
- ActiveSupport::SafeBuffer (+ ActionView::OutputBuffer alias) with
escape-on-concat << / concat / safe_concat / + and String#html_safe;
- tag helpers content_tag/tag/token_list/class_names/cdata_section;
- url helpers link_to/mail_to/button_to/current_page?/url_for;
- form_tag-family inputs, select_tag, submit/button, options_for_select,
form_tag, and form_with yielding an ActionView::Helpers::FormBuilder;
- text helpers truncate/pluralize/simple_format/word_wrap/highlight/
excerpt and the eight NumberHelper formatters;
- ActionView::PartialIteration for collection partials.
Seams: URLFor (routes) wires to a Ruby url_for= callable, else the
identity/path default; RenderTemplate wires to a Ruby render_template=
callable, else an inline-ERB default that evaluates the template through
the already-bound go-ruby-erb compiler so <%= %> runs Ruby against the
view context (binding-scoped locals + @Ivars via the ivarTable seam).
#render stays an ordinary dispatchable method so a later actionpack/
actionmailer binding renders a view by sending :render to a Base.
100% coverage of the new files; full internal/vm + internal/object
suites green; gofmt/vet clean; builds on all six 64-bit arches and under
the closed-world build tag.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bind github.com/go-ruby-actionpack/actionpack — a pure-Go (CGO=0) port of
Rails' Action Pack — into rbgo as a native module set, so `require
"action_controller"` / `require "action_dispatch"` work with no .rb file.
The four subpackages are wired across five files:
- routing: ActionDispatch::Routing::RouteSet + Mapper — the routes `draw`
DSL (verb matchers, resources/resource, root, namespace/scope,
member/collection, constraints, all option keys) plus recognize / path /
path_args / url_for reverse routing.
- controller: ActionController::Base (over AbstractController::Base +
ActionController::Metal) — before/after/around filters (only/except/if/
unless), rescue_from, render/redirect_to/head, and PostsController.dispatch.
- parameters: ActionController::Parameters — permit/require/[]/to_h/merge
strong-parameters, with the ParameterMissing/UnpermittedParameters/
UnfilteredParameters errors.
- dispatch: ActionDispatch::Request / Response over the bound go-ruby-rack.
Every seam runs inline on the VM goroutine under the GVL: the Ruby action
method (RunAction), the filter/rescue bodies (blocks or named methods), and
the view render — the Renderer seam sends a `render` message to an
ActionView-style context set with `view_context`, so the consolidated binary
dispatches to the bound actionview while this clone tests it with an injected
Ruby renderer stub. A controller instance is a plain RObject of the user's
subclass whose live *controller.Base is reached through the @__ac handle
(mirroring the ActionCable channel binding); the routing/dispatch/params value
objects each carry their Ruby class for classOf. actionpack does not import
actionview — rendering is the seam above.
registerActionPack joins the bootstrap after registerRack/registerActionCable;
providedFeatures gains action_controller/action_dispatch/actionpack/
abstract_controller; classOf gains the RouteSet/Mapper/Parameters/Request/
Response cases.
100% coverage of all new files (routing recognize/resources + reverse-routing
error paths, filters/rescue_from, strong-params permit/require raise paths,
the RunAction/around/rescue/Renderer seams, double-render), full internal/vm +
internal/object suites green, gofmt/go vet clean, builds on all 6 64-bit
arches (amd64/arm64/riscv64/loong64/ppc64le/s390x).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…bind-wave2 # Conflicts: # go.mod # go.sum # internal/vm/require.go
…t/bind-wave2 # Conflicts: # go.mod # go.sum
… rails Consolidates the 4 render-coupled Rails bindings (each verified 100% cov + full suite + 6-arch on its own branch before consolidation): - action_view — Base view context (tag/url/form/text/number helpers + FormBuilder + PartialIteration) + ActiveSupport::SafeBuffer; RenderTemplate seam defaults to inline ERB via go-ruby-erb, #render kept dispatchable - action_controller/action_dispatch (actionpack) — RouteSet/Mapper DSL + recognize/url_for, ActionController::Base filters/rescue_from/render/redirect, strong Parameters, Request/Response; Renderer seam dispatches ActionView at the Ruby level - action_mailer — Base subclass DSL + MessageDelivery proxy + mail/attachments; RenderBody->ActionView, EnqueueJob->ActiveJob via injectable renderer=/enqueuer= seams, :test delivery default - rails (meta) — extends railties' Rails module with top-level accessors (Rails.application/env/root/…), Rails::VERSION, EnvironmentInquirer, and a rails/all hook that requires the catalog's available components Merged on top of main's #192 (UDP/UNIX socket + server-side TLS). All seams run Ruby *Proc bodies inline on the VM goroutine under the GVL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Consolidates the 4 render-coupled Rails bindings (batch 4, wave 2) into one merge onto
main. Supersedes #195 (actionview), #196 (actionpack), #194 (actionmailer), #193 (rails). Rebased onto main's #192 (UDP/UNIX socket + server-side TLS), which merged after these branched.Bindings
action_viewActionView::Base+ helpers +FormBuilder+PartialIteration+ActiveSupport::SafeBufferaction_controller/action_dispatchRouteSet/Mapper,ActionController::Base,Parameters,Request/Responseaction_mailerActionMailer::Base+MessageDelivery+ attachmentsrails/rails/allRails.*accessors +VERSION+EnvironmentInquirer(extends railties'Rails)The render pipeline funnels through
ActionView::Base#render(dispatchable): actionpack'sRendererand actionmailer'sRenderBodydispatch it at the Ruby level, so the consolidated binary renders through the bound actionview.rails/allrequires the component catalog's available features.Verification (on the consolidated branch, real exit codes)
ok internal/vm 75.3s,ok internal/object.classOforphan scan clean;gofmt/go vetclean.This completes the Rails-core binding effort (batch 4 = 11 bindings across waves 1+2).
🤖 Generated with Claude Code