fix(core): regenerate slack trigger catalog from mapping#129
Conversation
|
Warning Review limit reached
More reviews will be available in 14 minutes and 15 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the trigger catalog generator to support reading mapping webhook events from a core directory in addition to package-specific directories. This allows prioritizing core mappings (such as Slack's raw webhook event names) over standard supported events. The generated catalog and tests are updated to reflect the new Slack event mappings. The reviewer suggested adding an explanatory comment to clarify the asymmetric priority logic between core mappings, package mappings, and supported events to improve maintainability.
|
|
||
| for (const adapterPackage of packages) { | ||
| const mappingEvents = await readMappingWebhookEvents(repoRoot, adapterPackage); | ||
| if (mappingEvents.events.length > 0 && mappingEvents.source === "core.mapping.webhooks") { |
There was a problem hiding this comment.
The priority logic here is asymmetric: core.mapping.webhooks takes precedence over supportedEvents, whereas package.mapping.webhooks is subordinated to supportedEvents. While this is done to support Slack's specific configuration, adding a brief explanatory comment here would greatly improve maintainability and prevent future confusion for other developers.
// Prioritize core mappings (e.g. Slack) over supportedEvents to ensure raw webhook event names are used.
if (mappingEvents.events.length > 0 && mappingEvents.source === "core.mapping.webhooks") {a2d590d to
9a8f8ca
Compare
|
Addressed Gemini's maintainability note by adding a short comment at the core-mapping priority branch explaining why packages/core/mappings webhook keys intentionally override supportedEvents() fallbacks for storage-bridge adapters. Re-ran:\n\n- node --import tsx packages/core/src/cli.ts triggers check\n- node --import tsx --test packages/core/tests/triggers/catalog-generator.test.ts\n- git diff --check |
Summary
packages/core/mappingswhen an adapter package has no package-local mapping source, so Slack uses the mapping webhook event names.KNOWN_TRIGGER_CATALOGsoslackexposesmessageandreaction_addedinstead of normalized adapter events likemessage.created.Notes
node --import tsx packages/core/src/cli.ts triggers generateafter building@relayfile/adapter-core; running generate before core build reproduces the known truncated-provider failure mode and was discarded.list-*action route, not this catalog generation path.Verification
npm installnpm run build --workspace @relayfile/adapter-corenode --import tsx packages/core/src/cli.ts triggers generatenode --import tsx packages/core/src/cli.ts triggers checknode --import tsx --test packages/core/tests/triggers/catalog-generator.test.tsnpm test --workspace @relayfile/adapter-core -- --test-name-pattern='trigger catalog|provider-specific'git diff --checkFixes #127