Skip to content

fix(dashboard): fix review trigger toggles showing under PM section#501

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/review-trigger-pm-section
Feb 23, 2026
Merged

fix(dashboard): fix review trigger toggles showing under PM section#501
zbigniewsobiecki merged 1 commit intodevfrom
fix/review-trigger-pm-section

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Feb 23, 2026

Summary

  • Bug fix: getTriggersForAgent() now accepts an optional opts parameter with category filter, preventing SCM-only triggers (Own PRs Only, External PRs, On Review Requested) from bleeding into the "Project Management Triggers" UI section for the Review agent
  • Secondary bug fix: handleSaveScm in AgentSection now uses extractRelevantTriggers() for proper dot-notation key nesting (e.g., reviewTrigger.ownPrsOnly) instead of flat key lookup that would corrupt saved data
  • Unit tests: New test file tests/unit/web/triggerAgentMapping.test.ts covering category filtering and backward compatibility

Changes

  • web/src/lib/trigger-agent-mapping.ts: Updated getTriggersForAgent signature from (agentType, pmProvider?) to (agentType, opts?) with optional category and pmProvider fields
  • web/src/components/projects/project-agent-configs.tsx: Updated PM trigger query to pass { pmProvider, category: 'pm' }, SCM trigger query to pass { category: 'scm' }, and handleSaveScm to use extractRelevantTriggers()
  • tests/unit/web/triggerAgentMapping.test.ts: New test file with 9 tests

Test plan

  • getTriggersForAgent('review', { category: 'pm' }) returns empty array
  • getTriggersForAgent('review', { category: 'scm' }) returns 3 review triggers
  • getTriggersForAgent('briefing', { category: 'pm', pmProvider: 'trello' }) returns PM-only triggers
  • getTriggersForAgent('briefing', { category: 'scm' }) returns empty array
  • Backward compatibility: getTriggersForAgent('review') without opts still returns all triggers
  • All 9 unit tests pass
  • Lint clean, typecheck passes

Card: https://trello.com/c/RLtfQJeE/88-fix-review-trigger-toggles-showing-under-pm-section-in-dashboard

🤖 Generated with Claude Code

@nhopeatall
Copy link
Copy Markdown
Collaborator

🔍 Reviewing PR...

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 — Clean, well-scoped bug fix with good test coverage.

Bug 1 (PM section bleed): The old getTriggersForAgent('review', pmProvider) only filtered by pmProvider, so review SCM triggers (which have no pmProvider) passed through unconditionally and appeared in the "Project Management Triggers" UI. Adding category filtering to the function and passing { category: 'pm' } / { category: 'scm' } from the call sites cleanly resolves this.

Bug 2 (flat key save corruption): handleSaveScm previously used relevant[t.key] = ... which would save dot-notation keys like reviewTrigger.ownPrsOnly as flat string keys rather than the expected nested { reviewTrigger: { ownPrsOnly: ... } } structure. Switching to the existing extractRelevantTriggers() helper (already used by handleSavePm) fixes the data shape.

Backward compatibility: When opts is omitted, both new filter conditions short-circuit (optional chaining on undefined), so unparameterized calls return all triggers as before. The test suite verifies this explicitly.

All 9 unit tests are well-structured and CI is green.

@zbigniewsobiecki zbigniewsobiecki merged commit a4189fe into dev Feb 23, 2026
5 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.

3 participants