# Turn Linear Issues Into Pull Requests for a Rust Service

An agent reproduces an lldap LDAP modify panic on a mixed-case DN with a failing test, fixes the one caller, and passes 81 crate tests and clippy.

[Run this on Rush](https://cloud.getrush.ai/run/linear-issue-to-pr/rust/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads issue #1542, then `parse_distinguished_name` in `crates/ldap/src/core/utils.rs`, which asserts `dn == dn.to_ascii_lowercase()`, and every caller of `get_user_id_from_distinguished_name`. Bind and password-modify lowercase the DN before calling it; `handle_modify_request` in `crates/ldap/src/modify.rs` passed `request.dn` raw, so only modify could panic. The issue says an authenticated client can abort the modify handler that way.

It adds `test_modify_password_with_mixed_case_dn` beside the existing modify tests, built on the crate's `MockTestBackendHandler` and `setup_bound_admin_handler`, and runs it without a fix to see the panic at `utils.rs:56`. The fix is one line: modify passes `&request.dn.to_ascii_lowercase()`, as the other callers do.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Fix the Linear issue this run was started for in this Rust workspace. Read the issue first, then the code it names and every caller of it. Reproduce the bug with a failing test in the crate that owns it, using that crate's existing test helpers, and fix the cause where that caller differs from the others. Run cargo test for each affected crate by its package name and cargo clippy as the repository's CI runs it. Open a pull request linking the issue, with the failing test output before the fix and the passing output after. If no issue follows this prompt, stop and say so.",
  "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 lldap/lldap at 99c510a: issue #1542, 1 file changed, 15 insertions(+), 1 deletion(-) in `crates/ldap/src/modify.rs`. Without the fix the new test failed with `assertion failed: dn == dn.to_ascii_lowercase()`. With it, `cargo test -p lldap_ldap` went from 80 tests to `test result: ok. 81 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.12s`, and `cargo clippy --tests --workspace -- -D warnings`, the command CI runs, exited 0.

For the reviewer: whether to also turn the `assert!` in `parse_distinguished_name` into an `InvalidDNSyntax` error, so no future caller can panic there. The run tested `lldap_ldap` only, not the whole workspace, and skipped `cargo fmt --check` because rustfmt was not installed in the sandbox.

## Run it on every Linear issue labelled bug

An automation with a `linear` trigger on `linear.issue.labeled`, the label `bug` and the team that owns the directory service runs this prompt per issue. A report that quotes the failing DN, as #1542 did, hands the agent its test case. The trial read a GitHub issue; a team that files bugs there uses a `github` trigger on `issues.labeled` instead, which fires only for issues filed by an owner, member or collaborator.

## Why run it on Rush?

The panic sat in a shared parser, but the bug was one caller skipping the lowercasing the others do. The run found that by reading every caller, proved it with a test that panicked before the fix, and left the wider `assert!` question to a maintainer instead of changing the parser under every path.

## Frequently asked questions

### Why not remove the assert instead?

Every other caller already lowercases the DN, so the run matched them and kept the change to one line. Replacing the `assert!` with an `InvalidDNSyntax` error would protect future callers as well; that is the reviewer's call.

### Does a mixed-case DN now modify a different user?

`UID=Bob,ou=People,...` now targets user `bob`, as bind and password-modify already resolve it. The new test covers that path; the run did not separately check how `UserId` handles case beyond it.

## More Rust jobs

- [Review Pull Requests Automatically in a Rust Service](https://getrush.ai/run/review-pull-requests/rust/)
- [Run a Security Audit on a Rust Service](https://getrush.ai/run/security-audit/rust/)
- [Add Missing Tests to Every Pull Request in a Rust Service](https://getrush.ai/run/test-every-pull-request/rust/)

## The same job on other stacks

- [Turn Linear Issues Into Pull Requests for a Spring Boot App](https://getrush.ai/run/linear-issue-to-pr/spring-boot/)
- [Turn Linear Issues Into Pull Requests for a SvelteKit App](https://getrush.ai/run/linear-issue-to-pr/sveltekit/)
- [Turn Linear Issues Into Pull Requests for a Symfony App](https://getrush.ai/run/linear-issue-to-pr/symfony/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
