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 22, 10:45 UTC
fix(forgejo): reviewer picker lists each assignee once on Forgejo and Gitea (#23580)
Co-authored-by: maria-rcks <maria@kuuro.net>
Paul van der lei committed
Oct 31, 2026 at 02:24 UTC
76c25c78a57e0b88fc3e95cfff43a6efb63ba6a7
2 files changed
+46
-3
packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
+7
-3
@@ -603,12 +603,16 @@ export const make = Effect.gen(function* () {
603
}),
604
listReviewerCandidates: Effect.fn("ForgejoPullRequestProvider.listReviewerCandidates")(
605
function* (input) {
606
+ // Unpaginated in Forgejo: paging it returns the full list on every page.
607
const [pr, users] = yield* Effect.all(
607
- [getPull(input), page({ ...input, path: `${repoPath(input)}/assignees` }, ForgejoUser)],
608
+ [
609
+ getPull(input),
610
+ readArray({ ...input, path: `${repoPath(input)}/assignees` }, ForgejoUser),
611
+ ],
612
{ concurrency: 2 },
613
);
614
return {
611
- candidates: users.items
615
+ candidates: users
616
.filter((user) => user.login !== pr.user?.login)
617
.flatMap((user) => {
618
const actor = forgejoActor(user);
@@ -625,7 +629,7 @@ export const make = Effect.gen(function* () {
629
]
630
: [];
631
}),
628
- truncated: users.truncated,
632
+ truncated: false,
633
};
634
},
635
),
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
+39
@@ -985,6 +985,45 @@ it.effect(
985
},
986
);
987
988
+it.effect("lists each Forgejo assignee once as a reviewer candidate", () => {
989
+ const paths: string[] = [];
990
+ return Effect.gen(function* () {
991
+ const provider = yield* ForgejoPullRequestProvider.make;
992
+ const result = yield* provider.listReviewerCandidates(requiredChecksInput);
993
+ assert.deepStrictEqual(
994
+ result.candidates.map((candidate) => [candidate.id, candidate.isRequested]),
995
+ [
996
+ ["ana", true],
997
+ ["noor", false],
998
+ ],
999
+ );
1000
+ assert.strictEqual(result.truncated, false);
1001
+ assert.strictEqual(paths.filter((path) => path.includes("/assignees")).length, 1);
1002
+ }).pipe(
1003
+ Effect.provide(
1004
+ Layer.mock(ForgejoCli.ForgejoCli)({
1005
+ api: (input) => {
1006
+ paths.push(input.path);
1007
+ const respond = (response: unknown) =>
1008
+ encodeJsonEffect(response).pipe(Effect.orDie, Effect.map(processOutput));
1009
+ switch (input.path.split("?")[0]) {
1010
+ case "repos/acme/web/pulls/7":
1011
+ return respond({
1012
+ ...requiredChecksPullRequest,
1013
+ requested_reviewers: [{ login: "ana" }],
1014
+ });
1015
+ // Forgejo ignores paging here: every page is the full list, with no Link header.
1016
+ case "repos/acme/web/assignees":
1017
+ return respond([{ login: "maria" }, { login: "ana" }, { login: "noor" }]);
1018
+ default:
1019
+ return Effect.die(`Unexpected Forgejo request: ${input.path}`);
1020
+ }
1021
+ },
1022
+ }),
1023
+ ),
1024
+ );
1025
+});
1026
+
1027
it.effect("discovers Forgejo accounts and retains the server port", () =>
1028
Effect.gen(function* () {
1029
const auth = ForgejoSourceControlProvider.discovery.parseAuth(