refactor: code review cleanups for trigger system and router#504
Merged
zbigniewsobiecki merged 1 commit intodevfrom Feb 23, 2026
Merged
refactor: code review cleanups for trigger system and router#504zbigniewsobiecki merged 1 commit intodevfrom
zbigniewsobiecki merged 1 commit intodevfrom
Conversation
- Replace 35+ raw console.log/warn/error calls with structured logger across router handlers (github, trello, jira, index, queue) - Create shared JiraWebhookPayload type and STATUS_TO_AGENT constant in src/triggers/jira/types.ts to eliminate duplication across 3 files - Fix Trello card-moved and label-added triggers to return null instead of throwing on missing card ID (consistency with other handlers) - Fix fragile isAgentLogFilename regex that couldn't handle multi-hyphen agent names like respond-to-review - Extract shared withPMCredentials helper to src/pm/context.ts, eliminating duplication between router and worker - Remove dead fallback job queueing for unresolvable GitHub projects - Rename queueJiraJob → processJiraWebhookEvent for naming consistency - Add Sentry captureException for persistent ack reaction failures - Add ackCommentId type-clarifying comments to job interfaces - Refactor processGitHubWebhook to fix cognitive complexity lint warning (extract tryEnqueueIfBusy and resolveTriggerResult helpers) - Add test coverage for unknown agent types, empty trigger config objects, multi-hyphen filenames, and missing card ID edge cases 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
Comprehensive code quality improvements identified through code review of the trigger system refactoring and router dispatch architecture:
console.log/warn/errorcalls with structuredloggeracross all router handlers (github, trello, jira, index, queue), enabling log-level control and JSON metadataJiraWebhookPayloadandSTATUS_TO_AGENTinsrc/triggers/jira/types.ts, eliminating duplicate definitions across 3 JIRA trigger filescard-movedandlabel-addedtriggers to returnnullinstead of throwing on missing card ID, matching every other trigger handlerisAgentLogFilenameregex that couldn't handle multi-hyphen agent names (e.g.respond-to-review-2026-01-02T16-30-24-339Z.zip)withPMCredentialshelper tosrc/pm/context.ts, eliminating near-identical implementations in router and workerqueueJiraJob→processJiraWebhookEventto match Trello/GitHub namingcaptureExceptionfor persistent ack reaction failuresprocessGitHubWebhookto resolve cognitive complexity warning (17 → under 15) by extractingtryEnqueueIfBusyandresolveTriggerResulthelpersTest plan
🤖 Generated with Claude Code