The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 09:45 UTC
fix(web): list each pull request once across servers (#37704)
Co-authored-by: screen <screen@users.noreply.git.cafe> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Screen committed
Nov 16, 2026 at 22:36 UTC
0a842b222d5732e12451484098e035429dc0f315
3 files changed
+37
-15
apps/web/src/components/pullRequest/pullRequestList.logic.test.ts
+23
-4
@@ -388,6 +388,18 @@ describe("partitioning with the hosts' own priority reads", () => {
388
expect(groups[0]!.entries.map((item) => item.number)).toEqual([1]);
389
expect(groups[1]!.entries.map((item) => item.number)).toEqual([2, 3]);
390
});
391
+
392
+ it("lists a pull request once when another environment's authored read supplies it", () => {
393
+ const mine = authoredRow(4, "2026-07-01T00:00:00Z");
394
+ const groups = partitionPullRequestsWithPriority(
395
+ [{ ...mine, environmentId: ENV_1 }],
396
+ [{ ...mine, environmentId: ENV_2 }],
397
+ [],
398
+ );
399
+ expect(groups.map((group) => [group.key, group.entries])).toEqual([
400
+ ["authored", [{ ...mine, environmentId: ENV_1 }]],
401
+ ]);
402
+ });
403
});
404
405
describe("remembered pull request list controls", () => {
@@ -491,13 +503,20 @@ describe("merging the environments' own listings", () => {
503
...rows.map((row) => [ENV_1, answer({ entries: [row] })] as const),
504
[ENV_2, answer({ entries: [older] })],
505
]);
494
- expect(merged?.entries).toEqual([
495
- { ...newer, environmentId: ENV_1 },
496
- { ...older, environmentId: ENV_2 },
497
- ]);
506
+ expect(merged?.entries).toEqual([{ ...newer, environmentId: ENV_1 }]);
507
},
508
);
509
510
+ it("keeps a pull request two environments read on the first environment that answered", () => {
511
+ const older = entry({ number: 4, updatedAt: "2026-07-01T00:00:00Z" });
512
+ const newer = entry({ number: 4, updatedAt: "2026-07-02T00:00:00Z" });
513
+ const merged = mergePullRequestLists([
514
+ [ENV_1, answer({ entries: [older] })],
515
+ [ENV_2, answer({ entries: [newer] })],
516
+ ]);
517
+ expect(merged?.entries).toEqual([{ ...older, environmentId: ENV_1 }]);
518
+ });
519
+
520
it("keeps Azure pull requests from distinct projects with the same repository name and number", () => {
521
const first = entry({
522
provider: SourceControlProviderKind.make("azure-devops"),
apps/web/src/components/pullRequest/pullRequestList.logic.ts
+13
-10
@@ -453,16 +453,16 @@ export function partitionPullRequestsWithPriority<Entry extends PullRequestListE
453
authored: ReadonlyArray<Entry>,
454
reviewRequested: ReadonlyArray<Entry>,
455
): ReadonlyArray<PullRequestGroup<Entry>> {
456
- const authoredByKey = new Map(authored.map((entry) => [pullRequestEntryKey(entry), entry]));
456
+ // Matched by URL: each list may hold the pull request under a different environment.
457
+ const authoredByKey = new Map(authored.map((entry) => [entry.url, entry]));
458
const reviewByKey = new Map(
458
- reviewRequested.flatMap((entry) => {
459
- const key = pullRequestEntryKey(entry);
460
- return authoredByKey.has(key) ? [] : [[key, entry] as const];
461
- }),
459
+ reviewRequested.flatMap((entry) =>
460
+ authoredByKey.has(entry.url) ? [] : [[entry.url, entry] as const],
461
+ ),
462
);
463
const others: Entry[] = [];
464
for (const entry of entries) {
465
- const key = pullRequestEntryKey(entry);
465
+ const key = entry.url;
466
if (authoredByKey.has(key)) {
467
authoredByKey.set(key, entry);
468
} else if (reviewByKey.has(key)) {
@@ -561,10 +561,13 @@ export function mergePullRequestLists(
561
);
562
}
563
for (const entry of answer.entries) {
564
- const key = JSON.stringify([environmentId, entry.url]);
565
- const held = entries.get(key);
566
- if (held === undefined || entry.updatedAt > held.updatedAt) {
567
- entries.set(key, { ...entry, environmentId });
564
+ const held = entries.get(entry.url);
565
+ // The first environment to answer keeps a pull request that several of them read.
566
+ if (
567
+ held === undefined ||
568
+ (held.environmentId === environmentId && entry.updatedAt > held.updatedAt)
569
+ ) {
570
+ entries.set(entry.url, { ...entry, environmentId });
571
}
572
}
573
errors.push(...answer.errors.map((error) => ({ ...error, environmentId })));
apps/web/src/state/pullRequests.test.ts
+1
-1
@@ -438,7 +438,7 @@ describe("pull request list answers across a reload", () => {
438
{ environmentId: remote, input },
439
]);
440
expect(restored?.entries.map((row) => [row.environmentId, row.updatedAt])).toEqual([
441
- [remote, "2026-07-03T00:00:00Z"],
441
+ [local, "2026-07-01T00:00:00Z"],
442
]);
443
});
444