V49, plain components: 100 at familiarity 5

October 2, 2026 · ALA · V49 · LiveView · LiveComponents · familiarity · checklist

V48 reached 100 at familiarity 4. V49 asks whether the most familiar LiveView shape can get there too. That shape is the one phx.gen.live hints at: LiveComponents that hold their own state and tell their parent what happened, and a page that reacts in handle_info.

It starts from V41-max, which already had that shape but wired it through a route table with nine target kinds. Since 2026-10-01 the checklist reads wiring written as function clauses in one module as meeting R8, so the table was never required. V49 removes it.

The page is plain LiveView

Each port a panel sends gets one handle_info clause, and every call in it is LiveView’s own:

def handle_info({:cart, :removed, item}, socket) do
  send_update(Undo.Banner, id: "undo", capture: item)
  {:noreply, socket}
end

def handle_info({:undo, :restored, item}, socket) do
  send_update(Cart.Panel, id: "cart", receive: item)
  {:noreply, put_flash(socket, :info, "Item restored")}
end

The route table’s harder kinds existed so the page wouldn’t take one abstraction’s answer and hand it to another, which is Spray’s “handling the data” (§1.6.3). feed (ask the store, pass the answer to a panel) was one of them. V49 uses LiveView’s own task for it. The page starts the store work, and handle_async sends the answer on:

def handle_info({:wishlist, :taken, product}, socket) do
  add_line = socket.assigns.instances.add_line
  {:noreply, socket |> start_async(:add_line, fn -> AddLine.run(add_line, product) end) |> put_flash(:info, "Added to cart")}
end

def handle_async(:add_line, {:ok, line}, socket) do
  send_update(Cart.Panel, id: "cart", receive: line)
  {:noreply, socket}
end

That changes behaviour slightly: the added line appears a moment after the click, not in the same render. The tests’ settle/1 helper now waits for the page’s tasks with render_async/1, and no assertion changed.

Three things the walk found

What it scores

V41-maxV49
Full checklist, by hand (2026-10-02 readings)98, now 97 (the panel names)100 (99.5)
ala_lint default / --strict / --super-strict100 / 100 / 99100 / 100 / 99
Rules met under --strict (of 10 checked)910
Message hops per cross-feature effect11
Tests8586
Mean / median time per test6.4 / 0.7 ms8.2 / 1.0 ms
Non-blank lines in lib/4,3174,414
Familiarity45

The half point is the hop: a cross-feature effect goes from a panel to the page and back to another panel, and the receiving panel stays mounted behind a hidden tab to receive it. It rounds to 100, as V41-max’s did.

One judgement call holds the score up, and it’s the one the checklist records as held loosely. The panels render their own markup. I count them as stateful domain UI abstractions, because they take their words, rules and data from the page. A reviewer who reads their markup as shaped for one page would call them contained sub-components (§2.2), and V49 would lose a point or two.

What it shows

With the route table gone, V49’s page uses nothing a Phoenix developer hasn’t seen. The rest of the vocabulary is V41’s: {state, outputs} feature modules, and an Instance module of two functions (run a step, send an output to the parent). I rated V41 a 5 with that vocabulary, so V49 is a 5 by the same judgement. That’s my reading, not a measurement.

So the strict rules don’t stop a familiar 100. The price at familiarity 5 is a message hop, an asynchronous add-to-cart, and a judgement call about panel markup. At familiarity 4 (V48) there’s no hop and no judgement call.

The cart page, drawn from its clauses

Paradigms.Drawing.mermaid/1 reads the page’s handle_info and handle_async clauses. A send_update is a solid arrow to the panel whose input it calls, labelled port → input, and a start_async is an arrow to a task, whose outcome clause carries on from it. Any other call is a dotted arrow to the page effect it lands on. As in V41-max, what each panel wires to itself isn’t drawn.

flowchart LR
  cart -.->|"summary"| page_assign["page: assign"]
  cart -.->|"changed"| call_apply_change["call Carts.apply_change"]
  cart -->|"removed → capture"| undo
  cart -->|"saved → stash"| saved
  cart -.->|"saved"| page_put_flash["page: put_flash"]
  cart -->|"line → toggle"| wishlist
  cart -.->|"promo_applied"| page_put_flash["page: put_flash"]
  cart -.->|"promo_rejected"| page_put_flash["page: put_flash"]
  undo -->|"expire → expire"| undo
  undo -->|"expired → confirm_removal"| cart
  undo -->|"restored → receive"| cart
  undo -.->|"restored"| page_put_flash["page: put_flash"]
  saved -.->|"count"| page_assign["page: assign"]
  saved -->|"moved → receive"| cart
  saved -.->|"moved"| page_put_flash["page: put_flash"]
  wishlist -.->|"count"| page_assign["page: assign"]
  wishlist -.->|"ids"| page_assign["page: assign"]
  wishlist -.->|"added"| page_put_flash["page: put_flash"]
  wishlist -.->|"dropped"| page_put_flash["page: put_flash"]
  wishlist -.->|"taken"| add_line["task AddLine.run"]
  wishlist -.->|"taken"| page_put_flash["page: put_flash"]
  checkout -.->|"blocked"| page_put_flash["page: put_flash"]
  checkout -.->|"ready_to_pay"| payment["task StartPayment.call"]
  checkout -.->|"done"| call_place["call PlaceOrder.place"]
  checkout -.->|"done"| page_redirect["page: redirect"]
  checkout -.->|"step"| page_push_patch["page: push_patch"]
  stock_changed -->|"fact → set_stock"| cart
  add_line -->|"ok → receive"| cart
  payment -->|"ok → succeeded"| checkout
  payment -->|"error → failed"| checkout
  payment -->|"exit → failed"| checkout

Rescored 2026-10-03: 99

Spray’s §6.17.2 is now read strictly under R10. The small fix is in: checkout gets the cart’s id and stored lines, {cart_id, items}, not the cart, and owns the readiness rule. What remains is the shared entity: the portal’s order lines are built on the storefront’s cart, which carries promo, gift-wrap and shipping state, one use case’s data in a struct another use case shares (−1). The fix is to split the storefront’s concerns out of the struct the portal uses; no variant has done that yet. 99.5 becomes 98.5, which rounds to 99. Lint under --strict is 99, meeting 9 of 10 rules: the linter now scores the shared aggregate from --strict up.

Rescored 2026-10-03 (later): 100

The shared entity is gone. The portal’s OrderLines has its own struct and pricing (subtotal, volume tier, shipping), and builds, like the storefront’s cart, on a new Lines domain abstraction: plain functions over a list of stored order lines (find, add, change a quantity, remove, set stock), holding no prices, codes or flags of any use case. The cart lost set_discount/2, which its own doc said was “added for the portal consumer”. With checkout already getting only {cart_id, items}, R10 is met, and 98.5 becomes 99.5 (the hop), which rounds to 100. Lint under --strict is 100, meeting 10 of 10 rules. The linter needed one correction to read it: a story that only builds the cart (Cart.new) creates an instance, which a Spray feature does (§2.2), and doesn’t know its data, so it no longer counts as a reader.

The code is in ala_variants_elixir/v49-plain-components.

← all posts