refactor: trigger config migration cleanup#636
Merged
zbigniewsobiecki merged 3 commits intodevfrom Mar 7, 2026
Merged
Conversation
…and harden - Add `checkTriggerEnabledWithParams()` to combine enabled check + parameter fetch in a single DB call (eliminates double query in check-suite-success and pr-opened handlers) - Extract `evaluateAuthorMode()` into `src/triggers/github/utils.ts` to deduplicate ~25 lines of authorMode gating logic across two handlers, with proper validation against ['own', 'external', 'all'] and fallback - Switch pr-ready-to-merge and pr-merged from direct `isTriggerEnabled()` to shared `checkTriggerEnabled()` helper for consistent logging - Add debug log for no-@mention path in pr-comment-mention - Remove ~1900 lines of legacy trigger config schemas and tests - Add disabled-trigger + argument verification tests to all 13 handler test files for complete coverage of the DB-driven trigger config path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Config toggle tests were using legacy `project_integrations.triggers` JSON which is no longer consulted. Updated to: - Seed `agent_trigger_configs` rows with `enabled: false` for disable tests - Test via `handle()` (which checks DB config) instead of `matches()` - Add `seedTriggerConfig` helper and include table in truncateAll Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-migration cleanup for the DB-driven trigger config system. Addresses quality issues found during code review:
checkTriggerEnabledWithParams()that fetches enabled state + parameters in a singlegetResolvedTriggerConfig()call. Used bycheck-suite-successandpr-openedhandlers.evaluateAuthorMode()intosrc/triggers/github/utils.ts, replacing ~25 duplicated lines across two handlers. Includes proper validation against['own', 'external', 'all']with fallback to'own'.pr-ready-to-mergeandpr-mergedfrom directisTriggerEnabled()to the sharedcheckTriggerEnabled()helper for uniform logging.pr-comment-mention.toHaveBeenCalledWithargument verification tests to all 13 handler test files.Changes
src/triggers/shared/trigger-check.tscheckTriggerEnabledWithParams()src/triggers/github/utils.tsevaluateAuthorMode()checkTriggerEnabledusagesrc/config/schema.ts,triggerConfig.ts,configMapper.ts, etc.Test plan
npm run typecheck— cleannpm run lint— cleannpm test— 3762 tests passingcheckTriggerEnabledWithParamsargument verification in check-suite-success and pr-opened tests🤖 Generated with Claude Code