fix(metadata): stop schema changes churning generated skill evidence (#1075)

This commit is contained in:
Ysopwnable
2026-10-08 22:21:30 +08:00
committed by GitHub
parent e2f03786f4
commit d52f66d62a
11 changed files with 98 additions and 18 deletions
@@ -195,6 +195,11 @@ describe("canonical product catalog", () => {
"project_managed_application_graph",
"verify_managed_native_boundaries",
]);
// Runtime schema commitments must not fan out into checked-in documentation.
// Provider commitments cover the facts actually present in this projection.
expect(Object.keys(catalog.runtime_catalog.digests)).toEqual([
"providers_sha256",
]);
expect(catalog.runtime_catalog.digests.providers_sha256).toBe(
providerCatalogDigest(catalog.providers),
);
+65 -1
View File
@@ -1,4 +1,4 @@
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
@@ -7,6 +7,11 @@ import {
canonicalSkillNeedsInstall,
installCanonicalSkill,
} from "../../../src/application/SetupSkill.js";
import {
runDoctor,
systemDoctorHost,
} from "../../../src/application/Doctor.js";
import { createDoctorHostFixture } from "../../../src/application/Doctor.fixture.js";
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
import { PRODUCT_IDENTITY } from "../../../src/identity.js";
import { skillReferenceIssues } from "../../../scripts/lib/docs-facts.mjs";
@@ -98,3 +103,62 @@ describe("canonical skill transaction", () => {
expect(await skillReferenceIssues(dirname(destination))).toEqual([]);
});
});
it("doctor verifies installed instructions and references even when metadata is current", async () => {
const home = await createTestTempDirectory("rea-skill-doctor-");
const destination = join(
home,
".agents/skills/reverse-engineer-anything/SKILL.md",
);
const reference = join(
dirname(destination),
"references/evidence-workflows.md",
);
const system = systemDoctorHost({
environment: { HOME: home, USERPROFILE: home },
});
const host = createDoctorHostFixture({
installedSkillIdentity: () =>
system.installedSkillIdentity?.() ?? Promise.resolve(undefined),
});
expect((await runDoctor(undefined, host)).identity?.skill.state).toBe(
"missing",
);
expect(await installCanonicalSkill(home)).toBe("installed");
expect((await runDoctor(undefined, host)).identity?.skill).toMatchObject({
state: "aligned",
installed_catalog_digest: null,
});
const legacyDigest = "0".repeat(64);
await writeFile(
destination,
(await readFile(destination, "utf8")).replace(
` tool_count: ${String(TOOL_CONTRACTS.length)}`,
` tool_count: ${String(TOOL_CONTRACTS.length)}\n catalog_digest: "${legacyDigest}"`,
),
);
expect((await runDoctor(undefined, host)).identity?.skill).toMatchObject({
state: "stale",
installed_catalog_digest: legacyDigest,
});
expect(await installCanonicalSkill(home)).toBe("installed");
for (const path of [destination, reference]) {
const canonical = await readFile(path, "utf8");
await writeFile(path, `${canonical}\nLocally changed instructions.\n`);
expect((await runDoctor(undefined, host)).identity?.skill.state).toBe(
"stale",
);
expect(await installCanonicalSkill(home)).toBe("installed");
expect((await runDoctor(undefined, host)).identity?.skill.state).toBe(
"aligned",
);
}
await rm(reference);
expect((await runDoctor(undefined, host)).identity?.skill.state).toBe(
"stale",
);
expect(await installCanonicalSkill(home)).toBe("installed");
expect((await runDoctor(undefined, host)).identity?.skill.state).toBe(
"aligned",
);
});