@aviaratech/ai-delivery 0.3.34 → 0.3.36
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 +57 -506
- package/dist/agent.d.ts +0 -2
- package/dist/agent.js +76 -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 +1746 -0
- package/dist/boardReconcile.test.js.map +7 -0
- package/dist/build.test.js +130 -0
- package/dist/build.test.js.map +7 -0
- package/dist/callerErrors.test.js +105 -0
- package/dist/callerErrors.test.js.map +7 -0
- package/dist/cli.js +406 -485
- package/dist/cli.js.map +7 -1
- package/dist/cliResult.d.ts +2 -2
- package/dist/cliResult.js +42 -25
- package/dist/cliResult.js.map +7 -1
- package/dist/cliResult.test.js +434 -297
- package/dist/cliResult.test.js.map +7 -1
- package/dist/config/deliveryConfig.d.ts +320 -14
- package/dist/config/deliveryConfig.js +472 -385
- package/dist/config/deliveryConfig.js.map +7 -1
- package/dist/config/deliveryConfig.test.js +775 -584
- 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 -477
- 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.d.ts +1 -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 +17 -12
- package/dist/dispatch.js +330 -322
- package/dist/dispatch.js.map +7 -1
- package/dist/errors.d.ts +16 -3
- package/dist/errors.js +104 -82
- 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 +59 -19
- 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.js +73 -67
- 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 +44 -51
- package/dist/github/commandIdentityPolicy.js.map +7 -1
- package/dist/github/discovery.d.ts +3 -0
- package/dist/github/discovery.js +197 -201
- 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 +53 -1
- package/dist/github/projectDelivery.js +623 -460
- package/dist/github/projectDelivery.js.map +7 -1
- package/dist/github/relationships.d.ts +5 -2
- package/dist/github/relationships.js +434 -333
- 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 +103 -7
- package/dist/issue.js +2104 -1547
- 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 +1004 -683
- 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 +1945 -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 +1088 -593
- 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 -90
- package/dist/mcp/index.js.map +7 -1
- package/dist/mcp/tools.d.ts +790 -220
- package/dist/mcp/tools.js +267 -333
- 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 -1231
- package/dist/pluginInstaller.js.map +7 -1
- package/dist/pluginInstaller.test.js +1822 -1283
- package/dist/pluginInstaller.test.js.map +7 -1
- package/dist/pluginPackaging.test.js +485 -305
- package/dist/pluginPackaging.test.js.map +7 -1
- package/dist/pr.d.ts +132 -94
- package/dist/pr.js +1521 -1323
- package/dist/pr.js.map +7 -1
- package/dist/pr.test.js +1678 -632
- 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 +150 -89
- package/dist/prDispatch.test.js.map +7 -1
- package/dist/readView.d.ts +183 -0
- package/dist/readView.js +217 -0
- package/dist/readView.js.map +7 -0
- package/dist/readView.test.d.ts +1 -0
- package/dist/readView.test.js +119 -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 +1204 -0
- package/dist/services/boardReconcileService.js +1445 -0
- package/dist/services/boardReconcileService.js.map +7 -0
- package/dist/services/deliveryAdmission.d.ts +2 -0
- package/dist/services/deliveryAdmission.js +129 -152
- package/dist/services/deliveryAdmission.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/services/worktreeRegistry.d.ts +27 -119
- package/dist/services/worktreeRegistry.js +765 -1182
- package/dist/services/worktreeRegistry.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 +354 -350
- 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 +305 -281
- package/dist/targetPolicyRoutes.test.js.map +7 -1
- package/dist/targetRepositoryExecution.test.d.ts +1 -0
- package/dist/targetRepositoryExecution.test.js +463 -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.js +84 -76
- package/dist/utils/atomicJson.js.map +7 -1
- package/dist/utils/filesystem.js +15 -18
- 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 -19
- package/dist/verification.js +1020 -1929
- 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.d.ts +6 -0
- package/dist/version.js +24 -10
- package/dist/version.js.map +7 -1
- package/dist/worktree.d.ts +3 -15
- package/dist/worktree.js +97 -177
- package/dist/worktree.js.map +7 -1
- package/package.json +10 -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 +261 -43
- package/plugins/ai-delivery/runtime/dist/cli.js +369 -125
- 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/setup.d.ts +0 -60
- package/dist/setup.js +0 -585
- package/dist/setup.js.map +0 -1
- package/dist/setup.test.js +0 -3058
- package/dist/setup.test.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 → boardReconcile.test.d.ts} +0 -0
- /package/dist/{setup.test.d.ts → build.test.d.ts} +0 -0
- /package/dist/{worktreeTransition.test.d.ts → callerErrors.test.d.ts} +0 -0
package/dist/lifecycle.test.js
CHANGED
|
@@ -1,77 +1,50 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { execFileSync, spawn
|
|
3
|
-
import { once } from
|
|
4
|
-
import { createHash } from
|
|
5
|
-
import { existsSync, mkdtempSync, readFileSync,
|
|
6
|
-
import { tmpdir } from
|
|
7
|
-
import { join } from
|
|
8
|
-
import { fileURLToPath } from
|
|
9
|
-
import { afterAll, test
|
|
10
|
-
|
|
11
|
-
import { withRuntimeSetupWriter } from './verification.js';
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
3
|
+
import { once } from "node:events";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { afterAll, test } from "vitest";
|
|
10
|
+
const qualificationOwner = await import(new URL("../scripts/current-qualification.mjs", import.meta.url).href);
|
|
12
11
|
let node26Package;
|
|
13
|
-
const scripts = new Map();
|
|
14
|
-
async function fixture(input = {}) {
|
|
15
|
-
const root = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-runtime-runner-')));
|
|
16
|
-
execFileSync('git', ['init', '-q', root]);
|
|
17
|
-
scripts.set(root, input.firstStageScript ?? '');
|
|
18
|
-
return { root };
|
|
19
|
-
}
|
|
20
|
-
async function hostFixtureCheckout(input) {
|
|
21
|
-
return { path: input.repoRoot };
|
|
22
|
-
}
|
|
23
|
-
async function runRuntimeFixture(input) {
|
|
24
|
-
return withRuntimeSetupWriter(input.repoRoot, (runner) => runner.run([process.execPath, '-e', scripts.get(input.repoRoot)], input.resourceBounds, input.signal));
|
|
25
|
-
}
|
|
26
12
|
afterAll(() => {
|
|
27
|
-
|
|
28
|
-
rmSync(node26Package.temporary, { recursive: true, force: true });
|
|
13
|
+
if (node26Package) rmSync(node26Package.temporary, { recursive: true, force: true });
|
|
29
14
|
});
|
|
30
15
|
function packedNode26Consumer() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
rmSync(temporary, { recursive: true, force: true });
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function node26ConsumerScript(script) {
|
|
67
|
-
const consumer = packedNode26Consumer();
|
|
68
|
-
return `
|
|
69
|
-
require('node:assert/strict').equal(process.version, 'v24.21.0');
|
|
70
|
-
const child = require('node:child_process').spawnSync(${JSON.stringify(consumer.executable)}, ['-e', ${JSON.stringify(script)}], { cwd: ${JSON.stringify(consumer.root)}, stdio: 'inherit' });
|
|
71
|
-
if (child.error) throw child.error;
|
|
72
|
-
process.exit(child.status ?? 1);`;
|
|
16
|
+
if (node26Package !== void 0) return node26Package;
|
|
17
|
+
assert.equal(process.version, "v24.21.0", "canonical verification controller must remain Node 24.21.0");
|
|
18
|
+
const executable = process.env["AI_DELIVERY_NODE26_EXECUTABLE"];
|
|
19
|
+
assert.ok(executable, "set AI_DELIVERY_NODE26_EXECUTABLE to the actual Node 26.2.0 executable");
|
|
20
|
+
assert.equal(execFileSync(executable, ["--version"], { encoding: "utf8" }).trim(), "v26.2.0");
|
|
21
|
+
const temporary = realpathSync(mkdtempSync(join(tmpdir(), "ai-delivery-node26-")));
|
|
22
|
+
try {
|
|
23
|
+
const source = fileURLToPath(new URL("../", import.meta.url));
|
|
24
|
+
const archive = qualificationOwner.copyReleaseArchive(
|
|
25
|
+
process.env.AI_DELIVERY_RELEASE_CONTRACT ?? "",
|
|
26
|
+
source,
|
|
27
|
+
join(temporary, "qualified.tgz")
|
|
28
|
+
);
|
|
29
|
+
execFileSync("tar", ["-xzf", archive.archivePath, "-C", temporary]);
|
|
30
|
+
const root = join(temporary, "package");
|
|
31
|
+
symlinkSync(join(source, "node_modules"), join(root, "node_modules"), "dir");
|
|
32
|
+
process.stderr.write(
|
|
33
|
+
`ai-delivery.node26-consumer ${JSON.stringify({
|
|
34
|
+
controller: process.version,
|
|
35
|
+
consumer: "v26.2.0",
|
|
36
|
+
archiveSha256: archive.archiveSha256,
|
|
37
|
+
manifestSha256: createHash("sha256").update(readFileSync(join(root, "package.json"))).digest("hex")
|
|
38
|
+
})}
|
|
39
|
+
`
|
|
40
|
+
);
|
|
41
|
+
node26Package = { executable: realpathSync(executable), root, temporary };
|
|
42
|
+
return node26Package;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
rmSync(temporary, { recursive: true, force: true });
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
73
47
|
}
|
|
74
|
-
// Shared by both readiness producers and the controlled partial-write regression.
|
|
75
48
|
const readinessPublisher = `async function publishReadiness(file, bytes, pause) {
|
|
76
49
|
const temporary = file + '.pending';
|
|
77
50
|
const fd = fs.openSync(temporary, 'wx', 0o600);
|
|
@@ -84,13 +57,18 @@ const readinessPublisher = `async function publishReadiness(file, bytes, pause)
|
|
|
84
57
|
} finally { fs.closeSync(fd); }
|
|
85
58
|
fs.renameSync(temporary, file);
|
|
86
59
|
}`;
|
|
87
|
-
for (const name of [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
60
|
+
for (const name of ["capability", "pids"])
|
|
61
|
+
test(
|
|
62
|
+
`readiness record ${name} is unavailable during a controlled partial publication`,
|
|
63
|
+
{ tags: ["release"] },
|
|
64
|
+
async ({ signal }) => {
|
|
65
|
+
const output = realpathSync(mkdtempSync(join(tmpdir(), "ai-delivery-readiness-")));
|
|
66
|
+
const file = join(output, name);
|
|
67
|
+
const child = spawn(
|
|
68
|
+
process.execPath,
|
|
69
|
+
[
|
|
70
|
+
"-e",
|
|
71
|
+
`
|
|
94
72
|
const fs = require('node:fs');
|
|
95
73
|
${readinessPublisher}
|
|
96
74
|
publishReadiness(${JSON.stringify(file)}, '{"root":17,"descendant":23}', async () => {
|
|
@@ -98,302 +76,40 @@ for (const name of ['capability', 'pids'])
|
|
|
98
76
|
process.send('partial');
|
|
99
77
|
await resumed;
|
|
100
78
|
}).then(() => process.disconnect());
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
assert.equal(existsSync(file), false, 'Existence must mean a completely closed readiness record');
|
|
110
|
-
}
|
|
111
|
-
finally {
|
|
112
|
-
if (child.connected)
|
|
113
|
-
child.send('complete');
|
|
114
|
-
const [code] = (await closed);
|
|
115
|
-
try {
|
|
116
|
-
assert.equal(code, 0);
|
|
117
|
-
assert.deepEqual(JSON.parse(readFileSync(file, 'utf8')), { root: 17, descendant: 23 });
|
|
118
|
-
// A fully published malformed record is an immediate failure, never retried.
|
|
119
|
-
writeFileSync(file, '{');
|
|
120
|
-
assert.throws(() => JSON.parse(readFileSync(file, 'utf8')), SyntaxError);
|
|
121
|
-
}
|
|
122
|
-
finally {
|
|
123
|
-
rmSync(output, { recursive: true, force: true });
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
function filesystemFixtureScript(output, mode, runtime = 'node24') {
|
|
128
|
-
const script = `
|
|
129
|
-
(async () => {
|
|
130
|
-
const fs = require('node:fs'), cp = require('node:child_process'), path = require('node:path'), assert = require('node:assert/strict');
|
|
131
|
-
assert.equal(process.version, ${JSON.stringify(runtime === 'node26' ? 'v26.2.0' : 'v24.21.0')});
|
|
132
|
-
const { withVerificationFilesystemFixture } = await import(${JSON.stringify(runtime === 'node26' ? '@aviaratech/ai-delivery/agent' : new URL('./agent.js', import.meta.url).href)});
|
|
133
|
-
const { loadValidRepositoryDeliveryEvidence } = await import(${JSON.stringify(runtime === 'node26' ? new URL('./delivery/evidence.js', import.meta.url).href : new URL('./delivery/evidence.js', import.meta.url).href)});
|
|
134
|
-
const output = ${JSON.stringify(output)}, fifo = path.join(output, 'fifo'), events = path.join(output, 'events');
|
|
135
|
-
const evidenceId = 'sha256:' + 'a'.repeat(64), currentHead = { sha: 'b'.repeat(40), tree: 'c'.repeat(40) };
|
|
136
|
-
const evidence = path.join(output, 'ai-delivery', 'receipts', 'delivery@1', currentHead.sha, evidenceId.slice(7) + '.json');
|
|
137
|
-
fs.mkdirSync(path.dirname(evidence), { recursive: true });
|
|
138
|
-
const rejectPrivateFile = file => {
|
|
139
|
-
fs.renameSync(file, evidence);
|
|
140
|
-
try { assert.throws(() => loadValidRepositoryDeliveryEvidence({ createInput: { gitCommonDir: output, currentHead }, evidenceId }), /private regular file/); }
|
|
141
|
-
finally { fs.renameSync(evidence, file); }
|
|
142
|
-
};
|
|
143
|
-
const gate = JSON.parse(process.env.AI_DELIVERY_OUTPUT_OBSERVATION_GATE);
|
|
144
|
-
${readinessPublisher}
|
|
145
|
-
const trace = value => fs.appendFileSync(events, value + '\\n');
|
|
146
|
-
await withVerificationFilesystemFixture(async () => {
|
|
147
|
-
cp.execFileSync('mkfifo', ['-m', '600', fifo]);
|
|
148
|
-
await publishReadiness(path.join(output, 'capability'), JSON.stringify(gate));
|
|
149
|
-
trace('created');
|
|
150
|
-
try {
|
|
151
|
-
if (${JSON.stringify(mode)} === 'abrupt') process.exit(9);
|
|
152
|
-
if (${JSON.stringify(mode)} === 'cancel') await new Promise(() => { setInterval(() => {}, 1000); });
|
|
153
|
-
if (${JSON.stringify(mode)} === 'block') fs.readFileSync(fifo);
|
|
154
|
-
while (fs.readdirSync(path.join(gate.directory, 'requests')).length === 0) await new Promise(resolve => setTimeout(resolve, 10));
|
|
155
|
-
assert.ok(fs.existsSync(fifo)); trace('scan-queued');
|
|
156
|
-
rejectPrivateFile(fifo); trace('reader-rejected');
|
|
157
|
-
const regular = path.join(output, 'regular'), hard = path.join(output, 'hard'), alias = path.join(output, 'alias');
|
|
158
|
-
fs.writeFileSync(regular, 'x'.repeat(128), { mode: 0o600 });
|
|
159
|
-
fs.linkSync(regular, hard); rejectPrivateFile(hard); fs.unlinkSync(hard);
|
|
160
|
-
fs.symlinkSync('./regular', alias); rejectPrivateFile(alias); fs.unlinkSync(alias);
|
|
161
|
-
if (${JSON.stringify(mode)} === 'assertion') throw new Error('synthetic reader assertion failure');
|
|
162
|
-
} finally { fs.unlinkSync(fifo); trace('cleaned'); }
|
|
163
|
-
});
|
|
164
|
-
trace('released');
|
|
165
|
-
})().catch(error => { console.error(error.message); process.exitCode = 1; });`;
|
|
166
|
-
return runtime === 'node26' ? node26ConsumerScript(script) : script;
|
|
167
|
-
}
|
|
168
|
-
test.each([
|
|
169
|
-
['pass', 'node24'],
|
|
170
|
-
['assertion', 'node24'],
|
|
171
|
-
['pass', 'node26'],
|
|
172
|
-
['assertion', 'node26'],
|
|
173
|
-
])('filesystem fixture gate deterministically queues a scan through reader rejection and %s teardown on %s', async (mode, runtime) => {
|
|
174
|
-
const output = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-fixture-gate-')));
|
|
175
|
-
const { root } = await fixture({ firstStageScript: filesystemFixtureScript(output, mode, runtime) });
|
|
176
|
-
try {
|
|
177
|
-
const row = await hostFixtureCheckout({
|
|
178
|
-
baseRef: 'main',
|
|
179
|
-
identity: 'synthetic-author',
|
|
180
|
-
issueNumber: 17,
|
|
181
|
-
repoRoot: root,
|
|
182
|
-
});
|
|
183
|
-
const run = runRuntimeFixture({
|
|
184
|
-
issueNumber: 17,
|
|
185
|
-
repoRoot: row.path,
|
|
186
|
-
resourceBounds: {
|
|
187
|
-
maxAggregateRssBytes: 1_000_000_000,
|
|
188
|
-
minFreeDiskBytes: 1,
|
|
189
|
-
maxNewOutputBytes: 2048,
|
|
190
|
-
outputRoots: [output],
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
if (mode === 'assertion')
|
|
194
|
-
await assert.rejects(run, /exit 1/u);
|
|
195
|
-
else
|
|
196
|
-
await run;
|
|
197
|
-
assert.equal(existsSync(join(output, 'fifo')), false);
|
|
198
|
-
const events = readFileSync(join(output, 'events'), 'utf8').trim().split('\n');
|
|
199
|
-
assert.deepEqual(events, mode === 'pass'
|
|
200
|
-
? ['created', 'scan-queued', 'reader-rejected', 'cleaned', 'released']
|
|
201
|
-
: ['created', 'scan-queued', 'reader-rejected', 'cleaned']);
|
|
202
|
-
const capability = JSON.parse(readFileSync(join(output, 'capability'), 'utf8'));
|
|
203
|
-
assert.equal(existsSync(capability.directory), false);
|
|
204
|
-
assert.equal(readFileSync(join(output, 'regular'), 'utf8').length, 128);
|
|
205
|
-
}
|
|
206
|
-
finally {
|
|
207
|
-
rmSync(root, { recursive: true, force: true });
|
|
208
|
-
rmSync(output, { recursive: true, force: true });
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
test.each([
|
|
212
|
-
['abrupt', 'node24'],
|
|
213
|
-
['block', 'node24'],
|
|
214
|
-
['cancel', 'node24'],
|
|
215
|
-
['abrupt', 'node26'],
|
|
216
|
-
['block', 'node26'],
|
|
217
|
-
['cancel', 'node26'],
|
|
218
|
-
])('filesystem fixture gate preserves leaked FIFO and unrelated files after %s on %s', async (mode, runtime) => {
|
|
219
|
-
const output = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-fixture-failure-')));
|
|
220
|
-
writeFileSync(join(output, 'unrelated'), 'preserved');
|
|
221
|
-
const { root } = await fixture({ firstStageScript: filesystemFixtureScript(output, mode, runtime) });
|
|
222
|
-
const controller = new AbortController();
|
|
223
|
-
let running;
|
|
224
|
-
const progress = vi.spyOn(process.stderr, 'write');
|
|
225
|
-
try {
|
|
226
|
-
const row = await hostFixtureCheckout({
|
|
227
|
-
baseRef: 'main',
|
|
228
|
-
identity: 'synthetic-author',
|
|
229
|
-
issueNumber: 17,
|
|
230
|
-
repoRoot: root,
|
|
79
|
+
`
|
|
80
|
+
],
|
|
81
|
+
{ stdio: ["ignore", "pipe", "pipe", "ipc"], timeout: 5e3 }
|
|
82
|
+
);
|
|
83
|
+
const closed = once(child, "close");
|
|
84
|
+
try {
|
|
85
|
+
const [message] = await once(child, "message", {
|
|
86
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(5e3)])
|
|
231
87
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (mode === 'cancel') {
|
|
245
|
-
for (let attempt = 0; attempt < 300 && !existsSync(join(output, 'capability')); attempt++)
|
|
246
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
247
|
-
assert.ok(existsSync(join(output, 'capability')));
|
|
248
|
-
const cap = JSON.parse(readFileSync(join(output, 'capability'), 'utf8'));
|
|
249
|
-
for (let attempt = 0; attempt < 300 && readdirSync(join(cap.directory, 'requests')).length === 0; attempt++)
|
|
250
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
251
|
-
assert.ok(readdirSync(join(cap.directory, 'requests')).length > 0);
|
|
252
|
-
controller.abort();
|
|
253
|
-
}
|
|
254
|
-
const failure = String(await running);
|
|
255
|
-
assert.match(failure, mode === 'abrupt' ? /exit 9/u : mode === 'block' ? /reader or teardown is stalled/u : /cancelled/u);
|
|
256
|
-
assert.doesNotMatch(failure, /cleanup failed|live holder/u);
|
|
257
|
-
const capability = JSON.parse(readFileSync(join(output, 'capability'), 'utf8'));
|
|
258
|
-
assert.equal(existsSync(capability.directory), false);
|
|
259
|
-
assert.ok(existsSync(join(output, 'fifo')));
|
|
260
|
-
assert.equal(readFileSync(join(output, 'unrelated'), 'utf8'), 'preserved');
|
|
261
|
-
if (mode !== 'abrupt')
|
|
262
|
-
assert.ok(progress.mock.calls.filter(([line]) => String(line).includes('sampledAggregateRssBytes')).length > 2);
|
|
263
|
-
await assert.rejects(runRuntimeFixture({ issueNumber: 17, repoRoot: row.path, resourceBounds: bounds }), /unsupported file/u);
|
|
264
|
-
}
|
|
265
|
-
finally {
|
|
266
|
-
controller.abort();
|
|
267
|
-
await running;
|
|
268
|
-
progress.mockRestore();
|
|
269
|
-
rmSync(root, { recursive: true, force: true });
|
|
270
|
-
rmSync(output, { recursive: true, force: true });
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
test.each(['node24', 'node26'])('filesystem fixture gate still enforces positive byte limits after deterministic contention on %s', async (runtime) => {
|
|
274
|
-
const output = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-fixture-limit-')));
|
|
275
|
-
const { root } = await fixture({ firstStageScript: filesystemFixtureScript(output, 'pass', runtime) });
|
|
276
|
-
try {
|
|
277
|
-
const row = await hostFixtureCheckout({
|
|
278
|
-
baseRef: 'main',
|
|
279
|
-
identity: 'synthetic-author',
|
|
280
|
-
issueNumber: 17,
|
|
281
|
-
repoRoot: root,
|
|
282
|
-
});
|
|
283
|
-
await assert.rejects(runRuntimeFixture({
|
|
284
|
-
issueNumber: 17,
|
|
285
|
-
repoRoot: row.path,
|
|
286
|
-
resourceBounds: {
|
|
287
|
-
maxAggregateRssBytes: 1_000_000_000,
|
|
288
|
-
minFreeDiskBytes: 1,
|
|
289
|
-
maxNewOutputBytes: 64,
|
|
290
|
-
outputRoots: [output],
|
|
291
|
-
},
|
|
292
|
-
}), /filesystem output.*exceeded/u);
|
|
293
|
-
assert.equal(existsSync(join(output, 'fifo')), false);
|
|
294
|
-
assert.equal(readFileSync(join(output, 'regular'), 'utf8').length, 128);
|
|
295
|
-
}
|
|
296
|
-
finally {
|
|
297
|
-
rmSync(root, { recursive: true, force: true });
|
|
298
|
-
rmSync(output, { recursive: true, force: true });
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
test.each(['verification', 'runtime'])('filesystem fixture gate preserves observation and cancellation after direct %s command closure', async (mode) => {
|
|
302
|
-
const output = realpathSync(mkdtempSync(join(tmpdir(), 'ai-delivery-fixture-close-')));
|
|
303
|
-
writeFileSync(join(output, 'unrelated'), 'preserved');
|
|
304
|
-
const script = `
|
|
305
|
-
(async () => {
|
|
306
|
-
const fs = require('node:fs'), cp = require('node:child_process');
|
|
307
|
-
${readinessPublisher}
|
|
308
|
-
const child = cp.spawn(process.execPath, ['-e', ${JSON.stringify(filesystemFixtureScript(output, 'cancel'))}], { stdio: 'ignore' });
|
|
309
|
-
child.unref();
|
|
310
|
-
await publishReadiness(${JSON.stringify(join(output, 'pids'))}, JSON.stringify({ root: process.pid, descendant: child.pid }));
|
|
311
|
-
while (!fs.existsSync(${JSON.stringify(join(output, 'exit-parent'))})) await new Promise(resolve => setTimeout(resolve, 10));
|
|
312
|
-
process.exit(0);
|
|
313
|
-
})().catch(error => { console.error(error.message); process.exitCode = 1; });`;
|
|
314
|
-
const { root } = await fixture({ firstStageScript: script });
|
|
315
|
-
const controller = new AbortController();
|
|
316
|
-
const progress = vi.spyOn(process.stderr, 'write');
|
|
317
|
-
let running;
|
|
318
|
-
let completed = false;
|
|
319
|
-
try {
|
|
320
|
-
const row = await hostFixtureCheckout({
|
|
321
|
-
baseRef: 'main',
|
|
322
|
-
identity: 'synthetic-author',
|
|
323
|
-
issueNumber: 17,
|
|
324
|
-
repoRoot: root,
|
|
325
|
-
});
|
|
326
|
-
const bounds = {
|
|
327
|
-
maxAggregateRssBytes: 1_000_000_000,
|
|
328
|
-
minFreeDiskBytes: 1,
|
|
329
|
-
maxNewOutputBytes: 4096,
|
|
330
|
-
outputRoots: [output],
|
|
331
|
-
};
|
|
332
|
-
const { withRuntimeSetupWriter } = await import('./verification.js');
|
|
333
|
-
running = (mode === 'verification'
|
|
334
|
-
? runRuntimeFixture({
|
|
335
|
-
issueNumber: 17,
|
|
336
|
-
repoRoot: row.path,
|
|
337
|
-
resourceBounds: bounds,
|
|
338
|
-
signal: controller.signal,
|
|
339
|
-
})
|
|
340
|
-
: withRuntimeSetupWriter(row.path, (runner) => runner.run([process.execPath, '-e', script], bounds, controller.signal))).catch((error) => error);
|
|
341
|
-
for (let attempt = 0; attempt < 300 && (!existsSync(join(output, 'capability')) || !existsSync(join(output, 'pids'))); attempt++)
|
|
342
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
343
|
-
assert.ok(existsSync(join(output, 'capability')));
|
|
344
|
-
assert.ok(existsSync(join(output, 'pids')));
|
|
345
|
-
const cap = JSON.parse(readFileSync(join(output, 'capability'), 'utf8'));
|
|
346
|
-
const pids = JSON.parse(readFileSync(join(output, 'pids'), 'utf8'));
|
|
347
|
-
assert.equal(typeof cap.directory, 'string');
|
|
348
|
-
assert.ok(Number.isSafeInteger(pids.root) && pids.root > 0);
|
|
349
|
-
assert.ok(Number.isSafeInteger(pids.descendant) && pids.descendant > 0);
|
|
350
|
-
const writerPath = join(root, '.git', 'ai-delivery', 'writers@1', digestValue(row.path).slice(7) + '.json');
|
|
351
|
-
const descendantObserved = () => {
|
|
352
|
-
const state = JSON.parse(readFileSync(writerPath, 'utf8'));
|
|
353
|
-
return state.command.tracked?.some((member) => member.pid === pids.descendant) === true;
|
|
354
|
-
};
|
|
355
|
-
for (let attempt = 0; attempt < 300 && (!descendantObserved() || readdirSync(join(cap.directory, 'requests')).length === 0); attempt++)
|
|
356
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
357
|
-
assert.ok(descendantObserved());
|
|
358
|
-
assert.ok(readdirSync(join(cap.directory, 'requests')).length > 0);
|
|
359
|
-
writeFileSync(join(output, 'exit-parent'), 'exit');
|
|
360
|
-
const parentAlive = () => spawnSync('ps', ['-p', String(pids.root), '-o', 'stat='], { encoding: 'utf8' }).stdout.trim().length > 0;
|
|
361
|
-
for (let attempt = 0; attempt < 100 && parentAlive(); attempt++)
|
|
362
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
363
|
-
assert.equal(parentAlive(), false);
|
|
364
|
-
const samples = () => progress.mock.calls.filter(([line]) => String(line).includes('sampledAggregateRssBytes')).length;
|
|
365
|
-
const afterExit = samples();
|
|
366
|
-
for (let attempt = 0; attempt < 100 && samples() === afterExit; attempt++)
|
|
367
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
368
|
-
const observedAfterExit = samples() > afterExit;
|
|
369
|
-
controller.abort();
|
|
370
|
-
const failure = String(await running);
|
|
371
|
-
assert.match(failure, /cancelled/u);
|
|
372
|
-
assert.doesNotMatch(failure, /cleanup failed|live holder/u);
|
|
373
|
-
assert.ok(observedAfterExit, 'RSS and disk observation continues while the closed command awaits its scan');
|
|
374
|
-
assert.equal(existsSync(cap.directory), false);
|
|
375
|
-
assert.ok(existsSync(join(output, 'fifo')));
|
|
376
|
-
assert.equal(readFileSync(join(output, 'unrelated'), 'utf8'), 'preserved');
|
|
377
|
-
assert.equal(spawnSync('ps', ['-p', String(pids.descendant), '-o', 'stat='], { encoding: 'utf8' }).stdout.trim().length, 0);
|
|
378
|
-
assert.equal(progress.mock.calls.some(([line]) => String(line).includes('"state":"completed"')), false);
|
|
379
|
-
completed = true;
|
|
380
|
-
}
|
|
381
|
-
finally {
|
|
382
|
-
controller.abort();
|
|
383
|
-
await running;
|
|
384
|
-
progress.mockRestore();
|
|
385
|
-
// Preserve any future failed synthetic readiness bytes in the owned TMPDIR
|
|
386
|
-
// for the supervising run's recovery archive; never print capability bytes.
|
|
387
|
-
if (completed) {
|
|
388
|
-
rmSync(root, { recursive: true, force: true });
|
|
389
|
-
rmSync(output, { recursive: true, force: true });
|
|
88
|
+
assert.equal(message, "partial");
|
|
89
|
+
assert.equal(existsSync(file), false, "Existence must mean a completely closed readiness record");
|
|
90
|
+
} finally {
|
|
91
|
+
if (child.connected) child.send("complete");
|
|
92
|
+
const [code] = await closed;
|
|
93
|
+
try {
|
|
94
|
+
assert.equal(code, 0);
|
|
95
|
+
assert.deepEqual(JSON.parse(readFileSync(file, "utf8")), { root: 17, descendant: 23 });
|
|
96
|
+
writeFileSync(file, "{");
|
|
97
|
+
assert.throws(() => JSON.parse(readFileSync(file, "utf8")), SyntaxError);
|
|
98
|
+
} finally {
|
|
99
|
+
rmSync(output, { recursive: true, force: true });
|
|
390
100
|
}
|
|
101
|
+
}
|
|
391
102
|
}
|
|
392
|
-
|
|
393
|
-
test(
|
|
103
|
+
);
|
|
104
|
+
test(
|
|
105
|
+
"Node 26 packed public exports preserve standalone and malformed-capability behavior",
|
|
106
|
+
{ tags: ["release"] },
|
|
107
|
+
() => {
|
|
394
108
|
const consumer = packedNode26Consumer();
|
|
395
|
-
execFileSync(
|
|
396
|
-
|
|
109
|
+
execFileSync(
|
|
110
|
+
consumer.executable,
|
|
111
|
+
[
|
|
112
|
+
"-e",
|
|
397
113
|
`
|
|
398
114
|
(async () => {
|
|
399
115
|
const assert = require('node:assert/strict');
|
|
@@ -418,78 +134,33 @@ test('Node 26 packed public exports preserve standalone and malformed-capability
|
|
|
418
134
|
if (prior === undefined) delete process.env.AI_DELIVERY_OUTPUT_OBSERVATION_GATE;
|
|
419
135
|
else process.env.AI_DELIVERY_OUTPUT_OBSERVATION_GATE = prior;
|
|
420
136
|
})().catch(error => { console.error(error); process.exitCode = 1; });
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
137
|
+
`
|
|
138
|
+
],
|
|
139
|
+
{ cwd: consumer.root, stdio: "pipe" }
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
test(
|
|
144
|
+
"filesystem fixture helper runs standalone and fails closed on malformed capability",
|
|
145
|
+
{ tags: ["release"] },
|
|
146
|
+
async () => {
|
|
147
|
+
const { withVerificationFilesystemFixture } = await import("./agent.js");
|
|
148
|
+
assert.equal(await withVerificationFilesystemFixture(() => "standalone"), "standalone");
|
|
149
|
+
const prior = process.env["AI_DELIVERY_OUTPUT_OBSERVATION_GATE"];
|
|
428
150
|
try {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
151
|
+
process.env["AI_DELIVERY_OUTPUT_OBSERVATION_GATE"] = "{}";
|
|
152
|
+
let executed = false;
|
|
153
|
+
await assert.rejects(
|
|
154
|
+
withVerificationFilesystemFixture(() => {
|
|
155
|
+
executed = true;
|
|
156
|
+
}),
|
|
157
|
+
/invalid or stale/u
|
|
158
|
+
);
|
|
159
|
+
assert.equal(executed, false);
|
|
160
|
+
} finally {
|
|
161
|
+
if (prior === void 0) delete process.env["AI_DELIVERY_OUTPUT_OBSERVATION_GATE"];
|
|
162
|
+
else process.env["AI_DELIVERY_OUTPUT_OBSERVATION_GATE"] = prior;
|
|
441
163
|
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const inner = await fixture();
|
|
446
|
-
const worker = filesystemFixtureScript(output, 'pass');
|
|
447
|
-
const { root } = await fixture({
|
|
448
|
-
firstStageScript: `
|
|
449
|
-
(async () => {
|
|
450
|
-
const fs = require('node:fs'), cp = require('node:child_process'), assert = require('node:assert/strict');
|
|
451
|
-
const { withRuntimeSetupWriter } = await import(${JSON.stringify(new URL('./verification.js', import.meta.url).href)});
|
|
452
|
-
const capability = process.env.AI_DELIVERY_OUTPUT_OBSERVATION_GATE;
|
|
453
|
-
const child = cp.spawn(process.execPath, ['-e', ${JSON.stringify(worker)}], { stdio: ['ignore', 'inherit', 'inherit'] });
|
|
454
|
-
const closed = new Promise((resolve, reject) => child.once('exit', code => code === 0 ? resolve() : reject(new Error('fixture child exit ' + code))));
|
|
455
|
-
while (!fs.existsSync(${JSON.stringify(join(output, 'capability'))})) await new Promise(resolve => setTimeout(resolve, 10));
|
|
456
|
-
assert.equal(fs.readFileSync(${JSON.stringify(join(output, 'capability'))}, 'utf8'), capability);
|
|
457
|
-
await withRuntimeSetupWriter(${JSON.stringify(inner.root)}, async runner => {
|
|
458
|
-
await runner.run([process.execPath, '-e', 'require("node:assert/strict").equal(process.env.AI_DELIVERY_OUTPUT_OBSERVATION_GATE, ' + JSON.stringify(capability) + ')'], { maxAggregateRssBytes: 1000000000, minFreeDiskBytes: 1, maxNewOutputBytes: 2048, outputRoots: [${JSON.stringify(output)}] });
|
|
459
|
-
});
|
|
460
|
-
await closed;
|
|
461
|
-
})().catch(error => { console.error(error.message); process.exitCode = 1; });`,
|
|
462
|
-
});
|
|
463
|
-
try {
|
|
464
|
-
const row = await hostFixtureCheckout({
|
|
465
|
-
baseRef: 'main',
|
|
466
|
-
identity: 'synthetic-author',
|
|
467
|
-
issueNumber: 17,
|
|
468
|
-
repoRoot: root,
|
|
469
|
-
});
|
|
470
|
-
await runRuntimeFixture({
|
|
471
|
-
issueNumber: 17,
|
|
472
|
-
repoRoot: row.path,
|
|
473
|
-
resourceBounds: {
|
|
474
|
-
maxAggregateRssBytes: 1_000_000_000,
|
|
475
|
-
minFreeDiskBytes: 1,
|
|
476
|
-
maxNewOutputBytes: 2048,
|
|
477
|
-
outputRoots: [output],
|
|
478
|
-
},
|
|
479
|
-
});
|
|
480
|
-
assert.deepEqual(readFileSync(join(output, 'events'), 'utf8').trim().split('\n'), [
|
|
481
|
-
'created',
|
|
482
|
-
'scan-queued',
|
|
483
|
-
'reader-rejected',
|
|
484
|
-
'cleaned',
|
|
485
|
-
'released',
|
|
486
|
-
]);
|
|
487
|
-
assert.equal(existsSync(join(inner.root, '.git', 'ai-delivery', 'output-observation')), false);
|
|
488
|
-
}
|
|
489
|
-
finally {
|
|
490
|
-
rmSync(root, { recursive: true, force: true });
|
|
491
|
-
rmSync(inner.root, { recursive: true, force: true });
|
|
492
|
-
rmSync(output, { recursive: true, force: true });
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
//# sourceMappingURL=lifecycle.test.js.map
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
//# sourceMappingURL=lifecycle.test.js.map
|