Skip to content

fix(db): update proxies on password rotation - #7707

Merged
diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
floze-the-genius:fix/proxy-password-upsert-7703
Jul 19, 2026
Merged

diegosouzapw merged 3 commits into
cheaper-inference:release/v3.8.49from
floze-the-genius:fix/proxy-password-upsert-7703

Conversation

@floze-the-genius

Copy link
Copy Markdown
Contributor

Summary

  • Match bulk-imported proxies by host + port + username.
  • Treat password as mutable so password-only rotations update the existing row.
  • Add a regression test that asserts one row remains with the rotated password.

Related Issues

Validation

  • Focused regression suite: 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.ts
  • npm run typecheck:core
  • npm run check:changelog-integrity
  • npm run test:unit — attempted, but the host volume reached 100% capacity during the run; unrelated tests failed with ENOSPC, SQLITE_FULL, and SQLITE_IOERR_SHMSIZE. The macOS run also hit the pre-existing readarray: command not found failure in tests/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.ts

Coverage 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 returns updated, 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/lib/db/proxies.ts
"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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

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.

@diegosouzapw
diegosouzapw merged commit 0c9578d into cheaper-inference:release/v3.8.49 Jul 19, 2026
3 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
* 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>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(backend): proxy upsert key includes password → password-only changes create duplicates instead of updating

2 participants