All jobs

Turn Linear Issues Into Pull Requests for an Express API

An agent finds Joi validation refusing padded, upper-case emails in an Express API, adds trim and lowercase, and proves it with 11 Jest tests on MongoDB.

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

What the agent does

The issue was hagopj13/node-express-boilerplate #313, a real GitHub issue appended in place of a Linear one: " TEST@EXAMPLE.COM " gets stored as-is. Tracing the route first, the agent found the Mongoose model already trims and lowercases emails. The Joi schemas in src/validations/auth.validation.js and src/validations/user.validation.js did not, so such an email got a 400 on register, create-user, update-user and forgot-password and never reached the model.

The change adds .trim().lowercase() to the email field in register, login, forgot-password, create-user and update-user. The new tests/integration/emailNormalization.test.js runs 11 tests through the real app; 4 of them fail without the fix.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Implement the scoped Linear issue whose URL, description, comments, acceptance criteria and allowed changes the caller appends below. Work in the existing Express auth and user routes, tracing validation, middleware, controllers, services and persistence before editing. The caller supplies Linear context; this body grants no Linear connection. Use the checked-in dependency lockfile. Add Jest regression coverage through the real application and disposable MongoDB for the requested behavior and relevant permission failures. Run focused coverage and npm test, keeping exact command results and setup errors. Open a pull request that links the supplied Linear issue and explains the change. Return its URL so the caller can comment it on Linear. Do not merge, deploy or use production data.",
  "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 hagopj13/node-express-boilerplate at 179ae84: issue #313, 3 files changed, 134 insertions(+), 5 deletions(-). npm test went from 113 tests to Tests: 124 passed, 124 total, exit 0. With no mongod or Docker in the sandbox, the agent ran mongodb-memory-server, installed outside the repo, and sourced .env.example by hand; without it, 5 of 7 suites on the untouched clone died on "Config validation error" (exit code not recorded).

For the reviewer: login now normalizes too, for symmetry, though it already worked because Mongoose lowercases query values. npx eslint src tests still exits 1 with 7 prettier errors in src/middlewares/auth.js, which the run reports as pre-existing from the error counts, not a captured baseline. Stored rows are not migrated.

Run it on every Linear issue labelled agent

An automation with a linear trigger on linear.issue.labeled and the label agent runs the recipe's prompt for each issue a member of your Rush org labels, with the issue as its context. That prompt does the work the issue describes and asks on the issue when the description is not enough; it asks for no tracing, so add that line to the saved prompt if a short issue like #313 should get it.

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

Why run it on Rush?

The issue described the bug wrong. A padded email was not stored as-is; the validator refused it with a 400 before the model's own normalization could run. Tracing validation, controller, service and model first put the fix in two Joi files, and four tests that fail before and pass after show it.

Frequently asked questions

Does the forgot-password test send mail?

No. It spies on emailService.transport.sendMail. Every other test runs against the real app and a real MongoDB.

Why change login if it already worked?

Its test passes with or without the change, because Mongoose lowercases query values. The agent added it so all five schemas match; a reviewer may drop it.

More Express jobs

The same job on other stacks

Keep reading