fix(dashboard): fix review trigger toggles showing under PM section#501
fix(dashboard): fix review trigger toggles showing under PM section#501zbigniewsobiecki merged 1 commit intodevfrom
Conversation
|
🔍 Reviewing PR... |
nhopeatall
left a comment
There was a problem hiding this comment.
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.
Summary
getTriggersForAgent()now accepts an optionaloptsparameter withcategoryfilter, preventing SCM-only triggers (Own PRs Only, External PRs, On Review Requested) from bleeding into the "Project Management Triggers" UI section for the Review agenthandleSaveScminAgentSectionnow usesextractRelevantTriggers()for proper dot-notation key nesting (e.g.,reviewTrigger.ownPrsOnly) instead of flat key lookup that would corrupt saved datatests/unit/web/triggerAgentMapping.test.tscovering category filtering and backward compatibilityChanges
web/src/lib/trigger-agent-mapping.ts: UpdatedgetTriggersForAgentsignature from(agentType, pmProvider?)to(agentType, opts?)with optionalcategoryandpmProviderfieldsweb/src/components/projects/project-agent-configs.tsx: Updated PM trigger query to pass{ pmProvider, category: 'pm' }, SCM trigger query to pass{ category: 'scm' }, andhandleSaveScmto useextractRelevantTriggers()tests/unit/web/triggerAgentMapping.test.ts: New test file with 9 testsTest plan
getTriggersForAgent('review', { category: 'pm' })returns empty arraygetTriggersForAgent('review', { category: 'scm' })returns 3 review triggersgetTriggersForAgent('briefing', { category: 'pm', pmProvider: 'trello' })returns PM-only triggersgetTriggersForAgent('briefing', { category: 'scm' })returns empty arraygetTriggersForAgent('review')without opts still returns all triggersCard: https://trello.com/c/RLtfQJeE/88-fix-review-trigger-toggles-showing-under-pm-section-in-dashboard
🤖 Generated with Claude Code