Repository navigation
fix(api): load connection passwords in the usage stats job - #3613
Conversation
The password field is select: false, so the job built ClickHouse clients with no password and every run failed auth on password-protected connections. Fixes #3612
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 4fc4c77 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (2 lines, under the 30-line bar for Tier 4) Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
| const getClickhouseTableSize = async () => { | ||
| // fetch mongo data | ||
| const connections = await Connection.find(); | ||
| const connections = await Connection.find().select('+password'); |
There was a problem hiding this comment.
🔵 minor — No regression test that the usage stats job sends the connection password to ClickHouse
Add a case to packages/api/src/tasks/__tests__/usageStats.test.ts, which never mentions Connection or password today. It should create a Connection with a password, mock ClickhouseClient, and assert the constructor receives that password. The catch {} at usageStats.ts:220 swallows auth errors, so if someone drops .select('+password') again the job fails silently and nothing catches it.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Deep Review✅ No critical issues found. The one-line change ( 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (6): correctness, security, reliability, testing, maintainability, project-standards. Testing gaps: Note: the 2 prior PR comments are automated bot output (Vercel, changeset-bot) with no reviewer feedback to verify. No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 464 passed • 1 skipped • 1474s
Tests ran across 4 shards in parallel. |
The usage stats job loaded connections without their password (the field is
select: false), so every run sent ClickHouse an empty password. Each password-protected connection loggedAUTHENTICATION_FAILEDevery 4 hours, and its table sizes were left out of the report because the job swallows the error. The job now selects+password, as the alert checks already do.Fixes #3612