Skip to content

fix(db): match digest subscriptions case-insensitively by login#1524

Open
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/digest-subscription-login-case
Open

fix(db): match digest subscriptions case-insensitively by login#1524
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/digest-subscription-login-case

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

Fixes #1523.

upsertDigestSubscription and listDigestSubscriptionsForLogin keyed digest subscriptions on the raw login without 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

  • upsertDigestSubscription now stores login: input.login.toLowerCase(), and listDigestSubscriptionsForLogin looks up with login.toLowerCase() — making storage and lookup consistent and the [login, email] dedup effective, exactly like the sibling subscription paths.

Scope

Validation

  • git diff --check
  • npm run typecheck
  • npm run test:coverage locally (4619 passed); both changed lines are covered by a new case-insensitive + dedup test.
  • npm run test:workers
  • npm audit --audit-level=moderate
  • New unit test: mixed-case subscribe + cross-case lookup resolves; re-subscribe under another casing updates the single row (no duplicate).

If any required check was skipped, explain why:

  • OpenAPI/types/migrations unchanged — this normalizes an input before existing queries; the schema and DigestSubscriptionRecord shape are identical.

Safety

  • No secrets, wallets, hotkeys, PATs, trust scores, or private evidence exposed.
  • Public text sanitized and low-noise.
  • No auth/CORS/session change.
  • API/OpenAPI/MCP behavior unchanged.
  • No UI changes.
  • No changelog edit.

Notes

  • Confined to two functions in src/db/repositories.ts; mirrors the existing case-insensitive handling in the notification/issue-watch subscription paths.

@galuis116 galuis116 requested a review from JSONbored as a code owner June 26, 2026 13:01
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.45%. Comparing base (6b1389b) to head (0f5bc00).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1524   +/-   ##
=======================================
  Coverage   95.45%   95.45%           
=======================================
  Files         195      195           
  Lines       21121    21121           
  Branches     7637     7637           
=======================================
  Hits        20161    20161           
  Misses        383      383           
  Partials      577      577           
Files with missing lines Coverage Δ
src/db/repositories.ts 96.12% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: digest subscriptions are keyed by case-sensitive login (missed lookups + case-variant duplicate rows)

1 participant