Skip to content

@blazetrails/actionpack ​

ActionController and ActionDispatch — mirroring Rails ActionPack

MeasureValue
Rails counterpartactionpack v8.0.5.2
API methods matched100% (2855 of 2855)
Rails tests matched100% (183 of 183) (1 permanent)
Ruby files ported141
Ruby files unported0
Measured atfe89b44726

Gaps by file ​

No gaps recorded for this package.

Missing methods ​

None recorded for this package.

Unported Ruby files ​

Every compared Ruby file has a TypeScript file.

Deviation receipts ​

JSDoc receipt tags in the package's source, by the receipt each carries.

TagPERMANENTCONVERGEABLEnone
@noRailsEquivalent3900
@missingRailsCall800
@missingRailsArgs800
@missingRailsName3200
@inventedArm4900
@inlinedFrom0016
@internal001001

Permanently skipped tests ​

Module#autoload is a build step (Zeitwerk::Loader#define_autoload) (4)
Method visibility is compile-time only (Module#private, basic_obj_respond_to's pub) (2)
A String has no encoding tag either (4)
Ruby pattern matching has no port (assert_pattern, deconstruct_keys) (1)

Ratified deviations ​

Each rule below is ratified in the repository's CLAUDE.md files. The first paragraph is quoted; the link opens the full section at this build's commit.

Method visibility is compile-time only (Module#private, basic_obj_respond_to's pub) ​

Ruby's basic_obj_respond_to (vendor/ruby/v3.3.11/vm_method.c:2864-2879) takes a pub flag and hands it to method_boundp (:1788-1818), so respond_to?(:m) and respond_to?(:m, true) can answer differently for the same receiver, and Kernel#public_send (vm_eval.c:1350) raises NoMethodError "private method '…' called for …" where send dispatches. Visibility is a property of the method entry, readable at run time.

CLAUDE.md →

A String has no encoding tag either ​

str.encoding, force_encoding and String#b read or change a per-object encoding. A JS string has none, and trails adds none: the carrier that would hold it is the carrier this section rejects. ruby-compat tags a Uint8Array only. A Rails body that branches on a String's encoding ports the UTF-8 arm, and a test asserting str.encoding is permanently unportable for that assertion.

CLAUDE.md →

Ruby pattern matching has no port (assert_pattern, deconstruct_keys) ​

Ruby's case/in and rightward => pattern matching (vendor/ruby/v3.3.11/compile.c, iseq_compile_pattern_each) are syntax: a pattern binds and destructures through deconstruct / deconstruct_keys and raises NoMatchingPatternKeyError on a miss. JS has no pattern syntax, and a pattern written as data or a predicate is a new mini-language Rails readers would not recognise. trails does not port Ruby pattern matching: Minitest's assert_pattern / refute_pattern have no trails counterpart, and the deconstruct_keys members already ported (Date, GlobalID, URI::GID, ruby-compat's Hash) stay as plain methods. A Rails test whose assertions are patterns (PatternMatchingTestCases, vendor/rails/v8.0.5.2/actionview/test/template/test_case_test.rb:490-516) is parked as it.skip under a PERMANENT-SKIP: line citing this section. Ruled by the operator on 2026-10-21.

CLAUDE.md →

ParamsWrapper::ClassMethods#inherited runs at a subclass's first _wrapper_options read ​

Rails' inherited (actionpack/lib/action_controller/metal/params_wrapper.rb:244-251) runs when a controller subclass is defined: when the inherited options' format is non-empty it dups them, sets klass to the subclass and assigns them. The own-property guard (root § "inherited is deferred to own-property memo guards") is deferInherited (metal/params-wrapper.ts), which wraps the _wrapperOptions class reader on Base and API: a subclass's first read runs inheritedParamsWrapper, the ported body, once.

packages/actionpack/CLAUDE.md →

An action's name is its method's name (AbstractController::Base#action_methods) ​

In Rails the action IS the method: def next_bundle defines the action next_bundle, and one string names both in a route, a test, a callback's only: list and a log line. A JS method is camelCase, so the method is nextBundle, and the port has to choose which spelling an action goes by.

packages/actionpack/CLAUDE.md →

A null positional keeps its url-helper slot (UrlHelper#handle_positional_args) ​

Rails' handle_positional_args (actionpack/lib/action_dispatch/routing/route_set.rb:292-318) removes every inner_options key from path_params, then merges inner_options over the positional values. In Ruby, product_path(nil, "id" => "url-tested") still fails generation, because the String key "id" is not the Symbol :id the positional nil fills (actionpack/test/dispatch/routing_test.rb:4981-4984).

packages/actionpack/CLAUDE.md →

System testing runs on Vitest (SystemTestCase, SystemTesting::*) ​

Rails' system-testing files (action_dispatch/system_test_case.rb, action_dispatch/system_testing/**) hand driver, server, session and screenshot state to a third-party browser-session library. trails does not port that library, vendor it, or use any of its names, registries or environment variables. The operator ruled this on 2026-10-15 (RFC 0166). It is an operator ruling, not a TypeScript language shortcoming.

packages/actionpack/CLAUDE.md →

A cache-backed session is prewarmed and peeked (Session::CacheStore#prepare_session) ​

Superseded. The heading is kept so citations resolve. The session now loads lazily, as Rails does: Request::Session#load_for_read! calls load!, which calls the store's load_session (vendor/rails/v8.0.5.2/actionpack/lib/action_dispatch/request/session.rb:255-282), on the first session[...] read. A cache-backed store's find_session reads ActiveSupport::Cache::Store, which is async in trails, so every Request::Session accessor (get, set, fetch, dig, hasKey, keys, values, toHash, update, delete, clear, isEmpty, idWas) is async and awaited at its call site. The same holds for what reads through it: request.flash and a controller's flash / notice / alert answer a promise, and so do formAuthenticityToken and the CSRF token chain under it. Templates compile to async functions (actionview/lib/template/handlers/tse.ts), so a view awaits them like any other helper. Session::CacheStore has no prepareSession override and nothing is prewarmed. The original ruling (2026-10-16, trails#8997) was lifted by the operator on 2026-11-20 once templates became async.

packages/actionpack/CLAUDE.md →

Request params are a null-prototype plain object (ParamBuilder#make_params) ​

Rails' make_params answers ActiveSupport::HashWithIndifferentAccess.new (vendor/rails/v8.0.5.2/actionpack/lib/action_dispatch/http/param_builder.rb:162-164). trails' makeParams answers Object.create(null), and paramsHashType accepts a null-prototype or plain object. A params hash is keyed by the request's own strings, so the String/Symbol folding is the identity. A null prototype keeps a __proto__ or toString param from reaching Object.prototype. The two assert_instance_of assertions in dispatch/param_builder_test.rb:15,21 are re-scored as an assertion that the prototype is null, by rows in scripts/test-compare/assertion-receipts/ citing this section. There is no story to make params a HashWithIndifferentAccess. Ruled by the operator on 2026-10-18, closing story param-builder-make-params-is-hash-with-indifferent-access as PERMANENT.

packages/actionpack/CLAUDE.md →

$! is passed explicitly, and a response body is iterated async (BadRequest#initialize, Response#each) ​

Ruby sets $! for the length of a rescue, so a constructor called there can read the exception being handled with no argument: ActionController::BadRequest#initialize (vendor/rails/v8.0.5.2/actionpack/lib/action_controller/metal/exceptions.rb:10-13) is super(msg) and then set_backtrace $!.backtrace if $!. JS has no equivalent: a catch binds its exception to a local only, and no hook runs on entry to a catch that could seat a carrier. The exception being rescued is passed as a trailing errinfo parameter. excSetupMessage(mesg, errinfo) (ruby-compat/lib/exception.ts) is the shape for raise's implicit cause:, and new BadRequest(msg, errinfo) is the shape for a constructor that reads $!. A carrier that every rescue site has to set would be an invented call at each site, and would still be wrong as soon as an await interleaved two handlers.

packages/actionpack/CLAUDE.md →

DOM testing is HTML5 only (Rails::Dom::Testing.default_html_version) ​

rails-dom-testing picks Nokogiri::HTML4 or HTML5 parser classes by default_html_version, which defaults to :html4 (vendor/rails-dom-testing/v2.3.0/lib/rails/dom/testing.rb:12,19-48). A Rails 7.1+ app sets it to :html5 through the gem's railtie (railtie.rb:7-10, railties/lib/rails/application/configuration.rb:276). @blazetrails/nokogiri is backed by parse5 and has no HTML4 parser. trails' DOM testing is HTML5 only: Testing.defaultHtmlVersion defaults to :html5, no railtie copies domTestingDefaultHtmlVersion, and the :html4 arm of chooseHtmlParser raises NotImplementedError where Rails' arm returns Nokogiri::HTML4. Ruled by the operator on 2026-10-15 (trails#8947). There is no story to add an HTML4 parser.

packages/actionpack/CLAUDE.md →

A colon-leading route path is a Symbol (Mapper#map_match's path_types) ​

Mapper#map_match (vendor/rails/v8.0.5.2/actionpack/lib/action_dispatch/routing/mapper.rb:1962-2006) groups its paths by class: a String is a path (post ":action" draws /:action(.:format) with a dynamic segment), a Symbol is an action (post :action draws /action(.:format), path_for_action, :1887-1895). A Ruby Symbol is a colon-leading JS string (root CLAUDE.md, § "Ruby idioms that do not translate literally"), so the two are one JS value at the Mapper's signature, and mapMatch reads /^:\w+[?!=]?$/ as the Symbol arm.

packages/actionpack/CLAUDE.md →

method_missing definers in this package ​

Class-specific rules under root § "Ruby protocol methods with a different JS mechanism"; its cross-table rules and docs/method-missing-definers.md apply too.

packages/actionpack/CLAUDE.md →

Module#autoload is a build step (Zeitwerk::Loader#define_autoload) ​

define_autoload calls Module#autoload (vendor/zeitwerk/v2.7.3/lib/zeitwerk/loader.rb:542), which binds a name and runs require synchronously at first reference. JS has no hook on an unresolved identifier and no synchronous import(). The asynchrony goes at the load, and the walk's result can be built ahead of time. In development and test the walk runs in process at setup. trails build (trails-tsc-views build-autoload) boots the application through setup_main_autoloader, with each loader's setup and eager_load stubbed so no application file is imported, runs the same walk, and writes manifest.json, imports.generated.js and constants.generated.d.ts to .trails/autoload/<tag>/ for each loader, with paths relative to Loader#manifestRoot, the application root. For an application it also writes .trails/autoload/install.generated.js, which imports config/application and assigns each of Trails.autoloaders' imports from its tag's map, and .trails/entry.generated.js, which imports that and re-exports config/environment. An ahead-of-time compiler starts from the entry: every require then reaches its file through a literal import() it can see, where importer's import(url) is opaque to it. The install module imports config/application itself rather than relying on the entry's import order, because config/application awaits at top level and a sibling import that does not depend on it runs before it finishes. Every path names the file the walk found: Node runs a .ts file as it stands, and a bundler resolves it. The digest leaves the tag out, so an untagged loader's manifest still matches when it is named by path. A namespace's load is what reveals the constants below it in Ruby, so the step seats an empty module for each namespace and descends. Loader#manifest, a parsed manifest or a path to one, makes setup fill autoloads, namespace_dirs and shadowed_files from its rows, and a digest that differs from the running configuration raises. With a manifest set up, ls, dir? and File.exist? answer from its rows, so the eager load variants, load_file, cpath_expected_at and all_expected_cpaths read no directory; a path the walk left out (hidden, not code) is unknown there, so load_file and cpath_expected_at raise "does not exist" for it and eager_load_dir raises "is not a directory". An ignored path the walk expanded is recorded, so those answer as Ruby does for it. A reload walks the file system, as setup does, so it sees what changed since the build. New names the step needs carry @noRailsEquivalent PERMANENT against this section. This is a genuine language shortcoming, ratified repo-wide by RFC 0213.

packages/zeitwerk/CLAUDE.md →

Source ​

packages/actionpack on GitHub →