fix(mcp): синхронизировать заглушки тестов с кодом блокировки и этапной авторизации

Полный прогон этапа 1 нашёл три теста, которые грузят исходники с явным
списком зависимостей: планировщик не знал node:timers/promises (ожидание
глобальной блокировки), фрагмент runtime.ts с экспортом константы
транслировался как ES-модуль, контекст маршрутизации не получал модуль
authorization-stage. Тестам переданы настоящие модули; проверки те же.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
DenozordecandClaude Opus 5.5 committed 2026-11-21 22:04:38 +07:00
1 parent d586f87009
commit daec2b473c
3 files changed
+5 -3

No files matched your search

@@ -16,6 +16,7 @@ import { canonicalVrfMembers } from "../../services/vrf-members.js"
import { readOspfEffectiveDisabled } from "../../services/ospf-effective-disabled.js"
import { isConfirmedRoutingFibTable } from "../../services/routing-table-fib.js"
import * as contextModel from "./routing-community-context-model.js"
import * as authorizationStage from "./authorization-stage.js"
import { scopedTargetRuleMatches } from "./routing-community-scoped-model.js"
import { prepareOriginalEffectSelection } from "./routing-original-effects.js"
import { readMeasurementAddress } from "./routing-measurement-address.js"
@@ -99,7 +100,7 @@ async function fixture(autoRecovery = false) {
await loadSource("./routing-community-context.ts", { ...common, "./routing-network-native-session.js": native,
"../../services/routing-table-fib.js": { isConfirmedRoutingFibTable }, "./routing-original-effects.js": { prepareOriginalEffectSelection },
"../../services/bgp-export-model.js": { nativeBgpRows, bgpTemplateReferences }, "../../services/bgp-filter-binding-model.js": { bgpFilterName, effectiveBgpFilter, stableBgpPolicyRow },
"./routing-community-context-model.js": contextModel, "./routing-community-scoped-model.js": { scopedTargetRuleMatches },
"./routing-community-context-model.js": contextModel, "./authorization-stage.js": authorizationStage, "./routing-community-scoped-model.js": { scopedTargetRuleMatches },
"./path-proof-purpose.js": { pathProofTag },
"./management-transport.js": { assertManagementTransport: async () => { throw Error("No alternate management fixture") } } }, context)
await loadSource("./routing-network-native-session.ts", { ...common, "node:net": { isIP }, zod: { z }, "@mmapp/contracts/mcp-routing": { routeAiProfileSchema },
@@ -73,7 +73,8 @@ async function actualBoundedRunner() {
const begin = runtime.indexOf("let activeRunners = 0"), end = runtime.indexOf("async function policyInput", begin)
assert(begin > 0 && end > begin)
// Execute the existing private slot owner directly, not a mirrored semaphore.
const code = ts.transpileModule(runtime.slice(begin, end) + "\nexports.runBounded = runBounded", { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
// CommonJS: the slice may contain exported constants next to the runner.
const code = ts.transpileModule(runtime.slice(begin, end) + "\nexports.runBounded = runBounded", { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 } }).outputText
const exports = {} as { runBounded(work: () => Promise<void>): Promise<void> }
runInNewContext(code, { exports, Promise }); return exports.runBounded
}
@@ -52,7 +52,7 @@ test("fixed scheduler ownership: real ALS/AsyncResource, fake I/O", async t => {
return client
} }) },
})
const locks = load(await source("services/config-mutation-lock.ts"), { "node:async_hooks": asyncProvider, "../db/index.js": { assertRuntimeDatabaseActivationCurrent() {}, pool: freshPool }, "../db/operation-lock.js": requestLock, "../db/database-restore-quarantine.js": { databaseRestoreQuarantineEnabled: () => false, assertDatabaseRestoreQuarantineOpen: async () => { throw new Error("quarantine must not be consulted") } }, "../modules/mcp/security.js": { McpError }, "../modules/mcp/database-request-lease.js": leases, "./operation-config-lock-lease.js": op })
const locks = load(await source("services/config-mutation-lock.ts"), { "node:async_hooks": asyncProvider, "node:timers/promises": require("node:timers/promises"), "../db/index.js": { assertRuntimeDatabaseActivationCurrent() {}, pool: freshPool }, "../db/operation-lock.js": requestLock, "../db/database-restore-quarantine.js": { databaseRestoreQuarantineEnabled: () => false, assertDatabaseRestoreQuarantineOpen: async () => { throw new Error("quarantine must not be consulted") } }, "../modules/mcp/security.js": { McpError }, "../modules/mcp/database-request-lease.js": leases, "./operation-config-lock-lease.js": op })
const policy = load(await source("services/config-mutation-policy.ts"), { "node:async_hooks": asyncProvider, "node:crypto": require("node:crypto"), "node:perf_hooks": require("node:perf_hooks"), "node:util": require("node:util"),
"../db/index.js": { pool: freshPool }, "../modules/mcp/store.js": { audit: async () => { throw Error("Unexpected audit I/O") } }, "../modules/mcp/security.js": { McpError }, "./config-mutation-lock.js": locks,
"../modules/mcp/routing-controller-active-writer.js": { assertActiveRoutingProfileWriter: async () => { throw Error("Unexpected native writer in fake scheduler collectors") } } })