Repository navigation
Bind pure-Go actionpack into rbgo (ActionController + ActionDispatch) - #196
Closed
tannevaled wants to merge 1 commit into
Closed
tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
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>
Contributor
Author
|
Superseded by the wave-2 consolidation PR (single merge onto main; shared builtins/require/object_model/vm/arith/digest_bind). Work preserved verbatim; branch kept for reference. |
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.
Binds 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"resolve with no.rbfile. Pinned at@main(8ba13fb).The four subpackages
ActionDispatch::Routing::RouteSet+Mapper— thedrawDSL (get/post/put/patch/delete/match,resources/resource,root,namespace/scope,member/collection,constraints, all option keys incl.to:/as:/via:/on:/constraints:/defaults:), plusrecognize/path/path_args/url_forreverse routingActionController::Base(overAbstractController::Base+ActionController::Metal) —before_action/after_action/around_action(withonly:/except:/if:/unless:),rescue_from,render/redirect_to/head, andPostsController.dispatch(action, env)ActionController::Parameters—permit/require/[]/to_h/to_unsafe_h/mergestrong-parameters, withParameterMissing/UnpermittedParameters/UnfilteredParameterserrorsActionDispatch::Request/Responseover the bound go-ruby-rackSeam wiring
Every seam runs inline on the VM goroutine under the GVL:
def index; …; end) is sent to the controller instance; an unmapped action returnsAbstractController::ActionNotFound.yieldruns the rest of the chain.rendermessage to an ActionView-style context object set withview_context— so the consolidated binary dispatches to the bound actionview at the Ruby level; actionpack itself does not import actionview. In this clone (no actionview present) the seam is tested with an injected Ruby renderer stub (aStub.newresponding to#render).A controller instance is a plain
RObjectof the user's subclass whose live*controller.Baseis reached through an@__achandle (mirroring the ActionCable channel binding), so a barerenderinsidedef indexresolves to the inherited native method that writes into that request's response. The routing/dispatch/params value objects each carry their Ruby class forclassOf.Registration
registerActionPackjoins the bootstrap afterregisterRack/registerActionCable;providedFeaturesgainsaction_controller/action_dispatch/actionpack/abstract_controller;classOfgains theRouteSet/Mapper/Parameters/Request/Responsecases.Verification
actionpack*.go): routing recognize/resources + reverse-routing error paths, filters +rescue_from(match/miss/inherited/with:), strong-params permit/require raise paths, the RunAction/around/rescue/Renderer seams (string + non-string render), double-render, missing action.internal/vm+internal/objectsuites green;gofmt -lempty;go vetclean.Deps: go-ruby-activesupport + go-ruby-rack (both already bound). CGO=0, GOWORK=off, go 1.26.4, BSD-3-Clause.
🤖 Generated with Claude Code