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

@@ -1,16 +1,16 @@
{
"generatedAt": "2026-05-13T17:59:49.208Z",
"commit": "0867efb",
"generatedAt": "2026-05-13T18:08:34.469Z",
"commit": "57e9d98",
"repo": {
"statements": 95.86,
"branches": 88.93,
"branches": 88.91,
"functions": 100,
"lines": 95.86,
"counts": {
"lf": 3115,
"lh": 2986,
"brf": 488,
"brh": 434,
"lf": 3113,
"lh": 2984,
"brf": 487,
"brh": 433,
"fnf": 142,
"fnh": 142
}
@@ -45,13 +45,13 @@
}
},
"@repo/marketing-pages": {
"statements": 95.66,
"statements": 95.64,
"branches": 83.93,
"functions": 100,
"lines": 95.66,
"lines": 95.64,
"counts": {
"lf": 715,
"lh": 684,
"lf": 711,
"lh": 680,
"brf": 112,
"brh": 94,
"fnf": 32,
@@ -73,15 +73,15 @@
}
},
"@repo/navigation": {
"statements": 98.05,
"branches": 95.12,
"statements": 98.06,
"branches": 95,
"functions": 100,
"lines": 98.05,
"lines": 98.06,
"counts": {
"lf": 307,
"lh": 301,
"brf": 41,
"brh": 39,
"lf": 309,
"lh": 303,
"brf": 40,
"brh": 38,
"fnf": 13,
"fnh": 13
}

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(
tracer,
{ name: "navigation.getHeader", op: "use-case" },
withCapture(
logger,
{
// Use case
const wrappedGetHeader = wireUseCase({
container: navigationContainer,
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
factory: getHeaderUseCase,
deps: [repo],
feature: "navigation",
layer: "use-case",
name: "navigation.getHeader",
},
getHeaderUseCase(repo),
),
);
name: "getHeader",
tracer,
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(
tracer,
{ name: "navigation.getHeader", op: "use-case" },
withCapture(
logger,
{
// Use case
const wrappedGetHeader = wireUseCase({
container: navigationContainer,
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
factory: getHeaderUseCase,
deps: [repo],
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);
name: "getHeader",
tracer,
logger,
});
// Controller — wrapped with span at bind time
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {