mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-08 01:16:45 +08:00
* feat(pr): move issues to a workspace-chosen status when their PRs merge (MUL-7726) The merge automation completed an issue only when a PR said "Closes MUL-1", so the workspace switch mostly did nothing: most PRs are linked by title or branch and never completed anything. The workspace now picks what a merge does, in settings.pr_merge_status: "none", or the key of a started or done status (custom ones included, Blocked excluded). Absent means Done. When every linked PR is merged, the issue moves to that status. A closing keyword only links. - Decision: terminal, triage, "none", the per-issue switch and a new at_target state (the issue already has the target) come before the PR states, so the issue page only speaks when a merge would move the issue. The response adds target_status. - MoveIssueFromPullRequests replaces CompleteIssueFromPullRequests and writes the target status. The target is resolved through the delivery's shared catalog read (Resolver.WritableCategory). An archived or unknown choice, or a failed read, fails closed to no write. - Close intent is no longer synced or read. The column stays. - Migration 551 pins "none" on existing workspaces whose history shows a merge never moved every issue: auto-complete switched off, or a linked PR whose merges were not all keyword merges. Workspaces with no links, or with only keyword merges, keep the Done default. Replays are harmless. - CLI: `multica issue pr-automation <id> on|off` lets an agent keep one issue where it is. The multica-platform skill describes the new rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]> * feat(views): choose the status merged PRs move an issue to on the GitHub page (MUL-7726) - Settings → Integrations → GitHub → Features: "After PRs merge, move the issue to" picks Don't change, or a started or done status, custom ones included and Blocked excluded. It replaces the read-only auto-complete row. The self-hosted Git page shows the same setting. The statuses page drops its switch, and a badge on the target status now links to the setting. - Issue sidebar: the line under the PR list names the target status ("Moves to In Review when #19 merges"). It says nothing when the workspace leaves status alone, when the issue already has the target, or on an older backend's no_close_intent. The per-issue switch reads "Keep status when PRs merge" and is hidden when it would change nothing. The menu opens the GitHub setting. The link hint only shows while auto-link is on. - core: derivePRMergeStatus replaces derivePRAutoCompleteEnabled; the auto_complete schema adds target_status and the at_target state. - Copy in 5 languages. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]> * docs: describe the workspace-chosen status for merged PRs (MUL-7726) GitHub integration, self-hosted Git, issues and environment variable pages (4-5 languages) now say that the workspace picks what a merge does: Done by default, another started or done status, or no change. They also say that a closing keyword only links, and how to keep one issue's status. The troubleshooting entries explain what a missing line under the PR list means. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]> * refactor(pr): keep the merge automation out of agents' instructions (MUL-7726) Agents don't act on what a merge does to an issue, so they don't need a command for it or a rule to learn. Drop `multica issue pr-automation`, and cut the multica-platform skill down to how PRs get linked: no merge rule, no auto_complete field guide, no "the server moves it to done" note. People still keep one issue's status from its Pull requests menu, and the docs now point there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]> * fix(pr): keep the retired auto-complete switch working for old desktop clients (MUL-7726) Review of #8862: an admin on a desktop client from before this change can still flip "Complete issues when their PRs merge". The client saved pr_auto_complete_enabled = false, and the save looked successful, but the server only read pr_merge_status, so merges kept moving issues to Done. - Settings writes: a flip of the retired switch becomes a choice (off → none, on → Done). An old client that echoes a chosen target without flipping the switch leaves the target alone. Every write mirrors the switch from the effective choice (false for none, absent otherwise), so old clients show the right state. - Reads: without pr_merge_status, the retired switch decides (off → none, else Done), on the server and in derivePRMergeStatus. This also covers settings written by a pod that predates the change during rollout. - Migration 551 sets the switch off on the workspaces it pins to none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: multica-agent <[email protected]>
90 lines
3.0 KiB
TypeScript
90 lines
3.0 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { deriveGitHubSettings, derivePRMergeStatus } from "./settings";
|
|
import type { Workspace } from "../types";
|
|
|
|
function ws(settings: Record<string, unknown>): Pick<Workspace, "settings"> {
|
|
return { settings };
|
|
}
|
|
|
|
describe("deriveGitHubSettings", () => {
|
|
it("defaults every flag to true when workspace is null", () => {
|
|
expect(deriveGitHubSettings(null)).toEqual({
|
|
enabled: true,
|
|
prSidebar: true,
|
|
coAuthor: true,
|
|
autoLinkPRs: true,
|
|
});
|
|
});
|
|
|
|
it("defaults every flag to true on empty settings", () => {
|
|
expect(deriveGitHubSettings(ws({}))).toEqual({
|
|
enabled: true,
|
|
prSidebar: true,
|
|
coAuthor: true,
|
|
autoLinkPRs: true,
|
|
});
|
|
});
|
|
|
|
it("master switch off forces every dependent flag off", () => {
|
|
const got = deriveGitHubSettings(
|
|
ws({
|
|
github_enabled: false,
|
|
github_pr_sidebar_enabled: true,
|
|
co_authored_by_enabled: true,
|
|
github_auto_link_prs_enabled: true,
|
|
}),
|
|
);
|
|
expect(got).toEqual({
|
|
enabled: false,
|
|
prSidebar: false,
|
|
coAuthor: false,
|
|
autoLinkPRs: false,
|
|
});
|
|
});
|
|
|
|
it("each sub-flag can be flipped independently when master is on", () => {
|
|
expect(
|
|
deriveGitHubSettings(ws({ github_pr_sidebar_enabled: false })),
|
|
).toMatchObject({ enabled: true, prSidebar: false, coAuthor: true, autoLinkPRs: true });
|
|
|
|
expect(
|
|
deriveGitHubSettings(ws({ co_authored_by_enabled: false })),
|
|
).toMatchObject({ enabled: true, prSidebar: true, coAuthor: false, autoLinkPRs: true });
|
|
|
|
expect(
|
|
deriveGitHubSettings(ws({ github_auto_link_prs_enabled: false })),
|
|
).toMatchObject({ enabled: true, prSidebar: true, coAuthor: true, autoLinkPRs: false });
|
|
});
|
|
|
|
it("treats non-false values (true, null, missing) as enabled", () => {
|
|
expect(
|
|
deriveGitHubSettings(
|
|
ws({ github_enabled: true, github_pr_sidebar_enabled: null }),
|
|
),
|
|
).toMatchObject({ enabled: true, prSidebar: true });
|
|
});
|
|
});
|
|
|
|
describe("derivePRMergeStatus", () => {
|
|
it("defaults to Done and reads the chosen key", () => {
|
|
expect(derivePRMergeStatus(null)).toBe("done");
|
|
expect(derivePRMergeStatus(ws({}))).toBe("done");
|
|
expect(derivePRMergeStatus(ws({ pr_merge_status: "none" }))).toBe("none");
|
|
expect(derivePRMergeStatus(ws({ pr_merge_status: " In_Review " }))).toBe("in_review");
|
|
});
|
|
|
|
it("fails closed on a malformed value", () => {
|
|
expect(derivePRMergeStatus(ws({ pr_merge_status: "" }))).toBe("none");
|
|
expect(derivePRMergeStatus(ws({ pr_merge_status: 5 }))).toBe("none");
|
|
});
|
|
|
|
it("follows the retired switch only when no status is chosen", () => {
|
|
expect(derivePRMergeStatus(ws({ pr_auto_complete_enabled: false }))).toBe("none");
|
|
expect(derivePRMergeStatus(ws({ pr_auto_complete_enabled: false, pr_merge_status: "in_review" }))).toBe("in_review");
|
|
});
|
|
|
|
it("ignores the GitHub master switch", () => {
|
|
expect(derivePRMergeStatus(ws({ github_enabled: false }))).toBe("done");
|
|
});
|
|
});
|