How close can a LiveView app come to ideal ALA?
For most of this project I believed a LiveView page could never be ideal ALA. The framework calls the page with events and URL changes, and a page that routes them has to branch. So the checklist records a few “departures” for LiveView, and the linter scores its rule about the top layer (R11) only at its strictest setting. The linter’s post used to justify that with a sentence saying a page “can’t reach zero.”
That sentence turned out to be wrong, and the linter post has since been corrected. Three variants built this month, V39, V40 and V41, got their pages down to routing and configuration, and when I first scored them the linter found no logic in any of them. Its R11 check has since grown sharper (it now sees for loops, and one abstraction’s result passed straight into another’s call). It finds a little in V39 and V40, all in small page helpers, and still nothing in V41. So this post asks the question again, one departure at a time. For each thing a page does that Spray’s application layer wouldn’t, is it forced by LiveView, forced by Elixir, or just habit?
What Spray asks of the application
Spray’s application layer instantiates abstractions, configures them, and wires them together. It holds all of the app’s specific knowledge and none of its logic: “no normal programming language code such as assignments and if statements” (§3.5), and about 3 to 10% of the code (§2.4). He’s precise about what that excludes. Naming an instance so it can be wired twice is fine (§1.6.6, §3.6.2). So is a small predicate passed in to configure a generic abstraction, like new Filter(x => x>=0) (§3.11.3). What’s out is control flow that decides what runs, and assignments that hold data between calls. He flags his own first thermometer for exactly that: its application “is still doing some logic work - the ‘for loop’ and ‘if statement’, which we will address soon” (§1.6.3).
He also says where each kind of if goes, and I’ll use his list as the yardstick below. Guards move into the connection mechanism (§1.6.4, §6.1.3). Requirement conditions become wired instances, like the coffee maker’s AND gate (§2.9.3). History becomes a state machine (§4.16). A choice of path becomes an abstraction with two output ports (§4.9.1). The order of follow-ups becomes explicit fan-out (§4.4.4).
Spray also describes the application in functional terms: “ALA is, essentially, functional programming. All the top layer code that implements the application itself by wiring up instances of domain abstractions in some combination is pure functional code” (§3.11). The impure work, “execution details, state, and I/O”, lives in “pretested units that are then composed using pure functional code” (§3.11.1). That leaves a choice about where a page’s side effects happen. Spray hides them inside domain abstractions: his Display writes to the screen itself. The usual Elixir answer is the functional core and imperative shell: features return effects as data, and a generic interpreter below the page performs them (V35’s EffectInterpreter, V39’s Binder). Both keep the page pure. The interpreter keeps the features pure too, which is why most of these variants test without Phoenix.
A departure is only valid if none of those moves applies, or if applying one costs more than it buys. That’s the bar.
What LiveView hands the page
A LiveView page is a module the framework calls. It gets:
mount/3, twice: once for the static HTML render, once when the websocket connects;handle_event/3for every browser event, identified by a string name with string params;handle_params/3whenever the URL changes, including browser back;handle_info/2for every message to the process: PubSub, timers, anything sent toself();handle_async/3when astart_asyncjob finishes;render/1, with its assigns.
The page’s state is its socket’s assigns, and they’re immutable: each callback returns a new socket. LiveView tracks changes per assign key, not per field, so it re-renders an expression when the key it reads changed.
Some of this is Spray’s model under another name. Assigns are where the dataflow lands: his temperature connection between a wire and a display (§1.6.6) is an assign the handlers write and the template reads. The template’s nesting is the “display inside” wiring. And one process per page is the single-threaded execution he prefers anyway (§4.4.9). Other parts are genuinely foreign: string-named events, a URL that can change under you, and two mounts.
One consequence of one process per page is easy to miss. Every open page holds its own copy of any shared data, such as stock levels. Spray is wary of exactly this in immutable designs: “one thread could be using and inconsistent or outdated copy of the current actual state” (§3.10.2). The ALA answer is a wiring decision. Pick the instance that is authoritative (a process or the database), treat each page’s copy as a cache of it, and have the page subscribe to its updates. That’s the same PubSub subscription the page already owns. Since 2026-10-21 it is a part the page wires, described in “Changes made elsewhere” below.
One application, or several layers of it?
Several earlier variants treated the LiveView side as an application with sub-layers. V35’s architecture notes stack the page, its manifest, its generated glue, its views, and an effect interpreter as levels under one another, and call the features “application layer” too. V36 puts a shell on top that runs the page’s composition and interprets its outcomes. The linter went along: its layer maps could mark several layers app: true, which kept calls between them from counting as depth. It felt natural. A page, the views it renders, and the code that runs it look like three altitudes.
Spray doesn’t have that. The application is one abstraction, and “there are no subfolders under the application” (§5.4). When an app grows too big for one abstraction, it gets a Features layer under it (§2.2, §7.15). That’s a real layer of product-knowing abstractions with ports, wired by the application, not a subdivision of it. And an execution model, the thing that knows how a kind of connection runs, lives far below, in Programming Paradigms.
Sorted that way, each piece of the old stack lands somewhere definite:
- The page, its template, the router, and page-specific views are one abstraction, the application. Splitting it into files (an
IndexViewfor one action, aCheckoutViewfor another) is fine. Those files are the inside of one abstraction, like private helpers in a module. That holds for markup and functions. A LiveComponent is different: it has its own state, lifecycle and handlers, so a page-specific one is a contained sub-component, not a file of the page. They aren’t layers, and a view isn’t “more abstract” than the page that renders it. Treating them as layers invents knowledge dependencies between parts that know the same things. - Generated wiring is also application, and this is the one place Spray does use a subfolder: generated code “lives in a subfolder from where the diagram is, because it is not source code” (§2.5.1). V35’s
generated.exfits exactly. The generator is a tool outside the layers. - Features are a layer below the application, not part of it. V35 was right to give them their own modules and wrong to call them application code. The difference matters for R1: two features calling each other is a peer edge, which it wouldn’t be if they were all “the application.”
- A shell or interpreter is either the page’s own glue or a paradigm, never a layer on top. If it names the page (V36’s
CartShellcallsCartPage.handle/3), it’s part of the application. If it’s generic (V35’sEffectInterpreter, V39’sBinder, V40’sRunner, V41’sInstance), it belongs in Programming Paradigms, below the features. The page calls it, or configures it, and never the other way round. Putting a shell above the page had the dependency pointing the wrong way. - LiveView itself is a paradigm the page configures. The framework calls
handle_event/3, but that’s the page implementing callbacks of a far more general module, the same as implementingGenServer. It isn’t an upward edge (R9).
V39, V40 and V41 were built after this correction, and their layout shows it. The page is the application. Feature modules and feature components are the Features layer. Cart, the pricing rules, and generic row components are domain abstractions. The Binder, the circuit and its sinks, and Instance are Programming Paradigms. The Ecto and PubSub wrappers sit at the bottom. There’s no shell, and nothing is marked as a second application layer. (One correction, made later: what these variants call the Features layer holds stateful domain abstractions, not Spray’s features, which are compositions. “When the wiring outgrows a page” below explains it.)
One placement I hold loosely. V41’s feature panels are LiveComponents, and I put them in the Features layer: the page configures and wires each one, and none of them names the page. But their markup is shaped for this page’s layout, and a reviewer could fairly say that part of a panel is application. If that reading wins, the fix is to split each panel into a feature instance that handles events and outputs, and page-owned markup passed in through slots. I haven’t tried it.
So I don’t count application sub-layers as a LiveView departure. They were a naming mistake with two real ideas inside it: features deserve their own layer, and execution machinery should be shared and generic. Spray has a place for both, and it isn’t inside the application.
Pages, components and LiveComponents as abstractions
Spray’s UI abstraction gives each LiveView piece a job. A UI abstraction has a UI-layout port (it can be “put inside an instance of a panel”, Summary), takes the data it shows through dataflow ports, and emits events (§3.5.1). Data sources and sinks are separate abstractions wired to it (§5.2.2). Here is the whole map, as the checklist keeps it (this project’s Elixir reading):
| Piece | What it is | What it may do |
|---|---|---|
The page’s LiveView module (mount/3, callbacks, render/1) | Application | instantiate and configure, wire, hold application literals; no computing, deciding, fetching or persisting of its own (R11) |
| The page’s HEEx template | Application: the UI-layout wiring | contain UI abstractions in each other (the UI-layout paradigm), wire data into them through attributes and slot values, name the events they emit |
handle_event/3, handle_info/2, handle_async/3 clauses | Application: wires | route an emitted event, a message or an async result to one input, decoding params at the edge; clauses in one module are one place (R8) |
| The router | Application | it composes pages |
A function component (<.cart_item_row>, <.tabs>, core components) | UI domain abstraction | render data passed in as attributes; emit events whose names it’s given; contain children through slots (its UI-layout port); no state, no I/O |
| A LiveComponent that is a UI widget (a menu, a date picker, an autocomplete) | UI domain abstraction with internal state | keep the state of its own interaction (open or closed, the text typed so far); emit events; never fetch, persist or apply the product’s rules |
| A LiveComponent that holds a feature’s value | a host | fine when it’s generic (a paradigm that runs any feature, renders only what the page passes in through slots, and announces outputs); a bundle when it also renders its own markup and does I/O, which is an R6 finding (V41’s and V41-max’s panels) |
A page-specific LiveComponent (the generated FormComponent, V40’s circuit panels) | a contained sub-component | nothing: Spray has “no analog of a sub-module or sub-component” (§2.2), so it’s an R11 finding. Use a generic domain UI abstraction the page configures and wires, or move a reusable one down a layer |
Feature modules (Features.Cart, Features.Undo) | state-and-rules abstractions in a layer the variants call Features (in Spray’s terms stateful domain abstractions, see “When the wiring outgrows a page”) | {state, outputs} steps with declared ports; no markup, no events by name, no I/O unless I/O is the concept |
Store, gateway and placement instances (AddLine, PlaceOrder, Charge, a store module passed as configuration) | data source and sink abstractions | do the I/O they’re configured for; wired by the page into a feature’s inputs or from its outputs |
A domain UI component configured with a rule (StockIndicator) | UI domain abstraction | render passed-in data using a configured rule instance |
A generic shell, effect interpreter, runner or host (EffectInterpreter, Binder, Steps, a generic host LiveComponent) | Programming Paradigms | an execution model: it knows how a kind of connection runs, not what this page does (Spray keeps “Execution models.doc” in this layer) |
Phoenix.LiveView, Phoenix.Component | Programming Paradigms / Foundation, library-provided | LiveView’s event → state → render loop is an execution model; a page implementing its callbacks is configuring a more general module (R9) |
In short:
- The page and its HEEx are the application. The template is the UI-layout wiring (what’s inside what) and the data wiring (which values go into which component). The handler clauses are event wires.
- Function components are UI abstractions. They render what’s passed in, emit the events they’re named, and contain children through slots.
- A LiveComponent can be a UI abstraction with its own interaction state (a menu that’s open, a draft being typed). That’s its own business.
- A LiveComponent only one page uses, with its own state and handlers, is a sub-component the page contains. Spray replaces containment with layers (§2.2), so the generated
FormComponentis a finding (settled 2026-10-02). The page should build its form from a generic one it configures and wires. - A LiveComponent that also holds the product’s state, renders its own markup and saves through a store is a bundle. That’s a feature, a UI abstraction and a data sink in one module. V41’s panels are this, and a later walk counted it against R6 (one concept per abstraction). Splitting it means a generic host for the feature, page-owned markup passed in through slots, and the store wired by the page. Or it means holding the feature as a value in the page and dropping the host, as V45 does.
The departures, one at a time
Forced by LiveView, and valid
Event routing clauses. The framework calls handle_event("remove_item", params, socket). Something has to match on that string. A multi-clause handle_event with one clause per event is the dispatch, and a clause that only forwards is one wire from an event to an input. That’s Elixir’s pattern matching doing the job of Spray’s port names, not logic. The linter doesn’t count these, and the checklist records the reading as its own Elixir adaptation, not Spray’s words. V41 shows the routing can move into feature components (phx-target={@myself}), but it doesn’t disappear. Some module still matches on the event string.
Decoding params. The browser sends strings. String.to_integer(id) in a clause adapts one format to another, which is a technical domain reached sideways (§7.17). Fine when small. If it repeats everywhere, a generic param caster configured per event would take it out.
Holding the program value. Spray’s instances change in place. Elixir’s don’t, so the page stores each feature’s new state back into assigns after every step. The checklist lists this as a departure, and it’s Elixir’s, not LiveView’s. It’s also not “handling the data” in §1.6.3’s sense as long as the page stores values it never looks inside. V39’s Binder and V41’s panels both do this without the page ever reading a feature’s fields.
HEEx instead of wiring code for the UI. Spray builds his UI tree with WireTo nesting in C#, because WPF gave him nothing better. HEEx is a better notation for the same “display inside” wiring. An earlier comparison of our pages with Spray’s reference app came to the same verdict: moving the UI tree into a wiring table would be reinventing a worse HEEx. This one isn’t a compromise.
Assigns shaped for change tracking. Because LiveView re-renders by assign key, a page does better with @summary and @saved_count as separate assigns than with one struct holding both. That puts named landing points in the page. They’re Spray’s symbolic connections, kept inside one abstraction, and the checklist’s R5 is happy with them as long as no feature needs to know the names.
URL steps belong to the page. handle_params delivers the URL, and LiveView raises if a component calls push_patch inside update/2. So the page owns the table from flow step to path. V41 found this the hard way. Its checkout panel now announces {:checkout, :step, step} and the page patches. That’s a framework constraint that happens to agree with R3, since paths are application literals.
A few lines of client JavaScript. Focusing a field on mount can’t be done from the server. Most of the variants from V28 on ship an AutoFocus hook, attached from the template. It’s residue, it’s small, and it lives in its own file.
Forced by LiveView, but it moves out of the page
if connected?(socket) in mount/3. LiveView mounts twice, and you subscribe to PubSub only on the connected mount. Every LiveView variant carried that one-line guard, and it was the only super-strict finding on most toys. It doesn’t have to be in the page. An on_mount hook is LiveView’s own extension point, so V39 and V41 put the guard in a generic hook in the paradigms layer and configure it on the page:
on_mount {ZeroCoupledWeb.Paradigms.Subscribed, {ZeroCoupled.Foundation.Broadcast, :subscribe}}
The if still exists, once, below the page. That’s Spray’s first move: the guard goes into the connection mechanism. The linter now counts the guard as routing, so the finding is gone either way, but the page reads better without it.
Auth redirects. Same shape, same fix: on_mount is where Phoenix already puts auth. The variants here don’t have auth, so this one is untested.
handle_async results. When a payment job finishes, the page gets {:ok, {:ok, url}}, {:ok, {:error, reason}} or {:exit, reason}. V39 routes the three to Checkout.succeeded/2 and Checkout.failed/2 with three clauses, which is Spray’s two output ports (§4.9.1) written as heads. V40 and V41 move it further: the circuit’s ToAsync sink, or the checkout panel, owns the job and its outcome.
Not forced: habits the variants removed
These are the things I used to count as LiveView’s fault. Every one has a Spray move, and at least one variant made it.
Arithmetic and computed assigns. assign(socket, :total, Enum.sum(...)) is data handling. The zero-coupled variants from V28 on compute totals in a feature and let the page assign the result.
Business rules in handlers. “Can’t check out an empty cart” was an if in the page in the early variants. In V39 it’s Checkout.start/2 returning blocked: :empty, and the page binds blocked to a flash.
History. “Back to address is allowed from payment; forward jumps by URL aren’t” used to be a case in handle_params. V33 turned it into a transitions table, and V39–V41 keep that: the page passes the flow table in as configuration and the feature decides.
Handing values from one feature to another. V35’s contribution was to stop features reading each other’s state and have the page pass values in. V39 still does that in a couple of handlers, like Checkout.pay(&1, %{cart: cart, stock: stock}) and Wishlist.toggle(&1, Cart.find(socket.assigns.cart, id)). The checklist allows it, but by Spray’s §1.6.3 it’s still the page handling data. The linter now reports the second form, where one feature’s result goes straight into another’s call; the first, built into a map, it still can’t see. V40 removes it by making it a wire: the cart announces checkout_requested with its aggregate, and Checkout takes its stock source as configuration.
Loading rows in mount. items = Store.all(...) followed by Cart.new(items: items) is the page moving data between two abstractions. A store source wired into the feature’s :load input (V40), or a component that loads itself (V41), removes it.
Work in page helpers. V39 and V40 keep a few private helpers on the page that the circuit or bindings call: finalize/2 places the order, loops over the lines to decrement stock, and broadcasts each change, and add_line/2 writes a line and then looks it up again. That’s the application doing work, even though no handler branches. V41 moved the same work into its checkout panel, a feature, and a V42 design sketch in the project’s lab notes moves it into a domain abstraction that does its own I/O, as Spray’s Display does.
for loops and compound conditions in the template. A generic list component iterates. A feature computes the boolean. The page’s template only places and configures.
What the variants with posts show
Here is each one’s remaining R11 count at --super-strict, on two linters. The 2026-09-30 linter doesn’t count routing clauses, with, ok/error routing, or the connected? guard, and it does count for loops and one abstraction’s result passed straight into another’s call. The 2026-10-01 linter also reads HEEx templates, so a comparison, a :for, a case or arithmetic in a page’s markup counts too, and it is run with layer maps that place every module (the product pages and paradigms were outside the earlier maps).
| Variant | R11 findings, 2026-09-30 | 2026-10-01 (templates read) | What’s left in the top layer |
|---|---|---|---|
| thermometer §1.6.3 | 3 | 3 | two nil guards and handled data, the exact things Spray flags in his own §1.6.3 |
| thermometer §1.6.4 onward, including §1.6.6 in LiveView | 0 | 0 | a runner moves the data; the page holds one program value |
| coffee maker | 4 | 14 | its user stories still branch in the composition, the step the thermometer takes at §1.6.4; its template computes too |
| V36 | 4 | 4 | a plain composition that branches in a few places and hands the cart’s result to checkout |
| V38 | 8 | 82 | branching handlers, handled data and template logic, kept on purpose (its charter was to evolve a conventional app without adding indirection); built out to the full requirements on 2026-10-01, with 39% of application functions holding logic |
| V35 | 6 | 54 | URL and sequencing branches from V33’s flows, two hand-offs from the product store into the cart, and logic in its views’ markup |
| V39 | 4 | 35 | the order-placement loop and line lookup in page helpers, a handler passing the cart’s line to the wishlist, and logic in its views’ markup |
| V40 | 3 | 34 | the same page helpers as V39, and comparisons and loops in its components’ markup |
| V41 | 0 | 16 | tab and step comparisons and a tab loop in the pages’ markup; otherwise routing clauses, param decoding, a URL lookup, and with |
| V42 | 0 | 28 | V40’s circuit without the page helpers; comparisons and loops in its components’ markup |
| V41-max, V39-max, V38-max, V45 | 0 | 0 | only the forced forms; each also scored 100 on the full hand walk |
The pattern is the ladder from the thermometer posts, applied to a real app. Pages that call features one handler at a time keep a few branches and a few handled values. Pages that bind feature outputs once (V39), wire a circuit (V40), or let instances announce what they did (V41) keep no branches in their handlers. V39 and V40 still do some store work in page helpers; V41, which moved that work into its features, was the one at zero until the linter read templates. Once it does, only the max variants and V45 are at zero, because only they moved the comparisons and loops out of their markup too.
How far a page actually gets
Here is V41’s cart page, minus attributes and the template. It’s typical of the three.
def handle_event("switch_tab", %{"tab" => tab}, socket),
do: {:noreply, assign(socket, active_tab: String.to_existing_atom(tab))}
def handle_info({:cart, :removed, item}, socket),
do: {:noreply, pass(socket, Undo.Banner, "undo", capture: item)}
def handle_info({:undo, :restored, item}, socket),
do: {:noreply, socket |> pass(Cart.Panel, "cart", receive: item) |> put_flash(:info, "Item restored")}
def handle_info({:checkout, :step, step}, socket), do: {:noreply, patch(socket, @step_paths, step)}
Every line is an instance, a wire, a literal, or configuration. That’s Spray’s test (§3.5.2). Reading the clauses tells you what the store does.
What’s left, looked at honestly:
- Routing clauses and param decoding. Forced, and valid, as above.
Map.get(@steps_by_url, params["step"], :address)inhandle_params. A lookup in a table the page owns, with a default. Configuration, not a decision.with {:ok, path} <- Map.fetch(paths, step)inpatch/3. A guard written as the connection mechanism. That’s Spray’s first move, done in the page.- A comparison in the template. V41’s checkout button has
disabled={@item_count == 0}. By the checklist’s own LiveView table that’s a small piece of logic: the cart feature should announce anempty?boolean and the template should wire it. The linter doesn’t read templates, so it doesn’t see this. I left it in, and I’m noting it here. - Hidden subtrees.
send_updateto a component that isn’t mounted raises, so V41 keeps the cart’s instances mounted and hidden behind the checkout screen. It’s a cost of the instance design, not a branch. But it’s a real consequence of LiveView’s component model, and the page has to know about it.
What getting there costs
The three designs reach the same place by different routes, and none is free.
- V39 asks you to learn a binder with thirteen kinds of binding and one map per page. An unbound port is silently dropped, so it wants a test that every port a feature declares is bound. Familiarity 4 out of 5.
- V40 is Spray’s diagram run as data. A click takes two message hops, component to page to circuit to component, and the cart’s circuit has 38 instances and 41 wires. Familiarity 2.
- V41 is the shape
phx.gen.livegives you, so there’s nothing new to learn. Cross-feature effects take two message hops, and the design lives in twentyhandle_infoclauses instead of one table. Familiarity 5.
The linter scores all three within a point of each other (97 under --strict on the 2026-09-30 linter; 94 or 95 on the 2026-10-01 one). What separates them is what it can’t see: readability, hops, and how much vocabulary a new developer has to learn.
Past zero findings: pages at 100
Zero R11 findings says the top layer holds no logic. It doesn’t say the whole program follows ALA. For that I walk every rule of the checklist by hand, R1 to R11 with their “must” and “should” parts, and deduct for each finding: a local “must” costs 1, a structural one 2, a “should” or a judgement case half a point to 1, and a cost beyond the recorded LiveView departures 1 or a half. On that walk the best of the variants above scored 92 (V41) as first published, 88 after the rescores described below. So I took three of them, in copies, and changed each until the walk found nothing left to deduct.
| Variant | Before | After | How it got there | Familiarity |
|---|---|---|---|---|
| V41-max | 88 | 100 (98 until its panels lost their I/O) | V41’s feature components, with every word supplied by the page, configuration built once, outputs as facts, and one route table per page instead of a handle_info clause per wire | 4 of 5 |
| V39-max | 82 | 100 | V39’s bindings map, with store work and the payment call moved out of page helpers into configured domain instances behind a small paradigm protocol, no handler building another feature’s input, mount as an event on the map, and a test that every port is bound or deliberately ignored | 3 of 5 |
| V38-max | 85 | 100 | V38’s plain LiveViews, built out to the full requirements, with their logic moved into features and configured domain rules, and its wiring written as wire/3 function clauses, one per output port, checked by a test that reads the clause heads | 4 of 5 |
| V46 | 99 (V45, 2026-10-02 readings) | 100 | V45 with Spray’s Features layer: user stories that wire their own parts and lay out their own views, a page that wires the stories, a generic record form instead of FormComponent, and the coded modules named State | 3 of 5 |
| V47 | 99 (V39-max, 2026-10-02 readings) | 100 | V39-max with the same stories, each wired by its own bindings map, every port typed and the whole composition checked at mount and drawn from the value that runs | 3 of 5 |
| V48 | 99 (V45, 2026-10-02 readings) | 100 | V45 with only a generic record form and the coded modules named State; no Features layer, since its pages are under Spray’s size limit | 4 of 5 |
| V49 | 97 (V41-max, 2026-10-02 readings) | 100 (99.5, the hop) | V41-max without its route table: plain handle_info clauses, store work through LiveView tasks, panels named by the page | 5 of 5 |
Every one of them needed the same moves the table of departures above describes, applied all the way: no arithmetic, rule or loaded data in the page, no words or codes below it, no page helper doing store work, and no comparison in the template (generic components such as pane, tabs and none take those). What differs is how the wiring is held: a route table between components, a data map run by a binder, or plain clauses. None of the three is a copy of another.
Rescored 2026-10-02. Two of Spray’s statements are now read strictly, and they take each of these off 100. A page-specific LiveComponent is a contained sub-component, since Spray has “no analog of a sub-module or sub-component” (§2.2). All four still have the FormComponent that phx.gen.live generated for the product pages (R11, −1). And Spray’s features are compositions (§2.2), while the modules these variants call Features are coded state and rules (R8 “should”, −0.5; “When the wiring outgrows a page” below explains it). V39-max, V38-max and V45 are now 99 (98.5), and V41-max is 98. The table keeps the scores as they were reached.
What holds the 100 up
A 100 means no finding on this checklist and scale. It doesn’t mean the design is best. A few judgement calls hold it up, made the same way in each:
- Tiny domain rules count as concepts. The linter flags the gift-wrap fee rule and a line-total function as wrappers around a single multiplication. I count each as a named rule of the store (R6).
- Configured instances aren’t shared data. The linter reports configured rule instances (the stock-level rule, the shipping table, the store-work instances) as aggregates several features read. I count them as configuration the page hands down, not state the features share (R10).
- Report-only numbers stay unscored. Wide public surfaces, small average module size, and V38-max’s 22% of functions in the application layer (each wire is a function clause) are reported by the linter and scored by no tier.
- V41-max keeps half a point. A cross-feature effect takes one message hop, panel to page to panel, the cost of its component design. A later walk also found its panels doing their own I/O, which bundles a data source into a UI abstraction (R6; Spray keeps the UI element apart from the data source wired to it, §5.2.2). That cost two points until the panels loaded through a pull port and sent changes out for the page to store. It’s back to 99.5, which rounds to 100.
- Scope is now equal. V38-max was first built on V38’s smaller app. On 2026-10-01 V38 and V38-max were built out to the same storefront and portal requirements as the others, and all four storefront variants now pass the same acceptance tests.
What the measurement can’t tell you
Walking three designs to 100 also showed where the measurement itself is weak.
- Hand walks miss things. Walking the second and third max variants turned up four findings in code the first one shared: display words built inside a feature (“free over $50.00”), validation messages in the features’ form schemas, a currency code in a domain module, and a label that restated a configured fee. Earlier walks had also missed labels inside row components, logic in the product-page templates, and V39’s view logic. I rescored the published variants with them: V41 went from 92 to 89 (then 90, once R8 was settled for clause wiring), V39 from 88 to 82, and V38 from 91 to 89. Shared code carried the misses, so they compounded. A walk is only as good as its attention on the day.
- The scale caps each kind of finding. An R11 finding costs at most two points however much of the page it covers. V38’s whole cart page was logic, and it lost about as much as a page with a few stray branches. A proportional measure would separate them; this one doesn’t.
- Judgement calls move the score. Each call above is defensible, and each could reasonably go the other way. Reverse two of them and a “100” is a 99.
- Much of it is invisible to the linter. The linter doesn’t read templates, can’t count message hops, and doesn’t score R8 (“reads as the requirements”) at all. The max variants lint at 99 to 100, and so did variants that walked at 88.
- The rules reward absence, not assurance. A checked, drawn diagram (V42) earns nothing beyond what an unchecked one earns once the page is clean. The walk says what a page doesn’t do. It can’t say how safe its wiring is to change.
- Scope and size aren’t weighed. A smaller app reaches 100 more cheaply, and the scale has no way to say so.
What reaching it costs
The limits on reaching it are the costs of the three designs, and none is free:
- A design commitment. Every max variant had to pick a wiring form and a small paradigm to run it (a 45-line router, a 121-line binder plus a protocol, or a 19-line runner). A team has to learn it and keep it.
- Familiarity drops. V41 and V38 were 5 of 5, V39 was 4. Their max versions are 4, 4 and 3. The drop is a route table, a vocabulary of binding kinds, or the idea that a private function clause is a wire.
- Coverage needs its own test. Each design needs a test that every declared port is wired: sending every announcement, checking the map’s keys, or reading clause heads from source. Without it, an unwired output is lost or crashes at run time.
- LiveView’s shape leaks through. V41-max keeps its hop and its hidden subtrees (a component must stay mounted to receive
send_update). V39-max and V38-max avoid the hop by holding every feature’s state in the page process. - Character can go. V38’s point was a conventional page that kept its logic. At 100 it keeps none, so V38-max is a new design that keeps only V38’s preference for the most familiar option that conforms.
- Clauses at forty ports. Built out, V38-max has 44
wire/3clauses across two pages, and they still read as a list, about as long as V39-max’s map for the same wiring. What they don’t give is a value to inspect at run time. - Timing surprises. Rebuilding V39 exposed a test that had always relied on a payment task finishing before the page was read. It now waits for the task. It’s a reminder that moving work between processes and abstractions changes timing even when behaviour doesn’t change.
So a LiveView app can reach a full score on this checklist, in more than one way (V41-max, V39-max, V38-max and V45), keeping only the forced forms listed below. What the score can’t carry is the judgement behind it, and what it can’t price is the design each team has to adopt to get there.
Which to adopt
Six variants score 100 on the full walk and meet all ten rules the linter checks: V46, V47, V48, V49, V50 and V51. Judged on ALA purity first and familiarity second, V50 is my default. It has no relays between components, it’s familiarity 5, and a team learns only a two-function runner and one wire/3 clause per port. The other five are for particular needs, listed at the end of this section. Pick V51 for pages at or past Spray’s size limit, V48 if a misnamed instance should fail loudly, V49 if your team builds pages from LiveComponents, V46 if stories should each be held under their own key, and V47 if the wiring should be a typed value checked at mount.
The score can’t tell those six apart, so the choice comes down to familiarity, page size, and whether your team uses LiveComponents. The rest of this section shows where the trade-offs come from. V50 and V48 descend from V45, which wires each feature with wire/3 clauses in the page. V49 descends from V41-max, which wraps each feature in a LiveComponent. Before the stricter readings of 2026-10-02 and 2026-10-03, those two were my recommendation, with V45 the default, and comparing them shows what each way of wiring costs.
Two other variants that reached 100 under the earlier readings dropped out for plain reasons. V39-max is familiarity 3, and its binder’s vocabulary of binding kinds buys nothing on the score that the others lack. V38-max is V45 without V45’s safety. Both wire with wire/3 clauses, but V45 adds named instances that fail loudly when one isn’t configured, and a check that can fail the build on an unwired port. Nothing in V38-max scores higher, so there’s no reason to choose it over V45.
That left two designs, both familiarity 4, that hold each feature’s state the same way and wire it differently.
How alike they are
With the app’s module name normalized (GoodDeal, ZeroCoupled), about 70% of the non-blank lines in each codebase are the same. By part:
| Part | Lines shared |
|---|---|
| Feature state modules (cart, checkout, undo, saved items, wishlist, portal) | 636 of V45’s 671 |
| Domain rules and configured instances | 176 of V45’s 210 |
| UI components (rows, panes, badges) | 406 of V41-max’s 407 |
| Store, schemas, gateways and Phoenix scaffolding | nearly all |
Every difference is in how the pages hold and wire the features:
- V41-max wraps each feature in a LiveComponent. There are eight of them, 666 lines in all. Each panel holds its feature’s state, handles its own browser events and renders its own region of the page.
- V45 keeps each feature as a plain value in the page’s assigns. So its pages carry the handlers and markup that V41-max’s panels carry, about 690 non-blank lines against 430. It runs them with an 88-line runner (
Steps) and checks them with a 77-line coverage module (Wiring). V41-max’s runner (Instance) is 79 lines.
Switching between them means rewriting the pages and adding or removing the panels. The features, rules, components and store stay as they are.
How the wiring differs
Both designs wire the same ports. Here is one connection in each. When a wishlisted product goes to the cart, the store adds the line and the cart receives the stored line.
V45, a clause in the page:
defp wire(s, :wishlist, {:taken, product}),
do:
s
|> Steps.feed(:cart, &Cart.receive/2, {:add_line, &AddLine.run/2}, product, &wire/3)
|> put_flash(:info, "Added to cart")
V41-max, an entry in the page’s route table:
{:wishlist, :taken} => [
feed: {:add_line, &AddLine.run/2, {Cart.Panel, "cart", :receive}},
flash: {:info, "Added to cart"}
],
They read about the same. The differences sit underneath.
- Where the wiring lives. V45 wires every port of every feature in the page’s
wire/3clauses, including a feature’s ports into its own region (rowsto a stream,countto an assign). In V41-max a panel wires those ports to itself (its@wired_herelist), and the route table holds only what crosses between features or reaches the page. Spray keeps connections in one place because “they are typically cohesive” (§3.3.1). V45 has one place. V41-max has one per panel plus the page. - Hops. In V45 a click runs the feature and every wire it sets off inside one
handle_eventcall. In V41-max a cross-feature effect goes from the panel to the page as a message and back to another panel throughsend_update. That’s one hop, and the receiving panel has to stay mounted, even behind a hidden tab, to get it. The hop is the half point V41-max keeps. - Form. V45’s wiring is function clauses, which you can’t inspect at run time. A test reads their heads from source, and
use Wiringfails the build on a gap. V41-max’s wiring is a map thatroutes/0returns, and a test sends every declared port output to check it’s routed. A map can be printed, diffed or assembled from smaller maps. The clauses of one function have to sit in one module, but they’re easier to step through. - Testing. In both designs a feature’s state module is a pure value, tested without LiveView. V41-max adds a panel per feature, tested through a LiveView.
Choosing
On purity, V45 was the recommendation over V41-max. It keeps all the wiring in one place, takes no hop, has nothing mounted only to receive messages, and checks coverage when it compiles. It’s also the smaller design to learn, since a wire is a function clause.
Choose V41-max when one of these matters more:
- Your team already builds pages from LiveComponents and would read panels faster than a long page module.
- Different people own different regions of a page. A panel keeps one feature’s events, state and markup in one file, so a change touches that file and a route entry.
- A region is expensive to render. A LiveComponent is LiveView’s unit of separate change tracking, so it re-renders on its own.
- Your wiring needs to be data, for example a page’s routes assembled from per-feature tables.
If it’s still unclear, build one real page both ways and keep the one your reviewers read faster. With about 70% of the code shared, that experiment is cheap.
Updated 2026-10-02: four variants at the top, and which to choose
The stricter readings of that day took V45 to 99 and V41-max to 98 (97 once a later walk found its panels naming themselves). Four new variants each score 100, meet all ten rules the linter checks, and keep the familiarity question in view:
| Wiring | Hops | Familiarity | |
|---|---|---|---|
| V48 | V45’s wire/3 clauses, with only the two fixes (a generic record form, State for the coded modules) | 0 | 4 |
| V49 | LiveComponent panels and plain handle_info clauses; store work through LiveView tasks; the page names each panel | 1 | 5 |
| V46 | V45’s clauses split into Spray’s features: user stories wired by the page | 0 | 3 |
| V47 | the same stories, wired by typed bindings maps checked at mount and drawn | 0 | 3 |
So the strict rules don’t force a familiar team to give up a full score.
Rescored 2026-10-03. R10 is now read strictly too, against Spray’s §6.17.2, and it costs every variant. Checkout received the whole cart (%Cart{}), which the checklist already named as missing R10 and every walk had passed (−1). And the storefront’s cart, carrying promo, gift-wrap and shipping state, is the struct the portal’s order lines are built on: one use case’s data in a struct another shares (−1). V46 to V49 then took both fixes. Checkout gets only {cart_id, items}, and the portal’s order lines have their own struct on a new Lines abstraction, a plain list of stored lines that both use cases share without sharing each other’s data. All four are back at 100 and meet all ten rules the linter checks. V45 and the max variants, which didn’t take the fixes, are at 95 to 97. The order of the recommendation below doesn’t change.
The recommendation now:
- Pages under Spray’s size limit: V50. It has no relays between components, familiarity 5, and nothing to learn beyond a two-function runner and one clause per port. It’s V48 without named instances. V48 keeps a misnamed instance a loud error, at familiarity 4.
- LiveComponent teams: V49. It’s familiarity 5, at the cost of one hop per cross-feature effect, an asynchronous add-to-cart, and one held judgement call (that its panels, which render their own markup, are domain UI and not contained sub-components).
- Pages at or past the limit, or growing: V51, which is V50 split along user stories, with the cart’s state split into smaller abstractions wired inside its story. It’s familiarity 4, and the only variant that meets all ten checked rules under
--super-strict. Its stories share the page’s assigns, so two stories choosing the same key would collide, and nothing checks that yet. V46 makes the same split at familiarity 3, with each story held under its own key, where that can’t happen. - When the wiring should be a checked, drawn value: V47.
When the wiring outgrows a page
All of the designs above put a page’s whole composition in one place. In a very large app that place gets unwieldy, and the obvious fix is to split it into several files in one directory, or give each part of the app its own top-level directory. The second instinct is right. The first is weaker than it looks.
Spray’s answer to a large application is a layer, not a file split. “If a single abstraction is used for the application, then as more and more user stories are added into it, it will eventually get too large for the ALA size constraint… it is the application that will go over the 500 line complexity limit. ALA will need to be applied to the large application abstraction by adding a new layer below it” (§2.2). That layer is Features, or user stories. The application then “just composes a set of features or user stories needed in that specific application, and sets up any communication that may be needed between them” (§2.2), and features are “the natural abstractions in the requirements” (§7.15).
So you split along concepts. A part you split off has to be something you could name and read on its own. Cutting one page’s wiring across files with no concept for each file leaves one abstraction in several files. The size limit still applies to the whole, and a link from one file to the next is a symbolic connection: “as a program grows, these symbolic wirings are always hard to follow. You would need to resort to text searches” (§1.6.3).
A graph makes this harder, as you’d expect, but Spray reads the difficulty as a signal. User stories are cohesive, so a cut along them keeps most wires inside a feature. When a cut can’t, one of two things is wrong. Either the features are drawn in the wrong place, or a thing many of them connect to belongs a layer down. That second case is his “ground symbol” smell (§3.6.1): when many ports connect to one thing, that thing should be an abstraction, not a wire.
LiveView already partitions for you, at the route. The router composes pages, and pages reach each other only through URLs, PubSub and the store. So the router acts as the application, each page is a feature-sized application of its own, and what has to scale is one page’s wiring. A PubSub topic between pages is a symbolic connection too (§4.7.4), which is why the variants keep its subscribe and publish behind one module (Broadcast, and since 2026-10-21 ChangeFeed, below).
Do the variants do this yet?
They didn’t, until V46 and V47. Going back to Spray’s text for this section showed me that our “features” aren’t his. A Spray feature holds wiring, the same as the application: “Each feature creates instances of domain abstractions, configures the instances with feature specific details, and connects them together as needed to express the feature or user story” (§2.2). Its UI goes with it. The layout and “the bindings of the UI elements to data” are “kept together, encapsulated inside a feature. Instead, the UI is composed from Domain UI abstractions” (§7.14).
The modules our variants call features (Undo, Cart, Wishlist, Checkout) are coded state with ports. Each is a {state, outputs} step with logic inside. In Spray’s terms they’re stateful domain abstractions. Undo would serve any app in the storefront domain, and Cart is a storefront’s cart. Every edge stays the same under the right name, but the wrong one misleads a reader who knows Spray’s vocabulary, and since 2026-10-02 the checklist scores it as an R8 “should” (−0.5). It also meant no variant had Spray’s Features layer. Each page was the whole composition for its route.
At this size that’s still fine, but only just. V45’s cart page is 484 lines with its template, right at the limit where Spray adds the layer. Its portal page is 308. So I measured how the cart page would split. Of its 29 wire/3 clauses, 9 connect one feature to another, and every one of those touches the cart: removed goes to undo, and restored, moved and taken come back to the cart. The other 20 wire a feature to the page’s own landing points (assigns, streams, flashes, timers and store instances). Cut by user story (edit the cart, undo a removal, save for later, the wishlist, checkout), the page would wire 9 links between stories and leave the rest inside them. The portal is similar: 5 of 15, each touching the order. That’s a good cut. The crossing links are few, and they meet at the thing the stories are all about.
A Spray-shaped split needs three things, and V46 and V47 built each of them:
- A story module. A Features-layer module for one user story that instantiates and configures its domain abstractions, holds its wires, lays out its UI from domain UI components, and declares ports for the few links that leave it. The page composes stories and wires their ports. Both variants have the same eight stories across the two pages, and
UndoRemovalis shared by both pages with its own window on each. - A wiring form that splits. I had expected clauses to need delegation and maps to need merging. Neither did, because the runner calls a story’s own wiring directly. In V46 each story has its own
wire/4clauses and the page haswire/3clauses for the links between stories. In V47 each story has its own bindings map and the page’s map holds the links ({:to, story, port}). The wiring is nested, not merged. - A runner that nests. V46’s
Storyand V47’sBinderrun a story’s part, follow the story’s own wiring, and hand anything sent out (send_out,{:out, port}) to the page.
The measured cut held, with one surprise. The cart page wires 12 links between its five stories, not 9. The other three were there in V45, but hidden in shared page assigns and in an event the checkout’s view sent straight to the cart. A story owns its view, so each became a wire the page can be read for.
This also changes how I think about ALA itself. Spray’s definition is three constraints, but his designs use many paradigms and specialized, typed ports, and he treats that as ordinary: “we will for the first time use multiple programming paradigms, a usual thing in real ALA projects” (§7.14). A story layer, a nesting runner and a wiring form that composes are the same kind of invention. The tension is cost. Each paradigm is something a team has to learn, which is the familiarity price these variants keep paying, and why the recommendation above favours the smallest vocabulary that still scores 100.
Does partial ALA pay?
If a page can only reach zero by adopting one of those designs, is a page that stops short worth anything? Spray’s own history says yes. ALA didn’t start as a design he applied to whole programs. “The turning point was when I noticed two (accidental) successes in parts of two projects” (§1.5.1). Those parts had “undergone considerable maintenance” for 15 years in one case and 5 in the other, “but their simplicity had never degraded.” He compares it to finding “two pieces of metal that had never rusted” at a rubbish dump. The projects around them weren’t ALA. The parts that happened to be built that way kept their value anyway. His state-machine story is the same: one A3 diagram replaced 5000 lines of C in a real device, and it “was easy to maintain for years to come” (§4.16), inside a program that wasn’t otherwise ALA. And his advice for legacy code is to convert it one user story at a time: “Conversion of user stories takes place iteratively” (§8.3).
So benefits come in proportion to compliance, mostly. The reason is that most of ALA’s benefits are local to an abstraction’s boundary. An abstraction whose own dependencies all drop to more abstract things can be read and changed without reading anything else. That’s true whatever its neighbours do, which is why Spray’s two parts stayed clean for years inside messy projects. The same goes for a literal hoisted to the page, a feature that stops reading a sibling’s state, or a guard moved into a runner. Each one pays on its own, and V38 got real value from exactly that kind of step-by-step change.
Some benefits need critical mass, though, and a partial page doesn’t get them:
- The page reads as the requirements (R8) only when the whole top layer is wiring. One handler that computes, and a reader has to check every handler.
- The diagram is the source only when all the wiring is in it. V35’s drift check and V39’s bindings map both depend on nothing being wired anywhere else.
- “No abstraction knows a peer” is a guarantee only when there are no exceptions. One peer call means you can’t trust the rule, so you’re back to reading callers.
- An abstraction’s own isolation is all-or-nothing at its boundary. A module with one upward dependency has to be read together with the thing it depends on.
That’s the view I’ve settled on for LiveView. A page with a few forwarding clauses and a URL lookup loses nothing, because those forms aren’t logic. A page that keeps some real logic still gets the local benefits of every abstraction below it, and it’s a legitimate stopping point. What it gives up are the whole-page properties above. That’s a trade you can name, and it doesn’t mean the effort was wasted.
So how close?
Closer than I thought, and the gap is small and specific. A LiveView page can be ideal ALA except for:
- routing by event name and URL, which Elixir does with pattern matching instead of port names;
- decoding browser params, a technical-domain adapter at the edge;
- storing the program value back, because Elixir is immutable;
- a lookup table from URL to step, because the framework hands the page the URL;
- a JavaScript hook or two for things only the client can do.
None of these is logic. Each has a reason in the framework or the language, and none has a Spray move that removes it without replacing it with something equivalent. Everything else I used to excuse as LiveView’s nature (guards, rules, arithmetic, handled data, history, loops, even connected?) has a Spray move, and a variant here that made it. Six variants, V46 to V51, now make all of them at once. They score 100 on the full walk, within the limits of that measurement described above, with Spray’s statements on sub-components, features and shared data read strictly, and they meet all ten rules the linter checks.
The ALA Checklist now carries this whole account, the departures, the variant table, and the costs, in a section of its own (“How close a LiveView page can get”), so a reviewer can apply it without this post.
The other honest finding is about cost, and it has come down. Getting to 100 still means choosing a design that a team has to learn and keep, whether that’s a binding map, a route table, story modules or clauses as wires. But the smallest of them, V50’s two-function runner and one clause per port, is familiarity 5, so a full score no longer has to cost a team its familiar LiveView. R11 stays in the linter’s strictest tier all the same. It’s not that a page can’t reach it. It’s that reaching it is a design decision, and a CI gate shouldn’t make that decision for a team that hasn’t.
Changes made elsewhere
Added 2026-10-21. One process per page means every open page holds its own copy of shared data, and the page has to subscribe to keep it current (see “What LiveView hands the page” above). Until this month every variant built that subscription by hand. A page subscribed to Broadcast’s topic in mount/3 or through the Subscribed hook, wrote a handle_info clause per kind of message, built the stories’ %{product_id, stock} change itself, and wrote more clauses to ignore the messages it didn’t want. A new kind of outside change meant a clause on every page that cared, and the pages missed what nobody had written a clause for. In all three of V50, V51 and V51B, a staff stock edit at /products never reached an open cart or portal: the product pages broadcast product_updated, and the cart and portal ignored it.
A change-cost experiment run the same day, ten requirement changes made in sequence to a conventional Phoenix app and to V51B, put a number on it. The steps that added live updates were among ALA’s most expensive and held most of its confirmed defects. The conventional app got its live updates almost free from broadcasts its context already made on every write (Catalog.broadcast(product, :product_updated)), with each page handling them. The checklist counts that conventional form as the coupling ALA forbids, because the model, not the composition, decides what reaches every view (R1, R10).
So outside change is now a paradigm, built once and wired like any other part. The checklist calls it a live subscription port. In the variants it is GoodDealWeb.Paradigms.ChangeFeed, and V51B’s portal shows both ends:
# subscribe: a part the page mounts and wires, like a story
|> ChangeFeed.mount([topic: Catalog.changes_topic(), facts: [:stock]], out(:feed))
defp wire(s, :feed, {:stock, change}),
do: s |> to(:edit_lines, :stock, change) |> to(:catalog, :stock, change)
# publish: the composition that makes a change hands it to the same paradigm
ChangeFeed.publish([topic: Catalog.changes_topic(), facts: [:product, :stock]], product)
What makes it ALA rather than a tidier Broadcast:
- It lives in Programming Paradigms, the layer Spray keeps for the interfaces parts are wired through (§2.2). Pages and stories depend down on it, and it knows no page.
- The observer is inside the paradigm. Spray allows publish-subscribe only there, where “the subscriber does not know the publisher” (§4.4.2). Neither the cart nor the product page names the other, and no story subscribes itself.
- What travels is a fact keyed by identity, the saved product or
%{product_id, stock}, never rendered HTML. One module builds the facts, so the two ends share only the topic and the product id. - The topic is a symbolic connection, the way two sides agree on a global event name (§4.7.4). It is declared once (
Catalog.changes_topic/0) and passed to both compositions as configuration. Its grain stays a composition choice (see the run-time costs below). - It is one more paradigm in the same composition. The feed is wired with the same
wire/3clauses as the stories (§2.4.1), so the wiring check and the running trace seefeed → edit_lineslike any other hop.
The page writes no handle_info clause for it. ChangeFeed.mount/3 subscribes once connected and attaches one handle_info hook (attach_hook/4) that sends each fact out of the feed’s port through the page’s own out. That is also why it can’t be an on_mount hook like the Subscribed hook above: the page’s out closes over its private wiring, which on_mount can’t reach. The connected? guard moves into the paradigm, the same move as before.
Isn’t this just LiveView?
No, and the name avoids “Live” because the question is a fair one. They solve different halves.
LiveView keeps a stateful process for each open page and, when that process’s state changes, renders the template and pushes the diff to its browser over a websocket. It solves page to browser. It has nothing to say about how the process’s state changes when the cause is somewhere else, such as another shopper’s purchase in another process or a staff edit at /products. A plain LiveView app answers that with Phoenix.PubSub and hand-written handle_info clauses, which is what the variants did until now.
ChangeFeed solves world to page. It takes a change made anywhere, carries it as identity-keyed facts over Phoenix.PubSub, and delivers each fact into the parts inside the page’s process through the page’s own wiring (feed.stock → edit_lines.stock), the way any other output reaches a part. Then LiveView does what it always does: the part’s new state re-renders and the diff goes to the browser.
So ChangeFeed sits upstream of LiveView and uses Phoenix.PubSub for transport. It replaces neither. What it replaces is the per-page handle_info clause for each kind of change, and the conventional alternative of a context broadcasting what pages should show. The Rails variants have the same paradigm under the same name, where the transport is Action Cable and the page is rebuilt per request (the Rails post compares it with Turbo’s broadcasts_to).
Moving onto it closed the staff-stock gap in V50, V51 and V51B, with one publish setting in each. It didn’t make everything live. In V51 and V51B a price, name or new product still doesn’t reach an open cart or portal, because no state part has an input that takes them. The feed makes such a change one wire once that input exists, but it doesn’t create the input.
What it costs at run time
The checklist now carries a run-time note under “Kinds of connection”, and V51 is the design I measured it against. ALA changes no complexity class: a wire is one indirection, and Spray’s only structural claim is that performance is decided at wiring time (push or pull, sync or async, batching, §3.4.5, §4.3), so changing it never touches a feature. What the design makes visible is where each cost sits:
- One input costs what it reaches. A quantity change on the cart page runs one step of
CartLines, which emitsrows,contentsandchangedonce each; the page’s clauses route them to onestream_insert(an O(1) DOM patch), oneCartTotalsrecompute (O(lines)) and one store write. Three hops, no relay, and the drawing shows all three. BecauseSteps.run/4applies a step’s outputs in order and without re-entry, no instance runs twice for one input: the glitch a change-propagating graph can have (an instance re-emitting for each of two inputs that changed in one cycle) can’t happen here. - The state is in the process, so reads are free and mount pays once.
mount/3is one query with a preload; after that the page never reads the store to render. The price is the one Spray warns of (§3.10.2): every open page holds its own copy, kept honest only by the stock broadcast. - Pulls are batched where it matters. Checkout asks
Products.stock_levels(ids)once for the whole cart. A pull port’s natural grain is one question, and a pull inside a loop is a query per row; the drawing shows the port, not how often it’s asked, so this is the one place the shape makes a mistake easier. - Fan-out is the topic’s grain, a composition choice.
Broadcast(since 2026-10-21,ChangeFeed) has one topic for all product facts; every open cart, catalogue and portal page receives every stock fact, scans its lines (O(lines)) and patches at most one row, and a sale of n lines publishes n times. At storefront scale that is nothing. If it ever mattered, the lever is the topic the composition configures, not any feature, which is the point.
None of this is a reason to choose or avoid the design; it’s a reason the design is cheap to reason about. The reviewer’s test the checklist gives is the one I did: trace each input to its sinks, find each pull port’s callers, and ask each two-input instance whether it emits on input or on change.
What hasn’t been tried yet
Before V51, five variants had reached 100, but each took its techniques as a set. Several techniques that work in one variant have never been combined with another’s. These are the combinations that looked able to keep a full score while raising familiarity, adding a property a team would want, or meeting the checklist under the linter’s strictest tier. The first and third are now built, as V51. The other three are still unbuilt and unmeasured, and their familiarity figures are my estimates. A sixth, at the end of the list, is about the linter rather than a variant.
-
Stories in V50’s vocabulary. Built as V51. V46 split V48’s page along user stories and gained Spray’s Features layer, but it paid a point of familiarity for it. A story there has four kinds of clause, a behaviour and a runner. In V51 a story is a module of plain functions run by V50’s
runandfeed, with no struct, runner or behaviour. The open question had an answer: a story’s outputs reach the page through anoutfunction the page gives it, the page’swire/3with the story’s key bound, so no nesting runner is needed. One thing came out differently from the plan. Keeping everyhandle_eventon the page left each event name in a story’s template and the page’s handler, two modules agreeing on a name, which R5 rules out. So each story handles the events its own view fires, as a LiveComponent does. Familiarity came out at 4 by my judgement. -
Build-time checks on V50. V45, V48 and V50 ship a compile-time coverage check (
use Wiring) that no page turns on, and only V47 checks port types, at mount. Turning the first on and moving the second to compile time would make an unwired port, or a wire between ports of different types, fail the build. A failed build is something every team already knows, so familiarity could stay at 5. The work is in the checker. It has to read each clause’s source port and the input it runs, then compare the types each module declares inports/0. -
Smaller state abstractions. Built as V51. Every top variant missed one rule under
--super-strict, and it was the same rule each time. R7’s public-surface check flagsCart(17 to 19 public functions) andOrderLines(14) against a limit of 12, and in V46 theStoryrunner too (13). V51 splits the cart intoCartLines,PromoandCartTotals, wired to each other inside the cart’s story, so the extra wires don’t land on the page. A separate shipping-choice module didn’t earn its place, because it would only have forwarded one value the totals already keep.OrderLines’ helpers became private. V51 is the first variant to meet all ten checked rules under--super-strict, and it scores 100 on the full walk. -
Store writes as tasks, without relays. V49 runs adding a line, placing an order and saving a product as LiveView tasks (
start_async), and V50 runs only the payment that way. V50’s clauses with every store write sent through a task would keep the page responsive when the store is slow, with no relay between components and nothing outside standard LiveView. The cost is ordering. Two quick clicks can finish out of order, and as rebuilding V39 showed, moving work between processes changes timing even when behaviour doesn’t. -
The diagram as the source. The drawers derive Mermaid diagrams from V46 to V51’s wiring, so the diagram follows the code. Spray’s ideal runs the other way, with the diagram as the thing you edit. V35 generated its glue from a manifest and failed on drift (
mix zc.gen --check), but it scored below 95 on the full walk and is archived. Generating V50’swire/3clauses from a checked diagram would combine the two. It’s the most Spray-like direction here and the least familiar, likely 3. -
A story’s whole shape, checked by the linter. V51’s stories are checked three ways, but only by V51’s own tests.
Wiring.gaps/1checks that each story wires every port of its parts,input_gaps/1that it has an input clause for every input port it declares, andevent_gaps/1that every event its view fires is declared and handled by the story.ala_lintchecks only the outputs, so a variant built some other way, or new code in a real app, gets none of the rest from the linter. The difficulty is that variants write a story’s inputs differently. V51 hasinput/4clauses, V46input/4over a story struct, V47 bindings maps, and V50’s state modules plain named functions. A linter check would need the shape configured per project, the way layers already are. It would take checks a variant writes for itself and make them something any team gets for free.
Two techniques from the field guide’s later steps stay off this list. A graph value with a runner has been built, as V40 and V42’s circuits, and it cost two hops and familiarity 2 there. One process per instance is the most literal reading of Spray’s objects, but Elixir’s own guidance lists organizing code by process as an anti-pattern, so it only fits where the concept really is concurrent.
The first and third looked strongest together, and V51 bore that out. The Features layer and the linter’s strictest tier both came at familiarity 4. Of the three left, build-time checks look like the cheapest next step, and V51’s stories would give them more to check, since each story has its own ports, inputs and events.