Uh oh!
There was an error while loading. Please reload this page.
Bind the dispatch engine at onEnable - #44
Merged
Merged
Conversation
registerDulyActionHandlers is the one place an ObjectStack application is handed ctx.ql, so it now also calls bindDispatchEngine(ql) beside the existing action-handler registrations. Widens HandlerRegistrationContext to extend DispatchEngine (find/insert/update) so the type carries what the bind needs, with no restructuring of the function itself. test/dispatch-wiring.test.ts boots the app the way a real host does — merging objectstack.config.ts's default export with its onEnable named export before constructing AppPlugin, exactly as @objectstack/cli's serve.ts does — and calls dulyDispatch() with no test-side bindDispatchEngine call. This is the only suite that would fail if the wiring were reverted; every other dispatch test binds the engine itself. test/catalog-instantiate.test.ts's handler-wiring fake widened to satisfy the larger interface (no-op find/insert/update; that suite is about the action registry, not the dispatch engine). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqkTcrxUFci7nqXdbBSe2p
os-warren
marked this pull request as ready for review
September 1, 2026 05:20
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Fixes#42
What
src/jobs/dispatch.job.ts(#43) exposedbindDispatchEngine(engine)but nothing called it, soduly_dispatchthrewJob 'duly_dispatch' has no data engine …at every run and dispatched nothing — a scheduled job that appears fully configured and silently produces no tasks.registerDulyActionHandlersinsrc/actions/register-handlers.tsis the one place an ObjectStack application is handedctx.ql(viadefineStack({ onEnable })), so it now also callsbindDispatchEngine(ql)beside the existingregisterCatalogActionHandlers(ql)/registerTaskActionHandlers(ql)calls — one line, unchanged function shape.HandlerRegistrationContextwidened from{ registerAction }toextends DispatchEngine(addsfind/insert/update) so the type carries what the bind needs, single-sourced fromdispatch.job.ts's ownDispatchEngineinterface rather than restated.Per the issue, did not: rename
registerDulyActionHandlers(the issue's "consider renaming" was optional; the dispatch prompt for this card said not to restructure the function), touchobjectstack.config.ts, or change anything undersrc/jobs/.Why the test is the deliverable
register-handlers.tshas no author-time gate — an unregistered/unbound handler renders as fully configured, is clickable/schedulable, and fails only at call time;pnpm validateis green either way. Every existing dispatch assertion (test/dispatch.test.ts) callsbindDispatchEngine(data)itself before touchingdulyDispatch, which is right for testing the planner and the idempotency index — but it would keep passing even if this issue's one-line fix were reverted.test/dispatch-wiring.test.tsboots the app the way a real host does instead: it mergesobjectstack.config.ts'sdefaultexport with itsonEnablenamed export before constructingAppPlugin—{ ...stackConfig, onEnable }— exactly as@objectstack/cli'sserve.tsdoes (measured in itsdist/commands/serve.js, comment included in the test).test/task-actions.test.tsdeliberately does not do this (passes the default export alone, and registers handlers by hand) — this is the first suite in the repo that does. It then callsdulyDispatch({ jobId: DISPATCH_JOB_NAME })with no test-sidebindDispatchEnginecall and asserts a task is actually created against the real engine.test/catalog-instantiate.test.ts's handler-wiring fake needed a matching update (no-opfind/insert/update) to satisfy the widened interface — that suite is about the action-handler registry, not the dispatch engine, so the additions are inert.Ablation (required by the dispatch prompt)
Removed the
bindDispatchEngine(ql);line (plus its comment) fromregister-handlers.ts, confirmed on disk before measuring:Then measured:
pnpm validate→ exit 0, green (no gate exists for this — as the issue predicted)pnpm test -- test/dispatch-wiring.test.ts→ red, exactly:Test Files 1 failed | 8 passed (9),Tests 1 failed | 278 passed (279)— only the new suite fails)Restored via a
trap 'git checkout -- "$F"' EXIT INT TERMfrom the committed fix (commit made before ablating, per the "never ablate uncommitted work" rule), confirmed clean (git status --shortempty, line back in place) before re-running gates.Gates — all green at
ee3640fKnown limit (unchanged from the issue, not this PR's to fix)
This closes the
objectstack dev/config-boot path only. Theobjectstack buildartifact path still cannot carryonEnable(a JSON artifact holds no functions), so an artifact-served boot never runs it and the binding never happens there — that's the second half of objectstack#14094, upstream, and applies identically to the action handlers already registered in this same function.Generated by Claude Code