Repository navigation
improvement(outbox): load handler modules only for the event types a run will process - #8731
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
…dule; prove failed loads in Postgres
40b7cbc to
725a3b3
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 100 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Turn on auto-fix | Re-trigger cubic
…types from dependency-free modules
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
process-outboxstatically imported all 18 outbox handler modules, so every run loaded Stripe, the file parsers, react-email, the webhook provider registry, the block registry and more even when nothing was due. Its static graph drops from 5,718 to 794 modules (stripe,pdf-lib,mammoth,@aws-sdk,better-auth,next, … → 0)lib/core/outbox/handlers.tsdeclaresOUTBOX_HANDLER_GROUPS({ events, load: () => import(...) }, in the old spread order).processOutboxEventsnow takes these groups: after discovering ready event types it imports, in parallel, only the groups that serve one, before any claim — sotimeoutMscomes from the real handler and import time never runs inside a lease or handler windowprocessOutboxEventByIdand its callers are unchangedType of Change
Testing
handlers.test.ts: no event type in two groups; each group's loaded handler keys equal its declaredevents; everyexport const *OutboxHandlersmap in the app is covered by the registry (catches a dropped or never-registered group)service.test.ts/service.integration.tsrun through the lazy path: only due groups load; a failed import leaves its types unclaimed and reported, others process, the next run imports again; the pre-claim deadline uses the loaded handler'stimeoutMs; unknown types still retry/dead-letter as before.processor.test.ts: maintenance completes, then the run fails naming unloaded typesbun run test(3,287 app files),bun run test:integration lib/core/outbox/service.integration.ts,bun run lint,bun run type-check,bun run check:audits(unused-exports baseline shrunk for the moved constants),bun run docs-manifest:check— greenChecklist
test-auditauthoring gate)