fix(linear): route comment webhooks with project scope#1157
Conversation
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — Clean, well-tested bug fix for three real Linear webhook routing issues. Each fix is correctly scoped and follows existing codebase patterns.
What the PR does well:
-
Nested
teamIdextraction (data.issue.teamIdfallback) — correctly handles Linear Comment/IssueLabel webhooks that don't repeatteamIdat the data root. -
Project scope fetch fallback — when the payload omits
projectId/project, the adapter fetches it via a newlinearClient.getIssueProjectId()GraphQL query, with proper credential resolution and error handling. The fallback is narrowly scoped to comment events only, which is appropriate. -
Plain
@handlemention matching — thehasMentionfunction now checks stable bot identity aliases (name, displayName, email local-part) in addition to UUID substring matching. The regex/@([A-Za-z0-9._-]+)/gcorrectly ignores Linear's@[Display Name](uuid)markdown syntax since[isn't in the character class. -
resolveLinearBotIdentity— widens the cached viewer query to fetchname,email,displayNamealongsideid. The existingresolveLinearBotUserIdcorrectly delegates to the new function, and theisSelfAuthoredpath in the adapter continues to use the ID-only version. -
Test coverage is thorough — 87 tests pass across the 4 changed test files, covering nested teamId routing, project fetch fallback, identity caching, alias matching (including email local-part edge case), and null/error paths. The PM conformance harness (72 passing) confirms no regressions.
🕵️ claude-code · claude-opus-4-6 · run details
Summary
data.issue, includingteamIdand project scope resolution.@handlecomment mentions alongside Linear UUID-style mentions.Test Plan
npm testvianpm run verify)npm run lintvianpm run verify)npm run typecheckvianpm run verify)npm run test:fast -- --changed origin/dev)@cascadequeued the respond-to-feedback flow and posted the expected acknowledgement.Checklist