fix(db): match digest subscriptions case-insensitively by login#1524
fix(db): match digest subscriptions case-insensitively by login#1524galuis116 wants to merge 2 commits into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1524 +/- ##
=======================================
Coverage 95.37% 95.37%
=======================================
Files 199 199
Lines 21546 21546
Branches 7791 7791
=======================================
Hits 20550 20550
Misses 416 416
Partials 580 580
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review — blocked
🛑 Blocked Review summary Blockers
CI checks failing
Nits — 3 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. The change correctly normalizes GitHub login casing on both the write path (`upsertDigestSubscription`) and read path (`listDigestSubscriptionsForLogin`), closing the gap where a subscriber stored as "Foo" was missed on a "foo" lookup and the `[login, email]` conflict target accumulated case-variant duplicate rows. The fix mirrors existing lowercase normalization on sibling subscription paths and is accompanied by a well-structured test covering cross-case lookup and upsert-dedup. The one gap is that no SQL migration normalizes pre-existing rows, so mixed-case `login` values already in the table become unreachable after deploy without a re-upsert. Blockers
Nits (3)
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Fixes #1523.
upsertDigestSubscriptionandlistDigestSubscriptionsForLoginkeyed digest subscriptions on the rawloginwithout case-normalizing it — even though the email is already lowercased, and every sibling subscription/identity path (notification subscriptions, issue-watch, notification deliveries, official-miner detections) lowercases login on both write and read. GitHub logins are case-insensitive, so a subscriber stored as "Foo" was missed on a "foo" lookup, and the[login, email]conflict target accumulated case-variant duplicate rows.What changed
upsertDigestSubscriptionnow storeslogin: input.login.toLowerCase(), andlistDigestSubscriptionsForLoginlooks up withlogin.toLowerCase()— making storage and lookup consistent and the[login, email]dedup effective, exactly like the sibling subscription paths.Scope
CONTRIBUTING.md; nosite//CNAME/VitePress.Validation
git diff --checknpm run typechecknpm run test:coveragelocally (4619 passed); both changed lines are covered by a new case-insensitive + dedup test.npm run test:workersnpm audit --audit-level=moderateIf any required check was skipped, explain why:
DigestSubscriptionRecordshape are identical.Safety
Notes
src/db/repositories.ts; mirrors the existing case-insensitive handling in the notification/issue-watch subscription paths.