Files
multica/server/migrations/545_pr_auto_complete.up.sql
9df0cae78a MUL-7429: complete issues when every linked PR merges (#8758)
* feat(pr): complete issues when every linked PR merges (MUL-7429)

Title/branch identifiers link a PR; keywords and the body no longer matter.
Completion is evaluated only on a PR event for the issue (merge, link,
unlink), so settings changes and reopening never complete an issue.
Adds manual link/unlink with remembered exclusions and a per-issue
auto-complete switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: multica-agent <[email protected]>

* feat(pr): issue-page PR automation and single auto-complete setting (MUL-7429)

The issue's Pull requests section says what the merge rule will do next,
links a PR by URL, removes one per row, and turns auto-complete off for
that issue. The workspace switch lives under Issue statuses; the GitHub
page reports it. Agent skill and docs describe the title/branch rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: multica-agent <[email protected]>

* fix(pr): accept PR links pasted without a scheme (MUL-7429)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: multica-agent <[email protected]>

* test(skills): pin the PR auto-complete contract in the platform skill (MUL-7429)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: multica-agent <[email protected]>

* fix(pr): re-check linked PRs at the completion write; skip stale GitHub events (MUL-7429)

The status write now requires every linked PR to still be merged when it
runs, so a PR linked between the decision and the write keeps the issue
open. GitHub PR upserts ignore events older than the stored row, like the
self-hosted path, so a late delivery cannot roll a merged PR back to open
and turn a redelivered merge into a new one.

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]>
2026-09-24 02:58:19 +08:00

31 lines
1.2 KiB
SQL

-- PR auto-complete (MUL-7429). Two small per-issue records:
--
-- issue_pr_automation: an explicit "do not auto-complete this issue from PR
-- merges" choice. Absent row = follow the workspace setting.
--
-- issue_pull_request_exclusion: a PR a person removed from an issue. The
-- webhook must not re-link it from the title/branch on the next delivery.
-- pull_request_id points at github_pull_request or vcs_pull_request (both use
-- uuid ids).
--
-- No foreign keys: issue and workspace deletion are application-owned and
-- sweep both tables explicitly (DeleteIssue, DeleteWorkspaceData).
CREATE TABLE IF NOT EXISTS issue_pr_automation (
issue_id UUID PRIMARY KEY,
workspace_id UUID NOT NULL,
auto_complete_disabled BOOLEAN NOT NULL DEFAULT FALSE,
updated_by_type TEXT,
updated_by_id UUID,
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE IF NOT EXISTS issue_pull_request_exclusion (
issue_id UUID NOT NULL,
pull_request_id UUID NOT NULL,
workspace_id UUID NOT NULL,
excluded_by_type TEXT,
excluded_by_id UUID,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (issue_id, pull_request_id)
);