@aviaratech/ai-delivery 0.3.29 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +43 -4
  2. package/dist/cli.js +11 -6
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cliResult.d.ts +1 -0
  5. package/dist/cliResult.js +8 -0
  6. package/dist/cliResult.js.map +1 -1
  7. package/dist/cliResult.test.js +176 -0
  8. package/dist/cliResult.test.js.map +1 -1
  9. package/dist/errors.d.ts +19 -0
  10. package/dist/errors.js +52 -0
  11. package/dist/errors.js.map +1 -1
  12. package/dist/github/client.d.ts +5 -0
  13. package/dist/github/client.js +142 -6
  14. package/dist/github/client.js.map +1 -1
  15. package/dist/github/machineAuth.test.js +284 -1
  16. package/dist/github/machineAuth.test.js.map +1 -1
  17. package/dist/issue.d.ts +2 -0
  18. package/dist/issue.js +2 -0
  19. package/dist/issue.js.map +1 -1
  20. package/dist/issueInfoReadback.test.d.ts +1 -0
  21. package/dist/issueInfoReadback.test.js +203 -0
  22. package/dist/issueInfoReadback.test.js.map +1 -0
  23. package/dist/lifecycle.test.js +72 -6
  24. package/dist/lifecycle.test.js.map +1 -1
  25. package/dist/pluginAuthProbe.test.js +25 -0
  26. package/dist/pluginAuthProbe.test.js.map +1 -1
  27. package/dist/pluginDoctor.test.js +21 -3
  28. package/dist/pluginDoctor.test.js.map +1 -1
  29. package/dist/pluginInstaller.d.ts +22 -0
  30. package/dist/pluginInstaller.js +378 -57
  31. package/dist/pluginInstaller.js.map +1 -1
  32. package/dist/pluginInstaller.test.js +745 -31
  33. package/dist/pluginInstaller.test.js.map +1 -1
  34. package/dist/pr.d.ts +1 -1
  35. package/dist/pr.js +85 -27
  36. package/dist/pr.js.map +1 -1
  37. package/dist/pr.test.js +223 -5
  38. package/dist/pr.test.js.map +1 -1
  39. package/dist/prAssociation.test.js +509 -2
  40. package/dist/prAssociation.test.js.map +1 -1
  41. package/dist/review.js +11 -0
  42. package/dist/review.js.map +1 -1
  43. package/dist/review.test.js +38 -0
  44. package/dist/review.test.js.map +1 -1
  45. package/dist/setup.test.js +489 -4
  46. package/dist/setup.test.js.map +1 -1
  47. package/dist/targetPolicyLocal.test.js +574 -167
  48. package/dist/targetPolicyLocal.test.js.map +1 -1
  49. package/package.json +1 -1
  50. package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
  51. package/plugins/ai-delivery/README.md +7 -1
  52. package/plugins/ai-delivery/plugin.json +1 -1
  53. package/plugins/ai-delivery/runtime/dist/cli.js +57 -57
  54. package/plugins/ai-delivery/runtime/package.json +1 -1
@@ -1,27 +1,59 @@
1
1
  import assert from 'node:assert/strict';
2
2
  import { execFileSync } from 'node:child_process';
3
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync, } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
4
5
  import { dirname, join } from 'node:path';
5
- import { afterEach, beforeEach, describe, test } from 'vitest';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { afterEach, beforeEach, describe, test, vi } from 'vitest';
6
8
  import { loadDeliveryConfig } from './config/deliveryConfig.js';
7
9
  import { digestBytes, digestValue } from './delivery/common.js';
8
10
  import { investigationAcceptanceBody, investigationAuthorityBody } from './pr.js';
9
11
  import { readInvestigationPreparation } from './services/worktreeRegistry.js';
10
12
  import { WorktreeTransitionPlanSchema } from './worktreeTransition.js';
11
13
  import { fixtureGit, inertTarget } from './fixtures/inertTarget.js';
14
+ const ASSERTED_MS = 15_000;
15
+ const DRAIN_MS = 15_000;
16
+ const GIT_MS = 5_000;
17
+ const REQUEST_MS = 60_000; // Existing MCP initialize/callTool request bound.
18
+ // Acquisition has seven 5s Git calls. Policy has three Git calls and one 5s
19
+ // child. Archive is one 5s tar; local config retains its former 15s bound.
20
+ // Closing is handler drain, not a new 60s request allowance.
21
+ const stageSteps = [
22
+ ['fixture', 7 * GIT_MS],
23
+ ['archive', GIT_MS],
24
+ ['config', ASSERTED_MS],
25
+ ['policy', 4 * GIT_MS],
26
+ ['connect', REQUEST_MS],
27
+ ['runtime_stage', REQUEST_MS],
28
+ ];
29
+ const transitionSteps = [
30
+ ['fixture', 7 * GIT_MS],
31
+ ['worktree', GIT_MS],
32
+ ['connect', REQUEST_MS],
33
+ ['archive', GIT_MS],
34
+ ['config', ASSERTED_MS],
35
+ ['runtime_stage', REQUEST_MS],
36
+ ['runtime_admit', REQUEST_MS],
37
+ ['close', DRAIN_MS],
38
+ ['reconnect', REQUEST_MS],
39
+ ];
12
40
  // Each scoped case owns its fixture, signal bridge, operation promises and disposal.
13
41
  // A hook deadline can reject before the real MCP handler settles; join never releases
14
42
  // fixture globals until the existing active-handler drain completes.
15
- function runtimeScope() {
43
+ function runtimeScope(steps = []) {
16
44
  const controller = new AbortController();
17
45
  const pending = new Set();
18
46
  const unlink = new Set();
19
47
  let cleanup;
48
+ let disposal;
20
49
  let joined;
21
50
  const scope = {
22
51
  controller,
23
52
  signal: controller.signal,
24
53
  pending,
54
+ phases: [],
55
+ steps,
56
+ nextStep: 0,
25
57
  fixture: undefined,
26
58
  forward(signal) {
27
59
  const abort = () => controller.abort(signal.reason);
@@ -32,16 +64,25 @@ function runtimeScope() {
32
64
  unlink.add(() => signal.removeEventListener('abort', abort));
33
65
  }
34
66
  },
35
- acquire() {
67
+ acquire(fixtureCancellation) {
36
68
  controller.signal.throwIfAborted();
37
69
  assert.equal(scope.fixture, undefined, 'Each case acquires exactly one fixture');
38
- scope.fixture = inertTarget(controller.signal, (ownedCleanup) => {
70
+ // Expected fixture cancellation must not cancel the scope that still owns
71
+ // the cancellation assertions and actual handler/disposal join.
72
+ const signal = fixtureCancellation
73
+ ? AbortSignal.any([controller.signal, fixtureCancellation])
74
+ : controller.signal;
75
+ scope.fixture = inertTarget(signal, (ownedCleanup) => {
39
76
  cleanup = ownedCleanup;
40
77
  });
41
78
  return scope.fixture;
42
79
  },
43
80
  join() {
44
- joined ??= (async () => {
81
+ if (joined)
82
+ return joined;
83
+ // This disposal remains owned after a stalled observation. Transport
84
+ // rejection or elapsed time never authorizes fixture/global removal.
85
+ disposal ??= (async () => {
45
86
  controller.abort(new Error('Owned scoped runtime case finished'));
46
87
  try {
47
88
  while (pending.size)
@@ -54,6 +95,30 @@ function runtimeScope() {
54
95
  unlink.clear();
55
96
  }
56
97
  })();
98
+ const phase = { name: 'drain', budgetMs: DRAIN_MS, started: performance.now(), outcome: 'running' };
99
+ scope.phases.push(phase);
100
+ let timer;
101
+ joined = Promise.race([
102
+ disposal,
103
+ new Promise((_, reject) => {
104
+ timer = setTimeout(() => {
105
+ phase.outcome = 'drain-stall';
106
+ reject(new Error('Owned drain-stall: real handler/disposal did not settle within 15000ms'));
107
+ }, DRAIN_MS);
108
+ }),
109
+ ])
110
+ .then(() => {
111
+ phase.outcome = 'passed';
112
+ }, (error) => {
113
+ if (phase.outcome !== 'drain-stall')
114
+ phase.outcome = 'failed';
115
+ throw error;
116
+ })
117
+ .finally(() => {
118
+ clearTimeout(timer);
119
+ phase.elapsedMs = performance.now() - phase.started;
120
+ joined = undefined; // Later joins observe the SAME actual disposal.
121
+ });
57
122
  return joined;
58
123
  },
59
124
  };
@@ -63,6 +128,8 @@ async function scopedPhase(scope, name, budgetMs, operation) {
63
128
  scope.signal.throwIfAborted();
64
129
  const started = performance.now();
65
130
  const timeout = new Error(`Owned ${name} deadline exceeded (${budgetMs}ms)`);
131
+ const phase = { name, budgetMs, started, outcome: 'running' };
132
+ scope.phases.push(phase);
66
133
  const timer = setTimeout(() => scope.controller.abort(timeout), budgetMs);
67
134
  const pending = Promise.resolve().then(async () => {
68
135
  scope.signal.throwIfAborted();
@@ -74,17 +141,44 @@ async function scopedPhase(scope, name, budgetMs, operation) {
74
141
  return value;
75
142
  });
76
143
  scope.pending.add(pending);
144
+ // Cancellation may win the observation; actual work remains owned until settled.
145
+ void pending.then(() => scope.pending.delete(pending), () => scope.pending.delete(pending));
146
+ let removeAbort = () => { };
77
147
  try {
78
- return await pending;
148
+ const value = await Promise.race([
149
+ pending,
150
+ new Promise((_, reject) => {
151
+ const abort = () => reject(scope.signal.reason);
152
+ removeAbort = () => scope.signal.removeEventListener('abort', abort);
153
+ scope.signal.addEventListener('abort', abort, { once: true });
154
+ if (scope.signal.aborted)
155
+ abort();
156
+ }),
157
+ ]);
158
+ phase.outcome = 'passed';
159
+ return value;
160
+ }
161
+ catch (error) {
162
+ phase.outcome = scope.signal.reason === timeout ? 'deadline' : scope.signal.aborted ? 'cancelled' : 'failed';
163
+ throw error;
79
164
  }
80
165
  finally {
81
166
  clearTimeout(timer);
82
- scope.pending.delete(pending);
167
+ removeAbort();
168
+ phase.elapsedMs = performance.now() - started;
83
169
  }
84
170
  }
85
- async function prepareScope(scope, prepare, budgetMs = 15_000) {
171
+ async function setupStep(scope, name, operation) {
172
+ const declared = scope.steps[scope.nextStep++];
173
+ assert.ok(declared, `Undeclared setup operation: ${name}`);
174
+ assert.equal(name, declared[0], 'Setup must execute the declared ledger in order');
175
+ return scopedPhase(scope, `setup:${name}`, declared[1], async () => operation());
176
+ }
177
+ async function prepareScope(scope, prepare) {
86
178
  try {
87
- return await scopedPhase(scope, 'setup', budgetMs, prepare);
179
+ const prepared = await prepare();
180
+ assert.equal(scope.nextStep, scope.steps.length, 'Every declared setup operation must complete');
181
+ return prepared;
88
182
  }
89
183
  catch (error) {
90
184
  scope.controller.abort(error);
@@ -92,24 +186,240 @@ async function prepareScope(scope, prepare, budgetMs = 15_000) {
92
186
  throw error;
93
187
  }
94
188
  }
95
- function scopedRuntimeCase(name, prepare, observe) {
96
- describe('per-case runtime preparation (15s setup, 15s asserted body)', () => {
189
+ test('sequential setup operations may exceed the former aggregate budget while each operation stays bounded', async () => {
190
+ const scope = runtimeScope([
191
+ ['first', 10_000],
192
+ ['second', 10_000],
193
+ ]);
194
+ const observed = [];
195
+ vi.useFakeTimers();
196
+ try {
197
+ const result = prepareScope(scope, async () => {
198
+ for (const [name, step] of [
199
+ ['first', 1],
200
+ ['second', 2],
201
+ ])
202
+ await setupStep(scope, name, async () => {
203
+ await new Promise((resolve) => setTimeout(resolve, 8_000));
204
+ observed.push(step);
205
+ });
206
+ return 'prepared';
207
+ }).catch((error) => error);
208
+ await vi.advanceTimersByTimeAsync(16_000);
209
+ assert.equal(await result, 'prepared');
210
+ assert.deepEqual(observed, [1, 2]);
211
+ assert.deepEqual(scope.phases.map(({ name, outcome }) => ({ name, outcome })), [
212
+ { name: 'setup:first', outcome: 'passed' },
213
+ { name: 'setup:second', outcome: 'passed' },
214
+ ]);
215
+ }
216
+ finally {
217
+ vi.useRealTimers();
218
+ await scope.join();
219
+ }
220
+ });
221
+ test('held real handler reports a finite drain stall, retains ownership and permits cleanup only after late settlement', async ({ signal, }) => {
222
+ const scope = runtimeScope();
223
+ scope.forward(signal);
224
+ const f = scope.acquire();
225
+ let release;
226
+ let entered;
227
+ const held = new Promise((resolve) => {
228
+ release = resolve;
229
+ });
230
+ const reached = new Promise((resolve) => {
231
+ entered = resolve;
232
+ });
233
+ const get = f.rest.issues.get;
234
+ let handlerSettled = false;
235
+ f.rest.issues.get = async (input) => {
236
+ entered();
237
+ await held;
238
+ handlerSettled = true;
239
+ return get(input);
240
+ };
241
+ try {
242
+ const c = await f.connect();
243
+ const call = c.call('issue_info', { issueNumber: 17 }).catch((error) => error);
244
+ await reached;
245
+ vi.useFakeTimers();
246
+ let outcome;
247
+ const joined = scope.join().then(() => {
248
+ outcome = 'drained';
249
+ }, (error) => {
250
+ outcome = error;
251
+ });
252
+ await vi.advanceTimersByTimeAsync(15_000);
253
+ assert.ok(outcome instanceof Error, 'A held handler must produce a finite drain-stall outcome');
254
+ assert.match(outcome.message, /drain-stall/u);
255
+ assert.equal(handlerSettled, false);
256
+ assert.equal(existsSync(f.root), true);
257
+ assert.throws(() => inertTarget(signal), /previous fixture must finish disposal/u);
258
+ await joined;
259
+ release();
260
+ await scope.join();
261
+ await call;
262
+ assert.equal(handlerSettled, true);
263
+ assert.equal(existsSync(f.base), false);
264
+ const next = inertTarget(signal);
265
+ await next.dispose(undefined);
266
+ }
267
+ finally {
268
+ vi.useRealTimers();
269
+ release();
270
+ await scope.join();
271
+ }
272
+ }, 30_000);
273
+ for (const phase of ['setup', 'asserted body'])
274
+ test(`an individual ${phase} stall aborts without dropping unsettled work`, async () => {
275
+ const scope = runtimeScope([['controlled', 1_000]]);
276
+ let release;
277
+ const held = new Promise((resolve) => {
278
+ release = resolve;
279
+ });
280
+ vi.useFakeTimers();
281
+ try {
282
+ const result = (phase === 'setup'
283
+ ? setupStep(scope, 'controlled', () => held)
284
+ : scopedPhase(scope, phase, ASSERTED_MS, () => held)).catch((error) => error);
285
+ await vi.advanceTimersByTimeAsync(phase === 'setup' ? 1_000 : ASSERTED_MS);
286
+ assert.match(String(await result), /deadline exceeded/u);
287
+ assert.equal(scope.signal.aborted, true);
288
+ assert.equal(scope.pending.size, 1, 'Cancellation must not erase the unsettled operation');
289
+ assert.equal(scope.phases[0].outcome, 'deadline');
290
+ }
291
+ finally {
292
+ vi.useRealTimers();
293
+ release();
294
+ await scope.join();
295
+ assert.equal(scope.pending.size, 0);
296
+ }
297
+ });
298
+ const faultSteps = [
299
+ ['fixture', 7 * GIT_MS],
300
+ ['connect', REQUEST_MS],
301
+ ];
302
+ const faultBudget = faultSteps.reduce((sum, [, budget]) => sum + budget, 0) + DRAIN_MS;
303
+ const neverReleasedCase = 'never-released real handler fails in a supervised native test process and is reaped before cleanup';
304
+ test(neverReleasedCase, async ({ signal }) => {
305
+ const recordPath = process.env['AI_DELIVERY_DRAIN_FAULT_RECORD'];
306
+ if (recordPath) {
307
+ // Only the supervised child enters this fault. It deliberately never releases
308
+ // the real handler; an active handle prevents an idle event loop hiding it.
309
+ const scope = runtimeScope(faultSteps);
310
+ scope.forward(signal);
311
+ const f = await setupStep(scope, 'fixture', () => scope.acquire());
312
+ const owned = lstatSync(f.base);
313
+ let entered;
314
+ const reached = new Promise((resolve) => {
315
+ entered = resolve;
316
+ });
317
+ f.rest.issues.get = async () => {
318
+ setInterval(() => { }, 1_000);
319
+ entered();
320
+ await new Promise(() => { });
321
+ throw new Error('Never released');
322
+ };
323
+ const c = await setupStep(scope, 'connect', () => f.connect());
324
+ void c.call('issue_info', { issueNumber: 17 }).catch(() => { });
325
+ await reached;
326
+ try {
327
+ await scope.join();
328
+ assert.fail('A never-released real handler cannot drain');
329
+ }
330
+ catch (error) {
331
+ assert.match(String(error), /drain-stall/u);
332
+ assert.equal(existsSync(f.base), true);
333
+ assert.throws(() => inertTarget(signal), /previous fixture must finish disposal/u);
334
+ writeFileSync(recordPath, JSON.stringify({
335
+ base: f.base,
336
+ dev: owned.dev,
337
+ ino: owned.ino,
338
+ uid: owned.uid,
339
+ retainedOwnership: true,
340
+ phases: scope.phases,
341
+ }), { flag: 'wx', mode: 0o600 });
342
+ throw error;
343
+ }
344
+ }
345
+ const checks = (await import(new URL('../scripts/checks.mjs', import.meta.url).href));
346
+ const evidence = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-drain-fault-evidence-')));
347
+ const temporary = join(evidence, 'temporary');
348
+ mkdirSync(temporary);
349
+ const record = join(evidence, 'retained-handler.json');
350
+ const unrelated = join(evidence, 'unrelated');
351
+ writeFileSync(unrelated, 'preserved');
352
+ const started = performance.now();
353
+ const command = await checks.executeCommand([
354
+ process.execPath,
355
+ fileURLToPath(new URL('../node_modules/vitest/vitest.mjs', import.meta.url)),
356
+ 'run',
357
+ fileURLToPath(import.meta.url),
358
+ '-t',
359
+ neverReleasedCase,
360
+ '--reporter=json',
361
+ '--outputFile=' + join(evidence, 'vitest.json'),
362
+ ], {
363
+ cwd: fileURLToPath(new URL('../', import.meta.url)),
364
+ env: {
365
+ ...checks.safeEnvironment(process.env),
366
+ TMPDIR: temporary,
367
+ AI_DELIVERY_DRAIN_FAULT_RECORD: record,
368
+ },
369
+ directory: join(evidence, 'command'),
370
+ signal,
371
+ timeoutMs: faultBudget,
372
+ maxRssBytes: 1024 ** 3,
373
+ progress: (partial) => writeFileSync(join(evidence, 'supervision.json'), JSON.stringify(partial)),
374
+ });
375
+ assert.ok(['failed', 'command-timeout', 'owned-child-remained-after-command'].includes(command.status));
376
+ assert.notEqual(command.exitCode, 0);
377
+ assert.equal(command.cleanupConfirmed, true);
378
+ assert.equal(checks.confirmCommandQuiescence(command).quiescent, true);
379
+ assert.ok(performance.now() - started <= faultBudget + 4_000, 'Fault supervision must finish within its declared budget and termination grace');
380
+ assert.ok(command.observedProcesses.length > 0);
381
+ const retained = JSON.parse(readFileSync(record, 'utf8'));
382
+ assert.equal(retained.retainedOwnership, true);
383
+ assert.ok(retained.phases.some((phase) => phase.name === 'drain' && phase.outcome === 'drain-stall'));
384
+ assert.ok(retained.base.startsWith(temporary + '/ai-delivery-inert-target-'));
385
+ const owned = lstatSync(retained.base);
386
+ assert.equal(owned.isSymbolicLink(), false);
387
+ assert.deepEqual([owned.dev, owned.ino, owned.uid], [retained.dev, retained.ino, retained.uid]);
388
+ assert.equal(readFileSync(unrelated, 'utf8'), 'preserved');
389
+ // Termination/quiescence is the alternative to actual settlement. Only now may
390
+ // this parent's exact child temporary root be removed. Keep original evidence.
391
+ rmSync(temporary, { recursive: true });
392
+ assert.equal(existsSync(temporary), false);
393
+ const receipt = {
394
+ elapsedMs: performance.now() - started,
395
+ faultBudgetMs: faultBudget,
396
+ command,
397
+ ownedTemporaryRemoved: true,
398
+ unrelatedPreserved: true,
399
+ evidence,
400
+ };
401
+ writeFileSync(join(evidence, 'result.json'), JSON.stringify(receipt, null, 2));
402
+ process.stdout.write('DRAIN_FAULT_SUPERVISION_RECEIPT ' + JSON.stringify(receipt) + '\n');
403
+ }, faultBudget + 4_000); // Existing supervisor: 3s TERM grace + 1s quiescence confirmation.
404
+ function scopedRuntimeCase(name, steps, prepare, observe) {
405
+ describe('per-operation runtime preparation (15s asserted work, 15s drain)', () => {
97
406
  let owned;
98
407
  beforeEach(async ({ signal }) => {
99
408
  assert.equal(owned, undefined, 'Previous case must finish owned teardown');
100
- const scope = runtimeScope();
409
+ const scope = runtimeScope(steps);
101
410
  owned = { scope, ready: false };
102
411
  scope.forward(signal);
103
412
  owned.prepared = await prepareScope(scope, () => prepare(scope));
104
413
  owned.ready = true;
105
- }, 15_000);
414
+ }, steps.reduce((sum, [, budget]) => sum + budget, 0) + DRAIN_MS);
106
415
  afterEach(async () => {
107
416
  const current = owned;
108
417
  if (current) {
109
418
  await current.scope.join();
419
+ process.stderr.write('ai-delivery.fixture-phases ' + JSON.stringify(current.scope.phases) + '\n');
110
420
  owned = undefined;
111
421
  }
112
- }, 15_000);
422
+ }, ASSERTED_MS + DRAIN_MS);
113
423
  test(name, async ({ signal }) => {
114
424
  const current = owned;
115
425
  assert.ok(current?.ready, 'Real case prerequisites must finish before the asserted body');
@@ -117,51 +427,56 @@ function scopedRuntimeCase(name, prepare, observe) {
117
427
  const prepared = current.prepared;
118
428
  current.scope.forward(signal);
119
429
  try {
120
- await scopedPhase(current.scope, 'asserted body', 15_000, () => observe(prepared));
430
+ await scopedPhase(current.scope, 'asserted body', ASSERTED_MS, () => observe(prepared));
121
431
  }
122
432
  finally {
123
433
  await current.scope.join();
124
434
  }
125
- }, 15_000);
435
+ }, ASSERTED_MS + DRAIN_MS);
126
436
  });
127
437
  }
128
- async function runtimeFixture(f) {
438
+ async function runtimeFixture(f, scope) {
129
439
  f.signal.throwIfAborted();
130
- const packageRoot = join(f.base, 'archive', 'package');
131
- const lifecycleSentinel = join(f.base, 'lifecycle-executed');
132
- const files = {
133
- 'package.json': JSON.stringify({
134
- name: '@aviaratech/ai-delivery',
135
- version: '0.3.5',
136
- type: 'module',
137
- bin: { 'ai-delivery': './dist/cli.js' },
138
- scripts: { preinstall: 'node lifecycle.cjs', postinstall: 'node lifecycle.cjs' },
139
- }),
140
- 'lifecycle.cjs': `require('node:fs').appendFileSync(${JSON.stringify(lifecycleSentinel)},'executed\\n');\n`,
141
- 'dist/cli.js': "#!/usr/bin/env node\nconsole.log('0.3.5');\n",
142
- 'dist/agent.js': 'export const fictional = true;\n',
143
- 'plugins/ai-delivery/dist/mcp-launcher.js': '/* Owned inert launcher bytes. */\n',
144
- 'plugins/ai-delivery/.claude-plugin/plugin.json': JSON.stringify({
145
- name: 'ai-delivery',
146
- packageVersion: '0.3.5',
147
- deliveryCapabilityVersion: 2,
148
- }),
440
+ const archive = () => {
441
+ const packageRoot = join(f.base, 'archive', 'package');
442
+ const lifecycleSentinel = join(f.base, 'lifecycle-executed');
443
+ const files = {
444
+ 'package.json': JSON.stringify({
445
+ name: '@aviaratech/ai-delivery',
446
+ version: '0.3.5',
447
+ type: 'module',
448
+ bin: { 'ai-delivery': './dist/cli.js' },
449
+ scripts: { preinstall: 'node lifecycle.cjs', postinstall: 'node lifecycle.cjs' },
450
+ }),
451
+ 'lifecycle.cjs': `require('node:fs').appendFileSync(${JSON.stringify(lifecycleSentinel)},'executed\\n');\n`,
452
+ 'dist/cli.js': "#!/usr/bin/env node\nconsole.log('0.3.5');\n",
453
+ 'dist/agent.js': 'export const fictional = true;\n',
454
+ 'plugins/ai-delivery/dist/mcp-launcher.js': '/* Owned inert launcher bytes. */\n',
455
+ 'plugins/ai-delivery/.claude-plugin/plugin.json': JSON.stringify({
456
+ name: 'ai-delivery',
457
+ packageVersion: '0.3.5',
458
+ deliveryCapabilityVersion: 2,
459
+ }),
460
+ };
461
+ for (const [path, bytes] of Object.entries(files)) {
462
+ const file = join(packageRoot, path);
463
+ mkdirSync(dirname(file), { recursive: true });
464
+ writeFileSync(file, bytes);
465
+ }
466
+ const archivePath = join(f.base, 'inert.tgz');
467
+ execFileSync('tar', ['-czf', archivePath, '-C', dirname(packageRoot), 'package'], {
468
+ timeout: 5_000,
469
+ maxBuffer: 64 * 1024,
470
+ });
471
+ return { archivePath, lifecycleSentinel };
149
472
  };
150
- for (const [path, bytes] of Object.entries(files)) {
151
- const file = join(packageRoot, path);
152
- mkdirSync(dirname(file), { recursive: true });
153
- writeFileSync(file, bytes);
154
- }
155
- const archivePath = join(f.base, 'inert.tgz');
156
- execFileSync('tar', ['-czf', archivePath, '-C', dirname(packageRoot), 'package'], {
157
- timeout: 5_000,
158
- maxBuffer: 64 * 1024,
159
- });
160
- const loaded = await loadDeliveryConfig(f.root, {
473
+ const { archivePath, lifecycleSentinel } = scope ? await setupStep(scope, 'archive', archive) : archive();
474
+ const config = () => loadDeliveryConfig(f.root, {
161
475
  repository: 'example/widget',
162
476
  signal: f.signal,
163
477
  clients: { graphql: f.graphql },
164
478
  });
479
+ const loaded = scope ? await setupStep(scope, 'config', config) : await config();
165
480
  const runtimeDirectory = join(f.base, 'runtime');
166
481
  const common = { expectedSourceCommit: f.head, expectedConfigDigest: loaded.configDigest, runtimeDirectory };
167
482
  return {
@@ -184,68 +499,105 @@ async function runtimeFixture(f) {
184
499
  cli: join(runtimeDirectory, 'node_modules/@aviaratech/ai-delivery/dist/cli.js'),
185
500
  };
186
501
  }
187
- test('fixture cancellation drains the real MCP handler before releasing global ownership', async ({ signal }) => {
188
- const cancellation = new AbortController();
189
- const f = inertTarget(AbortSignal.any([signal, cancellation.signal]));
190
- let connection;
191
- let next;
192
- let nextConnection;
193
- let release;
194
- let entered;
195
- const held = new Promise((resolve) => {
196
- release = resolve;
197
- });
198
- const reached = new Promise((resolve) => {
199
- entered = resolve;
200
- });
201
- const get = f.rest.issues.get;
202
- let portSettled = false;
203
- f.rest.issues.get = async (input) => {
204
- entered();
205
- await held;
206
- portSettled = true;
207
- return get(input);
208
- };
209
- try {
210
- f.policy('tracked');
211
- connection = await f.connect();
212
- const pending = connection.call('issue_info', { issueNumber: 17 });
213
- const rejected = assert.rejects(pending, /Controlled fixture cancellation/u);
214
- await reached;
215
- cancellation.abort(new Error('Controlled fixture cancellation'));
216
- const disposal = f.dispose(connection);
217
- assert.equal(f.dispose(connection), disposal, 'All disposal callers must join the same promise');
218
- let disposed = false;
219
- void disposal.then(() => {
220
- disposed = true;
502
+ const cancellationSteps = [
503
+ ['fixture', 7 * GIT_MS],
504
+ ['policy', 4 * GIT_MS],
505
+ ['connect', REQUEST_MS],
506
+ ];
507
+ for (const preparationDelayMs of [0, 3_000])
508
+ test(preparationDelayMs === 0
509
+ ? 'fixture cancellation drains the real MCP handler before releasing global ownership'
510
+ : 'fixture cancellation and reuse keep bounded preparation outside asserted-work budgets', async ({ signal }) => {
511
+ const first = runtimeScope(cancellationSteps);
512
+ const reuse = runtimeScope(cancellationSteps);
513
+ first.forward(signal);
514
+ reuse.forward(signal);
515
+ const cancellation = new AbortController();
516
+ let release;
517
+ let entered;
518
+ const held = new Promise((resolve) => {
519
+ release = resolve;
520
+ });
521
+ const reached = new Promise((resolve) => {
522
+ entered = resolve;
523
+ });
524
+ const prepare = (scope, fixtureCancellation) => prepareScope(scope, async () => {
525
+ const f = await setupStep(scope, 'fixture', async () => {
526
+ if (preparationDelayMs)
527
+ await new Promise((resolve) => setTimeout(resolve, preparationDelayMs));
528
+ return scope.acquire(fixtureCancellation);
529
+ });
530
+ await setupStep(scope, 'policy', () => f.policy('tracked'));
531
+ const connection = await setupStep(scope, 'connect', () => f.connect());
532
+ return { f, connection };
221
533
  });
222
- await rejected;
223
- assert.equal(portSettled, false);
224
- assert.equal(disposed, false, 'Transport cancellation must not be treated as handler settlement');
225
- assert.equal(existsSync(f.root), true, 'Files remain owned until the handler settles');
226
- assert.throws(() => inertTarget(signal), /previous fixture must finish disposal/u);
227
- release();
228
- await disposal;
229
- assert.equal(portSettled, true);
230
- assert.equal(existsSync(f.base), false);
231
- next = inertTarget(signal);
232
- next.policy('tracked');
233
- nextConnection = await next.connect();
234
- await f.dispose(connection);
235
- const result = await nextConnection.call('issue_info', { issueNumber: 17 });
236
- assert.notEqual(result.response.isError, true, result.text);
237
- assert.ok(next.calls.some((call) => call.name === 'issues.get'));
238
- }
239
- finally {
240
- release();
241
534
  try {
242
- await f.dispose(connection);
535
+ const { f, connection } = await prepare(first, cancellation.signal);
536
+ const get = f.rest.issues.get;
537
+ let portSettled = false;
538
+ f.rest.issues.get = async (input) => {
539
+ entered();
540
+ await held;
541
+ portSettled = true;
542
+ return get(input);
543
+ };
544
+ await scopedPhase(first, 'asserted cancellation', ASSERTED_MS, async () => {
545
+ const pending = connection.call('issue_info', { issueNumber: 17 });
546
+ const rejected = assert.rejects(pending, /Controlled fixture cancellation/u);
547
+ // Observe immediately, then join below; an early transport failure must
548
+ // also release the wait for real handler entry rather than strand it.
549
+ void rejected.catch(() => { });
550
+ await Promise.race([
551
+ reached,
552
+ pending.then(() => {
553
+ throw new Error('Controlled real handler was not reached');
554
+ }),
555
+ ]);
556
+ cancellation.abort(new Error('Controlled fixture cancellation'));
557
+ const disposal = f.dispose(connection);
558
+ assert.equal(f.dispose(connection), disposal, 'All disposal callers must join the same promise');
559
+ let disposed = false;
560
+ void disposal.then(() => {
561
+ disposed = true;
562
+ }, () => { });
563
+ await rejected;
564
+ assert.equal(portSettled, false);
565
+ assert.equal(disposed, false, 'Transport cancellation must not be treated as handler settlement');
566
+ assert.equal(existsSync(f.root), true, 'Files remain owned until the handler settles');
567
+ assert.throws(() => inertTarget(signal), /previous fixture must finish disposal/u);
568
+ release();
569
+ });
570
+ await first.join();
571
+ assert.equal(portSettled, true);
572
+ assert.equal(existsSync(f.base), false);
573
+ const next = await prepare(reuse);
574
+ if (preparationDelayMs) {
575
+ const setupElapsed = [first, reuse].flatMap((scope) => scope.phases.filter((phase) => phase.name.startsWith('setup:')));
576
+ assert.ok(setupElapsed.reduce((sum, phase) => sum + phase.elapsedMs, 0) > 5_000, 'Two bounded preparations must exceed the former aggregate five-second fuse');
577
+ }
578
+ await scopedPhase(reuse, 'asserted reuse', ASSERTED_MS, async () => {
579
+ await f.dispose(connection);
580
+ const result = await next.connection.call('issue_info', { issueNumber: 17 });
581
+ assert.notEqual(result.response.isError, true, result.text);
582
+ assert.ok(next.f.calls.some((call) => call.name === 'issues.get'));
583
+ });
243
584
  }
244
585
  finally {
245
- await next?.dispose(nextConnection);
586
+ release();
587
+ try {
588
+ await first.join();
589
+ }
590
+ finally {
591
+ await reuse.join();
592
+ process.stderr.write('CANCELLATION_SCOPE_PHASES ' +
593
+ JSON.stringify({ preparationDelayMs, first: first.phases, reuse: reuse.phases }) +
594
+ '\n');
595
+ }
246
596
  }
247
- }
248
- }, 5_000);
597
+ },
598
+ // Each owner has finite setup/assertion limits and a distinct drain-stall
599
+ // bound; this framework guard includes failure-path and final cleanup joins.
600
+ 2 * (cancellationSteps.reduce((sum, [, budget]) => sum + budget, 0) + ASSERTED_MS + 2 * DRAIN_MS));
249
601
  test('fixture disposal closes a cancelled MCP connection', async ({ signal }) => {
250
602
  const f = inertTarget(signal);
251
603
  const cancellation = new AbortController();
@@ -269,16 +621,16 @@ test('fixture disposal closes a cancelled MCP connection', async ({ signal }) =>
269
621
  await next.dispose(undefined);
270
622
  }
271
623
  }, 5_000);
272
- async function stageAndAdmit(f, c) {
273
- const runtime = await runtimeFixture(f);
274
- const staged = await c.call('runtime_stage', runtime.stage);
624
+ async function stageAndAdmit(f, c, scope) {
625
+ const runtime = await runtimeFixture(f, scope);
626
+ const staged = await setupStep(scope, 'runtime_stage', () => c.call('runtime_stage', runtime.stage));
275
627
  assert.notEqual(staged.response.isError, true, staged.text);
276
- const admitted = await c.call('runtime_admit', {
628
+ const admitted = await setupStep(scope, 'runtime_admit', () => c.call('runtime_admit', {
277
629
  ...runtime.common,
278
630
  authority: 'runtime:admit',
279
631
  stageId: staged.value.stageId,
280
632
  expectedPriorAdmissionSha256: null,
281
- });
633
+ }));
282
634
  assert.notEqual(admitted.response.isError, true, admitted.text);
283
635
  return { ...runtime, stageId: staged.value.stageId, admission: admitted.value.admission };
284
636
  }
@@ -309,11 +661,11 @@ for (const cancellation of ['hook signal', 'owned setup deadline']) {
309
661
  f.policy('tracked');
310
662
  const c = await f.connect();
311
663
  let callOutcome;
312
- const setup = prepareScope(scope, async () => {
664
+ const setup = prepareScope(scope, () => scopedPhase(scope, 'setup', cancellation === 'owned setup deadline' ? 1_000 : REQUEST_MS, async () => {
313
665
  const call = c.call('issue_info', { issueNumber: 17 });
314
666
  callOutcome = call.then(() => undefined, (error) => error);
315
667
  return call;
316
- }, cancellation === 'owned setup deadline' ? 1_000 : 15_000);
668
+ }));
317
669
  // Observe both outcomes immediately; failures before release must not create
318
670
  // an unhandled assertion promise while the held real handler is drained.
319
671
  const setupOutcome = setup.then(() => undefined, (error) => error);
@@ -414,23 +766,110 @@ async function lifecycleControl(f, runtime) {
414
766
  assert.match(readFileSync(runtime.lifecycleSentinel, 'utf8'), /executed/u);
415
767
  }
416
768
  async function prepareStage(scope) {
417
- const f = scope.acquire();
418
- const runtime = await runtimeFixture(f);
419
- f.policy('tracked');
420
- const c = await f.connect();
421
- const staged = await c.call('runtime_stage', runtime.stage);
769
+ const f = await setupStep(scope, 'fixture', () => scope.acquire());
770
+ const runtime = await runtimeFixture(f, scope);
771
+ await setupStep(scope, 'policy', () => f.policy('tracked'));
772
+ const c = await setupStep(scope, 'connect', () => f.connect());
773
+ const staged = await setupStep(scope, 'runtime_stage', () => c.call('runtime_stage', runtime.stage));
422
774
  assert.notEqual(staged.response.isError, true, staged.text);
423
775
  assert.ok(existsSync(runtime.cli));
424
776
  assert.equal(existsSync(runtime.lifecycleSentinel), false);
425
777
  assert.equal(existsSync(join(f.root, '.git/ai-delivery/runtime-admission.json')), false, 'Staging must not admit');
426
778
  return { f, c, runtime, staged };
427
779
  }
428
- async function prepareTransition(f) {
429
- f.worktree();
430
- let c = await f.connect();
431
- const runtime = await stageAndAdmit(f, c);
432
- await c.close();
433
- c = await f.connect({ runtimeEntryPath: runtime.cli });
780
+ // The edited-policy refusal has the same real staged prerequisites, then one
781
+ // separately bounded tracked-to-edited transition (three Git calls, two controls).
782
+ const editedAdmitSteps = [...stageSteps, ['edited policy', 5 * GIT_MS]];
783
+ async function prepareEditedAdmit(scope) {
784
+ const prepared = await prepareStage(scope);
785
+ await setupStep(scope, 'edited policy', () => prepared.f.policy('edited'));
786
+ return prepared;
787
+ }
788
+ async function observeEditedAdmit({ f, c, runtime, staged }) {
789
+ const admitted = await c.call('runtime_admit', {
790
+ ...runtime.common,
791
+ authority: 'runtime:admit',
792
+ stageId: staged.value.stageId,
793
+ expectedPriorAdmissionSha256: null,
794
+ });
795
+ assert.equal(admitted.response.isError, true);
796
+ assert.match(admitted.text, /Delivery requires an exact clean worktree\./u);
797
+ assert.equal(existsSync(join(f.root, '.git/ai-delivery/runtime-admission.json')), false);
798
+ assert.equal(existsSync(runtime.lifecycleSentinel), false);
799
+ }
800
+ for (const cancellation of ['operation deadline', 'forwarded cancellation'])
801
+ test(`edited runtime_admit preparation ${cancellation} retains its real stage handler through drain stall and late settlement`, async ({ signal }) => {
802
+ const scope = runtimeScope(editedAdmitSteps.map(([name, budget]) => [name, name === 'runtime_stage' ? 3_000 : budget]));
803
+ const hook = new AbortController();
804
+ scope.forward(signal);
805
+ scope.forward(hook.signal);
806
+ let release;
807
+ let entered;
808
+ const held = new Promise((resolve) => {
809
+ release = resolve;
810
+ });
811
+ const reached = new Promise((resolve) => {
812
+ entered = resolve;
813
+ });
814
+ const acquire = scope.acquire.bind(scope);
815
+ let handlerSettled = false;
816
+ scope.acquire = () => {
817
+ const f = acquire();
818
+ const get = f.rest.repos.get;
819
+ f.rest.repos.get = async (input) => {
820
+ entered();
821
+ await held;
822
+ handlerSettled = true;
823
+ return get(input);
824
+ };
825
+ return f;
826
+ };
827
+ try {
828
+ const preparing = prepareScope(scope, () => prepareEditedAdmit(scope)).then(() => new Error('Controlled stage handler was not held'), (error) => error);
829
+ await Promise.race([
830
+ reached,
831
+ preparing.then((result) => {
832
+ throw result;
833
+ }),
834
+ ]);
835
+ const f = scope.fixture;
836
+ process.stderr.write('EDITED_REFUSAL_HELD ' + JSON.stringify({ cancellation, phases: scope.phases }) + '\n');
837
+ // This actual stage owns native supervision too: keep real timers while
838
+ // its held handler reaches the shortened fault-only operation deadline.
839
+ if (cancellation === 'forwarded cancellation')
840
+ hook.abort(new Error('Controlled edited-refusal setup cancellation'));
841
+ assert.match(String(await preparing), /drain-stall/u);
842
+ assert.equal(handlerSettled, false, 'Rejected transport cannot establish handler settlement');
843
+ assert.equal(scope.signal.aborted, true);
844
+ assert.equal(existsSync(f.base), true, 'Stalled handler must retain fixture and globals');
845
+ assert.throws(() => inertTarget(signal), /previous fixture must finish disposal/u);
846
+ assert.ok(scope.phases.some((phase) => phase.name === 'setup:runtime_stage' &&
847
+ phase.outcome === (cancellation === 'operation deadline' ? 'deadline' : 'cancelled')));
848
+ assert.ok(scope.phases.some((phase) => phase.name === 'drain' && phase.outcome === 'drain-stall'));
849
+ assert.equal(scope.phases.some((phase) => phase.name === 'setup:edited policy'), false);
850
+ release();
851
+ await scope.join();
852
+ assert.equal(handlerSettled, true);
853
+ assert.equal(scope.pending.size, 0);
854
+ assert.equal(existsSync(f.base), false);
855
+ process.stderr.write('EDITED_REFUSAL_OWNERSHIP ' +
856
+ JSON.stringify({ cancellation, phases: scope.phases, rootRemoved: true }) +
857
+ '\n');
858
+ const next = inertTarget(signal);
859
+ await next.dispose(undefined);
860
+ }
861
+ finally {
862
+ release();
863
+ await scope.join();
864
+ }
865
+ }, editedAdmitSteps.reduce((sum, [, budget]) => sum + budget, 0) + 2 * DRAIN_MS);
866
+ async function prepareTransition(scope) {
867
+ const f = await setupStep(scope, 'fixture', () => scope.acquire());
868
+ await setupStep(scope, 'worktree', () => f.worktree());
869
+ let c = await setupStep(scope, 'connect', () => f.connect());
870
+ const runtime = await stageAndAdmit(f, c, scope);
871
+ await setupStep(scope, 'close', () => c.close());
872
+ c = await setupStep(scope, 'reconnect', () => f.connect({ runtimeEntryPath: runtime.cli }));
434
873
  return { f, c, runtime };
435
874
  }
436
875
  async function observeTransition(f, c, runtime, kind) {
@@ -495,14 +934,14 @@ async function observeTransition(f, c, runtime, kind) {
495
934
  }
496
935
  for (const kind of ['tracked', 'edited']) {
497
936
  if (kind === 'tracked') {
498
- scopedRuntimeCase('public MCP runtime_stage asserts first install in 15s setup and exact reuse/lifecycle control in 15s body with tracked policy inert', prepareStage, async ({ f, c, runtime, staged }) => {
937
+ scopedRuntimeCase('public MCP runtime_stage asserts bounded first install and exact reuse/lifecycle control with tracked policy inert', stageSteps, prepareStage, async ({ f, c, runtime, staged }) => {
499
938
  const reused = await c.call('runtime_stage', runtime.stage);
500
939
  assert.notEqual(reused.response.isError, true, reused.text);
501
940
  assert.equal(reused.value.stageId, staged.value.stageId);
502
941
  assert.equal(reused.value.reused, true);
503
942
  await lifecycleControl(f, runtime);
504
943
  });
505
- scopedRuntimeCase('public MCP runtime_admit binds and reuses exact stage bytes after 15s real stage setup and leaves tracked policy inert', prepareStage, async ({ f, c, runtime, staged }) => {
944
+ scopedRuntimeCase('public MCP runtime_admit binds and reuses exact stage bytes after bounded real stage setup and leaves tracked policy inert', stageSteps, prepareStage, async ({ f, c, runtime, staged }) => {
506
945
  const args = {
507
946
  ...runtime.common,
508
947
  authority: 'runtime:admit',
@@ -537,31 +976,15 @@ for (const kind of ['tracked', 'edited']) {
537
976
  await f.dispose(c);
538
977
  }
539
978
  }, 15_000);
540
- test('public MCP runtime_admit refuses primary source edits and leaves edited policy inert', async ({ signal }) => {
541
- const f = inertTarget(signal);
542
- let c;
543
- try {
544
- const runtime = await runtimeFixture(f);
545
- f.policy('tracked');
546
- c = await f.connect();
547
- const staged = await c.call('runtime_stage', runtime.stage);
548
- assert.notEqual(staged.response.isError, true, staged.text);
549
- f.policy('edited');
550
- const admitted = await c.call('runtime_admit', {
551
- ...runtime.common,
552
- authority: 'runtime:admit',
553
- stageId: staged.value.stageId,
554
- expectedPriorAdmissionSha256: null,
555
- });
556
- assert.equal(admitted.response.isError, true);
557
- assert.match(admitted.text, /Delivery requires an exact clean worktree\./u);
558
- assert.equal(existsSync(join(f.root, '.git/ai-delivery/runtime-admission.json')), false);
559
- assert.equal(existsSync(runtime.lifecycleSentinel), false);
560
- }
561
- finally {
562
- await f.dispose(c);
563
- }
564
- }, 15_000);
979
+ scopedRuntimeCase('public MCP runtime_admit refuses primary source edits and leaves edited policy inert', editedAdmitSteps, prepareEditedAdmit, observeEditedAdmit);
980
+ scopedRuntimeCase('edited runtime_admit refusal keeps bounded preparation outside its asserted-work budget', [['controlled before fixture', 10_000], ...editedAdmitSteps, ['controlled after staging', 10_000]], async (scope) => {
981
+ const started = performance.now();
982
+ await setupStep(scope, 'controlled before fixture', () => new Promise((resolve) => setTimeout(resolve, 8_000)));
983
+ const prepared = await prepareEditedAdmit(scope);
984
+ await setupStep(scope, 'controlled after staging', () => new Promise((resolve) => setTimeout(resolve, 8_000)));
985
+ assert.ok(performance.now() - started > ASSERTED_MS, 'Preparation must exceed the original aggregate fuse');
986
+ return prepared;
987
+ }, observeEditedAdmit);
565
988
  }
566
989
  test(`public MCP investigation start ${kind === 'tracked' ? 'registers exact selected source' : 'refuses selected worktree edits'} with ${kind} policy`, async ({ signal, }) => {
567
990
  const f = inertTarget(signal);
@@ -686,22 +1109,6 @@ for (const kind of ['tracked', 'edited']) {
686
1109
  await f.dispose(c);
687
1110
  }
688
1111
  }, 15_000);
689
- if (kind === 'tracked') {
690
- scopedRuntimeCase('public MCP transition apply reaches unsupported historical binding after 15s real stage/admit/reconnect setup without loading tracked policy', async (scope) => prepareTransition(scope.acquire()), async ({ f, c, runtime }) => observeTransition(f, c, runtime, 'tracked'));
691
- }
692
- else {
693
- test('public MCP transition apply reaches unsupported historical binding without loading edited policy', async ({ signal, }) => {
694
- const f = inertTarget(signal);
695
- let c;
696
- try {
697
- const prepared = await prepareTransition(f);
698
- c = prepared.c;
699
- await observeTransition(f, c, prepared.runtime, 'edited');
700
- }
701
- finally {
702
- await f.dispose(c);
703
- }
704
- }, 15_000);
705
- }
1112
+ scopedRuntimeCase(`public MCP transition apply reaches unsupported historical binding after bounded stage/admit/reconnect without loading ${kind} policy`, transitionSteps, prepareTransition, async ({ f, c, runtime }) => observeTransition(f, c, runtime, kind));
706
1113
  }
707
1114
  //# sourceMappingURL=targetPolicyLocal.test.js.map