Compare commits

...

1 Commits

Author SHA1 Message Date
J
a23597de5f fix(slack): allow slack_chat issue origin so /issue can create issues (MUL-3908)
Follow-up to #4780 (the /issue slash command), which merged the code + docs. The DB migration was pushed to that branch after it had already been squash-merged, so it never landed on main — the /issue command still fails at issue creation.

The issue.origin_type CHECK constraint (migration 111) only allowed autopilot / quick_create / lark_chat. Slack stamps origin_type='slack_chat' on every /issue create, so the INSERT trips SQLSTATE 23514 and IssueService.Create fails ("Something went wrong creating the issue"). This also silently broke the pre-existing message-based Slack /issue. Extends the constraint to include 'slack_chat', mirroring 111 (lark_chat). Numbered 131 because 129/130 were taken on main since #4780 branched.

Verified against a real Postgres: full chain up to 131 applies cleanly and an issue insert with origin_type='slack_chat' passes the CHECK after 131 (fails with the pre-131 constraint).

Co-authored-by: multica-agent <github@multica.ai>
2026-07-01 15:14:54 +08:00
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
-- Revert to the pre-slack_chat issue_origin_type_check list. Any existing rows
-- with origin_type='slack_chat' would violate the rolled-back constraint; the
-- down migration assumes the operator has already deleted or relabeled those
-- rows. Kept strict (no DROP NOT VALID dance) to preserve the schema invariant
-- downstream code relies on. Mirrors 111.
ALTER TABLE issue DROP CONSTRAINT IF EXISTS issue_origin_type_check;
ALTER TABLE issue ADD CONSTRAINT issue_origin_type_check
CHECK (origin_type IN ('autopilot', 'quick_create', 'lark_chat'));

View File

@@ -0,0 +1,10 @@
-- Extend issue.origin_type to allow the Slack `/issue` command paths (both the
-- message-prefix form and the slash command) to stamp issues with
-- origin_type='slack_chat'. The Slack integration shipped this origin label
-- (originSlackChat) but no migration ever added it to the CHECK list, so every
-- Slack /issue create tripped SQLSTATE 23514 and IssueService.Create failed —
-- surfaced end-to-end by the /issue slash command (MUL-3908). Mirrors 111
-- (lark_chat), which fixed the identical gap for Lark.
ALTER TABLE issue DROP CONSTRAINT IF EXISTS issue_origin_type_check;
ALTER TABLE issue ADD CONSTRAINT issue_origin_type_check
CHECK (origin_type IN ('autopilot', 'quick_create', 'lark_chat', 'slack_chat'));