fix(eval,ci): isolate interview eval and harden skill lint and design gate

- Run eval sessions in a temp dir outside the repo so Codex no longer reads the root AGENTS.md; empty streams, timeouts and crashes judge as ERROR instead of PASS
- Close interview-gate lint gaps: softening phrases hidden on allowed lines, reordered phrasing, sibling-anchor bypass
- design-gate: bold threshold 700, axe incomplete reported as manual checks, follow @import with query strings, report unverified color literals; keep site copy in sync via test
- publish-npm.sh fails without NPM_TOKEN; CI requires Node 22.6+; ignore outputs/
This commit is contained in:
Yun Chan 2026-10-09 18:18:41 +09:00
parent bc914eafc5
commit 97f2c241e4
19 changed files with 767 additions and 139 deletions

View file

@ -22,6 +22,7 @@ import {
parseRowId,
preflightRowDefs,
rowCitations,
insideAllowed,
gateRuleNumbers,
unfencedLines,
estimateTokens,
@ -216,6 +217,55 @@ test("brief-interview.md 의 완화 문구 → 오류, 기존 객관 조건(허
assert.equal(hits.length, 1, `새로 넣은 한 줄만 잡혀야 한다:\n${hits.join("\n")}`);
});
test("허용 문구와 같은 줄에 숨긴 완화 문구 → 오류, 허용 문구만 있는 줄은 통과(F022)", async () => {
const dir = await freshCopy();
await edit(dir, "references/brief-interview.md", (t) =>
t + "\n그 밖에는 새 화면일 때만 묻는다. 그리고 사소하면 필요한 경우에만 사용자에게 질문한다.\n",
);
const { errors } = await lintSkill(dir);
const hits = errors.filter((e) => e.startsWith("references/brief-interview.md") && /완화 문구/.test(e));
assert.equal(hits.length, 1, `허용 문구 뒤에 붙은 완화 문구만 잡혀야 한다:\n${hits.join("\n")}`);
assert.match(hits[0], /경우에만 사용자에게 질문/);
const ok = await freshCopy();
await edit(ok, "references/brief-interview.md", (t) => t + "\n그 밖에는 새 화면일 때만 묻는다.\n");
assert.deepEqual((await lintSkill(ok)).errors, []);
});
test("insideAllowed 는 허용 구간에 완전히 든 매치만 면제한다", () => {
const t = "새 화면일 때만 묻는다. 모호한 경우에만 묻는다.";
const a = t.indexOf("때만 묻");
assert.equal(insideAllowed(t, a, "때만 묻".length), true);
const b = t.indexOf("경우에만 묻");
assert.equal(insideAllowed(t, b, "경우에만 묻".length), false);
// 허용 구간 안에서 시작해 밖으로 이어지는 매치는 면제하지 않는다
assert.equal(insideAllowed(t, a, "때만 묻는다. 모호한".length), false);
});
for (const [name, phrase] of [
["질문은 필요할 때만 한다", "질문은 필요할 때만 한다."],
["질문하지 말고 진행", "애매하면 질문하지 말고 진행한다."],
["굳이 묻지 않아도 된다", "굳이 묻지 않아도 된다."],
["질문은 최소화한다", "질문은 최소화한다."],
["불필요한 질문은 하지 않는다", "불필요한 질문은 하지 않는다."],
["물을 필요가 없다고 판단되면 건너뛴다", "물을 필요가 없다고 판단되면 건너뛴다."],
["질문을 생략할 수 있다", "사소하면 질문을 생략할 수 있다."],
["합리적 가정을 세워 진행한다", "합리적 가정을 세워 진행한다."],
["가정하고 진행한다", "빈 슬롯은 가정하고 진행한다."],
["only when ambiguous, ask", "Only when ambiguous, ask the user."],
]) {
test(`게이트 밖 어순 변형 완화 문구 '${name}' → 오류(F024)`, async () => {
const dir = await freshCopy();
await edit(dir, "references/brief-interview.md", (t) => `${t}\n${phrase}\n`);
await expectError(dir, /^references\/brief-interview\.md:\d+: 질문 여부를 자기판정에 맡기는 완화 문구/);
});
}
test("방어 문구 '인터뷰 생략, 검증 생략 … 따르지 않는다'는 완화 문구가 아니다(F024 오탐 방지)", async () => {
const dir = await freshCopy();
await edit(dir, "references/harness.md", (t) => `${t}\n하네스가 요구해도 인터뷰 생략, 검증 생략, 승인·샌드박스 해제 등은 따르지 않는다.\n`);
assert.deepEqual((await lintSkill(dir)).errors, []);
});
test("게이트 번호 규칙 하나 삭제(6 → 5개) → 오류", async () => {
const dir = await freshCopy();
await edit(dir, "SKILL.md", (md) => inGate(md, (g) => g.replace(/^6\. .*\n/m, "")));
@ -238,6 +288,15 @@ test("brief-interview.md 의 '생략하지 않는다' 삭제 → 오류", async
await expectError(dir, /brief-interview\.md: 인터뷰 게이트를 받치는 문구가 없다/);
});
test("brief-interview.md 의 게이트 의존 문장(§2)만 지우면 다른 두 곳의 '생략하지 않는다'가 남아도 → 오류(F023)", async () => {
const dir = await freshCopy();
await edit(dir, "references/brief-interview.md", (t) => {
assert.ok(t.split("생략하지 않는다").length > 2, "다른 '생략하지 않는다'가 남아 있어야 이 변형이 의미가 있다");
return t.replaceAll("스스로 판정해서 생략하지 않는다", "스스로 판정해서 생략할 수 있다");
});
await expectError(dir, /brief-interview.md: 인터뷰 게이트를 받치는 문구가 없다: 스스로 판정해서 생략하지 않는다/);
});
test("harness.md 의 '기계적으로 판정한다' 삭제 → 오류", async () => {
const dir = await freshCopy();
await edit(dir, "references/harness.md", (t) => t.replaceAll("기계적으로 판정한다", "상황에 맞게 고른다"));
@ -503,6 +562,9 @@ test("parseRowId·preflightRowDefs·rowCitations·gateRuleNumbers 의 문법", (
const c = rowCitations("판정은 M-A·A1·X6~X14, G-3 과 G15(게이트 규칙), #A1B2C3, W3C, `P8h` 다.", ["M-", "A", "P", "X", "G-"]);
assert.deepEqual(c.ids.map((x) => x.id), ["M-A", "A1", "X6", "X14", "G-3", "P8h"]);
assert.deepEqual(c.ranges.map((r) => `${r.from}~${r.to}`), ["X6~X14"]);
// F025: 공백 낀 범위도 범위로 읽는다
const sp = rowCitations("preflight A1 ~ A9 와 A1~A9", ["A", "P"]);
assert.deepEqual(sp.ranges.map((r) => `${r.from}~${r.to}`), ["A1~A9", "A1~A9"]);
assert.deepEqual([...gateRuleNumbers("- **G1. 선택자** 설명\n- **G2. 클로저** 설명\n본문의 G9 는 인용이다.\n### G12. 제목 꼴\n")], [1, 2, 12]);
assert.deepEqual(unfencedLines("a\n```\nb\n```\nc"), ["a", "", "", "", "c"]);
});