fix: address Phase 1 spec review findings

- di-explainer.html: update stale JS data strings from positional-arg
  form (bindAllProduction(config), bindProductionBlog(config,tracer,...))
  to ctx-arg form (bindAllProduction(deps), bindProductionBlog(ctx)) with
  a note on ctx shape.
- auth/sign-up.use-case: change bus param from IEventBus to
  EventBusProtocol|undefined; guard bus.publish with if(bus) so the use
  case is safe when core-events is absent (Phase 3+).
- auth/bind-production + bind-dev-seed: drop as IEventBus cast and unused
  IEventBus import; ctx.bus is now passed directly (typed as
  EventBusProtocol|undefined).
- marketing-pages/bind-production + bind-dev-seed: drop as IJobQueue cast
  and unused IJobQueue import; wrap event-handler DI block in if(queue)
  guard so the handler is only bound when core-jobs is wired.
- core-shared/src/index.ts: add `export * from "./di"` as the plan
  specified (subpath export alone is no longer the only access path).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 13:02:36 +02:00
parent 990f641425
commit ca2e7d8c10
7 changed files with 55 additions and 49 deletions

View File

@@ -6,7 +6,6 @@ import {
type ILogger,
} from "@repo/core-shared/instrumentation";
import type { BindProductionContext } from "@repo/core-shared/di";
import type { IJobQueue } from "@repo/core-shared/jobs";
import { marketingPagesContainer } from "./container";
import { MARKETING_PAGES_SYMBOLS } from "./symbols";
import { PagesRepository } from "../infrastructure/repositories/pages.repository";
@@ -130,24 +129,27 @@ export function bindProductionMarketingPages(ctx: BindProductionContext): void {
// <gen:event-handlers>
// onAuthUserSignedUpHandler subscription — generated, edit the handler file (not this block) for behavior.
const wrappedAuthUserSignedUp = withSpan(
tracer,
{ name: "marketing-pages.onAuthUserSignedUpHandler", op: "event-handler" },
withCapture(
logger,
{
feature: "marketing-pages",
layer: "event-handler",
name: "marketing-pages.onAuthUserSignedUpHandler",
},
onAuthUserSignedUpHandler(queue as IJobQueue),
),
);
if (marketingPagesContainer.isBound(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler)) {
marketingPagesContainer.unbind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler);
// queue is optional: guard so the handler is only bound when core-jobs is wired (Phase 3+).
if (queue) {
const wrappedAuthUserSignedUp = withSpan(
tracer,
{ name: "marketing-pages.onAuthUserSignedUpHandler", op: "event-handler" },
withCapture(
logger,
{
feature: "marketing-pages",
layer: "event-handler",
name: "marketing-pages.onAuthUserSignedUpHandler",
},
onAuthUserSignedUpHandler(queue),
),
);
if (marketingPagesContainer.isBound(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler)) {
marketingPagesContainer.unbind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler);
}
marketingPagesContainer.bind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler).toConstantValue(wrappedAuthUserSignedUp);
bus?.subscribe(userSignedUpEvent, "marketing-pages", wrappedAuthUserSignedUp);
}
marketingPagesContainer.bind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler).toConstantValue(wrappedAuthUserSignedUp);
bus?.subscribe(userSignedUpEvent, "marketing-pages", wrappedAuthUserSignedUp);
// <gen:jobs>
const wrappedSendWelcomeEmail = withSpan(
tracer,