483bc68a94
Enable evolution by default for source-backed workspaces. Add stable conformance ownership, semantic-major review, candidate typechecking, and durable fenced cutover with explicit migrations and forward recovery. Independently supervise package runtimes so unchanged resource owners keep their processes and connections across cutover. Add scoped invocation authority, resource sessions, and typed callback rebinding. Wire opaque object references through generated bindings and RPCs. Add canonical relationship sets, keyed maps, and ordered lists with scoped transactional mutations, revision checks, and inverse consistency. Support planned cascade deletion, protection, tombstones, and lifecycle foundations. Add journaled structural edits, package/function/migration scaffolding, managed repository creation, and resumable bottom-up dependency pin publication. Document lifetime boundaries, revision pinning, prototype compatibility policy, commands, and deferred work. Validate with 210 tests, user-systemd process/connection continuity, generated-package TypeScript checks, and Nix host/protocol checks. TTL handoff, physical reclamation, general multi-step migrations, and root-systemd migration isolation acceptance remain deferred.
51 lines
3.1 KiB
TypeScript
51 lines
3.1 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import os from "node:os";
|
|
import { execFile as callback } from "node:child_process";
|
|
import { promisify } from "node:util";
|
|
import { snapshotRepository, checkWorkspaceCandidate } from "../src/capability-language/candidate-check.js";
|
|
const execFile = promisify(callback);
|
|
|
|
test("candidate snapshots include dirty and new files without changing Git history or index", async (context) => {
|
|
const directory = await fs.mkdtemp(path.join(os.tmpdir(), "qx-candidate-test-"));
|
|
context.after(() => fs.rm(directory, { recursive: true, force: true }));
|
|
const root = path.join(directory, "source");
|
|
await fs.mkdir(root);
|
|
const git = (...args: string[]) => execFile("git", ["-C", root, ...args]);
|
|
await git("init");
|
|
await fs.writeFile(path.join(root, "tracked"), "original");
|
|
await fs.writeFile(path.join(root, ".gitignore"), "ignored\n");
|
|
await git("add", ".");
|
|
const index = await fs.readFile(path.join(root, ".git/index"));
|
|
await fs.writeFile(path.join(root, "tracked"), "edited");
|
|
await fs.writeFile(path.join(root, "new"), "new content");
|
|
await fs.writeFile(path.join(root, "ignored"), "not source");
|
|
const snapshot = await snapshotRepository(root, path.join(directory, "snapshot"));
|
|
assert.equal(await fs.readFile(path.join(snapshot.directory, "tracked"), "utf8"), "edited");
|
|
assert.equal(await fs.readFile(path.join(snapshot.directory, "new"), "utf8"), "new content");
|
|
await assert.rejects(fs.access(path.join(snapshot.directory, "ignored")));
|
|
assert.deepEqual(await fs.readFile(path.join(root, ".git/index")), index);
|
|
await assert.rejects(git("rev-parse", "--verify", "HEAD"), "no commit was created");
|
|
await fs.symlink("tracked", path.join(root, "link"));
|
|
await assert.rejects(snapshotRepository(root, path.join(directory, "rejected")), /regular file/);
|
|
});
|
|
|
|
test("candidate check produces explicitly non-activation evidence and never overwrites a report", async (context) => {
|
|
const directory = await fs.mkdtemp(path.join(os.tmpdir(), "qx-check-test-"));
|
|
context.after(() => fs.rm(directory, { recursive: true, force: true }));
|
|
const root = path.join(directory, "source"), output = path.join(directory, "check");
|
|
await fs.mkdir(root);
|
|
await execFile("git", ["-C", root, "init"]);
|
|
await fs.writeFile(path.join(root, "quixos.lock"), `quixos-lock version 1 { quixos source { repository "https://example.test/quixos.git"; commit "${"a".repeat(40)}"; } }`);
|
|
await fs.writeFile(path.join(root, "workspace.qx"), `workspace Test id "workspace:test" revision "workspace:test@1" commit "${"b".repeat(40)}" { atom Subject id "atom:subject"; }`);
|
|
const result = await checkWorkspaceCandidate({root, output});
|
|
assert.equal(result.candidateOnly, true);
|
|
assert.equal(result.activationEvidence, false);
|
|
assert.deepEqual(result.blockers, []);
|
|
const report = await fs.readFile(path.join(output, "report.json"));
|
|
await assert.rejects(checkWorkspaceCandidate({root, output}), /EEXIST/);
|
|
assert.deepEqual(await fs.readFile(path.join(output, "report.json")), report);
|
|
});
|