Document the labeled provenance evidence layout expected by spec validation. - Add an AGENTS.md example for required external integration evidence fields. - Expand contributing guidance with accepted labels, URL expectations, and checksum rules. - Add a regression test that keeps the documented example aligned with the evidence gate. Files changed: AGENTS.md | 14 ++++++++ docs/contributing.md | 28 ++++++++++++++++ .../src/__tests__/docs-evidence-example.test.ts | 37 ++++++++++++++++++++++ 3 files changed, 79 insertions(+) Fusion-Task-Id: FN-6357 Fusion-Task-Lineage: 788260ed-d5cf-4592-b117-40af5c45e0a1
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { detectExternalIntegrationEvidenceGaps } from "../spec-validation/external-integration-evidence.js";
|
|
|
|
const workspaceRoot = resolve(import.meta.dirname, "../../../..");
|
|
const contributingPath = resolve(workspaceRoot, "docs", "contributing.md");
|
|
|
|
function extractEvidenceExample(): string {
|
|
const contributing = readFileSync(contributingPath, "utf8");
|
|
const match = contributing.match(
|
|
/<!-- evidence-example:start -->([\s\S]*?)<!-- evidence-example:end -->/,
|
|
);
|
|
expect(match?.[1]).toBeDefined();
|
|
|
|
const fenced = match?.[1]?.trim() ?? "";
|
|
const fenceMatch = fenced.match(/^```markdown\r?\n([\s\S]*?)\r?\n```$/);
|
|
expect(fenceMatch?.[1]).toBeDefined();
|
|
return fenceMatch?.[1] ?? "";
|
|
}
|
|
|
|
describe("documented external integration evidence example", () => {
|
|
it("satisfies the spec-validation gate", () => {
|
|
const example = extractEvidenceExample();
|
|
|
|
expect(detectExternalIntegrationEvidenceGaps({ promptContent: example })).toEqual([]);
|
|
});
|
|
|
|
it("fails the gate when checksum evidence is removed", () => {
|
|
const example = extractEvidenceExample();
|
|
const withoutChecksum = example.replace(/^- Checksum:.*$/m, "- Checksum:");
|
|
|
|
const findings = detectExternalIntegrationEvidenceGaps({ promptContent: withoutChecksum });
|
|
expect(findings.length).toBeGreaterThan(0);
|
|
expect(findings[0]?.missing).toContain("checksum-or-source-of-truth-evidence");
|
|
});
|
|
});
|