refactor(navigation): migrate binders to wireUseCase for getHeader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"generatedAt": "2026-05-13T17:59:49.208Z",
|
"generatedAt": "2026-05-13T18:08:34.469Z",
|
||||||
"commit": "0867efb",
|
"commit": "57e9d98",
|
||||||
"repo": {
|
"repo": {
|
||||||
"statements": 95.86,
|
"statements": 95.86,
|
||||||
"branches": 88.93,
|
"branches": 88.91,
|
||||||
"functions": 100,
|
"functions": 100,
|
||||||
"lines": 95.86,
|
"lines": 95.86,
|
||||||
"counts": {
|
"counts": {
|
||||||
"lf": 3115,
|
"lf": 3113,
|
||||||
"lh": 2986,
|
"lh": 2984,
|
||||||
"brf": 488,
|
"brf": 487,
|
||||||
"brh": 434,
|
"brh": 433,
|
||||||
"fnf": 142,
|
"fnf": 142,
|
||||||
"fnh": 142
|
"fnh": 142
|
||||||
}
|
}
|
||||||
@@ -45,13 +45,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@repo/marketing-pages": {
|
"@repo/marketing-pages": {
|
||||||
"statements": 95.66,
|
"statements": 95.64,
|
||||||
"branches": 83.93,
|
"branches": 83.93,
|
||||||
"functions": 100,
|
"functions": 100,
|
||||||
"lines": 95.66,
|
"lines": 95.64,
|
||||||
"counts": {
|
"counts": {
|
||||||
"lf": 715,
|
"lf": 711,
|
||||||
"lh": 684,
|
"lh": 680,
|
||||||
"brf": 112,
|
"brf": 112,
|
||||||
"brh": 94,
|
"brh": 94,
|
||||||
"fnf": 32,
|
"fnf": 32,
|
||||||
@@ -73,15 +73,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@repo/navigation": {
|
"@repo/navigation": {
|
||||||
"statements": 98.05,
|
"statements": 98.06,
|
||||||
"branches": 95.12,
|
"branches": 95,
|
||||||
"functions": 100,
|
"functions": 100,
|
||||||
"lines": 98.05,
|
"lines": 98.06,
|
||||||
"counts": {
|
"counts": {
|
||||||
"lf": 307,
|
"lf": 309,
|
||||||
"lh": 301,
|
"lh": 303,
|
||||||
"brf": 41,
|
"brf": 40,
|
||||||
"brh": 39,
|
"brh": 38,
|
||||||
"fnf": 13,
|
"fnf": 13,
|
||||||
"fnh": 13
|
"fnh": 13
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import {
|
|||||||
type ILogger,
|
type ILogger,
|
||||||
} from "@repo/core-shared/instrumentation";
|
} from "@repo/core-shared/instrumentation";
|
||||||
import type { BindContext } from "@repo/core-shared/di";
|
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 { navigationManifest } from "../feature.manifest.js";
|
||||||
import { navigationContainer } from "./container.js";
|
import { navigationContainer } from "./container.js";
|
||||||
import { NAVIGATION_SYMBOLS } from "./symbols.js";
|
import { NAVIGATION_SYMBOLS } from "./symbols.js";
|
||||||
@@ -52,31 +55,22 @@ export async function bindDevSeedNavigation(ctx: BindContext): Promise<void> {
|
|||||||
.bind<IHeaderRepository>(NAVIGATION_SYMBOLS.IHeaderRepository)
|
.bind<IHeaderRepository>(NAVIGATION_SYMBOLS.IHeaderRepository)
|
||||||
.toConstantValue(repo);
|
.toConstantValue(repo);
|
||||||
|
|
||||||
// Wrap use case + controller identically to bind-production
|
// Use case
|
||||||
const wrappedGetHeader = withSpan(
|
const wrappedGetHeader = wireUseCase({
|
||||||
tracer,
|
container: navigationContainer,
|
||||||
{ name: "navigation.getHeader", op: "use-case" },
|
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
|
||||||
withCapture(
|
factory: getHeaderUseCase,
|
||||||
logger,
|
deps: [repo],
|
||||||
{
|
|
||||||
feature: "navigation",
|
feature: "navigation",
|
||||||
layer: "use-case",
|
layer: "use-case",
|
||||||
name: "navigation.getHeader",
|
name: "getHeader",
|
||||||
},
|
tracer,
|
||||||
getHeaderUseCase(repo),
|
logger,
|
||||||
),
|
});
|
||||||
);
|
|
||||||
|
|
||||||
for (const sym of [
|
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {
|
||||||
NAVIGATION_SYMBOLS.IGetHeaderUseCase,
|
navigationContainer.unbind(NAVIGATION_SYMBOLS.IGetHeaderController);
|
||||||
NAVIGATION_SYMBOLS.IGetHeaderController,
|
|
||||||
]) {
|
|
||||||
if (navigationContainer.isBound(sym)) navigationContainer.unbind(sym);
|
|
||||||
}
|
}
|
||||||
navigationContainer
|
|
||||||
.bind(NAVIGATION_SYMBOLS.IGetHeaderUseCase)
|
|
||||||
.toConstantValue(wrappedGetHeader);
|
|
||||||
|
|
||||||
navigationContainer
|
navigationContainer
|
||||||
.bind(NAVIGATION_SYMBOLS.IGetHeaderController)
|
.bind(NAVIGATION_SYMBOLS.IGetHeaderController)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import {
|
|||||||
type ILogger,
|
type ILogger,
|
||||||
} from "@repo/core-shared/instrumentation";
|
} from "@repo/core-shared/instrumentation";
|
||||||
import type { BindProductionContext } from "@repo/core-shared/di";
|
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 { navigationContainer } from "./container";
|
||||||
import { NAVIGATION_SYMBOLS } from "./symbols";
|
import { NAVIGATION_SYMBOLS } from "./symbols";
|
||||||
import { navigationManifest } from "../feature.manifest";
|
import { navigationManifest } from "../feature.manifest";
|
||||||
@@ -41,27 +44,18 @@ export function bindProductionNavigation(ctx: BindProductionContext): void {
|
|||||||
.bind(NAVIGATION_SYMBOLS.IHeaderRepository)
|
.bind(NAVIGATION_SYMBOLS.IHeaderRepository)
|
||||||
.toConstantValue(repo);
|
.toConstantValue(repo);
|
||||||
|
|
||||||
// Use case — wrapped with span + capture at bind time
|
// Use case
|
||||||
const wrappedGetHeader = withSpan(
|
const wrappedGetHeader = wireUseCase({
|
||||||
tracer,
|
container: navigationContainer,
|
||||||
{ name: "navigation.getHeader", op: "use-case" },
|
symbol: NAVIGATION_SYMBOLS.IGetHeaderUseCase,
|
||||||
withCapture(
|
factory: getHeaderUseCase,
|
||||||
logger,
|
deps: [repo],
|
||||||
{
|
|
||||||
feature: "navigation",
|
feature: "navigation",
|
||||||
layer: "use-case",
|
layer: "use-case",
|
||||||
name: "navigation.getHeader",
|
name: "getHeader",
|
||||||
},
|
tracer,
|
||||||
getHeaderUseCase(repo),
|
logger,
|
||||||
),
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderUseCase)) {
|
|
||||||
navigationContainer.unbind(NAVIGATION_SYMBOLS.IGetHeaderUseCase);
|
|
||||||
}
|
|
||||||
navigationContainer
|
|
||||||
.bind(NAVIGATION_SYMBOLS.IGetHeaderUseCase)
|
|
||||||
.toConstantValue(wrappedGetHeader);
|
|
||||||
|
|
||||||
// Controller — wrapped with span at bind time
|
// Controller — wrapped with span at bind time
|
||||||
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {
|
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IGetHeaderController)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user