Skip to content

Fix Live accept for Elixir templates in lib/#374

Open
heliumbrain wants to merge 1 commit into
pbakaus:mainfrom
heliumbrain:fix/live-heex-lib-extensions
Open

Fix Live accept for Elixir templates in lib/#374
heliumbrain wants to merge 1 commit into
pbakaus:mainfrom
heliumbrain:fix/live-heex-lib-extensions

Conversation

@heliumbrain

@heliumbrain heliumbrain commented Jul 16, 2026

Copy link
Copy Markdown

What broke

In Phoenix apps, Live often wraps markup that lives in lib/** inside a ~H""" block in a .ex file. Accept in the browser runs live-accept.mjs, which searches the tree for impeccable-variants-start markers.

That search only considered a handful of frontend extensions (.html, .jsx, …) and directories like src/ and app/. It never looked at .ex files or lib/, so accept returned Session markers not found even though the session was valid.

What changed

  • live-accept.mjs and live-wrap.mjs now include .ex, .heex, .exs, and .eex, and search under lib/ as well.
  • A small regression test accepts a variant from lib/my_app_web/components/layouts.ex.

How I checked

node --test tests/live-accept.test.mjs

All tests in that file pass (including the new case).

Note

Detector hooks recently gained configurable template extensions (#316 / #347). Live wrap/accept still uses its own hardcoded list; this PR only extends that list for a common Elixir layout. Happy to fold into a broader Live pass if #371 is the better home.


Note

Low Risk
Narrow search-path and file-extension changes to Live CLI helpers, covered by a new accept test; no auth or data-path changes.

Overview
Live accept/wrap no longer miss Phoenix-style markup in lib/** inside ~H""" blocks in .ex files. live-accept.mjs and live-wrap.mjs now scan .ex, .heex, .exs, and .eex and include lib/ in their project search paths (alongside src/, app/, etc.), so browser Accept can find impeccable-variants-start markers instead of returning Session markers not found.

A regression test accepts a variant from lib/my_app_web/components/layouts.ex. Live still uses its own hardcoded extension list (not the configurable detector hooks from other work).

Reviewed by Cursor Bugbot for commit fabb797. Bugbot is set up for automated code reviews on this repo. Configure here.

Wrap and accept search the repo for impeccable variant markers. That
search skipped .ex files and the lib/ tree, so Phoenix LiveView markup
inside ~H""" blocks never matched and browser Accept returned
"Session markers not found".

Extend the same EXTENSIONS and searchDirs in live-accept.mjs and
live-wrap.mjs. Add a regression test that accepts from
lib/my_app_web/components/layouts.ex.
@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR expands Live wrap and accept discovery for Phoenix-style Elixir templates. The main changes are:

  • Adds .ex, .heex, .exs, and .eex to the Live file extension lists.
  • Adds lib/ to the Live wrap and accept search directories.
  • Adds a test for accepting a variant from lib/**/layouts.ex.

Confidence Score: 5/5

Safe to merge with minimal risk.

The changes are small and localized to hardcoded Live search extensions and directories. The added test covers the reported Phoenix lib/ accept path. No correctness or security issues were found in the changed code.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The live acceptance test suite was executed to validate the code-execution contract.
  • The test run completed with exit code 0 and reported 15 passing and 0 failing tests.
  • A log artifact capturing the test run was saved for review.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
skill/scripts/live-accept.mjs Extends Live accept discovery to Elixir/Phoenix template extensions and the lib/ tree.
skill/scripts/live-wrap.mjs Extends Live wrap source discovery to Elixir/Phoenix template extensions and lib/.
tests/live-accept.test.mjs Adds a test covering accept of variant markers in a Phoenix-style .ex template under lib/.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Browser as Live browser accept
participant Accept as live-accept.mjs
participant FS as Project files
Browser->>Accept: accept session id + variant
Accept->>FS: search src/app/pages/components/public/views/templates/lib
FS-->>Accept: .ex/.heex/.exs/.eex file with markers
Accept->>FS: replace wrapper with chosen variant
Accept-->>Browser: "handled=true"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Browser as Live browser accept
participant Accept as live-accept.mjs
participant FS as Project files
Browser->>Accept: accept session id + variant
Accept->>FS: search src/app/pages/components/public/views/templates/lib
FS-->>Accept: .ex/.heex/.exs/.eex file with markers
Accept->>FS: replace wrapper with chosen variant
Accept-->>Browser: "handled=true"
Loading

Reviews (1): Last reviewed commit: "Fix Live accept for Elixir templates in ..." | Re-trigger Greptile

@github-actions github-actions Bot added the ready to merge Passing, resolved, and ready for a maintainer merge decision label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Passing, resolved, and ready for a maintainer merge decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant