@aviaratech/ai-delivery 0.3.20 → 0.3.21

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issueJournal.test.js","sourceRoot":"","sources":["../src/issueJournal.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,IAAI,CAAC,iEAAiE,EAAE,GAAG,EAAE;IAC3E,MAAM,IAAI,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,+BAA+B,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG;QACb,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,0BAA0B;QACnC,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,YAAY;QACtB,UAAU,EAAE,CAAC,UAAU,CAAC;QACxB,QAAQ,EAAE,CAAC,2CAA2C,CAAC;KACxD,CAAC;IACF,KAAK,MAAM,KAAK,IAAI;QAClB,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE;QAC9D,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE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
4300
  rmSync(root, { recursive: true, force: true });
4301
4301
  }
4302
- }, 15_000);
4302
+ }, 0);
4303
4303
  test.each(['runtime', 'primary-policy', 'witness', 'sibling', 'foreign-repository', 'missing-source'])('source-bound dispatch rejects invalid %s before running candidate stages', async (invalid) => {
4304
4304
  const { root, runtimeEntryPath, counter } = await fixture();
4305
4305
  let foreignRoot;
@@ -4626,6 +4626,7 @@ test.each([
4626
4626
  });
4627
4627
  test('MCP exposes one implementation surface for native lifecycle commands', () => {
4628
4628
  assert.deepEqual(AI_DELIVERY_MCP_TOOLS.map((tool) => tool.name), [
4629
+ 'issue_comment',
4629
4630
  'runtime_stage',
4630
4631
  'runtime_admit',
4631
4632
  'issue_create',
@@ -4645,6 +4646,17 @@ test('MCP exposes one implementation surface for native lifecycle commands', ()
4645
4646
  'issue_worktree_transition_apply',
4646
4647
  ]);
4647
4648
  const validInputs = {
4649
+ issue_comment: {
4650
+ issueNumber: 17,
4651
+ kind: 'start',
4652
+ summary: 'Implementation started.',
4653
+ status: 'In progress',
4654
+ outcome: 'Deliver validation',
4655
+ keyNumbers: [],
4656
+ evidence: [],
4657
+ nextStep: 'Run checks',
4658
+ nextDate: '2026-10-09',
4659
+ },
4648
4660
  issue_create: { title: 'Synthetic tracking parent' },
4649
4661
  issue_update: { issueNumber: 17, park: true },
4650
4662
  issue_ready_check: { issueNumber: 17 },
@@ -4725,6 +4737,7 @@ async function syntheticLifecycle(routing) {
4725
4737
  body: `## Outcome\nDeliver a verified synthetic change to the local repository.\n\n## Scope\n- \`artifact.txt\`\n\n## Acceptance Criteria\n- [ ] Change is verified\n- [ ] Review and merge are recorded\n\n## Verification\nRun \`node --version\`.`,
4726
4738
  state: 'open',
4727
4739
  html_url: 'https://example.test/issues/17',
4740
+ created_at: '2026-10-01T00:00:00Z',
4728
4741
  type: { name: 'Task' },
4729
4742
  };
4730
4743
  let issuePoints;
@@ -4762,7 +4775,9 @@ async function syntheticLifecycle(routing) {
4762
4775
  let nativeTimelineCalls = 0;
4763
4776
  let nativePrRepository;
4764
4777
  const continuationComments = [];
4778
+ const journalComments = [];
4765
4779
  const createPayloads = [];
4780
+ let loseNextJournalResponse = false;
4766
4781
  const statuses = { Queued: 'STATUS-0', Active: 'STATUS-1', Waiting: 'STATUS-2', Shipped: 'STATUS-3' };
4767
4782
  const statusName = (option) => Object.entries(statuses).find(([, id]) => id === option)?.[0];
4768
4783
  const pageInfo = { endCursor: null, hasNextPage: false };
@@ -5044,9 +5059,24 @@ async function syntheticLifecycle(routing) {
5044
5059
  data: nativeTimelinePages?.[input.page - 1] ?? (input.page === 1 ? [nativeReference()] : []),
5045
5060
  };
5046
5061
  },
5047
- listComments: async () => ({ data: continuationComments }),
5062
+ listComments: async () => ({ data: [...continuationComments, ...journalComments] }),
5063
+ createComment: async (input) => {
5064
+ const data = {
5065
+ id: 1000 + journalComments.length,
5066
+ body: input.body,
5067
+ html_url: `https://example.test/issues/17#issuecomment-${String(1000 + journalComments.length)}`,
5068
+ issue_url: 'https://api.example.test/repos/example/widget/issues/17',
5069
+ user: { login: authenticatedAuthor },
5070
+ };
5071
+ journalComments.push(data);
5072
+ if (loseNextJournalResponse) {
5073
+ loseNextJournalResponse = false;
5074
+ throw new Error('Synthetic journal response lost');
5075
+ }
5076
+ return { data };
5077
+ },
5048
5078
  getComment: async (input) => ({
5049
- data: continuationComments.find((comment) => comment.id === input.comment_id),
5079
+ data: [...continuationComments, ...journalComments].find((comment) => comment.id === input.comment_id),
5050
5080
  }),
5051
5081
  create: async (input) => {
5052
5082
  calls.push('issue:create');
@@ -5314,7 +5344,7 @@ async function syntheticLifecycle(routing) {
5314
5344
  parentIssueNumber = null;
5315
5345
  projectStatus = null;
5316
5346
  calls.length = 0;
5317
- await assert.rejects(startTrackedIssue(context, { issueNumber, resumeCreated: true }), /requires issueNumber and develop=true/u);
5347
+ await assert.rejects(startTrackedIssue(context, { issueNumber, resumeCreated: true }), /requires issueNumber and an explicit develop boolean/u);
5318
5348
  await assert.rejects(createIssue(context, {
5319
5349
  body: issue.body,
5320
5350
  blockedBy: [9],
@@ -5351,14 +5381,19 @@ async function syntheticLifecycle(routing) {
5351
5381
  trackingParent = false;
5352
5382
  issue.state = 'closed';
5353
5383
  await assert.rejects(developIssue(context, issueNumber), /closed/u);
5384
+ assert.equal(journalComments.length, 0, 'failed readiness must not publish a start journal');
5354
5385
  issue.state = 'open';
5355
5386
  assert.equal((await readyCheck(context, issueNumber)).ready, true);
5356
5387
  if (routing.committedDescendantContinuation)
5357
5388
  await prepareIssueWorktree({ identity: 'synthetic-preparer', issueNumber, repoRoot: root });
5389
+ loseNextJournalResponse = true;
5390
+ await assert.rejects(startTrackedIssue(context, { issueNumber }), /journal response lost/u);
5358
5391
  const started = await startTrackedIssue(context, { issueNumber });
5359
5392
  assert.equal(started.mode, 'existing-issue');
5360
5393
  assert.equal(started.issueNumber, issueNumber);
5361
5394
  assert.equal(started.title, issue.title);
5395
+ assert.equal(journalComments.length, 1, 'successful start publishes one journal');
5396
+ assert.match(journalComments[0].body, /\*\*Kind:\*\* start/u);
5362
5397
  const row = started;
5363
5398
  assert.equal(projectStatus, 'Active');
5364
5399
  const parked = await updateIssue(context, { issueNumber, park: true });
@@ -5366,6 +5401,7 @@ async function syntheticLifecycle(routing) {
5366
5401
  assert.equal(existsSync(row.path), true);
5367
5402
  assert.equal((await updateIssue(context, { issueNumber, title: issue.title })).projectStatus, 'Todo');
5368
5403
  await developIssue(context, issueNumber);
5404
+ assert.equal(journalComments.length, 1, 'repeat develop reuses the start journal');
5369
5405
  assert.equal(projectStatus, 'Active');
5370
5406
  const blockedUpdate = await updateIssue(context, { issueNumber, blockedBy: [9] });
5371
5407
  assert.deepEqual(blockedUpdate.blockedBy, [9]);
@@ -6346,15 +6382,23 @@ exec "${realGit}" "$@"
6346
6382
  const blockedRecordPath = join(gitCommonDir(root), 'ai-delivery', 'deliveries.json');
6347
6383
  mkdirSync(blockedRecordPath);
6348
6384
  await assert.rejects(finishIssue(context, { issueNumber, prNumber, strategy: 'merge' }), /Delivery record store is invalid/u);
6385
+ assert.equal(journalComments.filter((comment) => comment.body.includes('**Kind:** closeout')).length, 0, 'failed finish must not claim closeout');
6349
6386
  assert.equal(existsSync(row.path), false);
6350
6387
  rmSync(blockedRecordPath, { recursive: true });
6351
6388
  const dispatchClient = enableDispatch();
6352
6389
  execution.runtimeEntryPath = runtimeEntryPath;
6353
6390
  const terminalMerge = (await executeTool('issue_pr_merge', { issueNumber, prNumber, strategy: 'merge' }, execution));
6354
6391
  assert.equal(terminalMerge.mergeSha, git(remote, 'rev-parse', 'refs/heads/main'));
6392
+ loseNextJournalResponse = true;
6393
+ await assert.rejects(executeTool('issue_finish', { issueNumber, prNumber, strategy: 'merge' }, execution), /journal response lost/u);
6355
6394
  const finished = (await executeTool('issue_finish', { issueNumber, prNumber, strategy: 'merge' }, execution));
6356
6395
  assert.equal(finished.issueClosed, true);
6357
6396
  assert.equal(finished.cleaned, true);
6397
+ const closeouts = journalComments.filter((comment) => comment.body.includes('**Kind:** closeout'));
6398
+ assert.equal(closeouts.length, 1);
6399
+ assert.match(closeouts[0].body, /Change is verified/u);
6400
+ assert.match(closeouts[0].body, /Review and merge are recorded/u);
6401
+ assert.match(closeouts[0].body, /https:\/\/example.test\/pulls\/23/u);
6358
6402
  assert.equal(projectStatus, 'Shipped');
6359
6403
  assert.equal(git(remote, 'rev-parse', 'refs/heads/main'), finished.mergeSha);
6360
6404
  assert.equal(existsSync(row.path), false);
@@ -6362,15 +6406,31 @@ exec "${realGit}" "$@"
6362
6406
  assert.equal(getDeliveryRecords(root)[0]?.points, 4);
6363
6407
  assert.deepEqual(calls, ['issue:create', 'review:create', 'git:createCommit']);
6364
6408
  assert.deepEqual(await executeTool('issue_finish', { issueNumber, prNumber, strategy: 'merge' }, execution), finished);
6409
+ assert.equal(journalComments.filter((comment) => comment.body.includes('**Kind:** closeout')).length, 1, 'repeated finish reuses closeout');
6365
6410
  await assert.rejects(executeTool('issue_finish', { issueNumber, prNumber: 24 }, execution), /exact terminal merge receipts/u);
6366
6411
  dispatchClient.mockRestore();
6367
6412
  assert.equal(getDeliveryRecords(root).length, 1);
6368
6413
  await assert.rejects(finishIssue(context, { issueNumber, prNumber: 24 }), /exact terminal merge receipts/u);
6369
- const newlyStarted = await startTrackedIssue(context, { request: 'New synthetic task' });
6414
+ const readyBody = issue.body;
6415
+ issue.created_at = '2026-10-08T00:00:00Z';
6416
+ issue.state = 'open';
6417
+ const beforeCreationOnly = calls.filter((call) => call === 'issue:create').length;
6418
+ const beforeCreationJournal = journalComments.length;
6419
+ loseNextJournalResponse = true;
6420
+ const creationOnlyFailure = (await startTrackedIssue(context, { request: 'New synthetic task' }));
6421
+ assert.equal(creationOnlyFailure.status, 'created-not-started');
6422
+ assert.equal(creationOnlyFailure.createdIssue.number, issueNumber);
6423
+ assert.equal(creationOnlyFailure.failure.phase, 'journal');
6424
+ assert.equal(creationOnlyFailure.safeResume.arguments.develop, false);
6425
+ const newlyStarted = await startTrackedIssue(context, creationOnlyFailure.safeResume.arguments);
6370
6426
  assert.equal(newlyStarted.mode, 'created-issue');
6371
6427
  assert.equal(newlyStarted.issueNumber, issueNumber);
6428
+ assert.equal(calls.filter((call) => call === 'issue:create').length, beforeCreationOnly + 1);
6429
+ assert.equal(journalComments.length, beforeCreationJournal + 1);
6430
+ assert.equal(existsSync(row.path), false, 'creation-only journal recovery must not develop the issue');
6372
6431
  assert.equal(createPayloads.at(-1)?.body, 'New synthetic task');
6373
6432
  assert.equal(issuePoints, 2);
6433
+ issue.body = readyBody;
6374
6434
  issue.state = 'closed';
6375
6435
  const beforeDevelopment = calls.filter((call) => call === 'issue:create').length;
6376
6436
  const developmentFailure = (await startTrackedIssue(context, {
@@ -6413,7 +6473,7 @@ test.each([
6413
6473
  { remote: 'origin', divergentOrigin: false },
6414
6474
  { remote: 'upstream', divergentOrigin: false },
6415
6475
  { remote: 'upstream', divergentOrigin: true },
6416
- ])('synthetic lifecycle finishes with remote $remote and divergent origin $divergentOrigin', syntheticLifecycle, 15_000);
6476
+ ])('synthetic lifecycle finishes with remote $remote and divergent origin $divergentOrigin', syntheticLifecycle, 0);
6417
6477
  test('supported develop resumes an open merged issue under the same owner and preserves prior receipts', { timeout: 0 }, async () => syntheticLifecycle({ remote: 'origin', divergentOrigin: false, mergedContinuation: true }));
6418
6478
  test('supported develop reconciles authenticated host custody for an already committed descendant', { timeout: 0 }, async () => {
6419
6479
  const input = { remote: 'origin', divergentOrigin: false, committedDescendantContinuation: true };