From a9973ebabb86b3f7e19e0ca4d2b5c26af8f2e930 Mon Sep 17 00:00:00 2001 From: resec Date: Wed, 18 Nov 2026 11:15:27 +0800 Subject: [PATCH 1/3] fix(dsh): read the config hook's fiber argument instead of `this` (#7112) cordis dispatches internal/config as waterfall('internal/config', fiber, next): the first argument is the event name, so no this is bound (thisArg null) and the listener receives (fiber, next). Reading this.entry always yielded undefined, so every covered entry was recorded as unnamed-entry, sawFactoryPreset never latched, and PR #5994's #5248 restore could never fire. Tests dispatch through a real cordis Context; the existing mock hosts call the captured middleware directly, which is why the defect stayed green. --- src/agent/dsh-compaction-disable.ts | 15 ++- tests/issue7112-config-hook-fiber.test.ts | 120 ++++++++++++++++++++++ 2 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 tests/issue7112-config-hook-fiber.test.ts diff --git a/src/agent/dsh-compaction-disable.ts b/src/agent/dsh-compaction-disable.ts index 4970e3d159..30ead44212 100644 --- a/src/agent/dsh-compaction-disable.ts +++ b/src/agent/dsh-compaction-disable.ts @@ -172,6 +172,17 @@ export type CompactionDisableHost = { }; type MiddlewareSelf = { entry?: { options?: { name?: unknown } } | undefined }; +/** Entry option name carried by the fiber that owns a config resolution. + * The host dispatches `internal/config` as `waterfall('internal/config', + * fiber, next)` — the first argument is the event NAME, so cordis binds no + * `this` (vendor/cordis/src/events.ts:163 → thisArg null) and the listener + * receives `(fiber, next)`. Reading `this` therefore always yields + * undefined; the name lives on the first argument. */ +export function entryNameOf(fiber: unknown): string | undefined { + const name = (fiber as MiddlewareSelf | undefined)?.entry?.options?.name; + return typeof name === "string" && name.length > 0 ? name : undefined; +} + /** Register the load-time overlay + publish the gate. Runs from the always-on * gate entry's apply() (dsh-compaction-gate.ts, #3662) — NOT from bili-native, * whose disable/kill-switch must not take the service with it. The provide @@ -183,7 +194,7 @@ type MiddlewareSelf = { entry?: { options?: { name?: unknown } } | undefined }; export function registerCompactionDisable(ctx: CompactionDisableHost): void { if (typeof ctx.on === "function") { // Preset entries must carry the gate: sibling imports may finish out of order. - ctx.on("internal/config", function (this: MiddlewareSelf, _raw: unknown, next: () => unknown): unknown { + ctx.on("internal/config", function (fiber: unknown, next: () => unknown): unknown { const resolved = next(); // #3662: honor the process verdict — without an active declaration // from bili-native every row passes through stock. @@ -197,7 +208,7 @@ export function registerCompactionDisable(ctx: CompactionDisableHost): void { if (!Array.isArray(config.plugins)) return resolved; const compactionRows = countCompactionRows(config.plugins); if (compactionRows === 0) return resolved; - const rawName = this?.entry?.options?.name; + const rawName = entryNameOf(fiber); const entryName = typeof rawName === "string" ? rawName : "unnamed-entry"; noteGateCoverage(entryName.slice(0, 120), compactionRows, entryName === DSH_AGENT_PRESET_PACKAGE); return { ...config, plugins: disableBasicCompaction(config.plugins) }; diff --git a/tests/issue7112-config-hook-fiber.test.ts b/tests/issue7112-config-hook-fiber.test.ts new file mode 100644 index 0000000000..80e38bb952 --- /dev/null +++ b/tests/issue7112-config-hook-fiber.test.ts @@ -0,0 +1,120 @@ +// #7112: the internal/config middleware read the entry name from `this`, but +// cordis dispatches that waterfall as `('internal/config', fiber, next)` — the +// first argument is the event name, so no `this` is bound (thisArg null) and +// the listener receives (fiber, next). Every name-keyed branch was therefore +// dead: coverage telemetry degraded to "unnamed-entry", sawFactoryPreset never +// latched, and PR #5994's #5248 restore could never fire. These tests dispatch +// through a REAL cordis Context — the mock hosts elsewhere call the captured +// listener directly, which is exactly why the defect stayed green. +import test from "node:test"; +import assert from "node:assert/strict"; +import { Context } from "@deepseek-ai/cordis"; +import { + BILI_COMPACTION_DISABLE_SERVICE, + _resetDshCompactionGateTelemetryForTest, + _resetDshCompactionVerdictForTest, + declareDshCompactionActive, + dshCompactionGateTelemetry, + entryNameOf, + registerCompactionDisable, +} from "../src/agent/dsh-compaction-disable.ts"; + +const FACTORY_PRESET = "@deepseek-ai/dsh-agent-preset"; + +function presetConfig() { + return { + id: "standard", + plugins: [ + { + id: "compaction", + group: true, + config: [{ id: "compaction-basic", name: "@deepseek-ai/dsh-compaction-basic" }], + }, + ], + }; +} + +function fiberNamed(name: string) { + return { entry: { options: { id: "preset-standard", name } } }; +} + +function dispatch(name: string): { config: unknown; telemetry: ReturnType } { + const ctx = new Context(); + registerCompactionDisable(ctx as unknown as Parameters[0]); + const dispatchConfig = ctx.waterfall as unknown as + (event: string, fiber: unknown, next: () => unknown) => unknown; + const config = dispatchConfig("internal/config", fiberNamed(name), () => presetConfig()); + return { config, telemetry: dshCompactionGateTelemetry() }; +} + +test("#7112: the hook binds no `this`, so the name comes from the fiber argument", () => { + _resetDshCompactionVerdictForTest(); + _resetDshCompactionGateTelemetryForTest(); + declareDshCompactionActive(); + try { + const ctx = new Context(); + let seenThis: unknown = "unset"; + let seenFiberName: string | undefined; + const on = ctx.on as unknown as + (event: string, listener: (fiber: unknown, next: () => unknown) => unknown, options?: { global?: boolean }) => void; + const listener: (this: unknown, fiber: unknown, next: () => unknown) => unknown = + function (this: unknown, fiber: unknown, next: () => unknown) { + seenThis = this; + seenFiberName = entryNameOf(fiber); + return next(); + }; + on("internal/config", listener, { global: true }); + const dispatchConfig = ctx.waterfall as unknown as + (event: string, fiber: unknown, next: () => unknown) => unknown; + dispatchConfig("internal/config", fiberNamed(FACTORY_PRESET), () => presetConfig()); + assert.equal(seenThis, null, "cordis must bind null, not the fiber"); + assert.equal(seenFiberName, FACTORY_PRESET, "the fiber argument carries the entry name"); + } finally { + _resetDshCompactionVerdictForTest(); + } +}); + +test("#7112: coverage telemetry records the real entry name, not unnamed-entry", () => { + _resetDshCompactionVerdictForTest(); + _resetDshCompactionGateTelemetryForTest(); + declareDshCompactionActive(); + try { + const { config, telemetry } = dispatch(FACTORY_PRESET); + assert.ok(telemetry, "the transform must record coverage"); + assert.deepEqual(telemetry.covered, [{ entry: FACTORY_PRESET, rows: 1 }]); + assert.equal(telemetry.sawFactoryPreset, true, "the factory preset must latch"); + const rows = (config as { plugins: Array<{ config: Array<{ disabled?: boolean }> }> }).plugins; + assert.equal(rows[0]?.config[0]?.disabled, true, "the rewrite still disables the row"); + } finally { + _resetDshCompactionVerdictForTest(); + } +}); + +test("#7112: a custom preset keeps its own name and does not latch sawFactoryPreset", () => { + _resetDshCompactionVerdictForTest(); + _resetDshCompactionGateTelemetryForTest(); + declareDshCompactionActive(); + try { + const { telemetry } = dispatch("my-custom-preset"); + assert.deepEqual(telemetry?.covered, [{ entry: "my-custom-preset", rows: 1 }]); + assert.equal(telemetry?.sawFactoryPreset, false); + } finally { + _resetDshCompactionVerdictForTest(); + } +}); + +test("#7112: absent or empty names fall back to undefined (caller renders unnamed-entry)", () => { + assert.equal(entryNameOf(undefined), undefined); + assert.equal(entryNameOf({}), undefined); + assert.equal(entryNameOf({ entry: { options: { name: "" } } }), undefined); + assert.equal(entryNameOf({ entry: { options: { name: FACTORY_PRESET } } }), FACTORY_PRESET); +}); + +test("#7112: the gate service is published even when the transform cannot bind a name", () => { + const provided: string[] = []; + registerCompactionDisable({ + on: () => {}, + reflect: { provide: (name: string) => { provided.push(name) } }, + } as unknown as Parameters[0]); + assert.deepEqual(provided, [BILI_COMPACTION_DISABLE_SERVICE]); +}); From 8461f55bcf0cbcc7d6ef9592f1eda3d0bf2bf79e Mon Sep 17 00:00:00 2001 From: resec Date: Wed, 18 Nov 2026 11:57:58 +0800 Subject: [PATCH 2/3] test(dsh): drive the config hook with the fiber argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These three files invoked the captured internal/config middleware as mw.call(entryLike, null, next), passing the entry name as `this`. That is not how cordis dispatches (thisArg is null, the fiber is the first argument), so the mocks were asserting a binding the host never produces — which is why #7112 shipped green. Move the entry-like object to the first parameter; the assertions themselves are unchanged. --- tests/issue3354-dsh-compaction-disable.test.ts | 8 ++++---- tests/issue3662-dsh-gate-fallback.test.ts | 4 ++-- tests/issue4147-dsh-overlay-structural.test.ts | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/issue3354-dsh-compaction-disable.test.ts b/tests/issue3354-dsh-compaction-disable.test.ts index 0474d9ef2a..c2db1009ef 100644 --- a/tests/issue3354-dsh-compaction-disable.test.ts +++ b/tests/issue3354-dsh-compaction-disable.test.ts @@ -120,7 +120,7 @@ test("#3354 registerCompactionDisable: transform honors the entry predicate and ]; const cfg: Record = { plugins, isolate: { compaction: true } }; const self = { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }; - const out = mw?.call(self, null, () => cfg) as { plugins?: Array>; isolate?: Record }; + const out = mw?.call(null, self, () => cfg) as { plugins?: Array>; isolate?: Record }; assert.deepEqual(out.isolate, { compaction: true }); assert.equal(out.plugins?.[0]?.disabled, true); assert.equal(out.plugins?.[1]?.disabled, true); @@ -129,13 +129,13 @@ test("#3354 registerCompactionDisable: transform honors the entry predicate and // compaction rows is rewritten too (custom presets), while an entry // whose plugins carry none keeps its resolved config object identity. const custom: Record = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - const customOut = mw?.call({ entry: { options: { name: "preset-general" } } }, null, () => custom) as { plugins?: Array> }; + const customOut = mw?.call(null, { entry: { options: { name: "preset-general" } } }, () => custom) as { plugins?: Array> }; assert.equal(customOut.plugins?.[0]?.disabled, true); const untouched: Record = { plugins: [{ name: "@deepseek-ai/dsh-other" }] }; - assert.equal(mw?.call({ entry: { options: { name: "other-entry" } } }, null, () => untouched), untouched); + assert.equal(mw?.call(null, { entry: { options: { name: "other-entry" } } }, () => untouched), untouched); assert.equal(mw?.call(undefined, null, () => untouched), untouched); // next() returning nothing → verbatim passthrough - assert.equal(mw?.call(self, null, () => undefined), undefined); + assert.equal(mw?.call(null, self, () => undefined), undefined); } finally { _resetDshCompactionVerdictForTest(); } diff --git a/tests/issue3662-dsh-gate-fallback.test.ts b/tests/issue3662-dsh-gate-fallback.test.ts index dfd5869d12..9e8f3e8ffa 100644 --- a/tests/issue3662-dsh-gate-fallback.test.ts +++ b/tests/issue3662-dsh-gate-fallback.test.ts @@ -124,9 +124,9 @@ test("#3662: normal boot (verdict active) — the gate entry disables the compac // they nest no compaction rows — a custom preset nesting them is // rewritten (structural match), unrelated config keeps identity. const otherCfg: Record = { plugins: [{ name: "@deepseek-ai/dsh-other" }] }; - assert.equal(mw.call({ entry: { options: { name: "something-else" } } }, null, () => otherCfg), otherCfg); + assert.equal(mw.call(null, { entry: { options: { name: "something-else" } } }, () => otherCfg), otherCfg); const customCfg: Record = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - const customOut = mw.call({ entry: { options: { name: "preset-general" } } }, null, () => customCfg) as { plugins?: Array> }; + const customOut = mw.call(null, { entry: { options: { name: "preset-general" } } }, () => customCfg) as { plugins?: Array> }; assert.equal(customOut.plugins?.[0]?.disabled, true); } finally { _resetDshCompactionVerdictForTest(); diff --git a/tests/issue4147-dsh-overlay-structural.test.ts b/tests/issue4147-dsh-overlay-structural.test.ts index 6cadef1222..b4c39b8c87 100644 --- a/tests/issue4147-dsh-overlay-structural.test.ts +++ b/tests/issue4147-dsh-overlay-structural.test.ts @@ -43,7 +43,7 @@ test("#4147: custom preset entries nesting compaction rows are rewritten (group { name: "@deepseek-ai/dsh-command-compact" }, ], }; - const out = mw.call({ entry: { options: { name: "preset-general" } } }, null, () => cfg) as { plugins: Array> }; + const out = mw.call(null, { entry: { options: { name: "preset-general" } } }, () => cfg) as { plugins: Array> }; assert.equal(out.plugins[0].disabled, undefined, "unrelated sibling row untouched"); const group = out.plugins[1] as { config: Array> }; assert.equal(group.config[0].disabled, true, "nested group row disabled"); @@ -66,9 +66,9 @@ test("#4147 negative: no compaction rows → resolved config object identity kep declareDshCompactionActive(); const mw = middleware(); const unrelated = { plugins: [{ name: "@deepseek-ai/dsh-tool-result-pruner" }] }; - assert.equal(mw.call({ entry: { options: { name: "preset-shipin" } } }, null, () => unrelated), unrelated); + assert.equal(mw.call(null, { entry: { options: { name: "preset-shipin" } } }, () => unrelated), unrelated); const noPlugins = { other: 1 }; - assert.equal(mw.call({ entry: { options: { name: "preset-shipin" } } }, null, () => noPlugins), noPlugins); + assert.equal(mw.call(null, { entry: { options: { name: "preset-shipin" } } }, () => noPlugins), noPlugins); assert.equal(dshCompactionGateTelemetry(), null, "no rewrite, no coverage record"); } finally { _resetDshCompactionVerdictForTest(); @@ -82,7 +82,7 @@ test("#4147/#3662 negative: absent verdict → stock passthrough records nothing _resetDshCompactionGateTelemetryForTest(); const mw = middleware(); const cfg = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - const out = mw.call({ entry: { options: { name: "preset-general" } } }, null, () => cfg) as { plugins: Array> }; + const out = mw.call(null, { entry: { options: { name: "preset-general" } } }, () => cfg) as { plugins: Array> }; assert.equal(out, cfg, "verbatim passthrough"); assert.equal((cfg.plugins as Array>)[0].disabled, undefined); assert.equal(dshCompactionGateTelemetry(), null, "stock passthrough leaves no coverage record"); @@ -99,11 +99,11 @@ test("#3962: telemetry dedups per entry, keeps the max row count, flags the fact declareDshCompactionActive(); const mw = middleware(); const one = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - mw.call({ entry: { options: { name: "preset-general" } } }, null, () => one); + mw.call(null, { entry: { options: { name: "preset-general" } } }, () => one); const two = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }, { name: "@deepseek-ai/dsh-command-compact" }] }; - mw.call({ entry: { options: { name: "preset-general" } } }, null, () => two); + mw.call(null, { entry: { options: { name: "preset-general" } } }, () => two); const factory = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - mw.call({ entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }, null, () => factory); + mw.call(null, { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }, () => factory); const unnamed = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; mw.call(undefined, null, () => unnamed); const t = dshCompactionGateTelemetry()!; @@ -126,7 +126,7 @@ test("#3962: long entry names (URLs) are truncated for the durable note", () => const mw = middleware(); const longName = "file:///".padEnd(200, "x"); const cfg = { plugins: [{ name: "@deepseek-ai/dsh-compaction-basic" }] }; - mw.call({ entry: { options: { name: longName } } }, null, () => cfg); + mw.call(null, { entry: { options: { name: longName } } }, () => cfg); const t = dshCompactionGateTelemetry()!; assert.equal(t.covered[0].entry.length, 120); } finally { From f7059d7ba8ca02bd2509667104217ad868fc9c1d Mon Sep 17 00:00:00 2001 From: ci-check Date: Wed, 18 Nov 2026 12:24:14 +0800 Subject: [PATCH 3/3] test: finish the (fiber, next) binding alignment the previous commit missed (#7112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8461f55bcf moved the entry-like object to the first parameter in most mock calls but left two issue3662 sites still passing it as `this` (mw.call(PRESET_SELF, null, next)) — they only stay green because their assertions are name-independent, so the broken binding survives exactly where a future name-keyed branch (e.g. #5994's #5248 restore) would be exercised. Move those two calls to the real binding and rename the identifiers that now lie (PRESET_SELF/self/raw → the fiber they carry), so the mocks cannot silently drift back to the pre-#7112 convention. --- tests/issue3354-dsh-compaction-disable.test.ts | 10 ++++++---- tests/issue3662-dsh-gate-fallback.test.ts | 16 +++++++++------- tests/issue4147-dsh-overlay-structural.test.ts | 4 +++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/issue3354-dsh-compaction-disable.test.ts b/tests/issue3354-dsh-compaction-disable.test.ts index c2db1009ef..c21b5b13b3 100644 --- a/tests/issue3354-dsh-compaction-disable.test.ts +++ b/tests/issue3354-dsh-compaction-disable.test.ts @@ -100,7 +100,9 @@ test("#3806 detectCompactionOverlayGap: missing service provide -> no-service-pr }); test("#3354 registerCompactionDisable: transform honors the entry predicate and preserves siblings", () => { - type Mw = (raw: unknown, next: () => unknown) => unknown; + // #7112: cordis' real binding — `this` is null, the fiber is the FIRST + // argument; the mock calls below pass it there. + type Mw = (fiber: unknown, next: () => unknown) => unknown; let mw: Mw | undefined; let options: unknown; // #3662: the transform acts only while bili-native declared the lane owned. @@ -119,8 +121,8 @@ test("#3354 registerCompactionDisable: transform honors the entry predicate and { name: "@deepseek-ai/dsh-tool-result-pruner" }, ]; const cfg: Record = { plugins, isolate: { compaction: true } }; - const self = { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }; - const out = mw?.call(null, self, () => cfg) as { plugins?: Array>; isolate?: Record }; + const presetFiber = { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }; + const out = mw?.call(null, presetFiber, () => cfg) as { plugins?: Array>; isolate?: Record }; assert.deepEqual(out.isolate, { compaction: true }); assert.equal(out.plugins?.[0]?.disabled, true); assert.equal(out.plugins?.[1]?.disabled, true); @@ -135,7 +137,7 @@ test("#3354 registerCompactionDisable: transform honors the entry predicate and assert.equal(mw?.call(null, { entry: { options: { name: "other-entry" } } }, () => untouched), untouched); assert.equal(mw?.call(undefined, null, () => untouched), untouched); // next() returning nothing → verbatim passthrough - assert.equal(mw?.call(null, self, () => undefined), undefined); + assert.equal(mw?.call(null, presetFiber, () => undefined), undefined); } finally { _resetDshCompactionVerdictForTest(); } diff --git a/tests/issue3662-dsh-gate-fallback.test.ts b/tests/issue3662-dsh-gate-fallback.test.ts index 9e8f3e8ffa..d4bae5ff37 100644 --- a/tests/issue3662-dsh-gate-fallback.test.ts +++ b/tests/issue3662-dsh-gate-fallback.test.ts @@ -19,14 +19,14 @@ const TESTS_DIR = path.dirname(fileURLToPath(import.meta.url)); const GATE_INSERT = `- insert:\n - id: bili-native\n name: billion-context\n - id: bili-compaction-gate\n name: billion-context/dsh-compaction-gate\n`; type GateHost = { - on?: (event: string, listener: (raw: unknown, next: () => unknown) => unknown, options?: { global?: boolean }) => void; + on?: (event: string, listener: (fiber: unknown, next: () => unknown) => unknown, options?: { global?: boolean }) => void; reflect?: { provide?: (name: string, value: unknown) => void } | undefined; }; function mockGateHost() { const order: string[] = []; const provided: Array<{ name: string; value: unknown }> = []; let onOptions: { global?: boolean } | undefined; - let mw: ((raw: unknown, next: () => unknown) => unknown) | undefined; + let mw: ((fiber: unknown, next: () => unknown) => unknown) | undefined; const host: GateHost = { on: (event, listener, options) => { order.push(`on:${event}`); @@ -45,7 +45,9 @@ function mockGateHost() { globalFlag: () => onOptions?.global === true, }; } -const PRESET_SELF = { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }; +// #7112: the fiber is the FIRST listener argument (cordis binds no `this`); +// the mock calls below pass it there, not as `this`. +const PRESET_FIBER = { entry: { options: { name: "@deepseek-ai/dsh-agent-preset" } } }; function presetPlugins(): Array> { return [ { name: "@deepseek-ai/dsh-compaction-basic", config: { auto: true } }, @@ -91,10 +93,10 @@ test("#3662: bili-native absent (disabled / kill-switched) — service still pro // the four presets resolvable instead of pending forever const raw = m.middleware(); assert.equal(typeof raw, "function"); - const mw = raw as (raw: unknown, next: () => unknown) => unknown; + const mw = raw as (fiber: unknown, next: () => unknown) => unknown; const plugins = presetPlugins(); const cfg: Record = { plugins, x: 1 }; - const out = mw.call(PRESET_SELF, null, () => cfg) as Record; + const out = mw.call(null, PRESET_FIBER, () => cfg) as Record; assert.equal(out, cfg, "absent verdict must pass the resolved config through verbatim"); for (const row of plugins) assert.equal(row.disabled, undefined); } finally { @@ -111,10 +113,10 @@ test("#3662: normal boot (verdict active) — the gate entry disables the compac assert.deepEqual(m.provided.map((p) => p.name), [BILI_COMPACTION_DISABLE_SERVICE]); const raw = m.middleware(); assert.equal(typeof raw, "function"); - const mw = raw as (raw: unknown, next: () => unknown) => unknown; + const mw = raw as (fiber: unknown, next: () => unknown) => unknown; const plugins = presetPlugins(); const cfg: Record = { plugins, x: 1 }; - const out = mw.call(PRESET_SELF, null, () => cfg) as { plugins?: Array>; x?: number }; + const out = mw.call(null, PRESET_FIBER, () => cfg) as { plugins?: Array>; x?: number }; assert.equal(out.x, 1); assert.deepEqual(out.plugins?.[0]?.config, { auto: true }); assert.equal(out.plugins?.[0]?.disabled, true); diff --git a/tests/issue4147-dsh-overlay-structural.test.ts b/tests/issue4147-dsh-overlay-structural.test.ts index b4c39b8c87..66b9d1cc15 100644 --- a/tests/issue4147-dsh-overlay-structural.test.ts +++ b/tests/issue4147-dsh-overlay-structural.test.ts @@ -16,7 +16,9 @@ import { // globalThis telemetry channel so the durable boot note can state actual // coverage (patch-row misses are otherwise loader-log-only). -type Mw = (raw: unknown, next: () => unknown) => unknown; +// #7112: cordis' real binding — `this` is null, the fiber (the name carrier) +// is the FIRST argument; the mock calls below pass it there. +type Mw = (fiber: unknown, next: () => unknown) => unknown; function middleware(): Mw { let mw: Mw | undefined;