openpencil/scripts/ab-corpus
Fini bd370bd5b8 fix(ab-corpus): keep applying composite tags past per-shape failures
Codex stop-time review caught the previous commit (113bd55a) message
overstating apply.ts's behavior — I claimed "scripts/ab-corpus/apply
both catch per-shape and keep running the remaining tags" but the
loop at line 55 had no inner try/catch. A single throw from any
handleElementToolCall (e.g. the heading invalid-level reject 113bd55a
just added) would bubble up through the outer try at line 40 and
return early, dropping every remaining tag in a composite batch on
the floor — gpt-5.4's 13-tag team-people-page response would lose
tags 12-13 instead of just tag 12.

Wraps each handleElementToolCall in its own try/catch + accumulates
failures into a per-shape list. ELEMENT_TOOL_NAMES miss is also a
push-and-continue (was a return). When `failures.length > 0` we
return ok:false with a message listing every failed tag, AND the
partial PenDocument that DID land — so M3 (role coverage) can still
score the 11 tags that worked. M1 stays strict (any failure → false).

Mirrors apps/web/src/services/ai/element-tools-dispatcher::
dispatchElementToolCalls's "collect-errors-keep-going" semantics —
production already worked this way; ab-corpus now does too.

3772 vitest pass, format clean, tsc silent. Existing dry-run + live
sweeps exercise the path; a focused apply.ts unit test would need
pen-mcp setup that the harness's existing build-prompt test sidesteps,
so leaving that as a followup.
2026-04-29 09:49:55 +08:00
..
__tests__ fix(ab-corpus): preserve markdown structure across kept @domain blocks 2026-04-29 09:49:50 +08:00
clients feat(ab-corpus): bump minimax max_tokens to 8192 (defensive) 2026-04-29 09:49:48 +08:00
apply.ts fix(ab-corpus): keep applying composite tags past per-shape failures 2026-04-29 09:49:55 +08:00
build-prompt.ts fix(ab-corpus): preserve markdown structure across kept @domain blocks 2026-04-29 09:49:50 +08:00
measure-prompt-sizes.ts feat(ab-corpus): per-domain cookbook filter (Phase 2 of token diet) 2026-04-29 09:49:49 +08:00
real-model.ts feat(ab-corpus): per-domain cookbook filter (Phase 2 of token diet) 2026-04-29 09:49:49 +08:00
run.ts feat(ab-corpus): bootstrap ab-v3 with token cost + composite difficulty 2026-04-29 07:45:00 +08:00
stub-model.ts fix(ai-skills): drop invalid section_header subtitle from cookbook + stubs 2026-04-29 09:49:40 +08:00
write-report.ts feat(ab-corpus): bootstrap ab-v3 with token cost + composite difficulty 2026-04-29 07:45:00 +08:00