MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-108

2.4.10 Link management in the create modal (Linked issues at create time)

Done
Description

Estimate: 14m · Depends on: 2.4.8, 2.4.9

Closes a real design-vs-built gap: create.pen designs a "Linked issues" section in the CREATE modal (a relationship-kind chip + a linked row + "Add link" + "Choose a relationship") but it was never built — 2.3.3/2.3.4 shipped the modal without it. This adds it, designed in 2.4.8's links.mock.html (panel 5) and reusing 2.4.9's AddLink control (kind selector + issue-search Combobox + remove) — NO parallel control.

The one real difference from 2.4.9 (why it's its own subtask): at create the issue has no id yet, so chosen links can't be written immediately. They are collected in the modal's form state (rendered as pending rows with a relationship-kind chip) and written WHEN the issue is created — inside createWorkItem's existing $transaction, right after the item insert, atomically with it (issue + links commit or roll back together). Extend CreateWorkItemInput with a links: {toId, kind}[]; createWorkItem writes the work_item_link rows via the same repo + trigger backstop (reciprocal relates_to handled as in 1.4.4); createIssueAction threads the collected links. Cycle is validated on create (the new id exists by then); self-link is impossible (no id to self-link); duplicate is prevented in the pending list. Edit-page + detail-panel adds stay 2.4.9 (immediate write).

Acceptance criteria

  • From the create modal, add one+ links of various kinds via the combobox → they show as PENDING rows (kind chip + icon · id · title + remove); removing a pending row before Create drops it (nothing written).
  • Creating the issue writes the links ATOMICALLY with it (one transaction — issue + links succeed or fail together); the links then appear on the new issue's detail relationships panel + re-judge its readiness.
  • Reuses 2.4.9's AddLink control + the gated service (no raw Prisma, no parallel control); a cycle / cross-workspace target is rejected on create with an inline error, and the issue is NOT created (or is created without the bad link — decide: reject the whole submit, surfaced inline).
  • Vitest (real PG): createWorkItem with links writes them in the same tx + rolls back on a bad link; a component test for the modal's pending-link collect/remove; shell-a11y stays green (the modal combobox reuses 2.3.4 a11y).

Context refs

  • design/work-items/links.mock.html panel 5 + design-notes.md "Create modal — Linked issues" (2.4.8 — REQUIRED)
  • 2.4.9's AddLink control + createLinkAction (reuse, don't fork)
  • components/issues/CreateIssueModal.tsx + app/(authed)/issues/actions.ts (createIssueAction, 2.3.3)
  • workItemsService.createWorkItem + linkWorkItems + lib/dto/workItems.ts (CreateWorkItemInput) + lib/dto/workItemLinks.ts
  • The mirror product — Jira's create dialog "Linked issues" row
Status
Done
Type
Sub-task