V06 in Rails, plain Rails: the same design with no port vocabulary at all

October 12, 2026 · ALA · V06 · Ruby · Rails · Hotwire · checklist

Every Ruby variant before this one rated familiarity 4 or 3, and the reason was the same each time: the Foundation::Ports vocabulary. output and input macros, wire_to and on, emit and ask, sinks built as port objects. V50 reached 5 in Elixir by dropping that kind of thing: state abstractions as functions that return {state, outputs}, and a page that wires with plain wire/3 clauses. V06 is the Rails analogue. It is V03 exactly, the values, the stores, the Turbo Stream patches, the per-request screens, the layer map, with the ports spelled the way Ruby already spells things.

An input is a method; its outputs are what it returns

class CartLines
  OUTPUTS = %i[changed adding rows row_added row_changed row_removed contents removed saved line].freeze

  def bump(change)
    item = find(change[:item_id])
    item[:quantity] = [ item[:quantity] + change[:delta], 1 ].max
    { changed: { op: :quantity, id: item[:id], quantity: item[:quantity] }, row_changed: row(item), contents: contents }
  end

  def remove(item_id)
    item = take(item_id)
    { removed: item[:id], row_removed: row(item), contents: contents }
  end
end

No macro, no port object, no emit. The keys are the ports. OUTPUTS is the declaration a reader and the coverage test can see, where V03’s output :changed, DataFlow lines were. A store is the same with nothing to announce: lookup answers, apply returns nil. A sink such as LiveUpdate or the Patches response is a plain object with a method. When one output repeats in one call, SettleOrder announcing a stock change per product bought, the method returns an Array of pairs instead of a Hash; that is the whole of the shape.

A screen wires with one case

class Screens::Cart
  include ProgrammingParadigms::Wiring

  def bump(change) = (load; run(:lines, @lines.bump(change)))
  def remove(item_id) = (load; run(:lines, @lines.remove(item_id)))

  private

  def wire(part, output, payload)
    case [ part, output ]
    in [ :lines, :changed ] then run(:items, @items.apply(payload))
    in [ :lines, :adding ] then run(:items, @items.add(payload))
    in [ :items, :added ] then run(:lines, @lines.arrived(payload))
    in [ :lines, :rows ] then @rows = payload
    in [ :lines, :contents ] then run(:totals, @totals.contents(payload))
    in [ :lines, :removed ] then run(:undo, @undo.capture(payload))
    in [ :lines, :saved ] then run(:saved, @saved.stash(payload)); notice @say[:saved]
    in [ :lines, :row_changed ] then @patches.replace(@dom.cart_line_id(payload[:id]), @line_html.(payload))
    in [ :lines, :row_removed ] then @patches.remove(@dom.cart_line_id(payload[:id]))
    in [ :undo, :pending ] then @undo_pending = payload; @patches.update(@dom.undo_id, undo_html(payload))
    in [ :saved, :moved ] then run(:lines, @lines.receive(payload)); notice @say[:moved]
    in [ :pricing, :discount ] then run(:totals, @totals.discount(payload))
    in [ :totals, :summary ]
      @summary = payload
      @patches.update(@dom.summary_id, Partial.render("components/cart_summary", summary: payload, t: @t[:cart]))
      # ...
    end
  end
end

run(part, outputs) is three lines in ProgrammingParadigms::Wiring: for each pair a part returned, call wire. The arms are the wiring, read top to bottom. An arm either runs another part with the payload or lands it on the page, as an assign or a patch. Spray’s composition “specifies a number of objects that must be instantiated, configured, and wired together” (§3.11.3): here that is initialize, the keyword arguments, and this table. Nothing else connects two parts, and a Rails developer has seen a method shaped like this in a service object.

A pull is an argument. Where V03 had a request/response port, the composition passes what the value needs: run(:lines, @lines.load(@items.lookup)), and the checkout flow takes the lines when it pays, run(:flow, @flow.pay(@lines.lines)). The product lookup the three values need mid-change is a configured lambda, which is Spray’s lambda-as-configuration and the form V02 already used for a row’s links.

An output the screen lists in GROUNDED is dropped; any other output without an arm raises NoMatchingPatternError, which is the coverage test at run time. The structural one reads the arms with Prism and compares them with every part’s OUTPUTS.

The trace comes free

Because every output passes through run, V51B’s result costs thirteen lines of Foundation here. Wiring records the hop from the output being routed (or :outside) to the part it reached, and a landing when an arm ran no part. The suite turns the trace on and fails after a full run if a declared output was never routed. Its first run found what V05’s trace found on its own first run: the cart’s wishlist.dropped had no test, and two portal outputs could never fire because the portal adds lines through AddLine rather than through the value. One test added, two outputs grounded with the reason. docs/diagrams/running/ draws each screen from the hops; docs/diagrams/ from the arms.

The portal, from its arms:

flowchart LR
  screen[[Screens::Portal]]
  lines[lines]
  items[items]
  undo[undo]
  catalog[catalog]
  add_line[add_line]
  totals[totals]
  flow[flow]
  lines -- changed --> items
  lines -- rows --> screen
  lines -- contents --> totals
  lines -- removed --> undo
  undo -- pending --> screen
  catalog -- rows --> screen
  add_line -- added --> screen
  totals -- summary --> screen
  flow -- step --> screen
  flow -- form --> screen
  flow -- blocked --> screen
  flow -- reference --> screen

What the linter had to learn

The Ruby linter reads port declarations and wire_to calls, and at first read V06 as 44 findings and a score of 86: a case in the composition is a branch, a field assigned in an arm is state kept between steps, and @lines.load(@items.lookup) is one abstraction’s result handed to another. Two precision rules, both narrow, the way the Elixir linter learned two to read V51: a case [part, output] in a method named wire whose arms all match two symbols is a wiring table, and its arms are wiring blocks; a part’s call fed to run, including a pull passed straight in, is a wire. A case in any other method is still a branch, the same pull outside run is still handled data, and the linter’s suite has both. Re-linting V01 to V05 left every score the same.

With that, V06’s one real finding was mine: a helper that pulled five summary patches out of the totals.summary arm, ten handled-data findings, all right. The patches went back into the arm.

What it scores

V03V06
ala_lint default / --strict / --super-strict100 / 100 / 100100 / 100 / 100
Rules met under --super-strict (of 10 checked)1010
Functions with no scored finding238 / 238324 / 324
Declared outputs never routed under the full suitenot known0
Foundation for ports, lines880
Integration tests5757
Browser tests (Cuprite)55
Cart screen, lines149145
Non-blank lines in app/2,1311,981
Familiarity45

The function count rose because every port is now a method the linter counts, and the line count fell because the Foundation is gone.

What it costs

Later: two linter changes (2026-10-19)

A Prism upgrade had made the linter skip drawing.rb and wiring.rb, so the “no finding” above didn’t cover them. Read again, the drawing’s edge label “request” was an R3 finding; it is the drawing’s own notation, the same for any app, and is now declared in Drawing::INHERENT_LABELS, R3’s domain-vocabulary mechanism.

Then a clone check joined the linter (R7, scored from --strict). It found eight pieces of logic written twice. Six are now shared abstractions: ProgrammingParadigms::Wizard (the step flow the checkout and the portal keep in a record), Rules::LineRow (a held line shown as its product, with a product cache), Rules::LineRequest (an add request’s two forms) and Rules::Pricing.summary; the pages build the wizard and the rows and hand them in. Two are accepted with their reasons in the code: saving for later and moving to the cart are mirror operations, and CheckoutFlow#show is now a pure delegation to the wizard, which the linter reports as a pass-through. The same day CartLines#find was written def find(id) = … or raise …, and Ruby attaches the or raise to the method definition, so a line it didn’t hold came back nil instead of raising; it is bracketed now, with a test. Later that day the fixes for the defects found in V07 were ported here, each with a test that failed first: gift wrap now clears on removal, the portal says “Item restored”, the checkout button’s total is patched with every change, and a page waiting on a payment asks for the outcome once its stream is connected. An undo over Turbo now also puts the row back and reprices. Now: 100 at every tier, 10 of 10 rules, 348 functions, two accepted lines; 79 integration tests and 7 browser tests.

The same concepts now carry different names in the three Ruby variants, because each variant had its own copy extracted separately on the same day: the persisted step flow is PersistedSteps in V05, Wizard in V06 and StepRecord in V07; the product row is LineRow in V05 and V06 (V06’s with a product cache) and part of HeldProducts in V07; and Pricing.summary is written in all three. The names and APIs are left as they are for now, so a reader comparing the variants meets the same idea three ways.

Later: outside change as one paradigm (2026-10-21)

Before, each live path was built by hand. The catalogue configured three LiveUpdate sinks that broadcast rendered rows. The checkout broadcast a rendered stock badge to every page by CSS class and a rendered status to its own page. The waiting page carried a catch-up controller and a status endpoint, for an outcome sent before it listened. Every sink knew some page’s markup, and the row a product save broadcast was the /products row wherever it landed.

ProgrammingParadigms::ChangeFeed makes it one paradigm, the checklist’s “live subscription port”, in the layer Spray keeps for paradigm interfaces (§2.2). A screen that makes a change runs it into a Publish sink from an arm. A screen that shows it configures a Subscription, which its page renders:

in [ :settle, :stock_changed ] then run(:stock_news, @stock_news.push(payload))   # ChangeFeed::Publish, kind :stock
@feed = ProgrammingParadigms::ChangeFeed::Subscription.new(topic: Topics::CATALOG, kinds: %i[stock product])

What travels is a fact, a kind and identity keys ({ kind: "stock", product_id:, stock: }), never HTML, over one Action Cable channel that streams a signed topic and sends a page only the facts its feed hears. Delivery is where V06 differs from V05 and V07. A page here is rebuilt per request anyway, so a fact the page hears makes the change-feed Stimulus controller refresh it with a Turbo morph, and the rebuilt screen reads current values through the tables it is configured with. That is why the feed declares no OUTPUTS and has no arm: the wire from feed.stock to the lines is the rebuild. The morph keeps an open modal, the flash, typed input and the cart’s tab. A feed configured with catch_up also refreshes on every subscription, which is what the catch-up controller and the status endpoint were for, so both are gone. The topics are named once, in Screens::Topics.

Moving onto it closed three gaps, each shown failing on the old code first: a staff stock edit at /products never reached an open cart; a product created at /products never reached an open portal; and a staff edit replaced the portal’s catalogue row with the /products row (Edit and Delete in place of the quantity field), because the two shared a DOM id. The price is a whole-page GET per fact where a broadcast was one patch, and one read of Turbo internals (Turbo.session.navigator.currentVisit) to tell its own refresh from a form’s redirect. The linter’s new R11 reading also found two step templates chosen by an interpolated name, which now read a literal STEP_VIEWS table. Now: 100 at every tier, 10 of 10 rules, 353 functions, two accepted lines; 85 integration tests (6 for the paradigm) and 11 browser tests (4 for it). How this differs from Turbo’s broadcasts_to is in the Rails post.

What it shows

The ALA properties were never in the port vocabulary. Every rule the linter checks is about where knowledge sits, and V06 keeps every one of them with a Hash and a case. What the vocabulary bought in V03, explicit fan-out and a Foundation that could draw itself, V06 gets from the convention that every output passes through one method, which also turns out to be where V51B’s trace wanted to live. I rate familiarity 5 because the three things a Rails developer meets, a method that returns a Hash of outcomes, a run that feeds it through wire, and a case over two symbols, are each something they have written before; that is my judgment, as the ratings always are.

For a team starting a real Rails product, this is now the variant to start from. V05 remains the fullest expression of ALA in Ruby, with its kept compositions, its Features layer and its per-wire trace, and its ideas apply to V06 unchanged: a feature here would be a class with run and a wire of its own.

The code is in ala_variants_ruby/v06-plain-rails.

← all posts