Skip to content

S63: POST /issues honors labels/assignees/milestone (B3)#304

Merged
espadonne merged 2 commits into
trunkfrom
s63/issue-create-fields
May 17, 2026
Merged

S63: POST /issues honors labels/assignees/milestone (B3)#304
espadonne merged 2 commits into
trunkfrom
s63/issue-create-fields

Conversation

@espadonne
Copy link
Copy Markdown
Contributor

Summary

Closes B-audit finding B3: POST /api/v1/repos/{o}/{r}/issues was dropping labels[], assignees[], and milestone even when the CLI sent them, forcing a follow-up PATCH for any non-trivial issue create.

  • Extend issueCreateRequest with labels, assignees, milestone.
  • Resolve label names + assignee usernames + milestone id before the issue row is written, so a typo'd reference 422s without leaving a half-created issue.
  • After issues.Create() succeeds, apply each via the same helpers the PATCH path uses (ApplyLabels, AssignUser, AssignMilestone).
  • Re-fetch through GetIssueByID so the response reflects the final state.
  • Policy: anyone who can create an issue can set its initial labels/assignees/milestone — matches gh's POST /repos/{}/{}/issues behavior. PATCH-time gates (ActionIssueLabel, ActionIssueAssign) still apply on later edits.

Test plan

  • TestIssues_CreateWithLabelsAssigneesMilestone — happy path, asserts response labels + DB-side assignee row + DB-side milestone id.
  • TestIssues_CreateUnknownLabelRejected — 422 on bad label name + no issue inserted.
  • Full TestIssues suite still green against the integration DB.
  • golangci-lint run ./internal/web/handlers/api/... — 0 issues.

@espadonne espadonne force-pushed the s63/issue-create-fields branch from 4bdc6f0 to 07df9c9 Compare May 17, 2026 19:11
@espadonne espadonne merged commit 8f68c81 into trunk May 17, 2026
1 check passed
@espadonne espadonne deleted the s63/issue-create-fields branch May 17, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant