You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "vbhanuchander-lang (via GitHub)" <gi...@apache.org> on 2026/08/13 11:57:36 UTC
[PR] fix(org): match user and account emails case-insensitively [devlake]
vbhanuchander-lang opened a new pull request, #9051:
URL: https://github.com/apache/devlake/pull/9051
### Summary
- Closes #9050
- `ConnectUserAccountsExact` compared emails by exact map lookup, so addresses differing only in
capitalisation were never linked and the account was silently left out of `user_accounts`.
`user_account.go` keyed the map on the raw address and looked it up with the raw account address:
```go
emails[user.Email] = user.Id // line 49
...
if userId, ok := emails[account.Email]; account.Email != "" && ok { // line 79
```
The two sides come from different systems — a git config, a provider profile, and a
hand-maintained CSV — which routinely disagree on the case of the same address. When they do, the
subtask still reports success, so the failure is invisible: the account just never appears in
`user_accounts`, and everything attributing through it stops counting towards that user.
There is no second chance either. The scan is restricted to
`id NOT IN (SELECT account_id FROM user_accounts)` (line 58), so a later run will not revisit an
account that failed to match.
### What this changes
Case is folded on both sides of the **email** comparison only.
**Name matching is deliberately untouched.** Emails are case-insensitive by convention; personal
names and logins are not, and loosening those comparisons could manufacture links that are simply
wrong. That felt like a separate decision rather than something to slip into this fix.
### Test Plan
The `org` e2e fixtures gain one account, `a11`, whose email (`E6`) differs from user `U006`'s (`e6`)
only in case, with `full_name` and `user_name` set to `zz` so neither name fallback can match. That
isolates the email path.
Verified against a MySQL 8 instance with `E2E_DB_URL` set:
| | Result |
| --- | --- |
| Without the change | `FAIL` — `records in user_accounts count not match expectation count,[expected(CSV):11][actual(DB):10]` |
| With the change | `ok github.com/apache/incubator-devlake/plugins/org/e2e` |
`go test ./plugins/org/... -count=1` → e2e and impl both pass. `go vet ./plugins/org/...` is clean,
and `go build ./plugins/org/tasks/` is clean.
Two pre-existing build complaints are unrelated to this change and reproduce identically on an
unmodified tree, which I checked rather than assumed: `plugins/org` reports
`function main is undeclared in the main package` because it builds as a Go plugin, and
`git2go/v33` needs `pkg-config`, which is absent from my machine.
### Context
Found while investigating #8698, where a reporter's GitHub account was never linked so only commit
activities showed in work logs. To be clear, case sensitivity is **not** the cause of that issue — I
posted the root cause there separately (GitHub returns an empty email for users who have not made it
public, and `users.csv` has no column for a provider login, so no branch can match). This is a
different instance of the same silent-linkage class that surfaced while reading the code.
🤖 AI-assisted changes — generated with Claude Code (Opus 5) and reviewed by me before submitting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(org): match user and account emails case-insensitively [devlake]
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh merged PR #9051:
URL: https://github.com/apache/devlake/pull/9051
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org