@devries-cameron20 / t3code-1 / commits / d7c711503f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(source-control): fix forgejo check details links (#18434)

Robbie committed Oct 18, 2026 at 13:13 UTC d7c711503f2b8914db0a06cef3fa35f8eb4f2753
3 files changed +71 -3
packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
+5 -2
@@ -251,7 +251,10 @@ export const make = Effect.gen(function* () {
251 },
252 ForgejoStatus,
253 );
254 - return { state: forgejoChangeRequest(pr).state, checks: forgejoChecks(statuses.items) };
254 + return {
255 + state: forgejoChangeRequest(pr).state,
256 + checks: forgejoChecks(statuses.items, pr.html_url),
257 + };
258 },
259 ),
260 getChangeRequest: Effect.fn("ForgejoPullRequestProvider.getChangeRequest")(function* (input) {
@@ -275,7 +278,7 @@ export const make = Effect.gen(function* () {
278 const actor = forgejoActor(user);
279 return actor ? [actor] : [];
280 }),
278 - checks: forgejoChecks(statuses.items),
281 + checks: forgejoChecks(statuses.items, pr.html_url),
282 baseComparison: !pr.merge_base
283 ? "unknown"
284 : pr.merge_base === pr.base.sha
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
+62
@@ -164,6 +164,68 @@ it.effect("reads Forgejo checks without repository or viewer requests", () => {
164 );
165 });
166
167 +it.effect("opens Forgejo Actions check links on the pull request's server", () =>
168 + Effect.gen(function* () {
169 + const provider = yield* ForgejoPullRequestProvider.make;
170 + const read = provider.getChangeRequestChecks;
171 + if (read === undefined) return yield* Effect.die("checks read missing");
172 + const result = yield* read({
173 + cwd: "/repo",
174 + repository: "acme/web",
175 + host: "forgejo.test",
176 + number: 1,
177 + });
178 + assert.deepStrictEqual(
179 + result.checks.map((check) => [check.name, check.url]),
180 + [
181 + ["actions", "https://forgejo.test/git/acme/web/actions/runs/7/jobs/2"],
182 + ["external", "https://ci.example/build/9"],
183 + ["none", null],
184 + ],
185 + );
186 + }).pipe(
187 + Effect.provide(
188 + Layer.mock(ForgejoCli.ForgejoCli)({
189 + api: (input) => {
190 + const status = (context: string, target_url: string | null) => ({
191 + context,
192 + status: "success",
193 + description: null,
194 + target_url,
195 + updated_at: "2026-10-11T00:00:00Z",
196 + });
197 + const body = input.path.endsWith("pulls/1")
198 + ? {
199 + number: 1,
200 + title: "Checks",
201 + body: "",
202 + html_url: "https://forgejo.test/git/acme/web/pulls/1",
203 + user: null,
204 + state: "open",
205 + merged: false,
206 + head: { ref: "feature", sha: "head", repo: null },
207 + base: { ref: "main", sha: "base", repo: null },
208 + created_at: "2026-10-11T00:00:00Z",
209 + updated_at: "2026-10-11T00:00:00Z",
210 + closed_at: null,
211 + merged_at: null,
212 + labels: [],
213 + }
214 + : input.path.endsWith("page=1")
215 + ? [
216 + // Forgejo includes any sub-path mount in the relative links it reports.
217 + status("actions", "/git/acme/web/actions/runs/7/jobs/2"),
218 + status("external", "https://ci.example/build/9"),
219 + status("none", null),
220 + ]
221 + : [];
222 + return encodeJsonEffect(body).pipe(Effect.orDie, Effect.map(processOutput));
223 + },
224 + }),
225 + ),
226 + ),
227 +);
228 +
229 it.effect.each([
230 ["Ready", false, true, false, "mergeable"],
231 ["Draft", true, false, true, "unknown"],
packages/source-control-forgejo/src/server/forgejoPullRequestJson.ts
+4 -1
@@ -210,6 +210,7 @@ export function forgejoCommit(commit: typeof ForgejoCommit.Type): PullRequestCom
210
211 export function forgejoChecks(
212 statuses: ReadonlyArray<typeof ForgejoStatus.Type>,
213 + pullRequestUrl: string,
214 ): ReadonlyArray<PullRequestCheck> {
215 return dedupeChecks(
216 statuses.map((status) => ({
@@ -218,7 +219,9 @@ export function forgejoChecks(
219 check: {
220 name: status.context || "check",
221 description: status.description || null,
221 - url: status.target_url || null,
222 + url: status.target_url
223 + ? (URL.parse(status.target_url, pullRequestUrl)?.href ?? null)
224 + : null,
225 status:
226 status.status === "success"
227 ? "success"