mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 14:20:12 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The native Runner starts each agent harness and owns its lifecycle, credentials and recovery > - Google Antigravity is Google's only first-party coding harness, and it is the harness for Gemini 4 Neon > - The Runner had an Antigravity integration, but only as a pending candidate: ACP server 1.4.3, macOS ARM64 only, Google sign-in only, closed unless an operator opened it for one company and one model > - Cloud sandboxes run Linux and use API keys, so the candidate could not run there, and it had one attended test cell > - This pull request moves the integration to ACP server 1.5.2, makes it run on Linux and with a Gemini API key, adds the tests the other ACPX harnesses have, and removes the code paths that would block recovery after release > - The benefit is that the release of Antigravity becomes a small declaration change after the live suites pass. The profile stays `pending` in this pull request. ## Linked Issues or Issue Description Refs #98 Refs #6559 Refs #8523 Refs #21121 (a separate legacy-style `agy_local` adapter that uses the CLI print protocol; this pull request does not replace or include it) ## What Changed **Runtime** - Pin Antigravity ACP server 1.5.2 (was 1.4.3). Owned admission patch is `1.5.2-paperclip.2`. - Verified patched closures for `darwin-arm64`, `linux-x64` and `linux-arm64`. `darwin-x64` stays inventory-only. - The patcher reads Mach-O and ELF builds. It signs macOS output only. One admission source serves all platforms. - Platform gates in TypeScript, Rust, the sidecar schema and the server admit each host that has a verified closure. **Auth and models** - Gemini API-key auth reaches an exact-model session receipt. Admission accepts a model only when the base model and the thinking level both match the requested ID. - API-key connections get a model list on local and cloud environments. The list is generated at build time from the pinned runtime. The server starts no process to read it. - Gemini 4 Neon, Carbon, Argon and Hydrogen are selectable. The picker marks them "needs a paid Gemini API plan" for API-key connections. - One shared module maps model ID to family and thinking level. - `google/gemini-4-neon` is added to the OpenCode model list. A new model audit is in `doc/adapter-model-audit-2026-11-22.md`. **Lifecycle and failures** - A provider error no longer completes the turn. The driver classifies it: overloaded, rate limit, quota, auth rejected, model unavailable. - Overload retries are bounded (3 attempts, about 14 seconds). - A refused session reload maps to incompatible saved state, so the automatic replacement conversation applies. - Server gates that refused restart recovery, remote targets and shared state for Antigravity now apply only while the profile is pending. - A Google sign-in connection with a cloud environment is refused at save and at Test, with a plain message. - A released profile rejects candidate grants in TypeScript and in Rust. **Launch cost and integrity (all native ACPX providers)** - Each closure is verified one time into a sealed read-only store. Later launches check file identities and hash the exact executable they start. - Remote provider-pack verification is recorded per sandbox lease. Later runs check kernel identity and fall back to the full hash on any difference. - Superseded stores are removed in the background after a launch. **Provider pack and image** - The provider pack carries Antigravity for `linux-x64` as a candidate provider. It becomes an ordinary provider from the profile status alone. - The Daytona image build accepts the candidate. A credential-free smoke runs in the build. **Tests and CI** - New `antigravity-qualification` suite: 24 cells, local and Daytona. - New model lineup suites: 14 API-key cells and 14 Gemini 4 cells. Each cell requires the exact model in the Runner receipt. - Antigravity can run the `chat-features` cases with `--profile runner-acpx-antigravity`. - `runner-full-stack-e2e.yml` passes `GEMINI_API_KEY` for the new profile and derives candidate providers from the selected Daytona cells. **Docs** - `doc/plans/2026-11-22-antigravity-qualification.md` is the current release contract, acceptance ledger and operator recipe. ## Verification Commands that passed on the final revision: - `pnpm build` - Typecheck for all packages, including the runner-e2e test projects - `pnpm test:e2e:runner:unit`: 11,665 Vitest tests passed, 25 skipped; 386 node tests passed - `cargo test -p paperclip-runner-core -- --test-threads=4`: 1,199 passed, 2 failed. The 2 failures are Codex transport timing tests that pass alone and on `master`. - `cargo fmt --check`, `check:acpx-profiles`, `check:protocol-types`, `node scripts/check-maps.mjs` - Native patch tests: 9 of 9 on `darwin-arm64` and 9 of 9 on `linux-x64` - UI picker tests: 397 of 397 Known failures that also fail on `master`: - 11 runner package script tests (browser, Pi and package-boundary checks) - 6 `runtime-selection` tests that read an untracked local skill file Live evidence, without a prompt: - Clean provisioning on `darwin-arm64` and on `linux-x64` in a Daytona sandbox. The closure digests reproduce. A changed or missing file is rejected. - `initialize` reports 1.5.2. An API-key session returns a receipt for exactly `gemini-3.8-flash-low` and the exact instruction bytes, on both platforms. - All 28 model IDs (14 Gemini 3, 14 Gemini 4) return an exact receipt under an API key. - A session survives a process kill and resumes in a new process with exact receipts, on both platforms. - The server's remote path verifies the provider pack in a Daytona sandbox. - Run start to native `initialize`: 3.45 s to 1.46 s on macOS, 3.65 s to 1.74 s on Linux x64, before the per-launch executable hash was restored (about 60 ms on macOS; not measured on Linux). - Remote pack verification on a reused sandbox lease: about 4.3 s to about 0.25 s. Live evidence, with a prompt, on an already-released harness: - Pi native, `pi-native.runner-acpx-pi.local.agent-files-fresh-run`, on `darwin-arm64` at `427e9b088b`: 1 of 1 passed, 14 of 14 checks, both native runs succeeded (25.5 s and 25.7 s). The process started from the new launch store with no fallback warning. - The same cell and `native-pending-controller-restart` failed in the paid workflow on this branch and on `master` in the same way, before any native start. The workflow does not install the Pi runtime for local cells, so the agent setup check fails. That is a workflow gap, not part of this change. **Not run.** No Antigravity prompt completed on 1.5.2 on any platform. The only Gemini key available is on the free tier, and Google returned 503 or 429 for each attempt on two days. These gates are open: - All 24 `antigravity-qualification` cells - Both model lineup suites, including inference on Gemini 4 Neon - The attended Google sign-in journey on 1.5.2 - The chat cases under Antigravity - Image pull time and startup time on a published image - A native start on `linux-arm64` - A live provider-death cell for Kimi, Pi or Copilot on the new launch store (one ordinary Pi cell passed live; see above) ## Risks - **The launch store changes how every native ACPX provider starts** (Kimi, Copilot, Cursor, Pi), not only Antigravity. A review found two defects in the first version (an executable swap was possible, and Pi launches broke). Both are fixed with tests. One live Pi cell passed on this branch on macOS. No live provider-death cell and no Linux cell ran for those providers. - The profile digest changes. Saved Antigravity candidate sessions and existing candidate grants stop working. The new release refuses old state by name and starts a replacement conversation. - The Linux provider pack and the Daytona image grow by about 834 MB (about 274 MB compressed) when Antigravity is included. - The pack verification record is in server memory. The first run after a server restart pays the full hash again. - Antigravity 1.5.2 reads the workspace `GEMINI.md` and `AGENTS.md` as user rules. This is deliberate and matches Codex. Any other rule file is refused. - Orchestrator mode is not available. ACP server 1.5.2 does not expose it. - Antigravity stays `pending`. Normal users cannot run it until a later change removes the pending status. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`) planned, briefed and integrated the work, with tool use. - Claude Opus 5.5 (`claude-opus-5-5`) subagents wrote the code and ran the tests, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
263 lines
18 KiB
JavaScript
263 lines
18 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { createHash } from "node:crypto";
|
|
import { spawnSync } from "node:child_process";
|
|
import { cpSync, existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import test from "node:test";
|
|
import profiles from "../acpx-profiles.json" with { type: "json" };
|
|
import historicalKimi from "../test/fixtures/kimi-profile-v14-identity.json" with { type: "json" };
|
|
import { KIMI_DISTRIBUTION_CLOSURE_SHA256 as kimiClosures } from "../src/drivers/acpx/kimi-closure-pins.ts";
|
|
import distributions from "../cursor-distributions.json" with { type: "json" };
|
|
import antigravityDistributions from "../antigravity-distributions.json" with { type: "json" };
|
|
import { verifyReleaseProviderPack } from "./release-provider-pack.mjs";
|
|
import { existingReleaseProviderPack, releaseProviderPackManifest } from "./stage-release-runner-binaries.mjs";
|
|
|
|
const revision = "a".repeat(40);
|
|
const digest = "sha256:" + "b".repeat(64);
|
|
const canonical = value => Array.isArray(value) ? `[${value.map(canonical).join(",")}]`
|
|
: value && typeof value === "object" ? `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}` : JSON.stringify(value);
|
|
function fixture() {
|
|
const payload = { target: { platform: "linux", architecture: "x64" }, runnerSourceRevision: revision,
|
|
pins: { acpx: profiles.acpxVersion },
|
|
acpxProfileDigests: Object.fromEntries(["grok", "claude", "codex"].map(agent => [agent, profiles.profiles[agent].commandDigest])),
|
|
providers: { cursor: { version: profiles.profiles.cursor.agentServerVersion, profileDigest: profiles.profiles.cursor.commandDigest,
|
|
closureDigest: `sha256:${distributions.platforms["linux-x64"].closureSha256}`, qualification: "qualified",
|
|
path: "provider-assets/cursor/linux-x64", sha256: digest } } };
|
|
payload.providers.copilot = { version: profiles.profiles.copilot.agentServerVersion,
|
|
profileDigest: profiles.profiles.copilot.commandDigest, closureDigest: "sha256:a3d8f4367cfa1694d79e3f8b7930b6fbfe42a229c272b375b11951d631db8d07",
|
|
qualification: "qualified", path: "provider-assets/copilot/linux-x64", sha256: digest };
|
|
payload.providers.kimi = { version: profiles.profiles.kimi.agentServerVersion,
|
|
profileDigest: profiles.profiles.kimi.commandDigest, closureDigest: `sha256:${kimiClosures["linux-x64"]}`,
|
|
qualification: "qualified", path: "provider-assets/kimi/linux-x64", sha256: digest };
|
|
return payload;
|
|
}
|
|
function seal(payload) { return { schema: "paperclip-runner/remote-provider-pack/v1", payload,
|
|
digest: `sha256:${createHash("sha256").update(canonical(payload)).digest("hex")}` }; }
|
|
|
|
test("accepts a pack whose source and profiles match the assembled release", () => {
|
|
const manifest = seal(fixture()); assert.equal(verifyReleaseProviderPack(manifest, revision), manifest);
|
|
});
|
|
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path"]) {
|
|
test(`rejects an independently rehashed stale Cursor ${field}`, () => {
|
|
const payload = fixture(); payload.providers.cursor[field] = field.endsWith("Digest") ? digest : "stale";
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Cursor identity/);
|
|
});
|
|
}
|
|
test("rejects omitted Cursor, conflicting legacy inventory, stale sources and forged payload digests", () => {
|
|
const missing = fixture(); delete missing.providers.cursor;
|
|
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Cursor identity/);
|
|
const mixed = fixture(); mixed.candidateProviders = { cursor: { ...mixed.providers.cursor, profileDigest: digest } };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(mixed), revision), /Cursor identity/);
|
|
const old = fixture(); old.runnerSourceRevision = "c".repeat(40);
|
|
assert.throws(() => verifyReleaseProviderPack(seal(old), revision), /release source/);
|
|
const forged = seal(fixture()); forged.digest = digest;
|
|
assert.throws(() => verifyReleaseProviderPack(forged, revision), /payload digest/);
|
|
});
|
|
|
|
test("release assembly rejects rehashed stale or missing packs before staging any files", () => {
|
|
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-pack-")));
|
|
const source = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
try {
|
|
// Run the actual assembler in an isolated layout so it cannot overwrite built artifacts.
|
|
for (const file of ["scripts/stage-release-runner-binaries.mjs", "scripts/release-provider-pack.mjs", "src/live/runner-binary.ts", "src/drivers/acpx/kimi-closure-pins.ts", "acpx-profiles.json", "cursor-distributions.json", "antigravity-distributions.json", "release-runner-targets.json"]) {
|
|
mkdirSync(dirname(join(root, file)), { recursive: true }); cpSync(join(source, file), join(root, file));
|
|
}
|
|
const platforms = {};
|
|
for (const target of ["darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"]) {
|
|
const bytes = Buffer.alloc(64);
|
|
if (target.startsWith("linux-")) {
|
|
bytes.set([0x7f, 0x45, 0x4c, 0x46, 2, 1]); bytes.writeUInt16LE(target === "linux-x64" ? 62 : 183, 18);
|
|
} else {
|
|
bytes.writeUInt32LE(0xfeedfacf, 0); bytes.writeUInt32LE(target === "darwin-arm64" ? 0x0100000c : 0x01000007, 4);
|
|
}
|
|
const path = join(root, target); writeFileSync(path, bytes);
|
|
platforms[target] = { path, sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}` };
|
|
}
|
|
const payload = fixture(); payload.providers.cursor.profileDigest = digest;
|
|
const bytes = JSON.stringify(seal(payload)), path = join(root, "provider-pack.json"); writeFileSync(path, bytes);
|
|
const manifest = { sourceRevision: revision, platforms, remoteProviderPack: { path, sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}` } };
|
|
for (const error of [/Cursor identity/, /requires the matching Linux remote provider pack/]) {
|
|
writeFileSync(join(root, "release.json"), JSON.stringify(manifest));
|
|
const result = spawnSync(process.execPath, [join(root, "scripts/stage-release-runner-binaries.mjs"), join(root, "release.json")], { encoding: "utf8" });
|
|
assert.equal(result.status, 1); assert.match(result.stderr, error);
|
|
assert.equal(existsSync(join(root, "dist")), false);
|
|
delete manifest.remoteProviderPack;
|
|
}
|
|
} finally { rmSync(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
|
|
test("daemon-only assembly retains an existing same-source Linux provider-pack identity", () => {
|
|
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-retained-")));
|
|
try {
|
|
assert.equal(existingReleaseProviderPack(root, revision), undefined);
|
|
const file = join(root, "dist/remote-provider-packs/linux-x64/provider-pack.json");
|
|
mkdirSync(dirname(file), { recursive: true });
|
|
const pack = seal(fixture()); writeFileSync(file, JSON.stringify(pack));
|
|
assert.deepEqual(existingReleaseProviderPack(root, revision), pack);
|
|
assert.throws(() => existingReleaseProviderPack(root, "c".repeat(40)), /release source/);
|
|
const wrongTarget = fixture(); wrongTarget.target = { platform: "darwin", architecture: "arm64" };
|
|
writeFileSync(file, JSON.stringify(seal(wrongTarget)));
|
|
assert.throws(() => existingReleaseProviderPack(root, revision), /Linux x64 target/);
|
|
} finally { rmSync(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path", "sha256"]) {
|
|
test(`rejects an independently rehashed stale Copilot ${field}`, () => {
|
|
const payload = fixture(); payload.providers.copilot[field] = "stale";
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Copilot identity/);
|
|
});
|
|
}
|
|
test("rejects omitted Copilot and a duplicate candidate inventory", () => {
|
|
const missing = fixture(); delete missing.providers.copilot;
|
|
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Copilot identity/);
|
|
const mixed = fixture(); mixed.candidateProviders = { copilot: mixed.providers.copilot };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(mixed), revision), /Copilot identity/);
|
|
});
|
|
|
|
function armFixture() {
|
|
const payload = fixture();
|
|
payload.target.architecture = "arm64";
|
|
delete payload.providers;
|
|
return payload;
|
|
}
|
|
test("ARM pack binds its own target and preserves other providers qualification limits", () => {
|
|
const pack = seal(armFixture());
|
|
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-arm64"), pack);
|
|
assert.throws(() => verifyReleaseProviderPack(pack, revision), /Linux x64 target/);
|
|
assert.throws(() => verifyReleaseProviderPack(seal(fixture()), revision, "linux-arm64"), /linux-arm64 target/);
|
|
for (const inventory of ["providers", "candidateProviders"]) {
|
|
const payload = armFixture(); payload[inventory] = { pi: {} };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-arm64"), /must not expand/);
|
|
}
|
|
});
|
|
test("both remote pack identities bind one source and remain separated during assembly", () => {
|
|
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-targets-")));
|
|
try {
|
|
for (const [target, payload] of [["linux-x64", fixture()], ["linux-arm64", armFixture()]]) {
|
|
const file = join(root, target, "provider-pack.json"); mkdirSync(dirname(file), { recursive: true });
|
|
writeFileSync(file, JSON.stringify(seal(payload)));
|
|
}
|
|
const entries = releaseProviderPackManifest(root, revision);
|
|
assert.deepEqual(Object.keys(entries), ["linux-x64", "linux-arm64"]);
|
|
assert.notEqual(entries["linux-x64"].sha256, entries["linux-arm64"].sha256);
|
|
assert.throws(() => releaseProviderPackManifest(root, "c".repeat(40)), /release source/);
|
|
writeFileSync(join(root, "linux-arm64", "provider-pack.json"), JSON.stringify(seal(fixture())));
|
|
assert.throws(() => releaseProviderPackManifest(root, revision), /linux-arm64 target/);
|
|
rmSync(join(root, "linux-arm64"), { recursive: true });
|
|
assert.throws(() => releaseProviderPackManifest(root, revision), /exactly both/);
|
|
} finally { rmSync(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
test("frozen image validation uses release profiles rather than the newer workflow checkout", () => {
|
|
const frozenProfiles = structuredClone(profiles);
|
|
const frozenDistributions = structuredClone(distributions);
|
|
frozenProfiles.acpxVersion = "frozen-acpx";
|
|
for (const agent of ["claude", "codex", "grok", "cursor"]) frozenProfiles.profiles[agent].commandDigest = digest;
|
|
frozenProfiles.profiles.cursor.agentServerVersion = "frozen-cursor";
|
|
frozenDistributions.platforms["linux-x64"].closureSha256 = "c".repeat(64);
|
|
const payload = fixture();
|
|
payload.pins.acpx = frozenProfiles.acpxVersion;
|
|
for (const agent of ["claude", "codex", "grok"]) payload.acpxProfileDigests[agent] = digest;
|
|
Object.assign(payload.providers.cursor, { version: "frozen-cursor", profileDigest: digest, closureDigest: "sha256:" + "c".repeat(64) });
|
|
const pack = seal(payload);
|
|
const expected = { profiles: frozenProfiles, distributions: frozenDistributions };
|
|
assert.throws(() => verifyReleaseProviderPack(pack, revision), /profiles/);
|
|
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-x64", expected), pack);
|
|
payload.acpxProfileDigests.claude = "sha256:" + "d".repeat(64);
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", expected), /profiles/);
|
|
});
|
|
|
|
test("uses the frozen release's Copilot profile when the workflow checkout has advanced", () => {
|
|
const releaseProfiles = structuredClone(profiles);
|
|
releaseProfiles.profiles.copilot.commandDigest = "sha256:" + "e".repeat(64);
|
|
const payload = fixture(); payload.providers.copilot.profileDigest = releaseProfiles.profiles.copilot.commandDigest;
|
|
const manifest = seal(payload);
|
|
assert.equal(verifyReleaseProviderPack(manifest, revision, "linux-x64", { profiles: releaseProfiles, distributions }), manifest);
|
|
assert.throws(() => verifyReleaseProviderPack(manifest, revision), /Copilot identity/);
|
|
});
|
|
|
|
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path", "sha256"]) {
|
|
test(`rejects an independently rehashed stale Kimi ${field}`, () => {
|
|
const payload = fixture(); payload.providers.kimi[field] = "stale";
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Kimi identity/);
|
|
});
|
|
}
|
|
test("released Kimi requires one ordinary identity and exact frozen closure", () => {
|
|
const missing = fixture(); delete missing.providers.kimi;
|
|
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Kimi identity/);
|
|
const duplicate = fixture(); duplicate.candidateProviders = { kimi: duplicate.providers.kimi };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(duplicate), revision), /Kimi identity/);
|
|
const frozen = structuredClone(profiles); frozen.profiles.kimi.commandDigest = "sha256:" + "e".repeat(64);
|
|
const payload = fixture(); payload.providers.kimi.profileDigest = frozen.profiles.kimi.commandDigest;
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozen, distributions }), /Kimi identity/);
|
|
assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozen, distributions, kimiClosures }).payload, payload);
|
|
});
|
|
test("historical pending releases keep their separate candidate inventory", () => {
|
|
const historical = structuredClone(profiles);
|
|
historical.profiles.kimi = { ...historical.profiles.kimi, agentProfileVersion: 14,
|
|
commandDigest: historicalKimi.commandDigest, qualificationStatus: historicalKimi.declaration.qualificationStatus };
|
|
const payload = fixture(); payload.candidateProviders = { kimi: { ...payload.providers.kimi,
|
|
profileDigest: historicalKimi.commandDigest, qualification: "pending" } }; delete payload.providers.kimi;
|
|
const pack = seal(payload);
|
|
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-x64", { profiles: historical, distributions }), pack);
|
|
});
|
|
|
|
const antigravityProfile = profiles.profiles.antigravity;
|
|
const antigravityEntry = qualification => ({ version: antigravityProfile.agentServerVersion, profileDigest: antigravityProfile.commandDigest,
|
|
closureDigest: `sha256:${antigravityDistributions.platforms["linux-x64"].closureSha256}`, qualification,
|
|
path: "provider-assets/antigravity/linux-x64", sha256: digest });
|
|
function releasedAntigravityProfiles() {
|
|
const released = structuredClone(profiles); delete released.profiles.antigravity.qualificationStatus; return released;
|
|
}
|
|
|
|
test("pending Antigravity may ship only as one patched linux-x64 candidate", () => {
|
|
assert.equal(antigravityProfile.qualificationStatus, "pending");
|
|
const absent = seal(fixture());
|
|
assert.equal(verifyReleaseProviderPack(absent, revision), absent);
|
|
const candidate = fixture(); candidate.candidateProviders = { antigravity: antigravityEntry("pending") };
|
|
assert.equal(verifyReleaseProviderPack(seal(candidate), revision).payload, candidate);
|
|
const promoted = fixture(); promoted.providers.antigravity = antigravityEntry("qualified");
|
|
assert.throws(() => verifyReleaseProviderPack(seal(promoted), revision), /Antigravity identity/);
|
|
const both = fixture(); both.providers.antigravity = antigravityEntry("pending"); both.candidateProviders = { antigravity: antigravityEntry("pending") };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(both), revision), /Antigravity identity/);
|
|
});
|
|
|
|
test("released Antigravity requires one ordinary identity and never a candidate", () => {
|
|
const released = releasedAntigravityProfiles();
|
|
const expected = { profiles: released, distributions, kimiClosures, antigravityDistributions };
|
|
const payload = fixture(); payload.providers.antigravity = antigravityEntry("qualified");
|
|
assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", expected).payload, payload);
|
|
const missing = fixture();
|
|
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision, "linux-x64", expected), /Antigravity identity/);
|
|
const candidate = fixture(); candidate.candidateProviders = { antigravity: antigravityEntry("pending") };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(candidate), revision, "linux-x64", expected), /Antigravity identity/);
|
|
const both = structuredClone(payload); both.candidateProviders = { antigravity: antigravityEntry("pending") };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(both), revision, "linux-x64", expected), /Antigravity identity/);
|
|
});
|
|
|
|
for (const [name, change] of [
|
|
["vendor closure", { closureDigest: `sha256:${antigravityDistributions.platforms["linux-x64"].vendorClosureSha256}` }],
|
|
["darwin closure", { closureDigest: `sha256:${antigravityDistributions.platforms["darwin-arm64"].closureSha256}` }],
|
|
["older runtime version", { version: "1.4.3" }], ["older profile", { profileDigest: digest }],
|
|
["foreign path", { path: "provider-assets/antigravity/linux-arm64" }], ["unbound tree", { sha256: "stale" }],
|
|
["qualification", { qualification: "qualified" }], ["extra field", { executable: "agy_acp_server.par" }],
|
|
]) test(`rejects an Antigravity candidate with a stale ${name}`, () => {
|
|
const payload = fixture(); payload.candidateProviders = { antigravity: { ...antigravityEntry("pending"), ...change } };
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Antigravity identity/);
|
|
});
|
|
|
|
test("frozen Antigravity validation reads the release's own patched closure", () => {
|
|
const frozen = structuredClone(antigravityDistributions); frozen.platforms["linux-x64"].closureSha256 = "c".repeat(64);
|
|
const frozenProfiles = structuredClone(profiles); frozenProfiles.profiles.antigravity.commandDigest = "sha256:" + "e".repeat(64);
|
|
const payload = fixture(); payload.candidateProviders = { antigravity: { ...antigravityEntry("pending"),
|
|
profileDigest: frozenProfiles.profiles.antigravity.commandDigest, closureDigest: `sha256:${"c".repeat(64)}` } };
|
|
// Without the release's frozen declaration a different profile fails closed.
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures }), /Antigravity identity/);
|
|
assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures, antigravityDistributions: frozen }).payload, payload);
|
|
const vendorAsPatched = structuredClone(frozen); vendorAsPatched.platforms["linux-x64"].vendorClosureSha256 = "c".repeat(64);
|
|
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures, antigravityDistributions: vendorAsPatched }), /Antigravity identity/);
|
|
});
|