fix: judge evidence alt text with asset metadata, not syntax

The parser has no asset catalogue, so it cannot know whether an
evidence figure is decorative. Move the empty-alt rejection from
parse-time (a syntax error) to publish validation, where the mock
treats static evidence assets as decorative: false since the static
registry predates the Asset capability. The real rule is that the
server judges alt against Asset.decorative.
This commit is contained in:
DongHyeonka
2026-08-18 03:33:19 +09:00
parent 35cc5c868a
commit 0c071aaabc
3 changed files with 34 additions and 1 deletions
@@ -138,6 +138,32 @@ describe("Content Format v1", () => {
]);
});
it("parses a decorative evidence figure with an empty alt", () => {
const source =
':::evidence key="fetch-strategy-boundary" alt="" caption="" zoom="false"\n:::';
const [block] = parseCaseContent(source);
expect(block?.type).toBe("EVIDENCE_FIGURE");
if (block?.type !== "EVIDENCE_FIGURE") return;
expect(block.alt).toBe("");
});
it("round-trips an empty alt without reintroducing it as a parse error", () => {
const source =
':::evidence key="fetch-strategy-boundary" alt="" caption="" zoom="false"\n:::';
const parsed = parseCaseContent(source);
expect(() => parseCaseContent(serializeCaseContent(parsed))).not.toThrow();
});
it("still rejects an unsafe evidence key", () => {
expect(() =>
parseCaseContent(
':::evidence key="../etc" alt="x" caption="" zoom="false"\n:::',
),
).toThrow(/CONTENT_FORMAT_INVALID/);
});
it("derives stable table column and row IDs", () => {
const [table] = parseCaseContent(`:::table id="metrics" caption="측정" rowHeaderColumn="none"
| 이름 | 수치 |