@aviaratech/ai-delivery 0.3.35 → 0.3.37
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/CONTRIBUTING.md +12 -206
- package/README.md +56 -554
- package/dist/agent.d.ts +1 -3
- package/dist/agent.js +74 -16
- package/dist/agent.js.map +7 -1
- package/dist/agentReadiness.test.js +73 -67
- package/dist/agentReadiness.test.js.map +7 -1
- package/dist/boardReconcile.test.js +1651 -1590
- package/dist/boardReconcile.test.js.map +7 -1
- package/dist/build.test.js +130 -0
- package/dist/build.test.js.map +7 -0
- package/dist/callerErrors.test.js +91 -0
- package/dist/callerErrors.test.js.map +7 -0
- package/dist/cli.js +389 -517
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -45
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +424 -369
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +288 -14
- package/dist/config/deliveryConfig.js +472 -390
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +773 -649
- package/dist/config/deliveryConfig.test.js.map +7 -1
- package/dist/contributorChecks.test.js +1694 -916
- package/dist/contributorChecks.test.js.map +7 -1
- package/dist/currentConsumer.test.js +819 -737
- package/dist/currentConsumer.test.js.map +7 -1
- package/dist/currentTrackingScenario.test.js +499 -479
- package/dist/currentTrackingScenario.test.js.map +7 -1
- package/dist/delivery/common.js +160 -172
- package/dist/delivery/common.js.map +7 -1
- package/dist/delivery/delivery.test.js +509 -431
- package/dist/delivery/delivery.test.js.map +7 -1
- package/dist/delivery/evidence.d.ts +2 -2
- package/dist/delivery/evidence.js +133 -120
- package/dist/delivery/evidence.js.map +7 -1
- package/dist/delivery/index.js +7 -2
- package/dist/delivery/index.js.map +7 -1
- package/dist/delivery/legacy.js +65 -5
- package/dist/delivery/legacy.js.map +7 -1
- package/dist/delivery/policy.d.ts +10 -10
- package/dist/delivery/policy.js +211 -238
- package/dist/delivery/policy.js.map +7 -1
- package/dist/delivery/stage.d.ts +18 -18
- package/dist/delivery/stage.js +220 -235
- package/dist/delivery/stage.js.map +7 -1
- package/dist/deliveryBoard.d.ts +74 -0
- package/dist/deliveryBoard.js +644 -0
- package/dist/deliveryBoard.js.map +7 -0
- package/dist/deliveryBoard.test.js +649 -0
- package/dist/deliveryBoard.test.js.map +7 -0
- package/dist/deliveryHealth.test.js +179 -155
- package/dist/deliveryHealth.test.js.map +7 -1
- package/dist/dependencyCompatibility.test.js +154 -140
- package/dist/dependencyCompatibility.test.js.map +7 -1
- package/dist/directoryIndependent.test.js +417 -383
- package/dist/directoryIndependent.test.js.map +7 -1
- package/dist/dispatch.d.ts +16 -11
- package/dist/dispatch.js +316 -354
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +103 -96
- package/dist/errors.js.map +7 -1
- package/dist/fixtures/deliveryBoardReplay.d.ts +56 -0
- package/dist/fixtures/deliveryBoardReplay.js +617 -0
- package/dist/fixtures/deliveryBoardReplay.js.map +7 -0
- package/dist/fixtures/discovery.d.ts +63 -23
- package/dist/fixtures/discovery.js +96 -90
- package/dist/fixtures/discovery.js.map +7 -1
- package/dist/fixtures/inertEntrypointChild.js +57 -56
- package/dist/fixtures/inertEntrypointChild.js.map +7 -1
- package/dist/fixtures/inertEntrypoints.d.ts +1 -1
- package/dist/fixtures/inertEntrypoints.js +321 -276
- package/dist/fixtures/inertEntrypoints.js.map +7 -1
- package/dist/fixtures/inertTarget.d.ts +78 -7
- package/dist/fixtures/inertTarget.js +769 -691
- package/dist/fixtures/inertTarget.js.map +7 -1
- package/dist/fixtures/issue63.d.ts +4 -3
- package/dist/fixtures/issue63.js +260 -274
- package/dist/fixtures/issue63.js.map +7 -1
- package/dist/fixtures/issueProjectItems.d.ts +20 -0
- package/dist/fixtures/issueProjectItems.js +15 -0
- package/dist/fixtures/issueProjectItems.js.map +7 -0
- package/dist/fixtures/readView.d.ts +120 -0
- package/dist/fixtures/readView.js +172 -0
- package/dist/fixtures/readView.js.map +7 -0
- package/dist/fixtures/recordedGitHubFlows.d.ts +120 -0
- package/dist/fixtures/recordedGitHubFlows.js +109 -0
- package/dist/fixtures/recordedGitHubFlows.js.map +7 -0
- package/dist/genericCompatibility.test.js +64 -55
- package/dist/genericCompatibility.test.js.map +7 -1
- package/dist/git.d.ts +0 -3
- package/dist/git.js +59 -76
- package/dist/git.js.map +7 -1
- package/dist/gitProcess.d.ts +1 -1
- package/dist/gitProcess.js +58 -53
- package/dist/gitProcess.js.map +7 -1
- package/dist/github/client.d.ts +2 -2
- package/dist/github/client.js +484 -379
- package/dist/github/client.js.map +7 -1
- package/dist/github/commandIdentityPolicy.js +42 -52
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +1 -0
- package/dist/github/discovery.js +197 -215
- package/dist/github/discovery.js.map +7 -1
- package/dist/github/discovery.test.js +223 -177
- package/dist/github/discovery.test.js.map +7 -1
- package/dist/github/issueHistory.d.ts +2 -2
- package/dist/github/issueHistory.js +117 -125
- package/dist/github/issueHistory.js.map +7 -1
- package/dist/github/machineAuth.d.ts +1 -1
- package/dist/github/machineAuth.js +126 -117
- package/dist/github/machineAuth.js.map +7 -1
- package/dist/github/machineAuth.test.js +755 -639
- package/dist/github/machineAuth.test.js.map +7 -1
- package/dist/github/nativeIssueMetadata.js +286 -273
- package/dist/github/nativeIssueMetadata.js.map +7 -1
- package/dist/github/projectDelivery.d.ts +18 -2
- package/dist/github/projectDelivery.js +615 -557
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.js +433 -389
- package/dist/github/relationships.js.map +7 -1
- package/dist/github/repo.d.ts +1 -0
- package/dist/github/repo.js +123 -96
- package/dist/github/repo.js.map +7 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +7 -1
- package/dist/issue.d.ts +40 -9
- package/dist/issue.js +2102 -1742
- package/dist/issue.js.map +7 -1
- package/dist/issue63History.test.js +40 -42
- package/dist/issue63History.test.js.map +7 -1
- package/dist/issue63Routes.test.js +154 -143
- package/dist/issue63Routes.test.js.map +7 -1
- package/dist/issueBatchUpdate.test.js +989 -885
- package/dist/issueBatchUpdate.test.js.map +7 -1
- package/dist/issueBlockerGuard.test.js +262 -226
- package/dist/issueBlockerGuard.test.js.map +7 -1
- package/dist/issueContract.d.ts +23 -4
- package/dist/issueContract.js +416 -395
- package/dist/issueContract.js.map +7 -1
- package/dist/issueContract.test.d.ts +4 -3
- package/dist/issueContract.test.js +358 -321
- package/dist/issueContract.test.js.map +7 -1
- package/dist/issueDates.test.js +235 -233
- package/dist/issueDates.test.js.map +7 -1
- package/dist/issueInfoReadback.test.js +304 -190
- package/dist/issueInfoReadback.test.js.map +7 -1
- package/dist/issueIntake.test.js +1938 -1732
- package/dist/issueIntake.test.js.map +7 -1
- package/dist/issueJournal.d.ts +40 -19
- package/dist/issueJournal.js +229 -138
- package/dist/issueJournal.js.map +7 -1
- package/dist/issueJournal.test.js +605 -422
- package/dist/issueJournal.test.js.map +7 -1
- package/dist/issueRollup.test.d.ts +1 -0
- package/dist/issueRollup.test.js +476 -0
- package/dist/issueRollup.test.js.map +7 -0
- package/dist/issueTracking.test.js +1059 -989
- package/dist/issueTracking.test.js.map +7 -1
- package/dist/issueWriteRecovery.test.d.ts +1 -0
- package/dist/issueWriteRecovery.test.js +260 -0
- package/dist/issueWriteRecovery.test.js.map +7 -0
- package/dist/lifecycle.test.js +112 -441
- package/dist/lifecycle.test.js.map +7 -1
- package/dist/logger.js +80 -74
- package/dist/logger.js.map +7 -1
- package/dist/mcp/index.js +116 -94
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +252 -310
- package/dist/mcp/tools.js +235 -342
- package/dist/mcp/tools.js.map +7 -1
- package/dist/pluginAuthProbe.js +63 -52
- package/dist/pluginAuthProbe.js.map +7 -1
- package/dist/pluginAuthProbe.test.js +85 -62
- package/dist/pluginAuthProbe.test.js.map +7 -1
- package/dist/pluginCredentials.test.js +282 -259
- package/dist/pluginCredentials.test.js.map +7 -1
- package/dist/pluginDoctor.test.js +653 -588
- package/dist/pluginDoctor.test.js.map +7 -1
- package/dist/pluginInstaller.d.ts +7 -5
- package/dist/pluginInstaller.js +1173 -1229
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1842 -1423
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +417 -413
- package/dist/pluginPackaging.test.js.map +7 -1
- package/dist/pr.d.ts +114 -131
- package/dist/pr.js +1314 -1327
- package/dist/pr.js.map +7 -1
- package/dist/pr.test.js +967 -653
- package/dist/pr.test.js.map +7 -1
- package/dist/prAssociation.test.js +2419 -1788
- package/dist/prAssociation.test.js.map +7 -1
- package/dist/prDispatch.test.js +123 -89
- package/dist/prDispatch.test.js.map +7 -1
- package/dist/readView.d.ts +184 -0
- package/dist/readView.js +218 -0
- package/dist/readView.js.map +7 -0
- package/dist/readView.test.d.ts +1 -0
- package/dist/readView.test.js +146 -0
- package/dist/readView.test.js.map +7 -0
- package/dist/releaseReconciliation.test.js +267 -288
- package/dist/releaseReconciliation.test.js.map +7 -1
- package/dist/releaseWorkflow.test.js +2493 -422
- package/dist/releaseWorkflow.test.js.map +7 -1
- package/dist/review.d.ts +738 -2
- package/dist/review.js +601 -348
- package/dist/review.js.map +7 -1
- package/dist/review.test.js +1218 -812
- package/dist/review.test.js.map +7 -1
- package/dist/reviewSubmit.test.d.ts +1 -0
- package/dist/reviewSubmit.test.js +747 -0
- package/dist/reviewSubmit.test.js.map +7 -0
- package/dist/services/agentReadinessService.js +42 -37
- package/dist/services/agentReadinessService.js.map +7 -1
- package/dist/services/blockerGuardService.js +188 -188
- package/dist/services/blockerGuardService.js.map +7 -1
- package/dist/services/boardReconcileService.d.ts +125 -125
- package/dist/services/boardReconcileService.js +1295 -1421
- package/dist/services/boardReconcileService.js.map +7 -1
- package/dist/services/deliveryHealthService.js +197 -199
- package/dist/services/deliveryHealthService.js.map +7 -1
- package/dist/services/legacyIssueMigration.js +263 -277
- package/dist/services/legacyIssueMigration.js.map +7 -1
- package/dist/stagedChecks.test.js +396 -194
- package/dist/stagedChecks.test.js.map +7 -1
- package/dist/start.test.js +99 -95
- package/dist/start.test.js.map +7 -1
- package/dist/stdoutRegression.test.js +321 -358
- package/dist/stdoutRegression.test.js.map +7 -1
- package/dist/targetPolicyDiscovery.test.js +141 -143
- package/dist/targetPolicyDiscovery.test.js.map +7 -1
- package/dist/targetPolicyEntrypoints.test.js +308 -269
- package/dist/targetPolicyEntrypoints.test.js.map +7 -1
- package/dist/targetPolicyLocal.test.js +580 -1051
- package/dist/targetPolicyLocal.test.js.map +7 -1
- package/dist/targetPolicyRoutes.test.js +274 -281
- package/dist/targetPolicyRoutes.test.js.map +7 -1
- package/dist/targetRepositoryExecution.test.d.ts +1 -0
- package/dist/targetRepositoryExecution.test.js +451 -0
- package/dist/targetRepositoryExecution.test.js.map +7 -0
- package/dist/terminalMessages.js +41 -35
- package/dist/terminalMessages.js.map +7 -1
- package/dist/toolOutput.d.ts +2 -0
- package/dist/toolOutput.js +36 -0
- package/dist/toolOutput.js.map +7 -0
- package/dist/toolOutput.test.d.ts +1 -0
- package/dist/toolOutput.test.js +240 -0
- package/dist/toolOutput.test.js.map +7 -0
- package/dist/utils/atomicJson.d.ts +0 -2
- package/dist/utils/atomicJson.js +81 -77
- package/dist/utils/atomicJson.js.map +7 -1
- package/dist/utils/filesystem.d.ts +0 -8
- package/dist/utils/filesystem.js +5 -19
- package/dist/utils/filesystem.js.map +7 -1
- package/dist/utils/lockfile.js +68 -71
- package/dist/utils/lockfile.js.map +7 -1
- package/dist/verification.d.ts +1 -54
- package/dist/verification.js +976 -1941
- package/dist/verification.js.map +7 -1
- package/dist/verificationGate.test.js +127 -117
- package/dist/verificationGate.test.js.map +7 -1
- package/dist/version.js +45 -24
- package/dist/version.js.map +7 -1
- package/package.json +9 -8
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/README.md +47 -156
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/THIRD-PARTY-NOTICES.md +238 -44
- package/plugins/ai-delivery/runtime/dist/cli.js +351 -115
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +14 -78
- package/plugins/ai-delivery/skills/pr-handoff/SKILL.md +35 -36
- package/plugins/ai-delivery/skills/worktree-lifecycle/SKILL.md +14 -15
- package/dist/investigationCompletion.test.js +0 -728
- package/dist/investigationCompletion.test.js.map +0 -1
- package/dist/services/deliveryAdmission.d.ts +0 -49
- package/dist/services/deliveryAdmission.js +0 -165
- package/dist/services/deliveryAdmission.js.map +0 -1
- package/dist/services/worktreeRegistry.d.ts +0 -434
- package/dist/services/worktreeRegistry.js +0 -1248
- package/dist/services/worktreeRegistry.js.map +0 -1
- package/dist/setup.d.ts +0 -60
- package/dist/setup.js +0 -585
- package/dist/setup.js.map +0 -1
- package/dist/setup.test.js +0 -3329
- package/dist/setup.test.js.map +0 -1
- package/dist/worktree.d.ts +0 -28
- package/dist/worktree.js +0 -188
- package/dist/worktree.js.map +0 -1
- package/dist/worktreeTransition.d.ts +0 -211
- package/dist/worktreeTransition.js +0 -1037
- package/dist/worktreeTransition.js.map +0 -1
- package/dist/worktreeTransition.test.js +0 -1191
- package/dist/worktreeTransition.test.js.map +0 -1
- /package/dist/{investigationCompletion.test.d.ts → build.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → callerErrors.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → deliveryBoard.test.d.ts} +0 -0
|
@@ -1,318 +1,297 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { createHash } from
|
|
3
|
-
import { readFileSync } from
|
|
4
|
-
import { posix } from
|
|
5
|
-
import { Script } from
|
|
6
|
-
import { test } from
|
|
7
|
-
const workflow = readFileSync(new URL(
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { posix } from "node:path";
|
|
5
|
+
import { Script } from "node:vm";
|
|
6
|
+
import { test } from "vitest";
|
|
7
|
+
const workflow = readFileSync(new URL("../.github/workflows/release.yml", import.meta.url), "utf8");
|
|
8
8
|
const scripts = [...workflow.matchAll(/node --input-type=module <<'JS'\n([\s\S]*?)\n\s+JS/gu)];
|
|
9
9
|
const publishedScript = scripts.at(-1)?.[1];
|
|
10
|
-
assert.ok(publishedScript,
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const registry = 'https://registry.npmjs.org';
|
|
10
|
+
assert.ok(publishedScript, "The actual release workflow must contain its publication script.");
|
|
11
|
+
const program = publishedScript.replace(/^\s*import .+;\n/gmu, "");
|
|
12
|
+
const archive = Buffer.from("independently reviewed synthetic archive");
|
|
13
|
+
const digest = createHash("sha256").update(archive).digest("hex");
|
|
14
|
+
const integrity = `sha512-${createHash("sha512").update(archive).digest("base64")}`;
|
|
15
|
+
const source = "a".repeat(40);
|
|
16
|
+
const registry = "https://registry.npmjs.org";
|
|
18
17
|
const packageUrl = `${registry}/@aviaratech%2fai-delivery`;
|
|
19
|
-
const version =
|
|
20
|
-
const archivePath = posix.resolve(
|
|
18
|
+
const version = "0.8.1";
|
|
19
|
+
const archivePath = posix.resolve("/synthetic/package-artifact", `aviaratech-ai-delivery-${version}.tgz`);
|
|
21
20
|
const pkg = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
name: "@aviaratech/ai-delivery",
|
|
22
|
+
version,
|
|
23
|
+
private: false,
|
|
24
|
+
license: "MIT",
|
|
25
|
+
repository: { url: "git+https://github.com/aviaratech/ai-delivery.git" }
|
|
27
26
|
};
|
|
28
27
|
const manifest = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
name: pkg.name,
|
|
29
|
+
version,
|
|
30
|
+
dist: {
|
|
31
|
+
integrity,
|
|
32
|
+
tarball: `${registry}/@aviaratech/ai-delivery/-/ai-delivery-${version}.tgz`,
|
|
33
|
+
attestations: { provenance: { predicateType: "https://slsa.dev/provenance/v1" } }
|
|
34
|
+
}
|
|
36
35
|
};
|
|
37
36
|
async function runRelease(fixture = {}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (url === `${packageUrl}/${version}`) {
|
|
96
|
-
if (published())
|
|
97
|
-
reads++;
|
|
98
|
-
return published() && ready(fixture.versionReadyAt)
|
|
99
|
-
? fixture.oversizedManifest
|
|
100
|
-
? new Response('x'.repeat(4 * 1024 * 1024 + 1))
|
|
101
|
-
: Response.json(visibleManifest())
|
|
102
|
-
: new Response(null, { status: 404 });
|
|
103
|
-
}
|
|
104
|
-
if (url === manifest.dist.tarball) {
|
|
105
|
-
if (fixture.bodyDeadlineExceeded) {
|
|
106
|
-
return new Response(new ReadableStream({
|
|
107
|
-
start: (controller) => {
|
|
108
|
-
elapsed += 5 * 60_000;
|
|
109
|
-
controller.error(new DOMException('Readback body timed out', 'TimeoutError'));
|
|
110
|
-
},
|
|
111
|
-
}));
|
|
37
|
+
let publications = 0;
|
|
38
|
+
let reads = 0;
|
|
39
|
+
let elapsed = 0;
|
|
40
|
+
const requests = [];
|
|
41
|
+
const commands = [];
|
|
42
|
+
const waits = [];
|
|
43
|
+
const timeouts = [];
|
|
44
|
+
const messages = [];
|
|
45
|
+
const ready = (at = 1) => reads >= at;
|
|
46
|
+
const published = () => fixture.occupied || publications > 0;
|
|
47
|
+
const visibleManifest = (indexed = false) => {
|
|
48
|
+
const value = structuredClone(manifest);
|
|
49
|
+
if (!ready(fixture.provenanceReadyAt)) Reflect.deleteProperty(value.dist, "attestations");
|
|
50
|
+
if (fixture.conflict === "name") value.name = "@someone/else";
|
|
51
|
+
if (fixture.conflict === "version") value.version = "0.8.0";
|
|
52
|
+
if (fixture.conflict === "integrity" || indexed && fixture.conflict === "index")
|
|
53
|
+
value.dist.integrity = "sha512-conflicting";
|
|
54
|
+
if (fixture.conflict === "provenance")
|
|
55
|
+
value.dist.attestations = { provenance: { predicateType: "https://unexpected.example/predicate" } };
|
|
56
|
+
if (fixture.conflict === "origin") value.dist.tarball = "https://unexpected.example/archive.tgz";
|
|
57
|
+
if (fixture.conflict === "credentials") {
|
|
58
|
+
const tarball = new URL("/archive.tgz", registry);
|
|
59
|
+
tarball.username = "user";
|
|
60
|
+
tarball.password = "password";
|
|
61
|
+
value.dist.tarball = tarball.href;
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
const fetch = async (input, options = {}) => {
|
|
66
|
+
const url = String(input);
|
|
67
|
+
requests.push({ url, method: options.method ?? "GET", at: elapsed });
|
|
68
|
+
assert.equal(options.redirect, "error");
|
|
69
|
+
elapsed += fixture.fetchDurationMs ?? 100;
|
|
70
|
+
const phase = url.includes("api.github.com") ? "main" : url === packageUrl ? "index" : url === `${packageUrl}/${version}` ? "version" : "archive";
|
|
71
|
+
if (phase === fixture.errorPhase && (published() || phase === "main")) {
|
|
72
|
+
if (fixture.networkFailure) throw new Error("synthetic network failure");
|
|
73
|
+
return new Response(null, { status: fixture.errorStatus ?? 503 });
|
|
74
|
+
}
|
|
75
|
+
if (url === "https://api.github.com/repos/aviaratech/ai-delivery/branches/main") {
|
|
76
|
+
return Response.json({
|
|
77
|
+
name: "main",
|
|
78
|
+
protected: true,
|
|
79
|
+
commit: { sha: fixture.conflict === "main" ? "b".repeat(40) : source },
|
|
80
|
+
protection: { required_status_checks: { enforcement_level: "everyone", contexts: ["checks", "secrets"] } }
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (url === `${packageUrl}/${version}`) {
|
|
84
|
+
if (published()) reads++;
|
|
85
|
+
return published() && ready(fixture.versionReadyAt) ? fixture.oversizedManifest ? new Response("x".repeat(4 * 1024 * 1024 + 1)) : Response.json(visibleManifest()) : new Response(null, { status: 404 });
|
|
86
|
+
}
|
|
87
|
+
if (url === manifest.dist.tarball) {
|
|
88
|
+
if (fixture.bodyDeadlineExceeded) {
|
|
89
|
+
return new Response(
|
|
90
|
+
new ReadableStream({
|
|
91
|
+
start: (controller) => {
|
|
92
|
+
elapsed += 5 * 6e4;
|
|
93
|
+
controller.error(new DOMException("Readback body timed out", "TimeoutError"));
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
: published() && ready(fixture.latestReadyAt)
|
|
124
|
-
? version
|
|
125
|
-
: '0.8.0',
|
|
126
|
-
},
|
|
127
|
-
versions: published() && ready(fixture.indexReadyAt) ? { [version]: visibleManifest(true) } : {},
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
throw new Error(`Unexpected external request: ${url}`);
|
|
131
|
-
};
|
|
132
|
-
const context = {
|
|
133
|
-
createHash,
|
|
134
|
-
resolve: (path) => posix.resolve('/synthetic/package-artifact/unpacked/package', path),
|
|
135
|
-
readFileSync: (path) => {
|
|
136
|
-
assert.equal(path, archivePath);
|
|
137
|
-
return archive;
|
|
138
|
-
},
|
|
139
|
-
spawnSync: (command, args) => {
|
|
140
|
-
commands.push({ command, args: [...args] });
|
|
141
|
-
assert.equal(command, 'npm');
|
|
142
|
-
assert.equal(args[0], 'publish');
|
|
143
|
-
assert.equal(args[1], archivePath);
|
|
144
|
-
publications++;
|
|
145
|
-
return { status: fixture.publishStatus === undefined ? 0 : fixture.publishStatus };
|
|
146
|
-
},
|
|
147
|
-
pkg,
|
|
148
|
-
process: {
|
|
149
|
-
env: {
|
|
150
|
-
GITHUB_SHA: source,
|
|
151
|
-
REVIEWED_SOURCE_SHA: source,
|
|
152
|
-
RELEASE_VERSION: version,
|
|
153
|
-
REVIEWED_ARCHIVE_SHA256: digest,
|
|
154
|
-
GH_TOKEN: 'synthetic',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
fetch,
|
|
158
|
-
AbortSignal: {
|
|
159
|
-
timeout: (ms) => {
|
|
160
|
-
timeouts.push(ms);
|
|
161
|
-
return new AbortController().signal;
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
URL,
|
|
165
|
-
Buffer,
|
|
166
|
-
performance: { now: () => elapsed },
|
|
167
|
-
console: {
|
|
168
|
-
log: (message) => {
|
|
169
|
-
messages.push(String(message));
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
setTimeout: (callback, ms) => {
|
|
173
|
-
waits.push(ms);
|
|
174
|
-
elapsed += ms;
|
|
175
|
-
queueMicrotask(callback);
|
|
176
|
-
return 0;
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
return ready(fixture.archiveReadyAt) ? new Response(fixture.corruptArchive ? Buffer.from("conflicting registry bytes") : archive) : new Response(null, { status: 404 });
|
|
99
|
+
}
|
|
100
|
+
if (url === packageUrl) {
|
|
101
|
+
return Response.json({
|
|
102
|
+
name: pkg.name,
|
|
103
|
+
"dist-tags": {
|
|
104
|
+
latest: published() && fixture.conflict === "latest" ? "0.8.2" : published() && ready(fixture.latestReadyAt) ? version : "0.8.0"
|
|
177
105
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
await new Script(`(async () => {${program}\n})()`).runInNewContext(context);
|
|
106
|
+
versions: published() && ready(fixture.indexReadyAt) ? { [version]: visibleManifest(true) } : {}
|
|
107
|
+
});
|
|
182
108
|
}
|
|
183
|
-
|
|
184
|
-
|
|
109
|
+
throw new Error(`Unexpected external request: ${url}`);
|
|
110
|
+
};
|
|
111
|
+
const context = {
|
|
112
|
+
createHash,
|
|
113
|
+
resolve: (path) => posix.resolve("/synthetic/package-artifact/unpacked/package", path),
|
|
114
|
+
readFileSync: (path) => {
|
|
115
|
+
assert.equal(path, archivePath);
|
|
116
|
+
return archive;
|
|
117
|
+
},
|
|
118
|
+
spawnSync: (command, args) => {
|
|
119
|
+
commands.push({ command, args: [...args] });
|
|
120
|
+
assert.equal(command, "npm");
|
|
121
|
+
assert.equal(args[0], "publish");
|
|
122
|
+
assert.equal(args[1], archivePath);
|
|
123
|
+
publications++;
|
|
124
|
+
return { status: fixture.publishStatus === void 0 ? 0 : fixture.publishStatus };
|
|
125
|
+
},
|
|
126
|
+
pkg,
|
|
127
|
+
process: {
|
|
128
|
+
env: {
|
|
129
|
+
GITHUB_SHA: source,
|
|
130
|
+
REVIEWED_SOURCE_SHA: source,
|
|
131
|
+
RELEASE_VERSION: version,
|
|
132
|
+
REVIEWED_ARCHIVE_SHA256: digest,
|
|
133
|
+
GH_TOKEN: "synthetic"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
fetch,
|
|
137
|
+
AbortSignal: {
|
|
138
|
+
timeout: (ms) => {
|
|
139
|
+
timeouts.push(ms);
|
|
140
|
+
return new AbortController().signal;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
URL,
|
|
144
|
+
Buffer,
|
|
145
|
+
performance: { now: () => elapsed },
|
|
146
|
+
console: {
|
|
147
|
+
log: (message) => {
|
|
148
|
+
messages.push(String(message));
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
setTimeout: (callback, ms) => {
|
|
152
|
+
waits.push(ms);
|
|
153
|
+
elapsed += ms;
|
|
154
|
+
queueMicrotask(callback);
|
|
155
|
+
return 0;
|
|
185
156
|
}
|
|
186
|
-
|
|
157
|
+
};
|
|
158
|
+
let error = null;
|
|
159
|
+
try {
|
|
160
|
+
await new Script(`(async () => {${program}
|
|
161
|
+
})()`).runInNewContext(context);
|
|
162
|
+
} catch (failure) {
|
|
163
|
+
error = String(failure);
|
|
164
|
+
}
|
|
165
|
+
return { error, publications, requests, commands, waits, timeouts, messages, elapsed, reads };
|
|
187
166
|
}
|
|
188
|
-
test(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
167
|
+
test("successful publication reconciles staggered registry visibility without another npm invocation", async () => {
|
|
168
|
+
const result = await runRelease({
|
|
169
|
+
versionReadyAt: 2,
|
|
170
|
+
archiveReadyAt: 3,
|
|
171
|
+
provenanceReadyAt: 4,
|
|
172
|
+
indexReadyAt: 5,
|
|
173
|
+
latestReadyAt: 6
|
|
174
|
+
});
|
|
175
|
+
assert.equal(result.error, null);
|
|
176
|
+
assert.equal(result.publications, 1);
|
|
177
|
+
assert.equal(result.commands.length, 1);
|
|
178
|
+
assert.deepEqual(result.commands[0]?.args, [
|
|
179
|
+
"publish",
|
|
180
|
+
archivePath,
|
|
181
|
+
"--ignore-scripts",
|
|
182
|
+
"--access",
|
|
183
|
+
"public",
|
|
184
|
+
"--tag",
|
|
185
|
+
"latest",
|
|
186
|
+
"--registry",
|
|
187
|
+
registry,
|
|
188
|
+
"--provenance"
|
|
189
|
+
]);
|
|
190
|
+
assert.ok(result.waits.length > 0, "Stale reads must be paced.");
|
|
191
|
+
assert.ok(result.waits.every((ms) => ms > 0));
|
|
192
|
+
assert.ok(result.requests.every((request) => request.method === "GET"));
|
|
193
|
+
assert.ok(result.timeouts.every((ms) => ms > 0 && ms <= 3e4));
|
|
194
|
+
assert.ok(result.messages.some((message) => /exact reviewed registry/iu.test(message)));
|
|
216
195
|
});
|
|
217
|
-
test(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
196
|
+
test("matching occupied release reconciles latest without publication or retag", async () => {
|
|
197
|
+
const result = await runRelease({ occupied: true, latestReadyAt: 3 });
|
|
198
|
+
assert.equal(result.error, null);
|
|
199
|
+
assert.equal(result.publications, 0);
|
|
200
|
+
assert.deepEqual(result.commands, []);
|
|
201
|
+
assert.ok(result.messages.some((message) => /no publication repeated/iu.test(message)));
|
|
223
202
|
});
|
|
224
|
-
test(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
203
|
+
test("conflicting archive bytes fail immediately after one publication", async () => {
|
|
204
|
+
const result = await runRelease({ corruptArchive: true });
|
|
205
|
+
assert.match(result.error ?? "", /archive differs/iu);
|
|
206
|
+
assert.equal(result.publications, 1);
|
|
207
|
+
assert.deepEqual(result.waits, []);
|
|
229
208
|
});
|
|
230
|
-
test(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
209
|
+
test("unresolved visibility reports the external reconciliation bound without republishing", async () => {
|
|
210
|
+
const result = await runRelease({ versionReadyAt: Infinity });
|
|
211
|
+
assert.match(result.error ?? "", /reconciliation unresolved/iu);
|
|
212
|
+
assert.equal(result.publications, 1);
|
|
213
|
+
assert.ok(result.waits.length > 0);
|
|
214
|
+
assert.ok(result.elapsed < 10 * 6e4, "Reconciliation must fit the existing external publish job.");
|
|
215
|
+
assert.ok(
|
|
216
|
+
result.timeouts.some((ms) => ms < 3e4),
|
|
217
|
+
"Requests must respect the remaining reconciliation allowance."
|
|
218
|
+
);
|
|
237
219
|
});
|
|
238
|
-
test(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
220
|
+
test("an occupied version visible only in the index never enters publication", async () => {
|
|
221
|
+
const result = await runRelease({ occupied: true, versionReadyAt: 3, latestReadyAt: 4 });
|
|
222
|
+
assert.equal(result.error, null);
|
|
223
|
+
assert.deepEqual(result.commands, []);
|
|
224
|
+
assert.ok(result.waits.length > 0);
|
|
243
225
|
});
|
|
244
226
|
for (const conflict of [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
227
|
+
"name",
|
|
228
|
+
"version",
|
|
229
|
+
"integrity",
|
|
230
|
+
"provenance",
|
|
231
|
+
"origin",
|
|
232
|
+
"credentials",
|
|
233
|
+
"index",
|
|
234
|
+
"latest"
|
|
253
235
|
]) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
else
|
|
262
|
-
assert.equal(result.waits.length, 1);
|
|
263
|
-
});
|
|
236
|
+
test(`present ${conflict} conflict is refused without another publication`, async () => {
|
|
237
|
+
const result = await runRelease({ conflict });
|
|
238
|
+
assert.match(result.error ?? "", /differs|unexpected|advanced/iu);
|
|
239
|
+
assert.equal(result.publications, 1);
|
|
240
|
+
if (conflict !== "index") assert.deepEqual(result.waits, []);
|
|
241
|
+
else assert.equal(result.waits.length, 1);
|
|
242
|
+
});
|
|
264
243
|
}
|
|
265
|
-
for (const errorPhase of [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
244
|
+
for (const errorPhase of ["version", "index", "archive"]) {
|
|
245
|
+
for (const errorStatus of [401, 403, 429, 503]) {
|
|
246
|
+
test(`${errorPhase} HTTP ${errorStatus} remains a permanent failure`, async () => {
|
|
247
|
+
const result = await runRelease({ errorPhase, errorStatus });
|
|
248
|
+
assert.match(result.error ?? "", new RegExp(`readback failed: ${errorStatus}`, "u"));
|
|
249
|
+
assert.equal(result.publications, 1);
|
|
250
|
+
assert.deepEqual(result.waits, []);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
274
253
|
}
|
|
275
|
-
test(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
254
|
+
test("network failure is not retried as propagation", async () => {
|
|
255
|
+
const result = await runRelease({ errorPhase: "version", networkFailure: true });
|
|
256
|
+
assert.match(result.error ?? "", /synthetic network failure/u);
|
|
257
|
+
assert.equal(result.publications, 1);
|
|
258
|
+
assert.deepEqual(result.waits, []);
|
|
280
259
|
});
|
|
281
260
|
for (const publishStatus of [1, null]) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
261
|
+
test(`publish status ${publishStatus} remains ambiguous after matching readback`, async () => {
|
|
262
|
+
const result = await runRelease({ publishStatus, versionReadyAt: 3 });
|
|
263
|
+
assert.match(result.error ?? "", /failed or was ambiguous/iu);
|
|
264
|
+
assert.equal(result.publications, 1);
|
|
265
|
+
assert.ok(result.messages.some((message) => message.includes(`"status":${publishStatus}`)));
|
|
266
|
+
assert.ok(result.messages.some((message) => /exact reviewed registry/iu.test(message)));
|
|
267
|
+
});
|
|
289
268
|
}
|
|
290
|
-
test(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
269
|
+
test("an occupied conflicting release is never republished", async () => {
|
|
270
|
+
const result = await runRelease({ occupied: true, conflict: "integrity" });
|
|
271
|
+
assert.match(result.error ?? "", /integrity differs/iu);
|
|
272
|
+
assert.deepEqual(result.commands, []);
|
|
294
273
|
});
|
|
295
|
-
test(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
274
|
+
test("protected source drift refuses publication", async () => {
|
|
275
|
+
const result = await runRelease({ conflict: "main" });
|
|
276
|
+
assert.match(result.error ?? "", /protected main.*drifted/iu);
|
|
277
|
+
assert.deepEqual(result.commands, []);
|
|
299
278
|
});
|
|
300
|
-
test(
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
279
|
+
test("oversized registry metadata fails within the readback output bound", async () => {
|
|
280
|
+
const result = await runRelease({ oversizedManifest: true });
|
|
281
|
+
assert.match(result.error ?? "", /readback bound/iu);
|
|
282
|
+
assert.equal(result.publications, 1);
|
|
283
|
+
assert.deepEqual(result.waits, []);
|
|
305
284
|
});
|
|
306
|
-
test(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
285
|
+
test("a body timeout at the reconciliation bound retains an explicit unresolved result", async () => {
|
|
286
|
+
const result = await runRelease({ bodyDeadlineExceeded: true });
|
|
287
|
+
assert.match(result.error ?? "", /reconciliation unresolved/iu);
|
|
288
|
+
assert.equal(result.publications, 1);
|
|
310
289
|
});
|
|
311
|
-
for (const phase of [
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
290
|
+
for (const phase of ["archiveReadyAt", "provenanceReadyAt", "indexReadyAt", "latestReadyAt"]) {
|
|
291
|
+
test(`unresolved ${phase} cannot be accepted as a completed release`, async () => {
|
|
292
|
+
const result = await runRelease({ [phase]: Infinity });
|
|
293
|
+
assert.match(result.error ?? "", /reconciliation unresolved/iu);
|
|
294
|
+
assert.equal(result.publications, 1);
|
|
295
|
+
});
|
|
317
296
|
}
|
|
318
|
-
//# sourceMappingURL=releaseReconciliation.test.js.map
|
|
297
|
+
//# sourceMappingURL=releaseReconciliation.test.js.map
|