Skip to content

Commit a9684a2

Browse files
Flip the renamed-contributor repro to a passing test
The fix canonicalizes cached logins on load, so the repro from the previous commit now passes - drop test.failing and the temporary bun-types shim. Co-authored-by: abdalrouf-AAA <236259618+technologyet31-create@users.noreply.github.com>
1 parent 902d5a7 commit a9684a2

1 file changed

Lines changed: 21 additions & 32 deletions

File tree

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
import { describe, expect, test } from "bun:test"
22
import { loadPrAnalysis } from "../lib/data-processing/storePrAnalysis"
33

4-
// test.failing exists in the Bun runtime but isn't in this repo's bun-types yet.
5-
declare module "bun:test" {
6-
interface Test {
7-
failing(label: string, fn: () => void | Promise<unknown>): void
8-
}
9-
}
10-
11-
// Repro for the renamed-contributor bug: when a contributor renames their GitHub
12-
// account, cached PR analyses keep the OLD login while newer PRs use the new one,
13-
// so the tracker counts one person as two (two overview cards, two "PRs by
14-
// contributor" groups, split sponsorship totals).
4+
// Regression test for the renamed-contributor bug: when a contributor renames
5+
// their GitHub account, cached PR analyses keep the OLD login while newer PRs use
6+
// the new one. Without canonicalization the tracker counts one person as two
7+
// (two overview cards, two "PRs by contributor" groups, split sponsorship totals).
158
//
16-
// pr-analysis/2026-07-07.json really contains PRs cached under BOTH
17-
// technologyet31-create (pre-rename) and abdalraof-albarbar (post-rename) for the
18-
// same person. This assertion fails on main; it is marked test.failing so CI
19-
// stays green until the fix canonicalizes the login on load.
9+
// pr-analysis/2026-07-07.json contains PRs cached under both technologyet31-create
10+
// (pre-rename) and abdalraof-albarbar (post-rename); loadPrAnalysis must return
11+
// them under the single current login.
2012

21-
describe("renamed contributor is counted once (repro)", () => {
22-
test.failing(
23-
"cached PRs from before a rename load under the current login",
24-
() => {
25-
const prs = loadPrAnalysis("2026-07-07")
26-
const renamed = prs.filter(
27-
(pr) =>
28-
pr.contributor === "abdalraof-albarbar" ||
29-
pr.contributor === "technologyet31-create",
30-
)
31-
// Sanity: this week really contains the renamed contributor's PRs.
32-
expect(renamed.length).toBeGreaterThan(0)
33-
// The bug: those PRs load under two logins instead of one.
34-
const logins = [...new Set(renamed.map((pr) => pr.contributor))]
35-
expect(logins).toEqual(["abdalraof-albarbar"])
36-
},
37-
)
13+
describe("renamed contributor is counted once", () => {
14+
test("cached PRs from before a rename load under the current login", () => {
15+
const prs = loadPrAnalysis("2026-07-07")
16+
const renamed = prs.filter(
17+
(pr) =>
18+
pr.contributor === "abdalraof-albarbar" ||
19+
pr.contributor === "technologyet31-create",
20+
)
21+
// Sanity: this week really contains the renamed contributor's PRs.
22+
expect(renamed.length).toBeGreaterThan(0)
23+
// They must load under one login, not two.
24+
const logins = [...new Set(renamed.map((pr) => pr.contributor))]
25+
expect(logins).toEqual(["abdalraof-albarbar"])
26+
})
3827
})

0 commit comments

Comments
 (0)