@aviaratech/ai-delivery 0.3.46 → 0.3.47
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.
- package/README.md +1 -1
- package/dist/issue.js +6 -1
- package/dist/issue.js.map +2 -2
- package/dist/issueBlockerGuard.test.js +27 -0
- package/dist/issueBlockerGuard.test.js.map +2 -2
- package/dist/issueContract.d.ts +2 -0
- package/dist/issueContract.js +16 -2
- package/dist/issueContract.js.map +2 -2
- package/dist/issueContract.test.js +21 -0
- package/dist/issueContract.test.js.map +2 -2
- package/dist/issueTracking.test.js +2 -1
- package/dist/issueTracking.test.js.map +2 -2
- package/dist/services/blockerGuardService.js +8 -5
- package/dist/services/blockerGuardService.js.map +2 -2
- package/package.json +1 -1
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/cli.js +100 -100
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueTracking.test.ts"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { test } from 'vitest';\nimport * as issue from './issue.js';\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport { syntheticDiscoveryConfig } from './fixtures/discovery.js';\nimport type { DeliveryContext } from './issue.js';\nimport { getNativeBlockerRelationships } from './github/relationships.js';\nimport * as projectDelivery from './github/projectDelivery.js';\nimport { issueProjectItemsResponse } from './fixtures/issueProjectItems.js';\n\nfunction updateFixture() {\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-history-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const events: string[] = [];\n const live = {\n number: 17,\n id: 117,\n node_id: 'ISSUE17',\n title: ' Prior <title>\\r\\n',\n body: '\\nprior & body\\t ',\n state: 'open',\n html_url: 'https://github.com/example/widget/issues/17',\n };\n const controls = {\n corruptComment: false,\n failUpdate: false,\n ignoreClosure: false,\n drift: false,\n targetPr: false,\n reason: null as string | null,\n duplicate: null as number | null,\n archived: false,\n archiveAfterUpdate: false,\n projectUnavailableAfterUpdate: false,\n nativeUnavailableAfterUpdate: false,\n foreignAfterUpdate: false,\n wrongNodeAfterUpdate: false,\n driftAfterUpdate: false,\n projectFailure: '' as '' | 'rate-limit' | 'cancel',\n nativeReadsAfterUpdate: 0,\n failChildReadAfterUpdate: false,\n childReadsAfterUpdate: 0,\n artifacts: [] as { number: number; name: string; type: string; html_url: string }[],\n artifactStatus: 200,\n blocking: [] as { number: number; state: 'OPEN' | 'CLOSED' }[],\n blockingStatus: 200,\n };\n const comments: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n const updates: Record<string, unknown>[] = [];\n let projectStatus = 'Active';\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: { ...listingFixture().context.projectConfiguration!, writable: true },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n events.push('author');\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n listSubIssues: async () => {\n if (updates.length) controls.childReadsAfterUpdate++;\n if (updates.length && controls.failChildReadAfterUpdate) throw new Error('Child progress unavailable');\n return { data: [] };\n },\n get: async (input: { issue_number: number }) => {\n if (updates.length) controls.nativeReadsAfterUpdate++;\n if (updates.length && controls.nativeUnavailableAfterUpdate) throw new Error('Native unavailable');\n return {\n data:\n input.issue_number === 17\n ? {\n ...live,\n ...(updates.length && controls.wrongNodeAfterUpdate ? { node_id: 'FOREIGN_ISSUE' } : {}),\n ...(updates.length && controls.foreignAfterUpdate\n ? { html_url: 'https://github.com/other/widget/issues/17' }\n : {}),\n ...(updates.length && controls.driftAfterUpdate ? { body: 'Concurrent later edit' } : {}),\n }\n : {\n number: input.issue_number,\n id: 118,\n html_url: `https://github.com/example/widget/issues/${String(input.issue_number)}`,\n ...(controls.targetPr ? { pull_request: {} } : {}),\n },\n };\n },\n listComments: async () => ({ data: comments }),\n createComment: async (input: { body: string }) => {\n events.push('comment');\n const id = 91 + comments.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n user: { login: 'operator' },\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n };\n comments.push(data);\n return { data };\n },\n getComment: async (input: { comment_id: number }) => {\n events.push('comment-readback');\n if (controls.drift) live.body = 'Concurrent human edit';\n return {\n data: {\n ...comments.find((comment) => comment.id === input.comment_id),\n ...(controls.corruptComment ? { body: 'Wrong body' } : {}),\n },\n };\n },\n update: async (input: Record<string, unknown>) => {\n events.push('update');\n updates.push(input);\n if (controls.failUpdate) throw new Error('Update unavailable');\n if (controls.archiveAfterUpdate) controls.archived = true;\n if (typeof input.title === 'string') live.title = input.title;\n if (typeof input.body === 'string') live.body = input.body;\n if (!controls.ignoreClosure && typeof input.state === 'string') {\n live.state = input.state;\n controls.reason =\n input.state === 'closed'\n ? (typeof input.state_reason === 'string' ? input.state_reason : 'completed').toUpperCase()\n : 'REOPENED';\n if (input.duplicate_issue_id !== undefined) controls.duplicate = 18;\n }\n return { data: { ...live } };\n },\n },\n request: async (route: string) => {\n if (!route.endsWith('/artifacts')) return { data: [] };\n if (controls.artifactStatus !== 200)\n throw Object.assign(new Error('Artifacts unavailable'), { status: controls.artifactStatus });\n return { status: 200, data: controls.artifacts };\n },\n },\n graphql: async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('blocking(first:')) {\n if (controls.blockingStatus !== 200)\n throw Object.assign(new Error('Bad gateway'), { status: controls.blockingStatus });\n const nodes = controls.blocking.map((node) => ({\n ...node,\n id: `ISSUE${String(node.number)}`,\n title: 'Dependent',\n }));\n return { repository: { issue: { blocking: { nodes, pageInfo: { hasNextPage: false, endCursor: null } } } } };\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectFailure) {\n if (controls.projectFailure === 'cancel') throw new DOMException('Cancelled', 'AbortError');\n throw Object.assign(new Error('PRIVATE_RATE_CONTENT'), {\n status: 429,\n response: { headers: { 'retry-after': '60' } },\n });\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectUnavailableAfterUpdate)\n throw new Error('PRIVATE_REMOTE_CONTENT');\n if (query.includes('IssueClosureReadback'))\n return {\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: live.state.toUpperCase(),\n stateReason: controls.reason,\n duplicateOf:\n controls.duplicate === null\n ? null\n : { number: controls.duplicate, repository: { nameWithOwner: 'example/widget' } },\n },\n },\n };\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: { parent: null, blockedBy: { nodes: [], pageInfo: { hasNextPage: false, endCursor: null } } },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: controls.archived,\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n ]);\n if (query.includes('UpdateProjectDeliveryStatus')) {\n events.push('project-update');\n projectStatus =\n variables.optionId === 'DONE' ? 'Shipped' : variables.optionId === 'TODO' ? 'Queued' : 'Active';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('ProjectDeliveryItemReadback'))\n return {\n node: {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n };\n throw new Error(`Unexpected update fixture query: ${query}`);\n },\n },\n } as unknown as DeliveryContext;\n return {\n context,\n live,\n controls,\n comments,\n events,\n updates,\n cleanup: () => rmSync(root, { recursive: true, force: true }),\n };\n}\n\ntest('history preserves exact prior content before a rewrite and retries a failed mutation once', async () => {\n const fixture = updateFixture();\n try {\n const oldTitle = fixture.live.title;\n const oldBody = fixture.live.body;\n fixture.controls.failUpdate = true;\n const input = { issueNumber: 17, title: 'New title', body: 'New body', draft: true, preserveHistory: true };\n await assert.rejects(issue.updateIssue(fixture.context, input), /Update unavailable/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal(fixture.comments[0]!.body, issue.renderIssueHistory(oldTitle, oldBody));\n assert.ok(fixture.events.indexOf('comment-readback') < fixture.events.indexOf('update'));\n fixture.controls.failUpdate = false;\n const result = await issue.updateIssue(fixture.context, input);\n assert.equal(result.title, 'New title');\n assert.equal(result.conversion?.priorBody, oldBody);\n assert.ok(oldBody.split('\\n').every((line) => result.conversion?.diff.includes('-' + line)));\n assert.match(result.body, /ai-delivery:issue@1/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal((result as unknown as { historyComment: { reused: boolean } }).historyComment.reused, true);\n // The body replaces the converted legacy text; once that text has history, repeating the update is a no-op.\n await issue.updateIssue(fixture.context, input);\n await issue.updateIssue(fixture.context, input);\n const afterReplace = fixture.comments.length;\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, afterReplace, 'a no-op rewrite adds no history');\n } finally {\n fixture.cleanup();\n }\n});\n\ntest.each([{ state: 'closed' as const }, { state: 'open' as const }, { title: 'Retitled archived issue safely' }])(\n 'archived native update preserves the item and returns its identity: %j',\n async (patch) => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n if (patch.state === 'open') f.live.state = 'closed';\n const result = await issue.updateIssue(f.context, { issueNumber: 17, ...patch });\n assert.equal(f.live.state, patch.state ?? 'open');\n if (patch.title) assert.equal(f.live.title, patch.title);\n assert.equal(f.controls.archived, true);\n assert.equal(f.events.includes('project-update'), false);\n assert.ok(result.warnings.some((w) => w.code === 'project.archived' && w.message.includes('ITEM17')));\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('initially archived issue update refuses before history, closure or native writes', async () => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n /archived/u,\n );\n assert.deepEqual(f.updates, []);\n assert.deepEqual(f.comments, []);\n assert.equal(f.events.includes('project-update'), false);\n assert.equal(f.live.state, 'open');\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['archive', 'unavailable'] as const)(\n 'post-commit %s reports confirmed native content and closure separately from pending Project work',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = failure === 'archive';\n f.controls.projectUnavailableAfterUpdate = failure === 'unavailable';\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = (\n error as {\n result: {\n status: string;\n native: {\n status: string;\n repository: string;\n readback: issue.IssueInfo;\n closure: issue.IssueClosureReadback;\n historyComment: issue.IssueCommentReadback;\n };\n project: { status: string; desiredStatus: string };\n recovery: { tool: string };\n };\n }\n ).result;\n assert.equal(result.status, 'update-incomplete');\n assert.equal(result.native.status, 'confirmed');\n assert.equal(result.native.repository, 'example/widget');\n assert.equal(result.native.readback.state, 'closed');\n assert.match(result.native.readback.body, /Replacement/u);\n assert.equal(result.native.closure.closeReason, 'not_planned');\n assert.equal(result.native.historyComment.commentId, 91);\n assert.equal(result.project.status, failure === 'archive' ? 'pending' : 'unknown');\n assert.equal(result.project.desiredStatus, 'Done');\n assert.equal(result.recovery.tool, 'issue_batch_update');\n assert.equal(JSON.stringify(result).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.comments.length, 2);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('native fallback confirms committed closure without requiring child progress', async () => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.failChildReadAfterUpdate = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = issue.getIncompleteIssueUpdate(error);\n assert.equal(result?.native.status, 'confirmed');\n assert.equal(result?.native.readback?.state, 'closed');\n assert.match(result?.native.readback?.body ?? '', /Replacement/u);\n assert.equal(result?.native.closure?.closeReason, 'not_planned');\n assert.equal(result?.native.readback?.childProgress, undefined);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.controls.childReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['unavailable', 'foreign', 'drift', 'node'] as const)(\n 'post-commit native %s evidence remains unknown',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.nativeUnavailableAfterUpdate = failure === 'unavailable';\n f.controls.foreignAfterUpdate = failure === 'foreign';\n f.controls.wrongNodeAfterUpdate = failure === 'node';\n f.controls.driftAfterUpdate = failure === 'drift';\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const result = (error as { result: { native: { status: string; readback: unknown } } }).result;\n assert.equal(result.native.status, 'unknown');\n assert.equal(result.native.readback, null);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest.each(['rate-limit', 'cancel'] as const)(\n 'post-commit %s defers native readback without another request',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.projectFailure = failure;\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const partial = issue.getIncompleteIssueUpdate(error);\n assert.equal(partial?.native.status, 'unknown');\n assert.equal(partial?.native.readback, null);\n if (failure === 'rate-limit') assert.equal(partial?.rateLimit?.retryAfterSeconds, 60);\n assert.equal(JSON.stringify(partial).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.controls.nativeReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('history overflow, invalid metadata, failed comment readback and concurrent edits prevent rewrites', async () => {\n for (const failure of ['overflow', 'labels', 'readback', 'drift'] as const) {\n const fixture = updateFixture();\n try {\n if (failure === 'overflow') fixture.live.body = '&'.repeat(14000);\n if (failure === 'readback') fixture.controls.corruptComment = true;\n if (failure === 'drift') fixture.controls.drift = true;\n const oldBody = fixture.live.body;\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n ...(failure === 'labels' ? { labels: ['invalid'] } : {}),\n }),\n );\n assert.equal(fixture.updates.length, 0, failure);\n if (failure !== 'drift') assert.equal(fixture.live.body, oldBody);\n if (failure === 'overflow' || failure === 'labels') assert.equal(fixture.comments.length, 0);\n if (failure === 'overflow') assert.ok(!fixture.events.includes('author'));\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('reasoned closure records supersession and verifies native reason and duplicate identity', async () => {\n for (const closeReason of ['completed', 'not_planned', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n const input = { issueNumber: 17, state: 'closed' as const, draft: true, closeReason, supersededBy: 18 };\n const result = await issue.updateIssue(fixture.context, input);\n const closure = (\n result as unknown as {\n closure: issue.IssueClosureReadback & { supersededBy: number; comment: issue.IssueCommentReadback };\n }\n ).closure;\n assert.equal(result.state, 'closed');\n assert.equal(closure.closeReason, closeReason);\n assert.equal(closure.supersededBy, 18);\n assert.match(closure.comment.body, /example\\/widget#18/u);\n assert.equal(fixture.updates[0]!.state_reason, closeReason);\n if (closeReason === 'duplicate') {\n assert.equal(fixture.updates[0]!.duplicate_issue_id, 118);\n assert.deepEqual(closure.duplicateOf, { number: 18, repository: 'example/widget' });\n }\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, 2, 'closure retries reuse authoritative comments');\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n ...input,\n closeReason: closeReason === 'completed' ? 'not_planned' : 'completed',\n }),\n /already closed/u,\n );\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst studyArtifact = (number: number, name: string) => ({\n number,\n name,\n type: 'generic',\n html_url: `https://github.com/example/widget/issues/17/artifacts/${String(number)}`,\n});\n\ntest('a study closes as completed only with a verdict, a Result and a READOUT artifact', async () => {\n const close = { issueNumber: 17, state: 'closed' as const, closeReason: 'completed' as const };\n const closeout = { verdict: 'NONE: no cut passed', result: 'Net \u22120.4\u00A2/fill (n=212)' };\n const cases: {\n title?: string;\n input: issue.UpdateIssueInput;\n artifacts?: ReturnType<typeof studyArtifact>[];\n artifactStatus?: number;\n refusal?: RegExp;\n }[] = [\n { input: close, refusal: /Pass closeout\\.verdict/u },\n { input: { ...close, closeout: { ...closeout, result: '' } }, refusal: /Pass closeout\\.result/u },\n {\n input: { ...close, closeout },\n artifacts: [studyArtifact(1, 'PLAN.md')],\n refusal: /gh issue artifact create 17/u,\n },\n { input: { ...close, closeout }, artifactStatus: 404, refusal: /artifacts \\(HTTP 404\\)/u },\n { input: { ...close, closeout: { ...closeout, verdict: 'a\\nb\\nc\\nd' } }, refusal: /1\u20133 lines/u },\n { input: { ...close, closeReason: 'not_planned' } },\n { title: 'Book cell can hold tied', input: close },\n ];\n for (const example of cases) {\n const f = updateFixture();\n try {\n f.live.title = example.title ?? 'Study: X';\n f.controls.artifacts = example.artifacts ?? [];\n f.controls.artifactStatus = example.artifactStatus ?? 200;\n if (example.refusal) {\n await assert.rejects(issue.updateIssue(f.context, example.input), example.refusal);\n assert.equal(f.live.state, 'open');\n assert.equal(f.comments.length, 0);\n } else {\n const result = await issue.updateIssue(f.context, example.input);\n assert.equal(result.state, 'closed');\n assert.match(f.comments[0]!.body, /^Requested closure reason: (completed|not_planned)\\.$/u);\n }\n } finally {\n f.cleanup();\n }\n }\n const f = updateFixture();\n try {\n f.live.title = 'Study: X';\n f.controls.artifacts = [studyArtifact(1, 'READOUT.md'), studyArtifact(2, 'SHA256SUMS')];\n const result = await issue.updateIssue(f.context, { ...close, closeout });\n assert.equal(result.state, 'closed');\n assert.equal(\n result.closure?.comment.body,\n [\n '**Verdict:** NONE: no cut passed',\n '**Result:**\\n\\nNet \u22120.4\u00A2/fill (n=212)',\n '**Artifacts:**\\n- [READOUT.md](https://github.com/example/widget/issues/17/artifacts/1)\\n- [SHA256SUMS](https://github.com/example/widget/issues/17/artifacts/2)',\n 'Requested closure reason: completed.',\n ].join('\\n\\n'),\n );\n } finally {\n f.cleanup();\n }\n});\n\ntest('every close lists the open issues it was blocking', async () => {\n const close = { issueNumber: 17, state: 'closed' as const, closeReason: 'not_planned' as const };\n for (const example of [\n {\n blocking: [\n { number: 11, state: 'OPEN' as const },\n { number: 12, state: 'CLOSED' as const },\n ],\n unblocks: [11],\n },\n { blocking: [], unblocks: [] },\n { blocking: [], blockingStatus: 502, unblocks: [] },\n ]) {\n const f = updateFixture();\n try {\n f.controls.blocking = example.blocking;\n f.controls.blockingStatus = example.blockingStatus ?? 200;\n const result = await issue.updateIssue(f.context, close);\n assert.equal(result.state, 'closed');\n assert.deepEqual(result.unblocks, example.unblocks);\n const unblocksLine = /\\*\\*Unblocks:\\*\\* (.*)$/u.exec(result.closure!.comment.body)?.[1];\n assert.equal(unblocksLine, example.unblocks.length ? '#11' : undefined);\n assert.equal(\n result.warnings.some(\n (warning) => warning.code === 'close.unblocks' && /issues #17 blocks/u.test(warning.message),\n ),\n example.blockingStatus === 502,\n );\n } finally {\n f.cleanup();\n }\n }\n});\n\ntest('issue info lists artifacts on request and warns instead of failing when they are unreadable', async () => {\n const f = updateFixture();\n try {\n f.controls.artifacts = [studyArtifact(1, 'READOUT.md'), { ...studyArtifact(2, 's3 link'), type: 'link' }];\n assert.deepEqual((await issue.issueInfo(f.context, 17, { artifacts: true })).artifacts, [\n {\n number: 1,\n name: 'READOUT.md',\n type: 'generic',\n url: 'https://github.com/example/widget/issues/17/artifacts/1',\n },\n { number: 2, name: 's3 link', type: 'link', url: 'https://github.com/example/widget/issues/17/artifacts/2' },\n ]);\n f.controls.artifactStatus = 403;\n const unread = await issue.issueInfo(f.context, 17, { artifacts: true });\n assert.equal(unread.artifacts, undefined);\n assert.match(unread.warnings?.[0]?.message ?? '', /HTTP 403/u);\n } finally {\n f.cleanup();\n }\n});\n\ntest('invalid superseding issues and contradictory native closure fail closed', async () => {\n for (const failure of ['self', 'pull-request', 'reason', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n fixture.controls.targetPr = failure === 'pull-request';\n fixture.controls.ignoreClosure = failure === 'reason';\n if (failure === 'duplicate') {\n fixture.live.state = 'closed';\n fixture.controls.reason = 'DUPLICATE';\n fixture.controls.duplicate = 19;\n }\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n state: 'closed',\n draft: true,\n closeReason: failure === 'duplicate' ? 'duplicate' : 'completed',\n supersededBy: failure === 'self' ? 17 : 18,\n }),\n );\n if (failure !== 'reason') {\n assert.equal(fixture.updates.length, 0);\n assert.equal(fixture.comments.length, 0);\n }\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst listIssues = (\n issue as unknown as {\n listIssues: (context: DeliveryContext, input: unknown) => Promise<{ issues: unknown[]; nextPage: number | null }>;\n }\n).listIssues;\n\nfunction listingFixture(\n options: {\n foreign?: boolean;\n incomplete?: boolean;\n invalidField?: boolean;\n foreignParent?: boolean;\n missingOption?: boolean;\n dualBlockers?: boolean;\n missingMulti?: boolean;\n } = {},\n) {\n const requests: Record<string, unknown>[] = [];\n const context = {\n root: '/synthetic',\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: {\n projectId: 'PROJECT',\n projectNumber: 1,\n title: 'Delivery',\n writable: false,\n pointsFieldId: 'POINTS',\n priorityFieldId: 'PRIORITY',\n statusFieldId: 'STATUS',\n statusOptionIds: { Todo: 'TODO', 'In Progress': 'ACTIVE', Blocked: 'BLOCKED', Done: 'DONE' },\n settings: {\n number: 1,\n title: 'Delivery',\n statusField: 'Flow',\n statuses: { Todo: 'Queued', 'In Progress': 'Active', Blocked: 'Waiting', Done: 'Shipped' },\n },\n },\n clients: {\n rest: {\n issues: {\n listForRepo: async (params: Record<string, unknown>) => {\n requests.push(params);\n return {\n data: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: options.foreign\n ? 'https://github.com/elsewhere/widget/issues/17'\n : 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n { number: 18, pull_request: {} },\n ],\n };\n },\n },\n search: {\n issuesAndPullRequests: async (params: Record<string, unknown>) => {\n requests.push(params);\n return { data: { total_count: 0, incomplete_results: options.incomplete ?? false, items: [] } };\n },\n },\n request: async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, ...params });\n if (route.includes('/orgs/'))\n return {\n data: [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n { id: 103, name: 'Start date', data_type: 'date' },\n ...(options.missingMulti ? [{ id: 104, name: 'Tags', data_type: 'multi_select' }] : []),\n ],\n };\n return {\n data: [\n {\n issue_field_id: 101,\n issue_field_name: options.invalidField ? 'Foreign estimate' : 'Estimate',\n data_type: 'single_select',\n value: 44,\n ...(options.missingOption ? {} : { single_select_option: { id: 44, name: '4' } }),\n },\n { issue_field_id: 103, issue_field_name: 'Start date', data_type: 'date', value: '2026-10-07' },\n ...(options.missingMulti\n ? [{ issue_field_id: 104, issue_field_name: 'Tags', data_type: 'multi_select', value: 'one' }]\n : []),\n ],\n };\n },\n },\n graphql: async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: {\n parent: {\n id: 'PARENT9',\n number: 9,\n repository: { nameWithOwner: options.foreignParent ? 'example/other' : 'example/widget' },\n },\n blockedBy: {\n nodes: [\n {\n id: 'BLOCKER8',\n number: 8,\n title: 'Prerequisite',\n state: 'CLOSED',\n repository: { nameWithOwner: 'example/widget' },\n },\n ...(options.dualBlockers\n ? [\n {\n id: 'FOREIGN8',\n number: 8,\n title: 'Other prerequisite',\n state: 'OPEN',\n repository: { nameWithOwner: 'example/other' },\n },\n ]\n : []),\n ],\n pageInfo: { hasNextPage: false, endCursor: null },\n },\n },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: false,\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n },\n ]);\n throw new Error('Unexpected query');\n },\n },\n } as unknown as DeliveryContext;\n return { context, requests };\n}\n\ntest('typed listing filters stay repository-bound and expose named fields without identifiers', async () => {\n const tool = getAiDeliveryMcpTool('issue_list');\n assert.ok(tool, 'issue_list is registered');\n const input = tool.inputSchema.parse({\n state: 'open',\n labels: ['area:widget'],\n parentIssueNumber: 9,\n issueType: 'Task',\n projectStatus: 'In Progress',\n updatedSince: '2026-10-01T00:00:00Z',\n perPage: 2,\n });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, 2);\n assert.deepEqual(result.issues, [\n {\n number: 17,\n title: 'Repair widget',\n state: 'open',\n labels: ['area:widget'],\n issueType: 'Task',\n parentIssueNumber: 9,\n parent: { repository: 'example/widget', number: 9 },\n blockers: [{ repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' }],\n projectStatus: 'In Progress',\n fields: { Estimate: '4', Urgency: null, 'Start date': '2026-10-07' },\n url: 'https://github.com/example/widget/issues/17',\n updatedAt: '2026-10-07T00:00:00Z',\n },\n ]);\n assert.equal(requests[0]?.owner, 'example');\n assert.equal(requests[0]?.since, '2026-10-01T00:00:00Z');\n assert.equal(JSON.stringify(result).includes('BLOCKER8'), false);\n});\n\ntest('search quotes user text so it cannot change the selected repository', async () => {\n const tool = getAiDeliveryMcpTool('issue_search');\n assert.ok(tool, 'issue_search is registered');\n const input = tool.inputSchema.parse({ query: 'repo:elsewhere/project', page: 2, perPage: 10 });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, null);\n assert.equal(requests[0]?.q, 'repo:example/widget is:issue \"repo:elsewhere/project\"');\n});\n\ntest('update accepts history and reasoned closure while rejecting incoherent requests', () => {\n const tool = getAiDeliveryMcpTool('issue_update');\n assert.ok(tool);\n assert.equal(tool.inputSchema.safeParse({ issueNumber: 17, body: 'new body', preserveHistory: true }).success, true);\n assert.equal(\n tool.inputSchema.safeParse({ issueNumber: 17, state: 'closed', closeReason: 'duplicate', supersededBy: 9 }).success,\n true,\n );\n assert.throws(\n () => tool.inputSchema.safeParse({ issueNumber: 17, state: 'open', closeReason: 'completed' }),\n /\"code\":\"closure.state\"/u,\n );\n});\n\ntest('local filters retain pagination when the current GitHub page has no matching issue', async () => {\n const { context } = listingFixture();\n const result = await listIssues(context, { parentIssueNumber: null, perPage: 2 });\n assert.deepEqual(result.issues, []);\n assert.equal(result.nextPage, 2);\n});\n\ntest('foreign issue identity and mismatched organization fields fail rather than returning false readback', async () => {\n await assert.rejects(listIssues(listingFixture({ foreign: true }).context, {}), /foreign repository/u);\n await assert.rejects(listIssues(listingFixture({ invalidField: true }).context, {}), /conflicts with its catalog/u);\n});\n\ntest('search refuses incomplete upstream results and invalid literal text', async () => {\n await assert.rejects(\n listIssues(listingFixture({ incomplete: true }).context, { query: 'widget' }),\n /incomplete results/u,\n );\n await assert.rejects(listIssues(listingFixture().context, { query: '\" repo:elsewhere/widget' }), /literal text/u);\n assert.equal(getAiDeliveryMcpTool('issue_list')?.inputSchema.safeParse({ perPage: 101 }).success, false);\n});\n\ntest('a foreign parent with the same issue number cannot satisfy a local parent filter', async () => {\n const { context } = listingFixture({ foreignParent: true });\n assert.deepEqual((await listIssues(context, { parentIssueNumber: 9 })).issues, []);\n});\n\ntest('label filters preserve GitHub case-insensitive label identity', async () => {\n const { context } = listingFixture();\n assert.equal((await listIssues(context, { labels: ['AREA:Widget'] })).issues.length, 1);\n});\n\ntest('a set select field without its named option fails rather than reporting unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingOption: true }).context, {}), /option/u);\n});\n\ntest('same-number blockers in different repositories retain both qualified identities', async () => {\n const { context } = listingFixture({ dualBlockers: true });\n const result = await issue.listIssues(context, {});\n assert.deepEqual(result.issues[0]?.blockers, [\n { repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' },\n { repository: 'example/other', number: 8, title: 'Other prerequisite', state: 'OPEN' },\n ]);\n});\n\ntest('a set multi-select field without named options cannot be reported unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingMulti: true }).context, {}), /option/u);\n});\n\ntest('history rendering preserves whitespace and escapes content that could end the collapsed section', () => {\n const render = (issue as unknown as { renderIssueHistory: (title: string, body: string) => string })\n .renderIssueHistory;\n assert.equal(typeof render, 'function');\n const body = ' old body\\n</pre></details><script>x</script> & text ';\n const result = render('Old <title> & name', body);\n assert.equal(\n result,\n '<details>\\n<summary>Previous issue title and body</summary>\\n\\nTitle:\\n<pre>Old <title> & name</pre>\\n\\nBody:\\n<pre> old body\\n</pre></details><script>x</script> & text </pre>\\n\\n</details>',\n );\n});\n\ntest('closure evidence reads native reason and preserves qualified duplicate identity', async () => {\n const { context } = listingFixture();\n context.clients.graphql = (async () => ({\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: 'CLOSED',\n stateReason: 'DUPLICATE',\n duplicateOf: { number: 9, repository: { nameWithOwner: 'example/other' } },\n },\n },\n })) as unknown as typeof context.clients.graphql;\n const read = (\n issue as unknown as { readIssueClosure: (context: DeliveryContext, issueNumber: number) => Promise<unknown> }\n ).readIssueClosure;\n assert.equal(typeof read, 'function');\n assert.deepEqual(await read(context, 17), {\n state: 'closed',\n closeReason: 'duplicate',\n duplicateOf: { number: 9, repository: 'example/other' },\n });\n});\n\ntest('native field catalog and values both paginate through the last named field', async () => {\n const { context } = listingFixture();\n const requests: { route: string; page: unknown }[] = [];\n context.clients.rest.request = (async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, page: params.page });\n const catalog = route.includes('/orgs/');\n if (params.page === 2)\n return {\n data: catalog\n ? [{ id: 201, name: 'Late date', data_type: 'date' }]\n : [{ issue_field_id: 201, issue_field_name: 'Late date', data_type: 'date', value: '2026-10-09' }],\n };\n return {\n data: catalog\n ? [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n ...Array.from({ length: 98 }, (_, index) => ({\n id: index + 103,\n name: `Custom ${String(index)}`,\n data_type: 'text',\n })),\n ]\n : [\n {\n issue_field_id: 101,\n issue_field_name: 'Estimate',\n data_type: 'single_select',\n value: 44,\n single_select_option: { name: '4' },\n },\n { issue_field_id: 102, issue_field_name: 'Urgency', data_type: 'single_select', value: null },\n ...Array.from({ length: 98 }, (_, index) => ({\n issue_field_id: index + 103,\n issue_field_name: `Custom ${String(index)}`,\n data_type: 'text',\n value: 'retained',\n })),\n ],\n };\n }) as unknown as typeof context.clients.rest.request;\n const result = await issue.listIssues(context, {});\n assert.equal(result.issues[0]?.fields['Late date'], '2026-10-09');\n assert.equal(result.issues[0]?.fields.Urgency, null);\n assert.deepEqual(\n requests.map((request) => request.page),\n [1, 2, 1, 2],\n );\n});\n\ntest('native field pagination fails closed on a repeated nonadvancing page', async () => {\n const { context } = listingFixture();\n context.clients.rest.request = (async () => ({\n data: Array.from({ length: 100 }, (_, index) => ({\n id: index + 1,\n name: `Field ${String(index)}`,\n data_type: 'text',\n })),\n })) as unknown as typeof context.clients.rest.request;\n await assert.rejects(issue.listIssues(context, {}), /repeated a pagination page/u);\n});\n\ntest.each([\n ['catalog', 'list'],\n ['values', 'list'],\n ['catalog', 'ready'],\n ['values', 'ready'],\n ['catalog', 'capacity'],\n ['values', 'capacity'],\n] as const)('reconciliation bounds native %s through %s reads', async (collection, entry) => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n if (entry === 'ready')\n context.clients.rest.issues.listSubIssues = (async (input: Record<string, unknown>) => {\n assert.equal(input.owner, 'example');\n assert.equal(input.repo, 'widget');\n assert.equal(input.issue_number, 17);\n return { data: [] };\n }) as unknown as typeof context.clients.rest.issues.listSubIssues;\n context.clients.rest.issues.get = (async () => ({\n data: {\n number: 17,\n node_id: 'ISSUE17',\n state: 'open',\n body: '',\n title: 'Repair widget',\n html_url: 'https://github.com/example/widget/issues/17',\n },\n })) as typeof context.clients.rest.issues.get;\n if (entry === 'capacity')\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Native', match: { field: 'Estimate', value: '4' }, limit: 2 }],\n };\n const originalGraphql = context.clients.graphql;\n context.clients.graphql = (async (query: string, variables?: Record<string, unknown>) => {\n const response = await originalGraphql(query, variables);\n if (!query.includes('blockedBy(first:')) return response;\n const parsed = response as { repository: { issue: Record<string, unknown> } };\n Object.assign(parsed.repository.issue, {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n });\n return parsed;\n }) as unknown as typeof context.clients.graphql;\n const original = context.clients.rest.request;\n let requests = 0;\n context.clients.rest.request = (async (route: string, params: { page: number }) => {\n if (route.includes('/orgs/') !== (collection === 'catalog')) return original(route);\n requests++;\n return {\n data:\n params.page > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => {\n const id = 1000 + params.page * 100 + index;\n return collection === 'catalog'\n ? { id, name: `Extra ${String(id)}`, data_type: 'text' }\n : { issue_field_id: id, issue_field_name: `Extra ${String(id)}`, data_type: 'text', value: 'value' };\n }),\n };\n }) as typeof context.clients.rest.request;\n const operation =\n entry === 'list'\n ? issue.listIssues(context, {})\n : entry === 'ready'\n ? issue.readyCheck(context, 17)\n : issue.assertIssueStartCapacity(context, 17);\n await assert.rejects(operation, (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation bounds blocker pages and binds their source issue', async () => {\n const { context } = listingFixture();\n let requests = 0;\n context.clients.graphql = (async () => {\n requests++;\n return {\n repository: {\n issue: {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n parent: null,\n blockedBy: { nodes: [], pageInfo: { hasNextPage: requests < 21, endCursor: `page-${String(requests)}` } },\n },\n },\n };\n }) as unknown as typeof context.clients.graphql;\n const input = { graphql: context.clients.graphql, repo: context.repo, issueNumber: 17, maxPages: 20 };\n await assert.rejects(getNativeBlockerRelationships(input), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation WIP guards bound their label catalog', async () => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Urgent', match: { label: 'urgent' }, limit: 2 }],\n };\n let requests = 0;\n context.clients.rest.issues.listLabelsForRepo = (async () => {\n requests++;\n return {\n data:\n requests > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => ({\n name: index === 0 && requests === 1 ? 'urgent' : `label-${String(requests)}-${String(index)}`,\n })),\n };\n }) as typeof context.clients.rest.issues.listLabelsForRepo;\n await assert.rejects(issue.assertIssueStartCapacity(context, 17), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n return true;\n });\n assert.equal(requests, 20);\n});\n\nfunction membershipFixture() {\n const configuration = { ...listingFixture().context.projectConfiguration!, writable: true };\n const events: string[] = [];\n const controls = { corrupt: '', archived: false, duplicate: false, unreadable: false };\n let member = false;\n let status: 'In Progress' | null = null;\n const item = (readback = false) => ({\n id: readback && controls.corrupt === 'item' ? 'WRONG' : 'ITEM17',\n isArchived: controls.archived,\n project: { id: readback && controls.corrupt === 'project' ? 'WRONG' : 'PROJECT', number: 1 },\n content: controls.unreadable\n ? null\n : {\n __typename: 'Issue',\n id: readback && controls.corrupt === 'issue' ? 'WRONG' : 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n },\n fieldValueByName:\n status === null ? null : { name: 'Active', optionId: controls.corrupt === 'option' ? 'WRONG' : 'ACTIVE' },\n });\n const graphql = (async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('mutation AddProjectDeliveryItem')) {\n events.push('add');\n member = true;\n return { addProjectV2ItemById: { item: { id: 'ITEM17' } } };\n }\n if (query.includes('mutation UpdateProjectDeliveryStatus')) {\n events.push('status');\n status = 'In Progress';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('query ProjectDeliveryItemReadback')) {\n events.push('readback');\n return { node: item(true) };\n }\n const items = member ? (controls.duplicate ? [item(), { ...item(), id: 'SECOND' }] : [item()]) : [];\n if (query.includes('query ProjectDeliveryIssueItems')) return issueProjectItemsResponse(variables, items);\n if (query.includes('query ProjectDeliveryItems'))\n return {\n organization: {\n projectV2: { id: 'PROJECT', number: 1, items: { nodes: items, pageInfo: { hasNextPage: false } } },\n },\n };\n throw new Error('Unexpected membership fixture query.');\n }) as unknown as DeliveryContext['clients']['graphql'];\n return {\n input: { graphql, configuration, org: 'example', issueNodeId: 'ISSUE17' },\n events,\n controls,\n setMember: () => {\n member = true;\n },\n };\n}\n\ntest('membership-only add verifies the exact unarchived item and reuse writes nothing', async () => {\n const f = membershipFixture();\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input & { beforeAdd?: () => Promise<void> }) => Promise<{ itemId: string; archived: false }>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n const result = await ensure!({\n ...f.input,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n });\n assert.deepEqual(result, { itemId: 'ITEM17', archived: false });\n assert.deepEqual(f.events, ['before-add', 'add', 'readback']);\n f.events.length = 0;\n await ensure!(f.input);\n assert.deepEqual(f.events, ['readback']);\n});\n\ntest.each(['project', 'issue', 'item', 'archive', 'duplicate', 'unreadable'] as const)(\n 'membership refuses %s evidence without a repair write',\n async (failure) => {\n const f = membershipFixture();\n f.setMember();\n if (failure === 'archive') f.controls.archived = true;\n else if (failure === 'duplicate') f.controls.duplicate = true;\n else if (failure === 'unreadable') f.controls.unreadable = true;\n else f.controls.corrupt = failure;\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input) => Promise<unknown>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n await assert.rejects(ensure!(f.input));\n assert.deepEqual(\n f.events.filter((e) => e === 'add' || e === 'status'),\n [],\n );\n },\n);\n\nconst projectRow = {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n};\n\nfunction readStatus(nodes: unknown[], overrides: { nodeId?: string; hasNextPage?: boolean } = {}) {\n const { input } = membershipFixture();\n const graphql = (async () => ({\n node: {\n id: overrides.nodeId ?? 'ISSUE17',\n projectItems: { nodes, pageInfo: { hasNextPage: overrides.hasNextPage ?? false } },\n },\n })) as unknown as typeof input.graphql;\n return projectDelivery.getIssueProjectStatus({ ...input, graphql });\n}\n\ntest('issue Project Status is the exact configured item and never a guess (#180)', async () => {\n assert.deepEqual(await readStatus([projectRow]), { itemId: 'ITEM17', status: 'In Progress' });\n assert.equal(await readStatus([]), null);\n assert.equal(await readStatus([{ ...projectRow, isArchived: true }]), null);\n assert.equal(await readStatus([{ ...projectRow, project: { id: 'OTHER', number: 9 } }]), null);\n});\n\ntest.each([\n ['a different issue node', () => readStatus([projectRow], { nodeId: 'ISSUE99' }), /different issue/u],\n ['more than 50 Projects', () => readStatus([projectRow], { hasNextPage: true }), /more than 50 Projects/u],\n ['an unreadable item in the configured Project', () => readStatus([{ ...projectRow, content: null }]), /unreadable/u],\n [\n 'a duplicate item in the configured Project',\n () => readStatus([projectRow, { ...projectRow, id: 'SECOND' }]),\n /duplicate/u,\n ],\n])('issue Project lookup refuses %s', async (_name, read, message) => {\n await assert.rejects(read(), message);\n});\n\ntest('guards run immediately before both Project mutation boundaries', async () => {\n const f = membershipFixture();\n const input = {\n ...f.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n beforeAdvance: async () => {\n f.events.push('before-advance');\n },\n };\n await projectDelivery.syncIssueProjectStatus(input);\n assert.deepEqual(\n f.events.filter((e) => e !== 'readback'),\n ['before-add', 'add', 'before-advance', 'status'],\n );\n const refused = membershipFixture();\n const fail = {\n ...refused.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n throw new Error('native drift');\n },\n };\n await assert.rejects(projectDelivery.syncIssueProjectStatus(fail), /native drift/u);\n assert.deepEqual(refused.events, []);\n});\n\ntest.each(['project', 'option'] as const)(\n 'Project %s readback failure preserves an attempted write without retry',\n async (failure) => {\n const f = membershipFixture();\n f.controls.corrupt = failure;\n if (failure === 'project') {\n await assert.rejects(projectDelivery.ensureIssueProjectMembership(f.input), /exact issue item/u);\n assert.deepEqual(f.events, ['add', 'readback']);\n } else {\n f.setMember();\n await assert.rejects(\n projectDelivery.syncIssueProjectStatus({ ...f.input, status: 'In Progress' }),\n /unsupported Project Status/u,\n );\n assert.deepEqual(f.events, ['status', 'readback']);\n }\n },\n);\n\ntest('search applies the same case-insensitive label filter to authoritative result rows', async () => {\n const { context } = listingFixture();\n context.clients.rest.search.issuesAndPullRequests = (async () => ({\n data: {\n total_count: 1,\n incomplete_results: false,\n items: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n ],\n },\n })) as unknown as typeof context.clients.rest.search.issuesAndPullRequests;\n const result = await issue.listIssues(context, { query: 'widget', labels: ['AREA:Widget'] });\n assert.equal(result.issues.length, 1);\n assert.equal(result.nextPage, null);\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AAEzC,SAAS,qCAAqC;AAC9C,YAAY,qBAAqB;AACjC,SAAS,iCAAiC;AAE1C,SAAS,gBAAgB;AACvB,QAAM,OAAO,YAAY,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAC/D,eAAa,OAAO,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC;AAC/D,QAAM,SAAmB,CAAC;AAC1B,QAAM,OAAO;AAAA,IACX,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACA,QAAM,WAAW;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,oBAAoB;AAAA,IACpB,+BAA+B;AAAA,IAC/B,8BAA8B;AAAA,IAC9B,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,IACxB,0BAA0B;AAAA,IAC1B,uBAAuB;AAAA,IACvB,WAAW,CAAC;A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AAC,OAAO,UAAU,CAAC;AAAA,IAChD,OAAO;AACL,QAAE,UAAU;AACZ,YAAM,OAAO;AAAA,QACX,gBAAgB,uBAAuB,EAAE,GAAG,EAAE,OAAO,QAAQ,cAAc,CAAC;AAAA,QAC5E;AAAA,MACF;AACA,aAAO,UAAU,EAAE,QAAQ,CAAC,UAAU,UAAU,CAAC;AAAA,IACnD;AAAA,EACF;AACF;AAEA,KAAK,sFAAsF,YAAY;AACrG,QAAM,EAAE,QAAQ,IAAI,eAAe;AACnC,UAAQ,QAAQ,KAAK,OAAO,yBAAyB,aAAa;AAAA,IAChE,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,oBAAoB;AAAA,MACpB,OAAO;AAAA,QACL;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ,CAAC,EAAE,MAAM,cAAc,CAAC;AAAA,UAChC,MAAM,EAAE,MAAM,OAAO;AAAA,UACrB,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,MAAM,MAAM,WAAW,SAAS,EAAE,OAAO,UAAU,QAAQ,CAAC,aAAa,EAAE,CAAC;AAC3F,SAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AACpC,SAAO,MAAM,OAAO,UAAU,IAAI;AACpC,CAAC;",
|
|
4
|
+
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { execFileSync } from 'node:child_process';\nimport { mkdtempSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { test } from 'vitest';\nimport * as issue from './issue.js';\nimport { getAiDeliveryMcpTool } from './mcp/tools.js';\nimport { syntheticDiscoveryConfig } from './fixtures/discovery.js';\nimport type { DeliveryContext } from './issue.js';\nimport { getNativeBlockerRelationships } from './github/relationships.js';\nimport * as projectDelivery from './github/projectDelivery.js';\nimport { issueProjectItemsResponse } from './fixtures/issueProjectItems.js';\n\nfunction updateFixture() {\n const root = mkdtempSync(join(tmpdir(), 'ai-delivery-history-'));\n execFileSync('git', ['init', '-q', '-b', 'main'], { cwd: root });\n const events: string[] = [];\n const live = {\n number: 17,\n id: 117,\n node_id: 'ISSUE17',\n title: ' Prior <title>\\r\\n',\n body: '\\nprior & body\\t ',\n state: 'open',\n html_url: 'https://github.com/example/widget/issues/17',\n };\n const controls = {\n corruptComment: false,\n failUpdate: false,\n ignoreClosure: false,\n drift: false,\n targetPr: false,\n reason: null as string | null,\n duplicate: null as number | null,\n archived: false,\n archiveAfterUpdate: false,\n projectUnavailableAfterUpdate: false,\n nativeUnavailableAfterUpdate: false,\n foreignAfterUpdate: false,\n wrongNodeAfterUpdate: false,\n driftAfterUpdate: false,\n projectFailure: '' as '' | 'rate-limit' | 'cancel',\n nativeReadsAfterUpdate: 0,\n failChildReadAfterUpdate: false,\n childReadsAfterUpdate: 0,\n artifacts: [] as { number: number; name: string; type: string; html_url: string }[],\n artifactStatus: 200,\n blocking: [] as { number: number; state: 'OPEN' | 'CLOSED' }[],\n blockingStatus: 200,\n };\n const comments: { id: number; body: string; html_url: string; user: { login: string }; issue_url: string }[] = [];\n const updates: Record<string, unknown>[] = [];\n let projectStatus = 'Active';\n const context = {\n root,\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: { ...listingFixture().context.projectConfiguration!, writable: true },\n clients: {\n role: 'author',\n authenticatedAuthor: async () => {\n events.push('author');\n return { actorLogin: 'operator', credentialIdentity: 'user:1' };\n },\n rest: {\n issues: {\n listSubIssues: async () => {\n if (updates.length) controls.childReadsAfterUpdate++;\n if (updates.length && controls.failChildReadAfterUpdate) throw new Error('Child progress unavailable');\n return { data: [] };\n },\n get: async (input: { issue_number: number }) => {\n if (updates.length) controls.nativeReadsAfterUpdate++;\n if (updates.length && controls.nativeUnavailableAfterUpdate) throw new Error('Native unavailable');\n return {\n data:\n input.issue_number === 17\n ? {\n ...live,\n ...(updates.length && controls.wrongNodeAfterUpdate ? { node_id: 'FOREIGN_ISSUE' } : {}),\n ...(updates.length && controls.foreignAfterUpdate\n ? { html_url: 'https://github.com/other/widget/issues/17' }\n : {}),\n ...(updates.length && controls.driftAfterUpdate ? { body: 'Concurrent later edit' } : {}),\n }\n : {\n number: input.issue_number,\n id: 118,\n html_url: `https://github.com/example/widget/issues/${String(input.issue_number)}`,\n ...(controls.targetPr ? { pull_request: {} } : {}),\n },\n };\n },\n listComments: async () => ({ data: comments }),\n createComment: async (input: { body: string }) => {\n events.push('comment');\n const id = 91 + comments.length;\n const data = {\n id,\n body: input.body,\n html_url: `https://github.com/example/widget/issues/17#issuecomment-${String(id)}`,\n user: { login: 'operator' },\n issue_url: 'https://api.github.com/repos/example/widget/issues/17',\n };\n comments.push(data);\n return { data };\n },\n getComment: async (input: { comment_id: number }) => {\n events.push('comment-readback');\n if (controls.drift) live.body = 'Concurrent human edit';\n return {\n data: {\n ...comments.find((comment) => comment.id === input.comment_id),\n ...(controls.corruptComment ? { body: 'Wrong body' } : {}),\n },\n };\n },\n update: async (input: Record<string, unknown>) => {\n events.push('update');\n updates.push(input);\n if (controls.failUpdate) throw new Error('Update unavailable');\n if (controls.archiveAfterUpdate) controls.archived = true;\n if (typeof input.title === 'string') live.title = input.title;\n if (typeof input.body === 'string') live.body = input.body;\n if (!controls.ignoreClosure && typeof input.state === 'string') {\n live.state = input.state;\n controls.reason =\n input.state === 'closed'\n ? (typeof input.state_reason === 'string' ? input.state_reason : 'completed').toUpperCase()\n : 'REOPENED';\n if (input.duplicate_issue_id !== undefined) controls.duplicate = 18;\n }\n return { data: { ...live } };\n },\n },\n request: async (route: string) => {\n if (!route.endsWith('/artifacts')) return { data: [] };\n if (controls.artifactStatus !== 200)\n throw Object.assign(new Error('Artifacts unavailable'), { status: controls.artifactStatus });\n return { status: 200, data: controls.artifacts };\n },\n },\n graphql: async (query: string, variables: Record<string, unknown>) => {\n if (query.includes('blocking(first:')) {\n if (controls.blockingStatus !== 200)\n throw Object.assign(new Error('Bad gateway'), { status: controls.blockingStatus });\n const nodes = controls.blocking.map((node) => ({\n ...node,\n id: `ISSUE${String(node.number)}`,\n title: 'Dependent',\n }));\n return { repository: { issue: { blocking: { nodes, pageInfo: { hasNextPage: false, endCursor: null } } } } };\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectFailure) {\n if (controls.projectFailure === 'cancel') throw new DOMException('Cancelled', 'AbortError');\n throw Object.assign(new Error('PRIVATE_RATE_CONTENT'), {\n status: 429,\n response: { headers: { 'retry-after': '60' } },\n });\n }\n if (query.includes('ProjectDelivery') && updates.length && controls.projectUnavailableAfterUpdate)\n throw new Error('PRIVATE_REMOTE_CONTENT');\n if (query.includes('IssueClosureReadback'))\n return {\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: live.state.toUpperCase(),\n stateReason: controls.reason,\n duplicateOf:\n controls.duplicate === null\n ? null\n : { number: controls.duplicate, repository: { nameWithOwner: 'example/widget' } },\n },\n },\n };\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: { parent: null, blockedBy: { nodes: [], pageInfo: { hasNextPage: false, endCursor: null } } },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: controls.archived,\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n ]);\n if (query.includes('UpdateProjectDeliveryStatus')) {\n events.push('project-update');\n projectStatus =\n variables.optionId === 'DONE' ? 'Shipped' : variables.optionId === 'TODO' ? 'Queued' : 'Active';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('ProjectDeliveryItemReadback'))\n return {\n node: {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: {\n name: projectStatus,\n optionId: projectStatus === 'Active' ? 'ACTIVE' : projectStatus === 'Queued' ? 'TODO' : 'DONE',\n },\n },\n };\n throw new Error(`Unexpected update fixture query: ${query}`);\n },\n },\n } as unknown as DeliveryContext;\n return {\n context,\n live,\n controls,\n comments,\n events,\n updates,\n cleanup: () => rmSync(root, { recursive: true, force: true }),\n };\n}\n\ntest('history preserves exact prior content before a rewrite and retries a failed mutation once', async () => {\n const fixture = updateFixture();\n try {\n const oldTitle = fixture.live.title;\n const oldBody = fixture.live.body;\n fixture.controls.failUpdate = true;\n const input = { issueNumber: 17, title: 'New title', body: 'New body', draft: true, preserveHistory: true };\n await assert.rejects(issue.updateIssue(fixture.context, input), /Update unavailable/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal(fixture.comments[0]!.body, issue.renderIssueHistory(oldTitle, oldBody));\n assert.ok(fixture.events.indexOf('comment-readback') < fixture.events.indexOf('update'));\n fixture.controls.failUpdate = false;\n const result = await issue.updateIssue(fixture.context, input);\n assert.equal(result.title, 'New title');\n assert.equal(result.conversion?.priorBody, oldBody);\n assert.ok(oldBody.split('\\n').every((line) => result.conversion?.diff.includes('-' + line)));\n assert.match(result.body, /ai-delivery:issue@1/u);\n assert.equal(fixture.comments.length, 1);\n assert.equal((result as unknown as { historyComment: { reused: boolean } }).historyComment.reused, true);\n // The body replaces the converted legacy text; once that text has history, repeating the update is a no-op.\n await issue.updateIssue(fixture.context, input);\n await issue.updateIssue(fixture.context, input);\n const afterReplace = fixture.comments.length;\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, afterReplace, 'a no-op rewrite adds no history');\n } finally {\n fixture.cleanup();\n }\n});\n\ntest.each([{ state: 'closed' as const }, { state: 'open' as const }, { title: 'Retitled archived issue safely' }])(\n 'archived native update preserves the item and returns its identity: %j',\n async (patch) => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n if (patch.state === 'open') f.live.state = 'closed';\n const result = await issue.updateIssue(f.context, { issueNumber: 17, ...patch });\n assert.equal(f.live.state, patch.state ?? 'open');\n if (patch.title) assert.equal(f.live.title, patch.title);\n assert.equal(f.controls.archived, true);\n assert.equal(f.events.includes('project-update'), false);\n assert.ok(result.warnings.some((w) => w.code === 'project.archived' && w.message.includes('ITEM17')));\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('initially archived issue update refuses before history, closure or native writes', async () => {\n const f = updateFixture();\n try {\n f.controls.archived = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n /archived/u,\n );\n assert.deepEqual(f.updates, []);\n assert.deepEqual(f.comments, []);\n assert.equal(f.events.includes('project-update'), false);\n assert.equal(f.live.state, 'open');\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['archive', 'unavailable'] as const)(\n 'post-commit %s reports confirmed native content and closure separately from pending Project work',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = failure === 'archive';\n f.controls.projectUnavailableAfterUpdate = failure === 'unavailable';\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = (\n error as {\n result: {\n status: string;\n native: {\n status: string;\n repository: string;\n readback: issue.IssueInfo;\n closure: issue.IssueClosureReadback;\n historyComment: issue.IssueCommentReadback;\n };\n project: { status: string; desiredStatus: string };\n recovery: { tool: string };\n };\n }\n ).result;\n assert.equal(result.status, 'update-incomplete');\n assert.equal(result.native.status, 'confirmed');\n assert.equal(result.native.repository, 'example/widget');\n assert.equal(result.native.readback.state, 'closed');\n assert.match(result.native.readback.body, /Replacement/u);\n assert.equal(result.native.closure.closeReason, 'not_planned');\n assert.equal(result.native.historyComment.commentId, 91);\n assert.equal(result.project.status, failure === 'archive' ? 'pending' : 'unknown');\n assert.equal(result.project.desiredStatus, 'Done');\n assert.equal(result.recovery.tool, 'issue_batch_update');\n assert.equal(JSON.stringify(result).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.comments.length, 2);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('native fallback confirms committed closure without requiring child progress', async () => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.failChildReadAfterUpdate = true;\n await assert.rejects(\n issue.updateIssue(f.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n state: 'closed',\n closeReason: 'not_planned',\n }),\n (error: unknown) => {\n const result = issue.getIncompleteIssueUpdate(error);\n assert.equal(result?.native.status, 'confirmed');\n assert.equal(result?.native.readback?.state, 'closed');\n assert.match(result?.native.readback?.body ?? '', /Replacement/u);\n assert.equal(result?.native.closure?.closeReason, 'not_planned');\n assert.equal(result?.native.readback?.childProgress, undefined);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n assert.equal(f.controls.childReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n});\n\ntest.each(['unavailable', 'foreign', 'drift', 'node'] as const)(\n 'post-commit native %s evidence remains unknown',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.archiveAfterUpdate = true;\n f.controls.nativeUnavailableAfterUpdate = failure === 'unavailable';\n f.controls.foreignAfterUpdate = failure === 'foreign';\n f.controls.wrongNodeAfterUpdate = failure === 'node';\n f.controls.driftAfterUpdate = failure === 'drift';\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const result = (error as { result: { native: { status: string; readback: unknown } } }).result;\n assert.equal(result.native.status, 'unknown');\n assert.equal(result.native.readback, null);\n return true;\n },\n );\n assert.equal(f.updates.length, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest.each(['rate-limit', 'cancel'] as const)(\n 'post-commit %s defers native readback without another request',\n async (failure) => {\n const f = updateFixture();\n try {\n f.controls.projectFailure = failure;\n await assert.rejects(\n issue.updateIssue(f.context, { issueNumber: 17, body: 'Replacement', draft: true }),\n (error: unknown) => {\n const partial = issue.getIncompleteIssueUpdate(error);\n assert.equal(partial?.native.status, 'unknown');\n assert.equal(partial?.native.readback, null);\n if (failure === 'rate-limit') assert.equal(partial?.rateLimit?.retryAfterSeconds, 60);\n assert.equal(JSON.stringify(partial).includes('PRIVATE_'), false);\n return true;\n },\n );\n assert.equal(f.controls.nativeReadsAfterUpdate, 1);\n } finally {\n f.cleanup();\n }\n },\n);\n\ntest('history overflow, invalid metadata, failed comment readback and concurrent edits prevent rewrites', async () => {\n for (const failure of ['overflow', 'labels', 'readback', 'drift'] as const) {\n const fixture = updateFixture();\n try {\n if (failure === 'overflow') fixture.live.body = '&'.repeat(14000);\n if (failure === 'readback') fixture.controls.corruptComment = true;\n if (failure === 'drift') fixture.controls.drift = true;\n const oldBody = fixture.live.body;\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n body: 'Replacement',\n draft: true,\n preserveHistory: true,\n ...(failure === 'labels' ? { labels: ['invalid'] } : {}),\n }),\n );\n assert.equal(fixture.updates.length, 0, failure);\n if (failure !== 'drift') assert.equal(fixture.live.body, oldBody);\n if (failure === 'overflow' || failure === 'labels') assert.equal(fixture.comments.length, 0);\n if (failure === 'overflow') assert.ok(!fixture.events.includes('author'));\n } finally {\n fixture.cleanup();\n }\n }\n});\n\ntest('reasoned closure records supersession and verifies native reason and duplicate identity', async () => {\n for (const closeReason of ['completed', 'not_planned', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n const input = { issueNumber: 17, state: 'closed' as const, draft: true, closeReason, supersededBy: 18 };\n const result = await issue.updateIssue(fixture.context, input);\n const closure = (\n result as unknown as {\n closure: issue.IssueClosureReadback & { supersededBy: number; comment: issue.IssueCommentReadback };\n }\n ).closure;\n assert.equal(result.state, 'closed');\n assert.equal(closure.closeReason, closeReason);\n assert.equal(closure.supersededBy, 18);\n assert.match(closure.comment.body, /example\\/widget#18/u);\n assert.equal(fixture.updates[0]!.state_reason, closeReason);\n if (closeReason === 'duplicate') {\n assert.equal(fixture.updates[0]!.duplicate_issue_id, 118);\n assert.deepEqual(closure.duplicateOf, { number: 18, repository: 'example/widget' });\n }\n await issue.updateIssue(fixture.context, input);\n assert.equal(fixture.comments.length, 2, 'closure retries reuse authoritative comments');\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n ...input,\n closeReason: closeReason === 'completed' ? 'not_planned' : 'completed',\n }),\n /already closed/u,\n );\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst studyArtifact = (number: number, name: string) => ({\n number,\n name,\n type: 'generic',\n html_url: `https://github.com/example/widget/issues/17/artifacts/${String(number)}`,\n});\n\ntest('a study closes as completed only with a verdict, a Result and a READOUT artifact', async () => {\n const close = { issueNumber: 17, state: 'closed' as const, closeReason: 'completed' as const };\n const closeout = { verdict: 'NONE: no cut passed', result: 'Net \u22120.4\u00A2/fill (n=212)' };\n const cases: {\n title?: string;\n input: issue.UpdateIssueInput;\n artifacts?: ReturnType<typeof studyArtifact>[];\n artifactStatus?: number;\n refusal?: RegExp;\n }[] = [\n { input: close, refusal: /Pass closeout\\.verdict/u },\n { input: { ...close, closeout: { ...closeout, result: '' } }, refusal: /Pass closeout\\.result/u },\n {\n input: { ...close, closeout },\n artifacts: [studyArtifact(1, 'PLAN.md')],\n refusal: /gh issue artifact create 17/u,\n },\n { input: { ...close, closeout }, artifactStatus: 404, refusal: /artifacts \\(HTTP 404\\)/u },\n { input: { ...close, closeout: { ...closeout, verdict: 'a\\nb\\nc\\nd' } }, refusal: /1\u20133 lines/u },\n { input: { ...close, closeReason: 'not_planned' } },\n { title: 'Book cell can hold tied', input: close },\n { title: 'Design: #18 widget shape', input: close },\n ];\n for (const example of cases) {\n const f = updateFixture();\n try {\n f.live.title = example.title ?? 'Study: X';\n f.controls.artifacts = example.artifacts ?? [];\n f.controls.artifactStatus = example.artifactStatus ?? 200;\n if (example.refusal) {\n await assert.rejects(issue.updateIssue(f.context, example.input), example.refusal);\n assert.equal(f.live.state, 'open');\n assert.equal(f.comments.length, 0);\n } else {\n const result = await issue.updateIssue(f.context, example.input);\n assert.equal(result.state, 'closed');\n assert.match(f.comments[0]!.body, /^Requested closure reason: (completed|not_planned)\\.$/u);\n }\n } finally {\n f.cleanup();\n }\n }\n const f = updateFixture();\n try {\n f.live.title = 'Study: X';\n f.controls.artifacts = [studyArtifact(1, 'READOUT.md'), studyArtifact(2, 'SHA256SUMS')];\n const result = await issue.updateIssue(f.context, { ...close, closeout });\n assert.equal(result.state, 'closed');\n assert.equal(\n result.closure?.comment.body,\n [\n '**Verdict:** NONE: no cut passed',\n '**Result:**\\n\\nNet \u22120.4\u00A2/fill (n=212)',\n '**Artifacts:**\\n- [READOUT.md](https://github.com/example/widget/issues/17/artifacts/1)\\n- [SHA256SUMS](https://github.com/example/widget/issues/17/artifacts/2)',\n 'Requested closure reason: completed.',\n ].join('\\n\\n'),\n );\n } finally {\n f.cleanup();\n }\n});\n\ntest('every close lists the open issues it was blocking', async () => {\n const close = { issueNumber: 17, state: 'closed' as const, closeReason: 'not_planned' as const };\n for (const example of [\n {\n blocking: [\n { number: 11, state: 'OPEN' as const },\n { number: 12, state: 'CLOSED' as const },\n ],\n unblocks: [11],\n },\n { blocking: [], unblocks: [] },\n { blocking: [], blockingStatus: 502, unblocks: [] },\n ]) {\n const f = updateFixture();\n try {\n f.controls.blocking = example.blocking;\n f.controls.blockingStatus = example.blockingStatus ?? 200;\n const result = await issue.updateIssue(f.context, close);\n assert.equal(result.state, 'closed');\n assert.deepEqual(result.unblocks, example.unblocks);\n const unblocksLine = /\\*\\*Unblocks:\\*\\* (.*)$/u.exec(result.closure!.comment.body)?.[1];\n assert.equal(unblocksLine, example.unblocks.length ? '#11' : undefined);\n assert.equal(\n result.warnings.some(\n (warning) => warning.code === 'close.unblocks' && /issues #17 blocks/u.test(warning.message),\n ),\n example.blockingStatus === 502,\n );\n } finally {\n f.cleanup();\n }\n }\n});\n\ntest('issue info lists artifacts on request and warns instead of failing when they are unreadable', async () => {\n const f = updateFixture();\n try {\n f.controls.artifacts = [studyArtifact(1, 'READOUT.md'), { ...studyArtifact(2, 's3 link'), type: 'link' }];\n assert.deepEqual((await issue.issueInfo(f.context, 17, { artifacts: true })).artifacts, [\n {\n number: 1,\n name: 'READOUT.md',\n type: 'generic',\n url: 'https://github.com/example/widget/issues/17/artifacts/1',\n },\n { number: 2, name: 's3 link', type: 'link', url: 'https://github.com/example/widget/issues/17/artifacts/2' },\n ]);\n f.controls.artifactStatus = 403;\n const unread = await issue.issueInfo(f.context, 17, { artifacts: true });\n assert.equal(unread.artifacts, undefined);\n assert.match(unread.warnings?.[0]?.message ?? '', /HTTP 403/u);\n } finally {\n f.cleanup();\n }\n});\n\ntest('invalid superseding issues and contradictory native closure fail closed', async () => {\n for (const failure of ['self', 'pull-request', 'reason', 'duplicate'] as const) {\n const fixture = updateFixture();\n try {\n fixture.controls.targetPr = failure === 'pull-request';\n fixture.controls.ignoreClosure = failure === 'reason';\n if (failure === 'duplicate') {\n fixture.live.state = 'closed';\n fixture.controls.reason = 'DUPLICATE';\n fixture.controls.duplicate = 19;\n }\n await assert.rejects(\n issue.updateIssue(fixture.context, {\n issueNumber: 17,\n state: 'closed',\n draft: true,\n closeReason: failure === 'duplicate' ? 'duplicate' : 'completed',\n supersededBy: failure === 'self' ? 17 : 18,\n }),\n );\n if (failure !== 'reason') {\n assert.equal(fixture.updates.length, 0);\n assert.equal(fixture.comments.length, 0);\n }\n } finally {\n fixture.cleanup();\n }\n }\n});\n\nconst listIssues = (\n issue as unknown as {\n listIssues: (context: DeliveryContext, input: unknown) => Promise<{ issues: unknown[]; nextPage: number | null }>;\n }\n).listIssues;\n\nfunction listingFixture(\n options: {\n foreign?: boolean;\n incomplete?: boolean;\n invalidField?: boolean;\n foreignParent?: boolean;\n missingOption?: boolean;\n dualBlockers?: boolean;\n missingMulti?: boolean;\n } = {},\n) {\n const requests: Record<string, unknown>[] = [];\n const context = {\n root: '/synthetic',\n repo: { owner: 'example', repo: 'widget' },\n config: syntheticDiscoveryConfig,\n projectConfiguration: {\n projectId: 'PROJECT',\n projectNumber: 1,\n title: 'Delivery',\n writable: false,\n pointsFieldId: 'POINTS',\n priorityFieldId: 'PRIORITY',\n statusFieldId: 'STATUS',\n statusOptionIds: { Todo: 'TODO', 'In Progress': 'ACTIVE', Blocked: 'BLOCKED', Done: 'DONE' },\n settings: {\n number: 1,\n title: 'Delivery',\n statusField: 'Flow',\n statuses: { Todo: 'Queued', 'In Progress': 'Active', Blocked: 'Waiting', Done: 'Shipped' },\n },\n },\n clients: {\n rest: {\n issues: {\n listForRepo: async (params: Record<string, unknown>) => {\n requests.push(params);\n return {\n data: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: options.foreign\n ? 'https://github.com/elsewhere/widget/issues/17'\n : 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n { number: 18, pull_request: {} },\n ],\n };\n },\n },\n search: {\n issuesAndPullRequests: async (params: Record<string, unknown>) => {\n requests.push(params);\n return { data: { total_count: 0, incomplete_results: options.incomplete ?? false, items: [] } };\n },\n },\n request: async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, ...params });\n if (route.includes('/orgs/'))\n return {\n data: [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n { id: 103, name: 'Start date', data_type: 'date' },\n ...(options.missingMulti ? [{ id: 104, name: 'Tags', data_type: 'multi_select' }] : []),\n ],\n };\n return {\n data: [\n {\n issue_field_id: 101,\n issue_field_name: options.invalidField ? 'Foreign estimate' : 'Estimate',\n data_type: 'single_select',\n value: 44,\n ...(options.missingOption ? {} : { single_select_option: { id: 44, name: '4' } }),\n },\n { issue_field_id: 103, issue_field_name: 'Start date', data_type: 'date', value: '2026-10-07' },\n ...(options.missingMulti\n ? [{ issue_field_id: 104, issue_field_name: 'Tags', data_type: 'multi_select', value: 'one' }]\n : []),\n ],\n };\n },\n },\n graphql: async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('blockedBy(first:'))\n return {\n repository: {\n issue: {\n parent: {\n id: 'PARENT9',\n number: 9,\n repository: { nameWithOwner: options.foreignParent ? 'example/other' : 'example/widget' },\n },\n blockedBy: {\n nodes: [\n {\n id: 'BLOCKER8',\n number: 8,\n title: 'Prerequisite',\n state: 'CLOSED',\n repository: { nameWithOwner: 'example/widget' },\n },\n ...(options.dualBlockers\n ? [\n {\n id: 'FOREIGN8',\n number: 8,\n title: 'Other prerequisite',\n state: 'OPEN',\n repository: { nameWithOwner: 'example/other' },\n },\n ]\n : []),\n ],\n pageInfo: { hasNextPage: false, endCursor: null },\n },\n },\n },\n };\n if (query.includes('ProjectDeliveryIssueItems'))\n return issueProjectItemsResponse(variables, [\n {\n id: 'ITEM17',\n isArchived: false,\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n },\n ]);\n throw new Error('Unexpected query');\n },\n },\n } as unknown as DeliveryContext;\n return { context, requests };\n}\n\ntest('typed listing filters stay repository-bound and expose named fields without identifiers', async () => {\n const tool = getAiDeliveryMcpTool('issue_list');\n assert.ok(tool, 'issue_list is registered');\n const input = tool.inputSchema.parse({\n state: 'open',\n labels: ['area:widget'],\n parentIssueNumber: 9,\n issueType: 'Task',\n projectStatus: 'In Progress',\n updatedSince: '2026-10-01T00:00:00Z',\n perPage: 2,\n });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, 2);\n assert.deepEqual(result.issues, [\n {\n number: 17,\n title: 'Repair widget',\n state: 'open',\n labels: ['area:widget'],\n issueType: 'Task',\n parentIssueNumber: 9,\n parent: { repository: 'example/widget', number: 9 },\n blockers: [{ repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' }],\n projectStatus: 'In Progress',\n fields: { Estimate: '4', Urgency: null, 'Start date': '2026-10-07' },\n url: 'https://github.com/example/widget/issues/17',\n updatedAt: '2026-10-07T00:00:00Z',\n },\n ]);\n assert.equal(requests[0]?.owner, 'example');\n assert.equal(requests[0]?.since, '2026-10-01T00:00:00Z');\n assert.equal(JSON.stringify(result).includes('BLOCKER8'), false);\n});\n\ntest('search quotes user text so it cannot change the selected repository', async () => {\n const tool = getAiDeliveryMcpTool('issue_search');\n assert.ok(tool, 'issue_search is registered');\n const input = tool.inputSchema.parse({ query: 'repo:elsewhere/project', page: 2, perPage: 10 });\n const { context, requests } = listingFixture();\n const result = await listIssues(context, input);\n assert.equal(result.nextPage, null);\n assert.equal(requests[0]?.q, 'repo:example/widget is:issue \"repo:elsewhere/project\"');\n});\n\ntest('update accepts history and reasoned closure while rejecting incoherent requests', () => {\n const tool = getAiDeliveryMcpTool('issue_update');\n assert.ok(tool);\n assert.equal(tool.inputSchema.safeParse({ issueNumber: 17, body: 'new body', preserveHistory: true }).success, true);\n assert.equal(\n tool.inputSchema.safeParse({ issueNumber: 17, state: 'closed', closeReason: 'duplicate', supersededBy: 9 }).success,\n true,\n );\n assert.throws(\n () => tool.inputSchema.safeParse({ issueNumber: 17, state: 'open', closeReason: 'completed' }),\n /\"code\":\"closure.state\"/u,\n );\n});\n\ntest('local filters retain pagination when the current GitHub page has no matching issue', async () => {\n const { context } = listingFixture();\n const result = await listIssues(context, { parentIssueNumber: null, perPage: 2 });\n assert.deepEqual(result.issues, []);\n assert.equal(result.nextPage, 2);\n});\n\ntest('foreign issue identity and mismatched organization fields fail rather than returning false readback', async () => {\n await assert.rejects(listIssues(listingFixture({ foreign: true }).context, {}), /foreign repository/u);\n await assert.rejects(listIssues(listingFixture({ invalidField: true }).context, {}), /conflicts with its catalog/u);\n});\n\ntest('search refuses incomplete upstream results and invalid literal text', async () => {\n await assert.rejects(\n listIssues(listingFixture({ incomplete: true }).context, { query: 'widget' }),\n /incomplete results/u,\n );\n await assert.rejects(listIssues(listingFixture().context, { query: '\" repo:elsewhere/widget' }), /literal text/u);\n assert.equal(getAiDeliveryMcpTool('issue_list')?.inputSchema.safeParse({ perPage: 101 }).success, false);\n});\n\ntest('a foreign parent with the same issue number cannot satisfy a local parent filter', async () => {\n const { context } = listingFixture({ foreignParent: true });\n assert.deepEqual((await listIssues(context, { parentIssueNumber: 9 })).issues, []);\n});\n\ntest('label filters preserve GitHub case-insensitive label identity', async () => {\n const { context } = listingFixture();\n assert.equal((await listIssues(context, { labels: ['AREA:Widget'] })).issues.length, 1);\n});\n\ntest('a set select field without its named option fails rather than reporting unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingOption: true }).context, {}), /option/u);\n});\n\ntest('same-number blockers in different repositories retain both qualified identities', async () => {\n const { context } = listingFixture({ dualBlockers: true });\n const result = await issue.listIssues(context, {});\n assert.deepEqual(result.issues[0]?.blockers, [\n { repository: 'example/widget', number: 8, title: 'Prerequisite', state: 'CLOSED' },\n { repository: 'example/other', number: 8, title: 'Other prerequisite', state: 'OPEN' },\n ]);\n});\n\ntest('a set multi-select field without named options cannot be reported unset', async () => {\n await assert.rejects(listIssues(listingFixture({ missingMulti: true }).context, {}), /option/u);\n});\n\ntest('history rendering preserves whitespace and escapes content that could end the collapsed section', () => {\n const render = (issue as unknown as { renderIssueHistory: (title: string, body: string) => string })\n .renderIssueHistory;\n assert.equal(typeof render, 'function');\n const body = ' old body\\n</pre></details><script>x</script> & text ';\n const result = render('Old <title> & name', body);\n assert.equal(\n result,\n '<details>\\n<summary>Previous issue title and body</summary>\\n\\nTitle:\\n<pre>Old <title> & name</pre>\\n\\nBody:\\n<pre> old body\\n</pre></details><script>x</script> & text </pre>\\n\\n</details>',\n );\n});\n\ntest('closure evidence reads native reason and preserves qualified duplicate identity', async () => {\n const { context } = listingFixture();\n context.clients.graphql = (async () => ({\n repository: {\n issue: {\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n state: 'CLOSED',\n stateReason: 'DUPLICATE',\n duplicateOf: { number: 9, repository: { nameWithOwner: 'example/other' } },\n },\n },\n })) as unknown as typeof context.clients.graphql;\n const read = (\n issue as unknown as { readIssueClosure: (context: DeliveryContext, issueNumber: number) => Promise<unknown> }\n ).readIssueClosure;\n assert.equal(typeof read, 'function');\n assert.deepEqual(await read(context, 17), {\n state: 'closed',\n closeReason: 'duplicate',\n duplicateOf: { number: 9, repository: 'example/other' },\n });\n});\n\ntest('native field catalog and values both paginate through the last named field', async () => {\n const { context } = listingFixture();\n const requests: { route: string; page: unknown }[] = [];\n context.clients.rest.request = (async (route: string, params: Record<string, unknown>) => {\n requests.push({ route, page: params.page });\n const catalog = route.includes('/orgs/');\n if (params.page === 2)\n return {\n data: catalog\n ? [{ id: 201, name: 'Late date', data_type: 'date' }]\n : [{ issue_field_id: 201, issue_field_name: 'Late date', data_type: 'date', value: '2026-10-09' }],\n };\n return {\n data: catalog\n ? [\n { id: 101, name: 'Estimate', data_type: 'single_select' },\n { id: 102, name: 'Urgency', data_type: 'single_select' },\n ...Array.from({ length: 98 }, (_, index) => ({\n id: index + 103,\n name: `Custom ${String(index)}`,\n data_type: 'text',\n })),\n ]\n : [\n {\n issue_field_id: 101,\n issue_field_name: 'Estimate',\n data_type: 'single_select',\n value: 44,\n single_select_option: { name: '4' },\n },\n { issue_field_id: 102, issue_field_name: 'Urgency', data_type: 'single_select', value: null },\n ...Array.from({ length: 98 }, (_, index) => ({\n issue_field_id: index + 103,\n issue_field_name: `Custom ${String(index)}`,\n data_type: 'text',\n value: 'retained',\n })),\n ],\n };\n }) as unknown as typeof context.clients.rest.request;\n const result = await issue.listIssues(context, {});\n assert.equal(result.issues[0]?.fields['Late date'], '2026-10-09');\n assert.equal(result.issues[0]?.fields.Urgency, null);\n assert.deepEqual(\n requests.map((request) => request.page),\n [1, 2, 1, 2],\n );\n});\n\ntest('native field pagination fails closed on a repeated nonadvancing page', async () => {\n const { context } = listingFixture();\n context.clients.rest.request = (async () => ({\n data: Array.from({ length: 100 }, (_, index) => ({\n id: index + 1,\n name: `Field ${String(index)}`,\n data_type: 'text',\n })),\n })) as unknown as typeof context.clients.rest.request;\n await assert.rejects(issue.listIssues(context, {}), /repeated a pagination page/u);\n});\n\ntest.each([\n ['catalog', 'list'],\n ['values', 'list'],\n ['catalog', 'ready'],\n ['values', 'ready'],\n ['catalog', 'capacity'],\n ['values', 'capacity'],\n] as const)('reconciliation bounds native %s through %s reads', async (collection, entry) => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n if (entry === 'ready')\n context.clients.rest.issues.listSubIssues = (async (input: Record<string, unknown>) => {\n assert.equal(input.owner, 'example');\n assert.equal(input.repo, 'widget');\n assert.equal(input.issue_number, 17);\n return { data: [] };\n }) as unknown as typeof context.clients.rest.issues.listSubIssues;\n context.clients.rest.issues.get = (async () => ({\n data: {\n number: 17,\n node_id: 'ISSUE17',\n state: 'open',\n body: '',\n title: 'Repair widget',\n html_url: 'https://github.com/example/widget/issues/17',\n },\n })) as typeof context.clients.rest.issues.get;\n if (entry === 'capacity')\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Native', match: { field: 'Estimate', value: '4' }, limit: 2 }],\n };\n const originalGraphql = context.clients.graphql;\n context.clients.graphql = (async (query: string, variables?: Record<string, unknown>) => {\n const response = await originalGraphql(query, variables);\n if (!query.includes('blockedBy(first:')) return response;\n const parsed = response as { repository: { issue: Record<string, unknown> } };\n Object.assign(parsed.repository.issue, {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n });\n return parsed;\n }) as unknown as typeof context.clients.graphql;\n const original = context.clients.rest.request;\n let requests = 0;\n context.clients.rest.request = (async (route: string, params: { page: number }) => {\n if (route.includes('/orgs/') !== (collection === 'catalog')) return original(route);\n requests++;\n return {\n data:\n params.page > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => {\n const id = 1000 + params.page * 100 + index;\n return collection === 'catalog'\n ? { id, name: `Extra ${String(id)}`, data_type: 'text' }\n : { issue_field_id: id, issue_field_name: `Extra ${String(id)}`, data_type: 'text', value: 'value' };\n }),\n };\n }) as typeof context.clients.rest.request;\n const operation =\n entry === 'list'\n ? issue.listIssues(context, {})\n : entry === 'ready'\n ? issue.readyCheck(context, 17)\n : issue.assertIssueStartCapacity(context, 17);\n await assert.rejects(operation, (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation bounds blocker pages and binds their source issue', async () => {\n const { context } = listingFixture();\n let requests = 0;\n context.clients.graphql = (async () => {\n requests++;\n return {\n repository: {\n issue: {\n id: 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n parent: null,\n blockedBy: { nodes: [], pageInfo: { hasNextPage: requests < 21, endCursor: `page-${String(requests)}` } },\n },\n },\n };\n }) as unknown as typeof context.clients.graphql;\n const input = { graphql: context.clients.graphql, repo: context.repo, issueNumber: 17, maxPages: 20 };\n await assert.rejects(getNativeBlockerRelationships(input), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n assert.equal(Reflect.get(error, 'pagesRequested'), 20);\n return true;\n });\n assert.equal(requests, 20);\n});\n\ntest('reconciliation WIP guards bound their label catalog', async () => {\n const { context } = listingFixture();\n Object.assign(context, { readPageLimit: 20 });\n context.config = {\n ...context.config,\n wipLimits: [{ repository: 'example/widget', name: 'Urgent', match: { label: 'urgent' }, limit: 2 }],\n };\n let requests = 0;\n context.clients.rest.issues.listLabelsForRepo = (async () => {\n requests++;\n return {\n data:\n requests > 20\n ? []\n : Array.from({ length: 100 }, (_, index) => ({\n name: index === 0 && requests === 1 ? 'urgent' : `label-${String(requests)}-${String(index)}`,\n })),\n };\n }) as typeof context.clients.rest.issues.listLabelsForRepo;\n await assert.rejects(issue.assertIssueStartCapacity(context, 17), (error: unknown) => {\n assert.ok(error instanceof Error);\n assert.equal(error.name, 'CollectionLimitError');\n return true;\n });\n assert.equal(requests, 20);\n});\n\nfunction membershipFixture() {\n const configuration = { ...listingFixture().context.projectConfiguration!, writable: true };\n const events: string[] = [];\n const controls = { corrupt: '', archived: false, duplicate: false, unreadable: false };\n let member = false;\n let status: 'In Progress' | null = null;\n const item = (readback = false) => ({\n id: readback && controls.corrupt === 'item' ? 'WRONG' : 'ITEM17',\n isArchived: controls.archived,\n project: { id: readback && controls.corrupt === 'project' ? 'WRONG' : 'PROJECT', number: 1 },\n content: controls.unreadable\n ? null\n : {\n __typename: 'Issue',\n id: readback && controls.corrupt === 'issue' ? 'WRONG' : 'ISSUE17',\n number: 17,\n repository: { nameWithOwner: 'example/widget' },\n },\n fieldValueByName:\n status === null ? null : { name: 'Active', optionId: controls.corrupt === 'option' ? 'WRONG' : 'ACTIVE' },\n });\n const graphql = (async (query: string, variables?: Record<string, unknown>) => {\n if (query.includes('mutation AddProjectDeliveryItem')) {\n events.push('add');\n member = true;\n return { addProjectV2ItemById: { item: { id: 'ITEM17' } } };\n }\n if (query.includes('mutation UpdateProjectDeliveryStatus')) {\n events.push('status');\n status = 'In Progress';\n return { updateProjectV2ItemFieldValue: { projectV2Item: { id: 'ITEM17' } } };\n }\n if (query.includes('query ProjectDeliveryItemReadback')) {\n events.push('readback');\n return { node: item(true) };\n }\n const items = member ? (controls.duplicate ? [item(), { ...item(), id: 'SECOND' }] : [item()]) : [];\n if (query.includes('query ProjectDeliveryIssueItems')) return issueProjectItemsResponse(variables, items);\n if (query.includes('query ProjectDeliveryItems'))\n return {\n organization: {\n projectV2: { id: 'PROJECT', number: 1, items: { nodes: items, pageInfo: { hasNextPage: false } } },\n },\n };\n throw new Error('Unexpected membership fixture query.');\n }) as unknown as DeliveryContext['clients']['graphql'];\n return {\n input: { graphql, configuration, org: 'example', issueNodeId: 'ISSUE17' },\n events,\n controls,\n setMember: () => {\n member = true;\n },\n };\n}\n\ntest('membership-only add verifies the exact unarchived item and reuse writes nothing', async () => {\n const f = membershipFixture();\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input & { beforeAdd?: () => Promise<void> }) => Promise<{ itemId: string; archived: false }>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n const result = await ensure!({\n ...f.input,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n });\n assert.deepEqual(result, { itemId: 'ITEM17', archived: false });\n assert.deepEqual(f.events, ['before-add', 'add', 'readback']);\n f.events.length = 0;\n await ensure!(f.input);\n assert.deepEqual(f.events, ['readback']);\n});\n\ntest.each(['project', 'issue', 'item', 'archive', 'duplicate', 'unreadable'] as const)(\n 'membership refuses %s evidence without a repair write',\n async (failure) => {\n const f = membershipFixture();\n f.setMember();\n if (failure === 'archive') f.controls.archived = true;\n else if (failure === 'duplicate') f.controls.duplicate = true;\n else if (failure === 'unreadable') f.controls.unreadable = true;\n else f.controls.corrupt = failure;\n const ensure = Reflect.get(projectDelivery, 'ensureIssueProjectMembership') as\n | ((input: typeof f.input) => Promise<unknown>)\n | undefined;\n assert.equal(typeof ensure, 'function');\n await assert.rejects(ensure!(f.input));\n assert.deepEqual(\n f.events.filter((e) => e === 'add' || e === 'status'),\n [],\n );\n },\n);\n\nconst projectRow = {\n id: 'ITEM17',\n isArchived: false,\n project: { id: 'PROJECT', number: 1 },\n content: { id: 'ISSUE17' },\n fieldValueByName: { name: 'Active', optionId: 'ACTIVE' },\n};\n\nfunction readStatus(nodes: unknown[], overrides: { nodeId?: string; hasNextPage?: boolean } = {}) {\n const { input } = membershipFixture();\n const graphql = (async () => ({\n node: {\n id: overrides.nodeId ?? 'ISSUE17',\n projectItems: { nodes, pageInfo: { hasNextPage: overrides.hasNextPage ?? false } },\n },\n })) as unknown as typeof input.graphql;\n return projectDelivery.getIssueProjectStatus({ ...input, graphql });\n}\n\ntest('issue Project Status is the exact configured item and never a guess (#180)', async () => {\n assert.deepEqual(await readStatus([projectRow]), { itemId: 'ITEM17', status: 'In Progress' });\n assert.equal(await readStatus([]), null);\n assert.equal(await readStatus([{ ...projectRow, isArchived: true }]), null);\n assert.equal(await readStatus([{ ...projectRow, project: { id: 'OTHER', number: 9 } }]), null);\n});\n\ntest.each([\n ['a different issue node', () => readStatus([projectRow], { nodeId: 'ISSUE99' }), /different issue/u],\n ['more than 50 Projects', () => readStatus([projectRow], { hasNextPage: true }), /more than 50 Projects/u],\n ['an unreadable item in the configured Project', () => readStatus([{ ...projectRow, content: null }]), /unreadable/u],\n [\n 'a duplicate item in the configured Project',\n () => readStatus([projectRow, { ...projectRow, id: 'SECOND' }]),\n /duplicate/u,\n ],\n])('issue Project lookup refuses %s', async (_name, read, message) => {\n await assert.rejects(read(), message);\n});\n\ntest('guards run immediately before both Project mutation boundaries', async () => {\n const f = membershipFixture();\n const input = {\n ...f.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n f.events.push('before-add');\n },\n beforeAdvance: async () => {\n f.events.push('before-advance');\n },\n };\n await projectDelivery.syncIssueProjectStatus(input);\n assert.deepEqual(\n f.events.filter((e) => e !== 'readback'),\n ['before-add', 'add', 'before-advance', 'status'],\n );\n const refused = membershipFixture();\n const fail = {\n ...refused.input,\n status: 'In Progress' as const,\n beforeAdd: async () => {\n throw new Error('native drift');\n },\n };\n await assert.rejects(projectDelivery.syncIssueProjectStatus(fail), /native drift/u);\n assert.deepEqual(refused.events, []);\n});\n\ntest.each(['project', 'option'] as const)(\n 'Project %s readback failure preserves an attempted write without retry',\n async (failure) => {\n const f = membershipFixture();\n f.controls.corrupt = failure;\n if (failure === 'project') {\n await assert.rejects(projectDelivery.ensureIssueProjectMembership(f.input), /exact issue item/u);\n assert.deepEqual(f.events, ['add', 'readback']);\n } else {\n f.setMember();\n await assert.rejects(\n projectDelivery.syncIssueProjectStatus({ ...f.input, status: 'In Progress' }),\n /unsupported Project Status/u,\n );\n assert.deepEqual(f.events, ['status', 'readback']);\n }\n },\n);\n\ntest('search applies the same case-insensitive label filter to authoritative result rows', async () => {\n const { context } = listingFixture();\n context.clients.rest.search.issuesAndPullRequests = (async () => ({\n data: {\n total_count: 1,\n incomplete_results: false,\n items: [\n {\n number: 17,\n node_id: 'ISSUE17',\n title: 'Repair widget',\n state: 'open',\n labels: [{ name: 'area:widget' }],\n type: { name: 'Task' },\n html_url: 'https://github.com/example/widget/issues/17',\n updated_at: '2026-10-07T00:00:00Z',\n },\n ],\n },\n })) as unknown as typeof context.clients.rest.search.issuesAndPullRequests;\n const result = await issue.listIssues(context, { query: 'widget', labels: ['AREA:Widget'] });\n assert.equal(result.issues.length, 1);\n assert.equal(result.nextPage, null);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,cAAc;AACpC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AAEzC,SAAS,qCAAqC;AAC9C,YAAY,qBAAqB;AACjC,SAAS,iCAAiC;AAE1C,SAAS,gBAAgB;AACvB,QAAM,OAAO,YAAY,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAC/D,eAAa,OAAO,CAAC,QAAQ,MAAM,MAAM,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC;AAC/D,QAAM,SAAmB,CAAC;AAC1B,QAAM,OAAO;AAAA,IACX,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACA,QAAM,WAAW;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,oBAAoB;AAAA,IACpB,+BAA+B;AAAA,IAC/B,8BAA8B;AAAA,IAC9B,oBAAoB;AAAA,IACpB,sBAAs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jB,UAAM,IAAI,kBAAkB;AAC5B,MAAE,SAAS,UAAU;AACrB,QAAI,YAAY,WAAW;AACzB,YAAM,OAAO,QAAQ,gBAAgB,6BAA6B,EAAE,KAAK,GAAG,mBAAmB;AAC/F,aAAO,UAAU,EAAE,QAAQ,CAAC,OAAO,UAAU,CAAC;AAAA,IAChD,OAAO;AACL,QAAE,UAAU;AACZ,YAAM,OAAO;AAAA,QACX,gBAAgB,uBAAuB,EAAE,GAAG,EAAE,OAAO,QAAQ,cAAc,CAAC;AAAA,QAC5E;AAAA,MACF;AACA,aAAO,UAAU,EAAE,QAAQ,CAAC,UAAU,UAAU,CAAC;AAAA,IACnD;AAAA,EACF;AACF;AAEA,KAAK,sFAAsF,YAAY;AACrG,QAAM,EAAE,QAAQ,IAAI,eAAe;AACnC,UAAQ,QAAQ,KAAK,OAAO,yBAAyB,aAAa;AAAA,IAChE,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,oBAAoB;AAAA,MACpB,OAAO;AAAA,QACL;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ,CAAC,EAAE,MAAM,cAAc,CAAC;AAAA,UAChC,MAAM,EAAE,MAAM,OAAO;AAAA,UACrB,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,MAAM,MAAM,WAAW,SAAS,EAAE,OAAO,UAAU,QAAQ,CAAC,aAAa,EAAE,CAAC;AAC3F,SAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AACpC,SAAO,MAAM,OAAO,UAAU,IAAI;AACpC,CAAC;",
|
|
6
6
|
"names": ["f"]
|
|
7
7
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "../github/projectDelivery.js";
|
|
9
9
|
import { getNativeBlockerRelationships } from "../github/relationships.js";
|
|
10
10
|
import { readIssueHistory } from "../github/issueHistory.js";
|
|
11
|
+
import { isDesignTitle } from "../issueContract.js";
|
|
11
12
|
const OverrideReason = z.string().trim().min(1).max(2e3);
|
|
12
13
|
async function endpoint(context, number) {
|
|
13
14
|
if (!Number.isSafeInteger(number) || number <= 0)
|
|
@@ -16,7 +17,7 @@ async function endpoint(context, number) {
|
|
|
16
17
|
const url = new URL(issue.html_url);
|
|
17
18
|
if (issue.number !== number || "pull_request" in issue || !issue.node_id || url.protocol !== "https:" || url.hostname !== "github.com" || url.pathname.toLowerCase() !== `/${context.repo.owner}/${context.repo.repo}/issues/${number}`.toLowerCase())
|
|
18
19
|
throw new DeliveryError("Dependency endpoint is not the requested repository issue.");
|
|
19
|
-
return issue.node_id;
|
|
20
|
+
return { nodeId: issue.node_id, design: isDesignTitle(issue.title) };
|
|
20
21
|
}
|
|
21
22
|
async function prepareBlockerGuard(context, intents, overrideReason, forwardBlockers = []) {
|
|
22
23
|
if (context.clients.role !== "author" || !context.clients.authenticatedAuthor)
|
|
@@ -127,7 +128,7 @@ ${JSON.stringify(evidence, null, 2)}
|
|
|
127
128
|
return { id: matches[0]?.id, body };
|
|
128
129
|
};
|
|
129
130
|
for (const intent of intents) {
|
|
130
|
-
const id = await endpoint(context, intent.dependent);
|
|
131
|
+
const { nodeId: id } = await endpoint(context, intent.dependent);
|
|
131
132
|
const existing = await getNativeBlockerRelationships({
|
|
132
133
|
graphql: context.clients.graphql,
|
|
133
134
|
repo: context.repo,
|
|
@@ -136,8 +137,8 @@ ${JSON.stringify(evidence, null, 2)}
|
|
|
136
137
|
const candidates = [];
|
|
137
138
|
for (const blocker of new Set(intent.blockers)) {
|
|
138
139
|
if (blocker === intent.dependent) throw new DeliveryError("An issue cannot block itself.");
|
|
139
|
-
const blockerNodeId = await endpoint(context, blocker);
|
|
140
|
-
if (!existing.blockers.some((value) => value.number === blocker))
|
|
140
|
+
const { nodeId: blockerNodeId, design } = await endpoint(context, blocker);
|
|
141
|
+
if (!design && !existing.blockers.some((value) => value.number === blocker))
|
|
141
142
|
candidates.push({ issueNumber: intent.dependent, issueNodeId: id, blocker, blockerNodeId });
|
|
142
143
|
}
|
|
143
144
|
if (!intent.pendingBlocker && !candidates.length) continue;
|
|
@@ -157,9 +158,11 @@ ${JSON.stringify(evidence, null, 2)}
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
return async (edge) => {
|
|
160
|
-
const
|
|
161
|
+
const { nodeId: dependentId } = await endpoint(context, edge.issueNumber);
|
|
162
|
+
const { nodeId: blockerId, design } = await endpoint(context, edge.blocker);
|
|
161
163
|
if (dependentId !== edge.issueNodeId || blockerId !== edge.blockerNodeId || dependentId === blockerId)
|
|
162
164
|
throw new DeliveryError("Dependency endpoint identity changed.");
|
|
165
|
+
if (design) return;
|
|
163
166
|
if (await currentStatus(edge.issueNumber, dependentId) === "In Progress" && !required.has(edge.issueNumber))
|
|
164
167
|
required.set(edge.issueNumber, (/* @__PURE__ */ new Date()).toISOString());
|
|
165
168
|
if (!required.has(edge.issueNumber)) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/services/blockerGuardService.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from 'zod';\nimport type { DeliveryContext } from '../issue.js';\nimport { DeliveryError } from '../errors.js';\nimport { digestValue } from '../delivery/common.js';\nimport {\n getIssueProjectStatus,\n getProjectDeliveryConfiguration,\n projectSettingsFromDeliveryConfig,\n} from '../github/projectDelivery.js';\nimport { getNativeBlockerRelationships } from '../github/relationships.js';\nimport { readIssueHistory } from '../github/issueHistory.js';\n\nexport const OverrideReason = z.string().trim().min(1).max(2000);\nexport interface BlockerIntent {\n dependent: number;\n blockers: number[];\n pendingBlocker?: boolean;\n}\ntype Edge = { issueNumber: number; issueNodeId: string; blocker: number; blockerNodeId: string };\n\nasync function endpoint(context: DeliveryContext, number: number): Promise<string> {\n if (!Number.isSafeInteger(number) || number <= 0)\n throw new DeliveryError('Dependency endpoint must be a positive issue number.');\n const issue = (await context.clients.rest.issues.get({ ...context.repo, issue_number: number })).data;\n const url = new URL(issue.html_url);\n if (\n issue.number !== number ||\n 'pull_request' in issue ||\n !issue.node_id ||\n url.protocol !== 'https:' ||\n url.hostname !== 'github.com' ||\n url.pathname.toLowerCase() !== `/${context.repo.owner}/${context.repo.repo}/issues/${number}`.toLowerCase()\n )\n throw new DeliveryError('Dependency endpoint is not the requested repository issue.');\n return issue.node_id;\n}\n\n/** Read-only preflight plus a reconciled callback for every actual native addition. */\nexport async function prepareBlockerGuard(\n context: DeliveryContext,\n intents: BlockerIntent[],\n overrideReason?: string,\n forwardBlockers: number[] = [],\n) {\n if (context.clients.role !== 'author' || !context.clients.authenticatedAuthor)\n throw new DeliveryError('Dependency writes require configured author authority.');\n const authority = await context.clients.authenticatedAuthor();\n if (!authority.actorLogin.trim()) throw new DeliveryError('Dependency author identity is unavailable.');\n const reason = overrideReason === undefined ? undefined : OverrideReason.parse(overrideReason);\n for (const blocker of forwardBlockers) await endpoint(context, blocker);\n const configuration =\n context.projectConfiguration ??\n (await getProjectDeliveryConfiguration({\n graphql: context.clients.graphql,\n org: context.config.native.organization,\n settings: projectSettingsFromDeliveryConfig(context.config),\n }));\n const required = new Map<number, string>();\n const currentStatus = async (number: number, id: string) => {\n const status = await getIssueProjectStatus({\n graphql: context.clients.graphql,\n issueNodeId: id,\n org: context.config.native.organization,\n configuration,\n maxPages: 20,\n });\n if (status === null)\n throw new DeliveryError(\n `Project status for dependent #${number} is unresolved; dependency additions were refused.`,\n );\n return status.status;\n };\n const requireReason = (number: number) => {\n if (reason === undefined)\n throw new DeliveryError(`Adding a blocker to active issue #${number} requires overrideReason.`);\n };\n const episodeFor = async (edge: Edge) => {\n const history = await readIssueHistory(context, edge.issueNumber, 20, edge.issueNodeId);\n if (!history.complete)\n throw new DeliveryError(\n `Complete dependency history is required for an active blocker override: ${history.reason ?? 'Incomplete timeline'}.`,\n );\n const removals = history.events\n .filter(\n (value) =>\n value.__typename === 'BlockedByRemovedEvent' &&\n value.blockingIssue?.id === edge.blockerNodeId &&\n value.blockingIssue.repository.nameWithOwner.toLowerCase() === context.config.repository.toLowerCase(),\n )\n .sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));\n if (removals[0] && removals[1] && Date.parse(removals[1].createdAt) === Date.parse(removals[0].createdAt))\n throw new DeliveryError('Dependency removal episode is ambiguous.');\n return removals[0]?.id ?? 'complete-history:no-removal';\n };\n const verifyComment = async (id: number, body: string, number: number) => {\n const value = (await context.clients.rest.issues.getComment({ ...context.repo, comment_id: id })).data;\n if (\n value.id !== id ||\n value.body !== body ||\n value.user?.login.toLowerCase() !== authority.actorLogin.toLowerCase() ||\n value.issue_url !== `https://api.github.com/repos/${context.repo.owner}/${context.repo.repo}/issues/${number}`\n )\n throw new DeliveryError(\n 'Override comment author, body or issue readback disagrees; native dependency was not added.',\n );\n };\n const commentFor = async (edge: Edge, episode: string, observedAt: string) => {\n const identity = {\n schema: 'ai-delivery.blocker-override@1',\n repository: context.config.repository,\n projectId: configuration.projectId,\n dependent: { number: edge.issueNumber, id: edge.issueNodeId },\n blocker: { number: edge.blocker, id: edge.blockerNodeId },\n episode,\n reason,\n observedStatus: 'In Progress',\n };\n const marker = `<!-- ai-delivery:blocker-override@1:${digestValue({ repository: context.config.repository.toLowerCase(), projectId: configuration.projectId, dependentId: edge.issueNodeId, blockerId: edge.blockerNodeId, episode })} -->`;\n const matches: { id: number; body?: string | null }[] = [];\n let complete = false;\n for (let page = 1; page <= 20; page++) {\n const comments = (\n await context.clients.rest.issues.listComments({\n ...context.repo,\n issue_number: edge.issueNumber,\n per_page: 100,\n page,\n })\n ).data;\n matches.push(\n ...comments.filter(\n (value) =>\n value.body?.includes(marker) && value.user?.login.toLowerCase() === authority.actorLogin.toLowerCase(),\n ),\n );\n if (comments.length < 100) {\n complete = true;\n break;\n }\n }\n if (!complete || matches.length > 1)\n throw new DeliveryError('Override comment search is incomplete or has duplicate authoritative markers.');\n const render = (evidence: typeof identity & { observedAt: string }) =>\n `Blocker override requested for ${context.config.repository}#${edge.issueNumber} blocked by #${edge.blocker}.\\n\\n${marker}\\n\\n\\`\\`\\`json\\n${JSON.stringify(evidence, null, 2)}\\n\\`\\`\\``;\n let body = render({ ...identity, observedAt });\n if (matches[0]) {\n body = matches[0].body ?? '';\n const raw = body.match(/```json\\n([\\s\\S]+)\\n```$/u)?.[1];\n let saved: Record<string, unknown>;\n try {\n saved = JSON.parse(raw ?? '') as Record<string, unknown>;\n } catch {\n throw new DeliveryError('Override comment evidence is malformed.');\n }\n const { observedAt: prior, ...fields } = saved;\n if (\n typeof prior !== 'string' ||\n !z.iso.datetime().safeParse(prior).success ||\n JSON.stringify(fields) !== JSON.stringify(identity) ||\n body !== render(saved as typeof identity & { observedAt: string })\n )\n throw new DeliveryError('Existing override comment conflicts with the requested reason or endpoint evidence.');\n await verifyComment(matches[0].id, body, edge.issueNumber);\n }\n return { id: matches[0]?.id, body };\n };\n for (const intent of intents) {\n const id = await endpoint(context, intent.dependent);\n const existing = await getNativeBlockerRelationships({\n graphql: context.clients.graphql,\n repo: context.repo,\n issueNumber: intent.dependent,\n });\n const candidates: Edge[] = [];\n for (const blocker of new Set(intent.blockers)) {\n if (blocker === intent.dependent) throw new DeliveryError('An issue cannot block itself.');\n const blockerNodeId = await endpoint(context, blocker);\n if (!existing.blockers.some((value) => value.number === blocker))\n candidates.push({ issueNumber: intent.dependent, issueNodeId: id, blocker, blockerNodeId });\n }\n if (!intent.pendingBlocker && !candidates.length) continue;\n if ((await currentStatus(intent.dependent, id)) === 'In Progress') {\n const observedAt = new Date().toISOString();\n required.set(intent.dependent, observedAt);\n requireReason(intent.dependent);\n // Pending creation has no blocker node yet, but its dependent history must already be complete.\n if (intent.pendingBlocker) {\n const history = await readIssueHistory(context, intent.dependent, 20, id);\n if (!history.complete)\n throw new DeliveryError('Complete dependency history is required for an active blocker override.');\n }\n for (const edge of candidates) {\n const episode = await episodeFor(edge);\n await commentFor(edge, episode, observedAt);\n }\n }\n }\n return async (edge: Edge): Promise<void | boolean> => {\n const dependentId = await endpoint(context, edge.issueNumber),\n blockerId = await endpoint(context, edge.blocker);\n if (dependentId !== edge.issueNodeId || blockerId !== edge.blockerNodeId || dependentId === blockerId)\n throw new DeliveryError('Dependency endpoint identity changed.');\n if ((await currentStatus(edge.issueNumber, dependentId)) === 'In Progress' && !required.has(edge.issueNumber))\n required.set(edge.issueNumber, new Date().toISOString());\n if (!required.has(edge.issueNumber)) return;\n requireReason(edge.issueNumber);\n const actor = await context.clients.authenticatedAuthor!();\n if (\n actor.actorLogin.toLowerCase() !== authority.actorLogin.toLowerCase() ||\n actor.credentialIdentity !== authority.credentialIdentity\n )\n throw new DeliveryError('Dependency override author authority changed.');\n const episode = await episodeFor(edge);\n const comment = await commentFor(edge, episode, required.get(edge.issueNumber)!);\n const id =\n comment.id ??\n (\n await context.clients.rest.issues.createComment({\n ...context.repo,\n issue_number: edge.issueNumber,\n body: comment.body,\n })\n ).data.id;\n await verifyComment(id, comment.body, edge.issueNumber);\n // Enumeration and comment writes are not atomic with dependencies. Reconcile the exact episode again.\n if ((await episodeFor(edge)) !== episode)\n throw new DeliveryError(\n 'Dependency removal episode changed after override verification; inspect native state and resume this issue.',\n );\n const final = await getNativeBlockerRelationships({\n graphql: context.clients.graphql,\n repo: context.repo,\n issueNumber: edge.issueNumber,\n });\n if (final.blockers.some((value) => value.id === edge.blockerNodeId)) return false;\n };\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAElB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qCAAqC;AAC9C,SAAS,wBAAwB;
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\nimport type { DeliveryContext } from '../issue.js';\nimport { DeliveryError } from '../errors.js';\nimport { digestValue } from '../delivery/common.js';\nimport {\n getIssueProjectStatus,\n getProjectDeliveryConfiguration,\n projectSettingsFromDeliveryConfig,\n} from '../github/projectDelivery.js';\nimport { getNativeBlockerRelationships } from '../github/relationships.js';\nimport { readIssueHistory } from '../github/issueHistory.js';\nimport { isDesignTitle } from '../issueContract.js';\n\nexport const OverrideReason = z.string().trim().min(1).max(2000);\nexport interface BlockerIntent {\n dependent: number;\n blockers: number[];\n pendingBlocker?: boolean;\n}\ntype Edge = { issueNumber: number; issueNodeId: string; blocker: number; blockerNodeId: string };\n\nasync function endpoint(context: DeliveryContext, number: number): Promise<{ nodeId: string; design: boolean }> {\n if (!Number.isSafeInteger(number) || number <= 0)\n throw new DeliveryError('Dependency endpoint must be a positive issue number.');\n const issue = (await context.clients.rest.issues.get({ ...context.repo, issue_number: number })).data;\n const url = new URL(issue.html_url);\n if (\n issue.number !== number ||\n 'pull_request' in issue ||\n !issue.node_id ||\n url.protocol !== 'https:' ||\n url.hostname !== 'github.com' ||\n url.pathname.toLowerCase() !== `/${context.repo.owner}/${context.repo.repo}/issues/${number}`.toLowerCase()\n )\n throw new DeliveryError('Dependency endpoint is not the requested repository issue.');\n return { nodeId: issue.node_id, design: isDesignTitle(issue.title) };\n}\n\n/** Read-only preflight plus a reconciled callback for every actual native addition. */\nexport async function prepareBlockerGuard(\n context: DeliveryContext,\n intents: BlockerIntent[],\n overrideReason?: string,\n forwardBlockers: number[] = [],\n) {\n if (context.clients.role !== 'author' || !context.clients.authenticatedAuthor)\n throw new DeliveryError('Dependency writes require configured author authority.');\n const authority = await context.clients.authenticatedAuthor();\n if (!authority.actorLogin.trim()) throw new DeliveryError('Dependency author identity is unavailable.');\n const reason = overrideReason === undefined ? undefined : OverrideReason.parse(overrideReason);\n for (const blocker of forwardBlockers) await endpoint(context, blocker);\n const configuration =\n context.projectConfiguration ??\n (await getProjectDeliveryConfiguration({\n graphql: context.clients.graphql,\n org: context.config.native.organization,\n settings: projectSettingsFromDeliveryConfig(context.config),\n }));\n const required = new Map<number, string>();\n const currentStatus = async (number: number, id: string) => {\n const status = await getIssueProjectStatus({\n graphql: context.clients.graphql,\n issueNodeId: id,\n org: context.config.native.organization,\n configuration,\n maxPages: 20,\n });\n if (status === null)\n throw new DeliveryError(\n `Project status for dependent #${number} is unresolved; dependency additions were refused.`,\n );\n return status.status;\n };\n const requireReason = (number: number) => {\n if (reason === undefined)\n throw new DeliveryError(`Adding a blocker to active issue #${number} requires overrideReason.`);\n };\n const episodeFor = async (edge: Edge) => {\n const history = await readIssueHistory(context, edge.issueNumber, 20, edge.issueNodeId);\n if (!history.complete)\n throw new DeliveryError(\n `Complete dependency history is required for an active blocker override: ${history.reason ?? 'Incomplete timeline'}.`,\n );\n const removals = history.events\n .filter(\n (value) =>\n value.__typename === 'BlockedByRemovedEvent' &&\n value.blockingIssue?.id === edge.blockerNodeId &&\n value.blockingIssue.repository.nameWithOwner.toLowerCase() === context.config.repository.toLowerCase(),\n )\n .sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));\n if (removals[0] && removals[1] && Date.parse(removals[1].createdAt) === Date.parse(removals[0].createdAt))\n throw new DeliveryError('Dependency removal episode is ambiguous.');\n return removals[0]?.id ?? 'complete-history:no-removal';\n };\n const verifyComment = async (id: number, body: string, number: number) => {\n const value = (await context.clients.rest.issues.getComment({ ...context.repo, comment_id: id })).data;\n if (\n value.id !== id ||\n value.body !== body ||\n value.user?.login.toLowerCase() !== authority.actorLogin.toLowerCase() ||\n value.issue_url !== `https://api.github.com/repos/${context.repo.owner}/${context.repo.repo}/issues/${number}`\n )\n throw new DeliveryError(\n 'Override comment author, body or issue readback disagrees; native dependency was not added.',\n );\n };\n const commentFor = async (edge: Edge, episode: string, observedAt: string) => {\n const identity = {\n schema: 'ai-delivery.blocker-override@1',\n repository: context.config.repository,\n projectId: configuration.projectId,\n dependent: { number: edge.issueNumber, id: edge.issueNodeId },\n blocker: { number: edge.blocker, id: edge.blockerNodeId },\n episode,\n reason,\n observedStatus: 'In Progress',\n };\n const marker = `<!-- ai-delivery:blocker-override@1:${digestValue({ repository: context.config.repository.toLowerCase(), projectId: configuration.projectId, dependentId: edge.issueNodeId, blockerId: edge.blockerNodeId, episode })} -->`;\n const matches: { id: number; body?: string | null }[] = [];\n let complete = false;\n for (let page = 1; page <= 20; page++) {\n const comments = (\n await context.clients.rest.issues.listComments({\n ...context.repo,\n issue_number: edge.issueNumber,\n per_page: 100,\n page,\n })\n ).data;\n matches.push(\n ...comments.filter(\n (value) =>\n value.body?.includes(marker) && value.user?.login.toLowerCase() === authority.actorLogin.toLowerCase(),\n ),\n );\n if (comments.length < 100) {\n complete = true;\n break;\n }\n }\n if (!complete || matches.length > 1)\n throw new DeliveryError('Override comment search is incomplete or has duplicate authoritative markers.');\n const render = (evidence: typeof identity & { observedAt: string }) =>\n `Blocker override requested for ${context.config.repository}#${edge.issueNumber} blocked by #${edge.blocker}.\\n\\n${marker}\\n\\n\\`\\`\\`json\\n${JSON.stringify(evidence, null, 2)}\\n\\`\\`\\``;\n let body = render({ ...identity, observedAt });\n if (matches[0]) {\n body = matches[0].body ?? '';\n const raw = body.match(/```json\\n([\\s\\S]+)\\n```$/u)?.[1];\n let saved: Record<string, unknown>;\n try {\n saved = JSON.parse(raw ?? '') as Record<string, unknown>;\n } catch {\n throw new DeliveryError('Override comment evidence is malformed.');\n }\n const { observedAt: prior, ...fields } = saved;\n if (\n typeof prior !== 'string' ||\n !z.iso.datetime().safeParse(prior).success ||\n JSON.stringify(fields) !== JSON.stringify(identity) ||\n body !== render(saved as typeof identity & { observedAt: string })\n )\n throw new DeliveryError('Existing override comment conflicts with the requested reason or endpoint evidence.');\n await verifyComment(matches[0].id, body, edge.issueNumber);\n }\n return { id: matches[0]?.id, body };\n };\n for (const intent of intents) {\n const { nodeId: id } = await endpoint(context, intent.dependent);\n const existing = await getNativeBlockerRelationships({\n graphql: context.clients.graphql,\n repo: context.repo,\n issueNumber: intent.dependent,\n });\n const candidates: Edge[] = [];\n for (const blocker of new Set(intent.blockers)) {\n if (blocker === intent.dependent) throw new DeliveryError('An issue cannot block itself.');\n const { nodeId: blockerNodeId, design } = await endpoint(context, blocker);\n // A Design ticket writes no code, so it may block an active issue without an override (Paul, Dec 4).\n if (!design && !existing.blockers.some((value) => value.number === blocker))\n candidates.push({ issueNumber: intent.dependent, issueNodeId: id, blocker, blockerNodeId });\n }\n if (!intent.pendingBlocker && !candidates.length) continue;\n if ((await currentStatus(intent.dependent, id)) === 'In Progress') {\n const observedAt = new Date().toISOString();\n required.set(intent.dependent, observedAt);\n requireReason(intent.dependent);\n // Pending creation has no blocker node yet, but its dependent history must already be complete.\n if (intent.pendingBlocker) {\n const history = await readIssueHistory(context, intent.dependent, 20, id);\n if (!history.complete)\n throw new DeliveryError('Complete dependency history is required for an active blocker override.');\n }\n for (const edge of candidates) {\n const episode = await episodeFor(edge);\n await commentFor(edge, episode, observedAt);\n }\n }\n }\n return async (edge: Edge): Promise<void | boolean> => {\n const { nodeId: dependentId } = await endpoint(context, edge.issueNumber);\n const { nodeId: blockerId, design } = await endpoint(context, edge.blocker);\n if (dependentId !== edge.issueNodeId || blockerId !== edge.blockerNodeId || dependentId === blockerId)\n throw new DeliveryError('Dependency endpoint identity changed.');\n if (design) return;\n if ((await currentStatus(edge.issueNumber, dependentId)) === 'In Progress' && !required.has(edge.issueNumber))\n required.set(edge.issueNumber, new Date().toISOString());\n if (!required.has(edge.issueNumber)) return;\n requireReason(edge.issueNumber);\n const actor = await context.clients.authenticatedAuthor!();\n if (\n actor.actorLogin.toLowerCase() !== authority.actorLogin.toLowerCase() ||\n actor.credentialIdentity !== authority.credentialIdentity\n )\n throw new DeliveryError('Dependency override author authority changed.');\n const episode = await episodeFor(edge);\n const comment = await commentFor(edge, episode, required.get(edge.issueNumber)!);\n const id =\n comment.id ??\n (\n await context.clients.rest.issues.createComment({\n ...context.repo,\n issue_number: edge.issueNumber,\n body: comment.body,\n })\n ).data.id;\n await verifyComment(id, comment.body, edge.issueNumber);\n // Enumeration and comment writes are not atomic with dependencies. Reconcile the exact episode again.\n if ((await episodeFor(edge)) !== episode)\n throw new DeliveryError(\n 'Dependency removal episode changed after override verification; inspect native state and resume this issue.',\n );\n const final = await getNativeBlockerRelationships({\n graphql: context.clients.graphql,\n repo: context.repo,\n issueNumber: edge.issueNumber,\n });\n if (final.blockers.some((value) => value.id === edge.blockerNodeId)) return false;\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAElB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qCAAqC;AAC9C,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAEvB,MAAM,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,GAAI;AAQ/D,eAAe,SAAS,SAA0B,QAA8D;AAC9G,MAAI,CAAC,OAAO,cAAc,MAAM,KAAK,UAAU;AAC7C,UAAM,IAAI,cAAc,sDAAsD;AAChF,QAAM,SAAS,MAAM,QAAQ,QAAQ,KAAK,OAAO,IAAI,EAAE,GAAG,QAAQ,MAAM,cAAc,OAAO,CAAC,GAAG;AACjG,QAAM,MAAM,IAAI,IAAI,MAAM,QAAQ;AAClC,MACE,MAAM,WAAW,UACjB,kBAAkB,SAClB,CAAC,MAAM,WACP,IAAI,aAAa,YACjB,IAAI,aAAa,gBACjB,IAAI,SAAS,YAAY,MAAM,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,IAAI,WAAW,MAAM,GAAG,YAAY;AAE1G,UAAM,IAAI,cAAc,4DAA4D;AACtF,SAAO,EAAE,QAAQ,MAAM,SAAS,QAAQ,cAAc,MAAM,KAAK,EAAE;AACrE;AAGA,eAAsB,oBACpB,SACA,SACA,gBACA,kBAA4B,CAAC,GAC7B;AACA,MAAI,QAAQ,QAAQ,SAAS,YAAY,CAAC,QAAQ,QAAQ;AACxD,UAAM,IAAI,cAAc,wDAAwD;AAClF,QAAM,YAAY,MAAM,QAAQ,QAAQ,oBAAoB;AAC5D,M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