01ca965c7f
Coordinate registered resource edits bottom-up into retained exact remote sources. Use one Nix-owned source graph for provisional checking, template publication, explicit baseline upgrades and host activation; retain independent runtime pins. Add scoped contract inspection, historical recovery, derived worklists, crash-safe locks, named dependency adoption and plain-QX structural editing. Repair TODO ownership and template instantiation, and document the supported agent workflow. Validated with protocol and command suites, real jj/Nix convergence and cache checks, TS/React installed-command acceptance, and fresh TODO first-edit acceptance. No live deployment or public publication performed. Props projection generation and a one-command rich feature generator remain explicitly outside this delivery.
38 lines
2.2 KiB
TypeScript
38 lines
2.2 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { mkdtemp, writeFile, rm, symlink } from "node:fs/promises";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { execFile as callback } from "node:child_process";
|
|
import { promisify } from "node:util";
|
|
import { inspectAuthoringRepository } from "../src/capability-language/authoring-inspect.js";
|
|
|
|
const execFile = promisify(callback);
|
|
test("inspection keeps current files and labels historical recovery without granting verification", async context => {
|
|
const root = await mkdtemp(path.join(os.tmpdir(), "qx-inspection-test-"));
|
|
context.after(() => rm(root, { recursive: true, force: true }));
|
|
const git = (...args: string[]) => execFile("git", ["-C", root, ...args]);
|
|
await git("init");
|
|
await writeFile(path.join(root, "interface.qx"), 'interface Example id "interface:example" revision "interface:example@1" {}');
|
|
await git("add", ".");
|
|
await git("-c", "user.name=Test", "-c", "user.email=test@example.test", "commit", "-m", "contract");
|
|
const commit = (await git("rev-parse", "HEAD")).stdout.trim();
|
|
await writeFile(path.join(root, "interface.qx"), "interface broken {{{");
|
|
await writeFile(path.join(root, "new.qx"), 'interface New id "interface:new" revision "interface:new@1" {}');
|
|
const inspected = await inspectAuthoringRepository(root);
|
|
assert.equal(inspected.verificationEvidence, false);
|
|
assert.equal(inspected.resolutionChecked, false);
|
|
assert.equal(inspected.files[0].status, "historical");
|
|
assert.equal(inspected.files[0].revision, commit);
|
|
assert.ok(inspected.files[0].currentErrors.length);
|
|
assert.match(inspected.files[0].declarations[0].source, /Example/);
|
|
assert.equal(inspected.files[1].status, "current");
|
|
assert.match(inspected.files[1].declarations[0].source, /New/);
|
|
assert.equal((await git("rev-parse", "HEAD")).stdout.trim(), commit);
|
|
await symlink(path.join(root, "interface.qx"), path.join(root, "linked.qx"));
|
|
const linked = (await inspectAuthoringRepository(root)).files.find(file => file.file === "linked.qx")!;
|
|
assert.equal(linked.status, "unavailable");
|
|
assert.deepEqual(linked.declarations, []);
|
|
assert.match(JSON.stringify(linked.currentErrors), /ordinary files/);
|
|
});
|