Skip to content

fix(connector-linear-webhook): robust state normalization for webhook payloads - #127

Merged
c-h- merged 2 commits into
mainfrom
fix/linear-webhook-state-normalization
Mar 13, 2026
Merged

c-h- merged 2 commits into
mainfrom
fix/linear-webhook-state-normalization

Conversation

@c-h-

@c-h- c-h- commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Linear webhook Issue update payloads may send data.state as an object {id, name, type}, a plain string, or updatedFrom may only include stateId without a nested state object
  • Added resolveStateName() helper that extracts the state name from any of these shapes, falling back to "Unknown" when unavailable
  • State change detection now triggers on updatedFrom.stateId in addition to updatedFrom.state, so route filters like payload.new_state: Todo work correctly

Test plan

  • New test: updatedFrom with only stateId → detects state change, new_state uses name not ID, previous_state = "Unknown"
  • New test: state as object with {id, name, type} (real webhook shape)
  • New test: state as plain string
  • New test: state object missing name field → fallback to "Unknown"
  • All 33 existing tests pass
  • pnpm typecheck clean
  • pnpm lint clean

🤖 Generated with Claude Code

… payloads

Linear webhook Issue update payloads may send state as an object with
{id, name, type}, a plain string, or only a stateId in updatedFrom
without a nested state object. The previous code assumed state was
always an object with .name, which missed stateId-only changes and
could fail on string values.

Add resolveStateName() helper that handles object-with-name, plain
string, and null/undefined (falls back to "Unknown"). Detect state
changes via updatedFrom.stateId in addition to updatedFrom.state.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@c-h-
c-h- enabled auto-merge (squash) March 13, 2026 23:39
@c-h-
c-h- merged commit 9543c77 into main Mar 13, 2026
1 check passed
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