Repository navigation
fix(db): update proxies on password rotation - #7707
diegosouzapw merged 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves an issue where bulk proxy imports created duplicate entries when only the proxy password was rotated. The upsertProxy function in src/lib/db/proxies.ts was updated to exclude the password from the identity key tuple (host, port, and username), allowing password-only updates to modify the existing proxy instead of creating a new one. A corresponding unit test was added to verify this behavior, and minor formatting improvements were made. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bff73794f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "SELECT id FROM proxy_registry WHERE host = ? AND port = ? AND username = ? AND password = ? LIMIT 1" | ||
| ) | ||
| .get(host, port, username, password) as { id?: string } | undefined; | ||
| .prepare("SELECT id FROM proxy_registry WHERE host = ? AND port = ? AND username = ? LIMIT 1") |
There was a problem hiding this comment.
Update all duplicate proxy identities on rotation
For users who already imported a rotated password before this fix, proxy_registry can already contain multiple rows with the same host, port, and username because there is no uniqueness constraint. This new lookup selects only one arbitrary row with LIMIT 1, so a later password rotation updates whichever duplicate SQLite returns while the other row(s)—including any assignments that point at them—keep stale passwords and remain duplicated. Please handle the full duplicate set when matching by host/port/username, or merge/update them deterministically.
Useful? React with 👍 / 👎.
|
Thanks @floze-the-genius! Good catch — proxies now get updated on password rotation instead of silently keeping the stale credential. Validated in local merge-train @ c5997d6b2 (FAST gates green: static + changed tests + vitest). The stale per-PR CI reds were the shared base-red on the release tip, not this PR. |
0c9578d
into
cheaper-inference:release/v3.8.49
* fix(db): update proxies on password rotation * docs(changelog): link proxy rotation fix --------- Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
* fix(db): update proxies on password rotation * docs(changelog): link proxy rotation fix --------- Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Summary
host + port + username.passwordas mutable so password-only rotations update the existing row.Related Issues
Validation
node --import tsx/esm --test tests/unit/proxy-bulk-import-dedup-7594.test.ts(4/4 passed)npx eslint src/lib/db/proxies.ts tests/unit/proxy-bulk-import-dedup-7594.test.tsnpm run typecheck:corenpm run check:changelog-integritynpm run test:unit— attempted, but the host volume reached 100% capacity during the run; unrelated tests failed withENOSPC,SQLITE_FULL, andSQLITE_IOERR_SHMSIZE. The macOS run also hit the pre-existingreadarray: command not foundfailure intests/unit/ops-scripts.test.ts.npm run test:coverage— not run after the host-level disk exhaustion.Tests Added Or Updated
tests/unit/proxy-bulk-import-dedup-7594.test.tsCoverage Notes
The focused regression exercises the changed
upsertProxy()branch end to end against SQLite: importing the same host, port, and username with a new password returnsupdated, preserves the row id, leaves one row, and stores the new password.Reviewer Notes
No migration is needed. Existing behavior for distinct usernames and auth-less proxies remains covered by the same focused suite.