Merge dev to main: worker-side PM webhook project fix (third Linear shadow)#1341
Merged
Conversation
Third bug in the Linear router-shadow chain. PR #1332 fixed parseWebhook; PR #1337 fixed resolveProject; this PR fixes the WORKER-side re-resolution that overrode both router fixes. Flow before this PR: 1. Router parseWebhook → selects ucho (correct after #1332) 2. Router resolveProject → uses event.projectId (correct after #1337) 3. Router buildJob → embeds projectId=ucho in the LinearJob ✅ 4. Job enqueued 5. Worker picks up job, calls processLinearWebhook(payload, ...) — WITHOUT forwarding jobData.projectId ❌ 6. processPMWebhook calls integration.lookupProject(event.projectIdentifier) — which does loadProjectConfigByLinearTeamId(teamId) and returns the FIRST cascade project sharing the team. Returns "cascade" instead of "ucho". ❌ Live evidence 2026-05-11 after deploys at 09:55Z and 11:30:58Z (both router fixes live): webhook ddcee404 had data.projectId 7108c72e (ucho scope), webhook log showed projectId=ucho with "Coalesced dispatch scheduled". But the resulting run 5aa8f137 had projectId=cascade and cloned mongrel-intelligence/cascade. Worker re-resolved. Fix: pass jobData.projectId through the chain: worker-entry → process{Trello,Jira,Linear}Webhook → processPMWebhook as a new `preferredProjectId` parameter. processPMWebhook now uses loadProjectConfigById(preferredProjectId) when set, falling back to integration.lookupProject for legacy callers that do not pass it. Trello / JIRA threading is defensive (their discriminators are naturally unique per cascade project so no current shadow), but the symmetric signature keeps the architecture consistent and future- proofs against multi-cascade-project-per-discriminator configs. Tests: - tests/unit/pm/webhook-handler.test.ts: new describe block "preferredProjectId (router-selected project)" with 4 scenarios: uses loadProjectConfigById when set, withCredentials receives the router-selected project.id, falls back to lookupProject when unset, fail-closes when preferredProjectId resolves to nothing. - tests/unit/worker-entry.test.ts: updated 9 existing call-shape assertions to include the new projectId trailing arg. Full suite (9311 unit tests) clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…resolveProject-shadow fix(worker): use router-selected project in PM webhook handlers
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
processPMWebhook). The worker was callingintegration.lookupProject(teamId)instead of usingjobData.projectId, re-introducing the.find()first-match shadow despite the router selecting the correct project. PassespreferredProjectIdthrough worker → process{Trello,Jira,Linear}Webhook →processPMWebhook→loadProjectConfigById.Test plan
zbigniewsobiecki/ucho(full end-to-end fix at last)🤖 Generated with Claude Code