Files
PaperClipAI/packages/paperclip-runner/scripts/validate-doc-links.test.mjs
DottaandClaude Opus 4.8 ab7b85878a docs(runner): strip leaked generation wrappers, sync Phase 7 counts, guard against regressions
Remove trailing generation-wrapper markup (</content>, plus </invoke> in the
tutorial) that had leaked at EOF into eleven committed Phase 7 reference,
tutorial, evidence, and OKF-journal files.

Sync the stated suite counts in the current-state docs (tutorial,
scenario-explorer reference, verification-commands reference, and OKF journal)
to the verified results: test:phase7 49, test:browser:phase7 25,
docs:validate 73 files / 28 OKF concepts / 5 indexes. Drop a brittle wall-clock
timing from the journal. The dated 7F verification evidence and log.md milestone
entry keep their point-in-time 45/19 figures on purpose.

Add a wrapper-markup guard to docs:validate (via scripts/lib/doc-wrappers.mjs)
that fails with the exact file and line when generator envelope tags reappear,
plus a node:test regression suite wired into the package test script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-09 14:46:49 +00:00

46 lines
1.2 KiB
JavaScript

import assert from "node:assert/strict";
import { test } from "node:test";
import { wrapperMarkupIn } from "./lib/doc-wrappers.mjs";
test("clean prose reports no leaked generation-wrapper markup", () => {
const markdown = [
"# Title",
"",
"Body prose that talks about content and invoking tools without any tags.",
"",
"- [A link](other.md)",
"",
].join("\n");
assert.deepEqual(wrapperMarkupIn(markdown), []);
});
test("a trailing </content> wrapper is caught with its exact line", () => {
const markdown = ["# Title", "", "Body.", "</content>"].join("\n");
assert.deepEqual(wrapperMarkupIn(markdown), [{ line: 4, tag: "</content>" }]);
});
test("a tutorial's </invoke> wrapper is caught", () => {
const markdown = ["Body.", "</content>", "</invoke>"].join("\n");
assert.deepEqual(wrapperMarkupIn(markdown), [
{ line: 2, tag: "</content>" },
{ line: 3, tag: "</invoke>" },
]);
});
test("assorted generator envelope tags are all caught", () => {
for (const tag of [
"<content>",
"<invoke name=\"Bash\">",
"<parameter name=\"x\">",
"<function_calls>",
"</function_results>",
"<invoke>",
]) {
assert.deepEqual(wrapperMarkupIn(`prose\n${tag}\n`), [{ line: 2, tag }]);
}
});