All jobs

Add Live Search to a Phoenix LiveView Page from a Linear Issue

An agent adds a debounced phx-change search to a LiveView profile page that filters songs by title or artist, matching % and _ literally.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent works in fly-apps/live_beats on lib/live_beats_web/live/profile_live.ex and lib/live_beats/media_library.ex. Before writing code it started Postgres and ran mix test, which stopped at startup: LiveBeats.Application.load_serving/0 downloads a Whisper model through Bumblebee 0.1.2, which fails with {:error, {:no_scheme}} on HuggingFace's relative redirect.

list_profile_songs/3 gains a search argument and an ilike filter on title or artist, escaping %, _ and \. The profile page gets a form with phx-change="search" and phx-debounce="300", a handle_event("search", ...) that resets the songs stream, and a "No songs match" line. The test in profile_live_test.exs drives the form with render_change, and song_fixture now passes server_ip as a string, because every fixture insert failed without it.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "A Linear issue labeled agent says: \"Add Live Search to a Phoenix LiveView Page. Add a search box on the profile page that filters songs by title and artist as the user types, debounced, using phx-change.\" Do the work in this repository, add tests for it, run mix test with Postgres started in the sandbox, and open a pull request that links back to the issue.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Tried on fly-apps/live_beats at ac97804: 4 files changed, 88 insertions(+), 6 deletions(-). mix test cannot start on this commit, before or after the change, because of the Whisper download. With whisper_serving? = false set temporarily in application.ex and kept out of the diff, the new test passed, 3 tests, 0 failures, 2 excluded, and the full suite went from 34 tests, 9 failures to 35 tests, 5 failures. The 4 fewer failures come from the song_fixture fix, not from search; the 5 left failed before the change, and the failing set varies between runs because a whisper transcription task sometimes crashes with :bad_file. There was no Linear issue to read.

For the reviewer: how to fix the startup download, by skipping the model in tests or upgrading Bumblebee. Songs inserted into the stream while a filter is active are not filtered, and the debounce was never tried in a browser.

Run it on every Linear issue labeled agent

An automation with a linear trigger on linear.issue.labeled and the label agent runs the linear-label-to-pr recipe's prompt when someone in your Rush org labels a UI issue. This one named the profile page and the title and artist fields, so the filter matches those two only.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

The suite was broken before the agent arrived. The run traced the failure to a third-party download, kept its workaround out of the diff, and found the fixture bug that stopped every song_fixture insert.

Frequently asked questions

Is the whole test suite green?

No. Without the temporary workaround mix test exits 1 at startup, before and after. With it, 5 of 35 fail: the delete-modal stream test and four MediaLibraryTest comparisons, all failing before the change too.

Why does the new test view another user's profile?

The owner's view hits the delete-modal stream failure that already broke the uploads test. The search form is the same on any profile, so the test opens user2's profile, adds three songs to it and searches those.

More Phoenix LiveView jobs

More jobs like this: Turn a Linear label into a PR

Keep reading