Skip to content

feat(triggers): onCreate/onMove params for pm:status-changed#1144

Closed
zbigniewsobiecki wants to merge 1 commit intofeature/pm-triggers-created-statusfrom
feature/pm-status-changed-onCreate-onMove-params
Closed

feat(triggers): onCreate/onMove params for pm:status-changed#1144
zbigniewsobiecki wants to merge 1 commit intofeature/pm-triggers-created-statusfrom
feature/pm-status-changed-onCreate-onMove-params

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Follow-up on top of #1141. Makes the create-path firing that #1141 added for Linear/JIRA independently configurable per agent, and preserves pre-#1141 behavior as the default.

Two new boolean params on pm:status-changed

Param YAML default Semantics
onMove true Fire when a work item is moved into a configured status.
onCreate false Fire when a work item is created directly in a configured status.

Defaults by provider (preserved)

  • Linear & JIRA — default onCreate: false. Users who want the create-path fire agents must opt in via dashboard checkbox or cascade projects trigger-set --params '{"onCreate":true}'. This preserves pre-feat(triggers): support PM triggers for work items created directly in a triggering status #1141 behavior.
  • Trello — historical behavior was fire-on-both. Migration 0050 backfills {onCreate: true, onMove: true} into every existing Trello project's enabled pm:status-changed row. Idempotent, preserves user-set keys via JSONB || operator.

Zero UI / CLI code

Rides on the existing declarative trigger-param pipeline:

  • TriggerParameterInput already renders type: boolean params as checkboxes (web).
  • cascade projects trigger-set --params already accepts flat primitive JSON.
  • cascade projects trigger-discover auto-prints the new params from YAML.

Review-addressed issues from PR #1141

  1. Silent behavior change → now explicitly configurable, with provider-aware defaults preserved via migration.
  2. matches() asymmetry → create path now pre-filters on status presence (Linear: data.stateId; JIRA: issue.fields.status.name), mirroring update path.
  3. Lost fromStatus log → restored on JIRA update path; explicitly omitted on create path (no from).
  4. Test helper smell → JIRA buildCtx ternary de-duplicated; the redundant manual issue override dropped.
  5. Handler complexity → extracted resolveAgentType and shouldFireOnEvent helpers to keep biome's cognitive-complexity warnings at bay.

Shape of changes

  • src/agents/definitions/{splitting,planning,implementation,backlog-manager}.yaml — add onCreate + onMove params to each pm:status-changed entry.
  • src/triggers/{linear,jira,trello}/status-changed.ts — switch to checkTriggerEnabledWithParams, gate create/move branches on params, tighten create matches().
  • src/db/migrations/0050_trello_status_changed_on_create_backfill.sql — backfill existing Trello projects.
  • tests/unit/triggers/{linear,jira,status,merged}-status-changed.test.ts — matrix tests for (onCreate × onMove) × (create × move).
  • tests/integration/db/trelloStatusChangedBackfill.test.ts — 7 tests exercising the migration (Trello backfill, Linear/JIRA untouched, idempotent, preserves user-set keys).

Test run

  • Unit: 7914 / 7914 passing
  • Integration: 531 / 531 passing (including 7 new backfill tests)
  • Lint + typecheck: clean

Test plan

🤖 Generated with Claude Code

Make the create-path firing (added by PR #1141) independently configurable
per agent via the existing declarative YAML/CLI/dashboard pipeline.

Two boolean params on pm:status-changed:
- onMove   (default true)  — fire when an item is moved into the status
- onCreate (default false) — fire when an item is created in the status

Linear and JIRA: preserve pre-#1141 behavior by default; users opt in
explicitly. Trello: data migration backfills onCreate=true for existing
projects so fire-on-create keeps working without silent regression.

Also tightens create-path matches() to require status presence, restores
fromStatus in JIRA update-path log, de-dups the JIRA test helper's
ternary, and extracts resolveAgentType/shouldFireOnEvent helpers to keep
handler complexity in check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 97.34513% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/triggers/jira/status-changed.ts 94.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@zbigniewsobiecki zbigniewsobiecki deleted the branch feature/pm-triggers-created-status April 18, 2026 12:54
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