mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-27 19:52:49 +00:00
* feat(protocol): add forge check presentation metadata Expose optional rawStatus, isManual, and requiresAction fields while keeping older check payloads backward-compatible. * fix(gitea): model Actions jobs as tasks Gitea's /actions/tasks endpoint returns individual jobs rather than workflow runs. Preserve sibling tasks from the latest execution, avoid collapsing same-name jobs, and enrich blocked tasks with run-level approval metadata. * feat(app): distinguish forge check presentation states * fix(gitlab): preserve pipeline job semantics * refactor(app): centralize forge check presentation policy Use one canonical category order, count shape, visual policy, and translated copy mapping across sidebar, hover-card, PR-pane, and GitLab pipeline surfaces. * refactor: consolidate forge check handling * feat(forge): auto-attach pasted forge references * docs(compat): correct forge rollout metadata * refactor(forge): model check nuances as traits * fix(forge): harden checks from branch review Structural Gitea Actions shadow dedup by run id (verified upstream), rerun grouping without workflow_id, shared trait/status constants and Gitea state mapping in the protocol package, all cloud host aliases in pasted-link matching, logged glab job-detail failures, concurrent approvals/pipeline fetch, checks aggregate from the same pipeline as the job list, and removal of the unread check-level rawStatus. The released pipeline-level rawStatus is staged for removal under COMPAT(pipelineRawStatus). * fix(gitea): detect fork-PR Actions approval hold as action_required gitea.com represents a fork PR awaiting Actions approval as a run in status "waiting" with no tasks and pending shadow commit statuses; it does not expose need_approval. The previous mapping only set action_required from a task with blocked+need_approval, so the gate never surfaced (0 tasks -> early return; need_approval absent). Detect the hold from /actions/runs: a waiting/blocked run whose PR is cross-repo (head.repo.id != base.repo.id), or one that does expose need_approval (self-hosted). Tag the run's pending shadow statuses action_required. Runs are only fetched when a pending shadow has no covering task, keeping the common path at two requests. Verified live against gitea.com fork PR (run 715170, waiting, cross-repo). * fix(gitea): resolve cross-fork PRs by head sha The current-PR matcher gated candidates on the checkout owner (giteaHeadOwner === expectedHeadOwner), which excludes every fork PR: its head carries the fork owner while the checkout is the base repo, so a fork PR - the only shape that can be approval-held on Gitea - never resolved and its checks never showed in-app. GitLab has no such gate (it resolves fork MRs from the target project by source branch). Accept a recent PR whose head sha equals the workspace head sha regardless of owner; the sha is an unambiguous identity, so the anti-collision owner gate still applies when no sha match is available. Verified live against gitea.com fork PR #6 (resolves + renders action_required). * fix: resolve forge rebase drift * fix: type forge auto-attach boundary * fix(i18n): add Korean check status copy --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
105 lines
3.6 KiB
TypeScript
105 lines
3.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { extractForgeRefs, parseForgeRef } from "./forge-refs";
|
|
|
|
describe("parseForgeRef", () => {
|
|
it.each([
|
|
[
|
|
"GitHub pull request",
|
|
"git@github.com:getpaseo/paseo.git",
|
|
"https://github.com/getpaseo/paseo/pull/994/files?diff=split#discussion_r123",
|
|
{ kind: "change_request", number: 994 },
|
|
],
|
|
[
|
|
"GitHub issue",
|
|
"https://github.com/getpaseo/paseo.git",
|
|
"https://github.com/getpaseo/paseo/issues/456",
|
|
{ kind: "issue", number: 456 },
|
|
],
|
|
[
|
|
"nested GitLab merge request",
|
|
"git@gitlab.com:group/subgroup/project.git",
|
|
"https://gitlab.com/group/subgroup/project/-/merge_requests/73/diffs",
|
|
{ kind: "change_request", number: 73 },
|
|
],
|
|
[
|
|
"GitLab issue",
|
|
"https://gitlab.com/group/project.git",
|
|
"https://gitlab.com/group/project/-/issues/19#note_1",
|
|
{ kind: "issue", number: 19 },
|
|
],
|
|
[
|
|
"self-hosted Gitea pull request",
|
|
"ssh://git@git.example.com/acme/project.git",
|
|
"https://git.example.com/acme/project/pulls/31/files",
|
|
{ kind: "change_request", number: 31 },
|
|
],
|
|
[
|
|
"Forgejo issue",
|
|
"git@forgejo.example.com:acme/project.git",
|
|
"https://forgejo.example.com/acme/project/issues/27",
|
|
{ kind: "issue", number: 27 },
|
|
],
|
|
[
|
|
"Codeberg pull request",
|
|
"git@codeberg.org:acme/project.git",
|
|
"https://codeberg.org/acme/project/pulls/8",
|
|
{ kind: "change_request", number: 8 },
|
|
],
|
|
])("parses a matching %s URL", (_label, remote, text, expected) => {
|
|
expect(parseForgeRef(text, remote)).toEqual(expected);
|
|
});
|
|
|
|
it("canonicalizes a cloud SSH alias to its web host", () => {
|
|
expect(
|
|
parseForgeRef(
|
|
"https://github.com/getpaseo/paseo/pull/994",
|
|
"ssh://git@ssh.github.com/getpaseo/paseo.git",
|
|
),
|
|
).toEqual({ kind: "change_request", number: 994 });
|
|
});
|
|
|
|
it("ignores another host, repository, and malformed local id", () => {
|
|
const remote = "git@gitlab.com:group/project.git";
|
|
expect(
|
|
parseForgeRef("https://other.example/group/project/-/merge_requests/1", remote),
|
|
).toBeNull();
|
|
expect(parseForgeRef("https://gitlab.com/group/other/-/merge_requests/1", remote)).toBeNull();
|
|
expect(
|
|
parseForgeRef("https://gitlab.com/group/project/-/merge_requests/1oops", remote),
|
|
).toBeNull();
|
|
});
|
|
|
|
it("does not apply another forge's route grammar to a known cloud host", () => {
|
|
expect(
|
|
parseForgeRef(
|
|
"https://github.com/getpaseo/paseo/pulls/31",
|
|
"git@github.com:getpaseo/paseo.git",
|
|
),
|
|
).toBeNull();
|
|
expect(
|
|
parseForgeRef("https://gitlab.com/group/project/pull/31", "git@gitlab.com:group/project.git"),
|
|
).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe("extractForgeRefs", () => {
|
|
it("extracts matching references in text order and deduplicates them", () => {
|
|
const text = [
|
|
"[MR](https://gitlab.com/group/project/-/merge_requests/12/diffs).",
|
|
"https://gitlab.com/group/project/-/issues/34#note_1,",
|
|
"https://gitlab.com/group/project/-/merge_requests/12",
|
|
"https://gitlab.com/group/other/-/issues/99",
|
|
].join("\n");
|
|
|
|
expect(extractForgeRefs(text, "git@gitlab.com:group/project.git")).toEqual([
|
|
{ kind: "change_request", number: 12 },
|
|
{ kind: "issue", number: 34 },
|
|
]);
|
|
});
|
|
|
|
it("returns no references without text or a valid remote", () => {
|
|
expect(extractForgeRefs("", "git@github.com:getpaseo/paseo.git")).toEqual([]);
|
|
expect(extractForgeRefs("https://github.com/getpaseo/paseo/pull/1", null)).toEqual([]);
|
|
});
|
|
});
|