refactor!: enforce canonical evidence and provider boundaries

Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership.

Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers.

BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
This commit is contained in:
morluto
2026-10-09 20:18:52 +08:00
parent 2a7746998d
commit 63bf91405c
514 changed files with 9296 additions and 5825 deletions
@@ -1,6 +1,6 @@
import fs from "node:fs";
import { mkdir, rm, symlink, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { dirname, join } from "node:path";
import { add, commit, init } from "isomorphic-git";
import { describe, expect, it } from "vitest";
@@ -140,36 +140,48 @@ describe("reference source symlink import", () => {
});
describe("reference source manifest inventory", () => {
it("retains CMake build manifests in the imported inventory", async () => {
const root = await createTestTempDirectory("rea-reference-cmake-");
await mkdir(join(root, "src"));
await Promise.all([
writeFile(join(root, "CMakeLists.txt"), "project(example)\n"),
writeFile(
join(root, "src", "CMakeLists.txt"),
"add_library(example main.cpp)\n",
),
writeFile(join(root, "notes.txt"), "Build notes.\n"),
]);
it("retains manifest, test, generated and language classifications through import", async () => {
const root = await createTestTempDirectory("rea-reference-classification-");
const files = [
["CMakeLists.txt", "Text", ["documentation", "manifest"]],
["src/CMAKELISTS.TXT", "Text", ["documentation", "manifest", "source"]],
["CMakeLists.txt.backup", null, ["unknown"]],
["Dockerfile.dev.ts", "Dockerfile", ["source"]],
["DockerfileGuide.d.mts", "TypeScript", ["generated", "source"]],
["DockerfileHelper.py", "Python", ["source"]],
["dockerfiles", null, ["unknown"]],
["Widget_TeSt.TS", "TypeScript", ["source", "test"]],
["parser_spec.rs", "Rust", ["source", "test"]],
["main_test_helper.go", "Go", ["source"]],
["main_spec.ts.bak", null, ["unknown"]],
["tests/main.go", "Go", ["source", "test"]],
["out/widget_spec.js", "JavaScript", ["generated", "source", "test"]],
["vendor/widget_test.go", "Go", ["source", "test", "vendor"]],
["settings_spec.json", "JSON", ["config", "test"]],
] as const;
await Promise.all(
files.map(async ([path]) => {
const target = join(root, path);
await mkdir(dirname(target), { recursive: true });
await writeFile(target, "");
}),
);
const result = await importTree(root);
if (!result.ok) throw result.error;
expect(result.value.manifests).toEqual([
"CMakeLists.txt",
"src/CMakeLists.txt",
"src/CMAKELISTS.TXT",
]);
expect(result.value.entries).toContainEqual(
expect.objectContaining({
path: "CMakeLists.txt",
classifications: ["documentation", "manifest"],
}),
);
expect(result.value.entries).toContainEqual(
expect.objectContaining({
path: "src/CMakeLists.txt",
classifications: ["documentation", "manifest", "source"],
}),
const entries = new Map(
result.value.entries.map((entry) => [entry.path, entry]),
);
for (const [path, language, classifications] of files)
expect(entries.get(path), path).toMatchObject({
kind: "file",
language,
classifications,
});
});
});