Consolidate Reader source ownership and pinned application instances
Add exact recursive source checkout, independent Git/jj developer workbenches and source-only backup/recovery commands, with Workspace instance binding outside source. Qualify two empty Reader Graphs, packaged source commands, Agent VM compilation, exact Gitea read grants and reconciled Reader settings/annotation stability. Publish checked Reader Package/root revisions to canonical review branches and retention tags, retain all 57 repositories independently in private versioned storage, verify downloaded-backup recovery and advance the example pin. Add bounded Central pin acquisition and selection-specific read-only identities, qualified against all 57 canonical repositories without write authority. Replace regex fork dependency discovery with compiler-parsed lock imports and rewrite proposals; preserve source identities and unrelated files, passing instance binding through packed and ordinary host checks. Hosted run-pin versus authoring preparation and maintained duplicate removal remain pending. Live source selections, Template defaults and default source branches are unchanged.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { mkdtemp, writeFile, readFile, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { workspaceSourceLocks } from "../src/capability-language/source-locks.js";
|
||||
|
||||
test("fork lock proposals follow declared fragments and ignore comments and unrelated lock files", async (context) => {
|
||||
const directory = await mkdtemp(path.join(os.tmpdir(), "qx-lock-fork-"));
|
||||
context.after(() => rm(directory, { recursive: true, force: true }));
|
||||
const from = { repository: "https://source.test/app/runtime.git", commit: "b".repeat(40) };
|
||||
const to = { repository: "https://source.test/fork/runtime.git", commit: "c".repeat(40) };
|
||||
const root = `quixos-lock version 1 {
|
||||
quixos source { repository "https://source.test/quixos.git"; commit "${"a".repeat(40)}"; }
|
||||
import "resources.lock";
|
||||
// package Fake source { repository "https://unrelated.test/secret.git"; commit "${"d".repeat(40)}"; }
|
||||
}`;
|
||||
const fragment = `quixos-lock fragment version 1 {
|
||||
// Preserve this note: 雨 📚
|
||||
package Runtime source { repository "${from.repository}"; commit "${from.commit}"; }
|
||||
}`;
|
||||
await writeFile(path.join(directory, "quixos.lock"), root);
|
||||
await writeFile(path.join(directory, "resources.lock"), fragment);
|
||||
await writeFile(path.join(directory, "unrelated.lock"), "This is not a Quixos lock.");
|
||||
const result = await workspaceSourceLocks(directory, [{ from, to }]);
|
||||
assert.equal(result.lock.resources.length, 1);
|
||||
assert.deepEqual(result.lock.resources[0].source, { resolver: "git", ...to });
|
||||
assert.equal(result.files.find((file) => file.path === "quixos.lock")!.source, root);
|
||||
assert.match(result.files.find((file) => file.path === "resources.lock")!.source, /Preserve this note: 雨 📚/);
|
||||
assert.deepEqual(result.files.map((file) => file.path).sort(), ["quixos.lock", "resources.lock"]);
|
||||
assert.equal(
|
||||
await readFile(path.join(directory, "resources.lock"), "utf8"),
|
||||
fragment,
|
||||
"Proposing a fork does not edit selected source",
|
||||
);
|
||||
await assert.rejects(
|
||||
workspaceSourceLocks(directory, [
|
||||
{ from, to },
|
||||
{ from, to },
|
||||
]),
|
||||
/Duplicate/,
|
||||
);
|
||||
await assert.rejects(workspaceSourceLocks(directory, [{ from, to: { ...to, commit: "main" } }]), /exact commit/);
|
||||
await writeFile(path.join(directory, "quixos.lock"), root.replace('"resources.lock"', '"../outside.lock"'));
|
||||
await assert.rejects(workspaceSourceLocks(directory), /Invalid source lock/);
|
||||
});
|
||||
Reference in New Issue
Block a user