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") } } })