docs: address Copilot review round 5 on #2203

The truncation guard read only the first physical line of the scalar, so
a multiline plain scalar slipped past it:

    description: Covers boards
      #28 and #11

YAML parses that as `Covers boards`, and the first-line-only comparison
saw `Covers boards` on both sides and reported no loss — passing the
exact silent truncation the guard exists to reject.

It now walks the whole plain scalar: the value line plus every indented
continuation, whitespace-collapsed to match YAML's folding of newlines to
spaces. Quoted and block scalars are still skipped, since neither loses
text to a comment.

Two regression cases: the multiline truncation, and a multiline scalar
with no `#`, which must stay clean — the fix cannot be "reject anything
multiline".

No skill description or eval case changed, so skills:eval is unchanged
from round 4's 63/63. local:gate passes, 34/34. 390/390 script tests.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-01 11:31:22 -04:00
commit ec2ef5656d

View file

@ -471,3 +471,36 @@ test("the truncation guard covers `when_to_use`, not just `description`", () =>
assert.deepEqual(ok.errors, []);
assert.equal(ok.whenToUse, "Use when filing against board #28 or board #11.");
});
test("the truncation guard spans a multiline plain scalar", () => {
// A plain scalar continues onto more-indented lines, so a first-line-only
// comparison sees `Covers boards` on both sides and reports no loss — passing
// the exact truncation this guard exists to reject.
const multiline = [
"---",
"name: alpha",
"description: Covers boards",
" #28 and #11 and the hazard.",
"disable-model-invocation: false",
"---",
"body",
].join("\n");
const parsed = parseSkill("alpha", multiline);
assert.equal(parsed.description, "Covers boards");
assert.match(parsed.errors.join(" "), /`description` is truncated/);
// A multiline plain scalar with no `#` folds to one line and must stay clean,
// so the fix cannot be "reject anything multiline".
const folded = [
"---",
"name: alpha",
"description: Covers boards",
" and the option-deletion hazard.",
"disable-model-invocation: false",
"---",
"body",
].join("\n");
const ok = parseSkill("alpha", folded);
assert.deepEqual(ok.errors, []);
assert.equal(ok.description, "Covers boards and the option-deletion hazard.");
});