refactor(navigation): migrate binders to wireUseCase for getHeader

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 18:08:42 +00:00
parent 57e9d9805d
commit 81a791c5fd
3 changed files with 50 additions and 62 deletions

View File

@@ -6,7 +6,10 @@ import {
type ILogger,
} from "@repo/core-shared/instrumentation";
import type { BindContext } from "@repo/core-shared/di";
import { assertFeatureConformance } from "@repo/core-shared/conformance";
import {
assertFeatureConformance,
wireUseCase,
} from "@repo/core-shared/conformance";
import { navigationManifest } from "../feature.manifest.js";
import { navigationContainer } from "./container.js";
import { NAVIGATION_SYMBOLS } from "./symbols.js";
@@ -52,31 +55,22 @@ export async function bindDevSeedNavigation(ctx: BindContext): Promise<void> {
.bind<IHeaderRepository>(NAVIGATION_SYMBOLS.IHeaderRepository)
.toConstantValue(repo);
// Wrap use case + controller identically to bind-production
const wrappedGetHeader = withSpan(
// Use case
const wrappedGetHeader = wireUseCase({
container: navigationContainer,
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
factory: getHeaderUseCase,
deps: [repo],
feature: "navigation",
layer: "use-case",
name: "getHeader",
tracer,
{ name: "navigation.getHeader", op: "use-case" },
withCapture(
logger,
{
feature: "navigation",
layer: "use-case",
name: "navigation.getHeader",
},
getHeaderUseCase(repo),
),
);
logger,
});
for (const sym of [
NAVIGATION_SYMBOLS.IGetHeaderUseCase,
NAVIGATION_SYMBOLS.IGetHeaderController,
]) {
if (navigationContainer.isBound(sym)) navigationContainer.unbind(sym);
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {
navigationContainer.unbind(NAVIGATION_SYMBOLS.IGetHeaderController);
}
navigationContainer
.bind(NAVIGATION_SYMBOLS.IGetHeaderUseCase)
.toConstantValue(wrappedGetHeader);
navigationContainer
.bind(NAVIGATION_SYMBOLS.IGetHeaderController)
.toConstantValue(

View File

@@ -6,7 +6,10 @@ import {
type ILogger,
} from "@repo/core-shared/instrumentation";
import type { BindProductionContext } from "@repo/core-shared/di";
import { assertFeatureConformance } from "@repo/core-shared/conformance";
import {
assertFeatureConformance,
wireUseCase,
} from "@repo/core-shared/conformance";
import { navigationContainer } from "./container";
import { NAVIGATION_SYMBOLS } from "./symbols";
import { navigationManifest } from "../feature.manifest";
@@ -41,27 +44,18 @@ export function bindProductionNavigation(ctx: BindProductionContext): void {
.bind(NAVIGATION_SYMBOLS.IHeaderRepository)
.toConstantValue(repo);
// Use case — wrapped with span + capture at bind time
const wrappedGetHeader = withSpan(
// Use case
const wrappedGetHeader = wireUseCase({
container: navigationContainer,
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
factory: getHeaderUseCase,
deps: [repo],
feature: "navigation",
layer: "use-case",
name: "getHeader",
tracer,
{ name: "navigation.getHeader", op: "use-case" },
withCapture(
logger,
{
feature: "navigation",
layer: "use-case",
name: "navigation.getHeader",
},
getHeaderUseCase(repo),
),
);
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderUseCase)) {
navigationContainer.unbind(NAVIGATION_SYMBOLS.IGetHeaderUseCase);
}
navigationContainer
.bind(NAVIGATION_SYMBOLS.IGetHeaderUseCase)
.toConstantValue(wrappedGetHeader);
logger,
});
// Controller — wrapped with span at bind time
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {