Skip to content

connector-linear-webhook: state change events not normalized (updatedFrom.stateId vs updatedFrom.state) #129

@odink-kindo

Description

@odink-kindo

Bug

When Linear sends a webhook payload for an issue state change, updatedFrom contains stateId (a string UUID), not a nested state object:

{
  "action": "update",
  "type": "Issue",
  "updatedFrom": { "stateId": "6737bc0a-cc2e-45c3-9e15-cd68dd7648e5" },
  "data": { "state": { "id": "ddeca416-...", "name": "In Progress", "type": "started" }, ... }
}

The normalizeIssueEvent() method in connector-linear-webhook/dist/source.js checks:

if (updatedFrom.state !== undefined) { ... }

This check fails because the payload has updatedFrom.stateId, not updatedFrom.state. The event falls through to the raw-event builder and produces provenance.platform_event: "issue.update" instead of "issue.state_changed".

Expected

State transitions should be normalized into issue.state_changed events (matching the polling connector's behavior).

Suggested Fix

if (updatedFrom.stateId !== undefined || updatedFrom.state !== undefined) {
  const previousState = updatedFrom.state?.name ?? resolveStateName(updatedFrom.stateId);
  // ...
}

Verified

Tested on @orgloop/connector-linear-webhook@0.1.0 with a real Linear webhook (ENG-8741 moved from Todo → In Progress). OrgLoop emitted source.emit src=linear but the event hit route.no_match because the provenance.platform_event was not issue.state_changed.

Environment

  • @orgloop/connector-linear-webhook@0.1.0
  • @orgloop/connector-linear@0.1.9
  • orgloop@0.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions