Skip to content

fix(POR-22636): resolve null comment initiatorType in public API responses - #1408

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/por-22636-cursor-automated-triage-response-d4e5
Draft

fix(POR-22636): resolve null comment initiatorType in public API responses#1408
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/por-22636-cursor-automated-triage-response-d4e5

Conversation

@cursor

@cursor cursor Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Add CommentService.resolveCommentInitiatorTypes() to infer initiatorType for legacy comments with null values
  • Resolve initiator type before serializing public comment API responses (list/get/delete)
  • Resolve initiator type before dispatching comment.created webhooks
  • Make createdByUserType and uploadedByUserType required (non-null) in public DTOs

Testing Criteria

  • Unit tests for resolveCommentInitiatorTypes covering: already-set type, IU list resolution, client list resolution, and API fallback when not in bulk lists
  • yarn test src/app/api/comments/comment.service.resolve-initiator-type.test.ts — all 4 tests pass

Notes

  • Root cause: legacy comments have initiatorType: null in DB (added as optional in migration 20250227112916). Public API was returning createdByUserType: null, which the Copilot platform rejects.
  • Manual follow-up: run yarn cmd:backfill-initiatorType-in-comments to persist resolved types in DB for remaining legacy rows.

Impact & Surface Area of Change

  • Public comments API (GET/DELETE /api/comments/public)
  • comment.created webhook payloads
  • Public attachment serialization within comments (uses same initiator type)
Open in Web View Automation 

priosshrsth and others added 2 commits August 7, 2026 10:33
…1397)

deleteLabel passed `id: currentLabel?.id` straight into label.delete, so when
findFirst matched nothing Prisma got `{ id: undefined }` and threw
PrismaClientValidationError, failing the whole delete transaction. Return early
instead.
…onses

Legacy comments can have null initiatorType in the database. The public
comment serializer was passing this through as createdByUserType: null,
which the Copilot platform rejects with 'required field createdByUserType
is nil'.

Resolve initiator type from workspace user lists (with API fallback)
before serializing public comments and comment.created webhooks.

Co-authored-by: Neil Raina <makeitraina@users.noreply.github.com>
@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown

POR-22636

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tasks-app Error Error Aug 21, 2026 8:54pm

Request Review

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.

2 participants