Skip to content

feat(jira): route custom mapped statuses through workflow-definition resolvers#1373

Merged
aaight merged 1 commit into
devfrom
feature/MNG-1066-jira-custom-status-trigger
May 18, 2026
Merged

feat(jira): route custom mapped statuses through workflow-definition resolvers#1373
aaight merged 1 commit into
devfrom
feature/MNG-1066-jira-custom-status-trigger

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented May 18, 2026

Summary

Routes JIRA status-change and ready-to-process-label webhooks through the workflow-definition resolver so that custom-mapped JIRA statuses can dispatch their configured agents. Mirrors Linear's existing pattern but uses case-insensitive name matching since JIRA's statuses.<key> config values are display names, not stable IDs.

Closes MNG-1066.

What changed

  • src/triggers/shared/pm-status.ts — Added resolvePMStatusAgentByNameFromWorkflowDefinitions({ statusName, configuredStatuses }), the case-insensitive name-based counterpart of the existing resolvePMStatusAgentByIdFromWorkflowDefinitions. Returns { agentType, cascadeStatus } resolved through resolveWorkflowStatusDefinition so built-in and custom workflow status keys both dispatch correctly.
  • src/triggers/shared/pm-label.ts — Added resolvePMLabelAgentByStatusNameFromWorkflowDefinitions({ statusName, configuredStatuses }) that returns { agentType, cascadeStatus } via the workflow-definition path. The legacy resolvePMLabelAgentByStatusName (returns just agentType) is kept exported for current callers.
  • src/triggers/jira/status-changed.ts — Switched from the legacy hard-coded STATUS_TO_AGENT resolver to the new workflow-definition resolver. JIRA custom statuses like statuses.prd: "PRD Review" now dispatch their configured agent type. Adds cascadeStatus to the info log for parity with Linear.
  • src/triggers/jira/label-added.ts — Same change for the ready-to-process label trigger: when the configured ready label is added to an issue currently in a custom status, the agent registered on that workflow definition fires.

The legacy helpers resolvePMStatusAgentByName, resolvePMStatusAgentById, resolvePMLabelAgentByStatusName, and resolvePMLabelAgentByStatusId remain exported so other call sites (and existing tests) keep working unchanged.

Test plan

  • tests/unit/triggers/shared/pm-status.test.ts — new cases for custom-status resolution, built-in name resolution, status without agent, no-match returning undefined.
  • tests/unit/triggers/shared/pm-label.test.ts — new cases for the JIRA name-based workflow-definition resolver (built-in, custom, no-agent) and for the existing ID-based resolver (Linear).
  • tests/unit/triggers/jira-status-changed.test.ts — new custom workflow status mapping block: custom dispatch, case-insensitive match, no-agent custom status, missing workflow definition, trigger enablement check, custom-status onCreate dispatch.
  • tests/unit/triggers/jira-label-added.test.ts — new custom workflow status mapping block: custom dispatch, case-insensitive match, no-agent custom status, missing workflow definition, trigger enablement, disabled trigger.
  • All existing trigger tests still pass (verified unit-triggers + unit-core suites: 6834 tests pass).
  • Lint and typecheck pass (existing warnings unrelated to this change).

🕵️ claude-code · claude-opus-4-7 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - The Jira status-change and ready-label paths now resolve matched status names through workflow definitions while preserving built-in mappings, case-insensitive Jira matching, and create/move gating. Targeted unit coverage passes locally: 81 tests across the changed resolver and Jira trigger files.

🕵️ codex · gpt-5.5 · run details

@aaight aaight merged commit d92e06a into dev May 18, 2026
9 checks 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.

2 participants