Skip to content

feat(trello): route custom mapped lists to workflow-definition agents#1375

Merged
aaight merged 2 commits into
devfrom
feat/trello-custom-status-trigger
May 18, 2026
Merged

feat(trello): route custom mapped lists to workflow-definition agents#1375
aaight merged 2 commits into
devfrom
feat/trello-custom-status-trigger

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented May 18, 2026

Summary

Adds a new TrelloCustomStatusChangedTrigger that fires when a card is created or moved into a Trello list mapped under a custom (non-built-in) workflow status key, and updates ReadyToProcessLabelTrigger so ready-to-process labels on custom-mapped lists dispatch the correct custom agent. Mirrors the JIRA equivalent shipped in MNG-1066 (#1373).

Issue: https://linear.app/mongrel/issue/MNG-1067

Changes

Backend

  • src/triggers/trello/status-changed.ts
    • Adds TrelloCustomStatusChangedTrigger class beside the existing per-list factory instances.
    • matches() claims only createCard / updateCard events whose destination list ID is mapped under a CUSTOM workflow status key (built-in keys are filtered via BUILTIN_WORKFLOW_STATUS_KEYS so the existing per-list triggers stay authoritative for splitting/planning/todo/backlog/merged, and the other built-ins — inProgress/inReview/done/alerts/friction — naturally short-circuit because they have no agentType).
    • handle() resolves the agent via resolvePMStatusAgentByIdFromWorkflowDefinitions, preserves the existing trigger enablement, onCreate / onMove gating, pipeline capacity gate, coalesce key (projectId:cardId), URL/title extraction, and logging conventions.
  • src/triggers/trello/label-added.ts
    • Replaces resolvePMLabelAgentByList (built-in-only) with resolvePMLabelAgentByStatusIdFromWorkflowDefinitions so ready-to-process labels on custom-mapped lists resolve to their custom agent type. Logs the matched cascadeStatus for parity with the JIRA equivalent.
  • src/integrations/pm/trello/manifest.ts + src/triggers/trello/register.ts
    • Register TrelloCustomStatusChangedTrigger after the five built-in status triggers and before the ready-label trigger, keeping TrelloStatusChangedMergedTrigger (snapshot invalidation + backlog-manager retrigger) unchanged.

Tests

  • New tests/unit/triggers/trello-custom-status-changed.test.ts (18 tests) covers: matches for custom keys, exclusion of built-in keys, exclusion of unmapped lists and no-op moves, full custom dispatch shape, custom on-create dispatch, custom agent lookup, onCreate/onMove gating, no-agent / no-match / disabled-trigger fallthrough, and missing-card-id handling.
  • Extends tests/unit/triggers/label-added.test.ts with a 5-test custom workflow status mapping block: dispatch, no-agent slot, missing definition, enablement call site, and disabled-trigger path.
  • Updates tests/unit/triggers/builtins.test.ts to register the new trigger via the mocked PM registry, bump the expected handler count to 26, and pin the registration order (after trello-status-changed-merged, before ready-to-process-label).
  • Existing tests (status-changed.test.ts, merged-status-changed.test.ts, builtins-uniqueness.test.ts) still pass — merged-trigger snapshot-invalidation behavior is preserved.

Acceptance Criteria

  • TrelloCustomStatusChangedTrigger matches createCard and updateCard events whose destination list is mapped under a custom workflow status key.
  • The custom status trigger resolves custom agents via workflow status definitions and skips statuses with no agentType.
  • The custom status trigger preserves existing trigger enablement, onCreate/onMove parameter, capacity gate, coalesce key, and work item metadata behavior.
  • ReadyToProcessLabelTrigger dispatches custom agents when the fetched card idList maps to a custom workflow status.
  • Trello manifest and legacy registration include the new trigger after built-in status triggers and before the ready-label trigger.
  • Unit tests cover custom status-change dispatch, custom ready-label dispatch, no-agent/no-match behavior, and merged trigger preservation.

Test plan

  • `npm test` — 9673 unit tests pass
  • `npm run lint` — no new lint errors (existing warnings in unrelated files)
  • `npm run typecheck` — clean
  • `npx vitest run --project unit-core tests/unit/integrations/pm-conformance.test.ts` — manifest conformance still passes

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

@nhopeatall
Copy link
Copy Markdown
Collaborator

👀 On it — checking the PR #1375 changes

🕵️ run details

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/triggers/trello/status-changed.ts 96.36% 4 Missing ⚠️
src/triggers/trello/register.ts 0.00% 1 Missing ⚠️

📢 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 Trello custom status trigger follows the existing PM status-dispatch shape, preserves built-in/merged handling through registration and match filtering, and the ready-label resolver now covers custom workflow definitions without breaking the existing splitting/planning/todo paths. I also ran the focused Trello trigger and manifest unit suites locally.

🕵️ codex · gpt-5.5 · run details

@aaight aaight merged commit a64644a 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