From daec2b473ca684a90a453ce69016885bbb18aed4 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Sat, 21 Nov 2026 22:04:38 +0700 Subject: [PATCH] =?UTF-8?q?fix(mcp):=20=D1=81=D0=B8=D0=BD=D1=85=D1=80?= =?UTF-8?q?=D0=BE=D0=BD=D0=B8=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B7=D0=B0=D0=B3=D0=BB=D1=83=D1=88=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D1=81=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC=20=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D0=B8=20=D1=8D=D1=82=D0=B0=D0=BF=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Полный прогон этапа 1 нашёл три теста, которые грузят исходники с явным списком зависимостей: планировщик не знал node:timers/promises (ожидание глобальной блокировки), фрагмент runtime.ts с экспортом константы транслировался как ES-модуль, контекст маршрутизации не получал модуль authorization-stage. Тестам переданы настоящие модули; проверки те же. Co-Authored-By: Claude Opus 5.5 --- backend/src/modules/mcp/routing-network-scoped-context.test.ts | 3 ++- backend/src/services/detached-database-admission.test.ts | 3 ++- backend/src/services/scheduler-automatic-root.test.mjs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/modules/mcp/routing-network-scoped-context.test.ts b/backend/src/modules/mcp/routing-network-scoped-context.test.ts index 07781429..24f1295b 100644 --- a/backend/src/modules/mcp/routing-network-scoped-context.test.ts +++ b/backend/src/modules/mcp/routing-network-scoped-context.test.ts @@ -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 }, diff --git a/backend/src/services/detached-database-admission.test.ts b/backend/src/services/detached-database-admission.test.ts index 65131e58..ba2f8081 100644 --- a/backend/src/services/detached-database-admission.test.ts +++ b/backend/src/services/detached-database-admission.test.ts @@ -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): Promise } runInNewContext(code, { exports, Promise }); return exports.runBounded } diff --git a/backend/src/services/scheduler-automatic-root.test.mjs b/backend/src/services/scheduler-automatic-root.test.mjs index de8e3367..9c4352b5 100644 --- a/backend/src/services/scheduler-automatic-root.test.mjs +++ b/backend/src/services/scheduler-automatic-root.test.mjs @@ -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") } } })