fix(scripts): read Claude model ids from catalog row id field
Fixes #6310.
Problem
scripts/check-claude-code-model-support.mjs:81 filtered Object.keys(catalog["anthropic-messages"]) with id.startsWith("claude-"), but catalog keys are now chat:<id> (chat:claude-fable-5-1), so the list was always empty and --strict could never fail.
Fix
- New exported
catalogClaudeIds(catalog): ids come from the row'sidfield (falling back to the key with thechat:prefix stripped), restricted to chat rows (rowtype === "chat"or achat:-prefixed key). - The script only runs its CLI when invoked as the entry point, so tests can import
catalogClaudeIdswithout executing a check. - Test-only env hooks (
SENPI_CHECK_CATALOG_PATH/SENPI_CHECK_BINARY_PATH) let the colocated test drive--strictagainst a fixture catalog/binary.
Evidence (RED -> GREEN)
RED (pre-fix, main 53f3de9a19, SDK pin 0.3.321, fixture binary holding only the control id claude-sonnet-4-5):
check-claude-code-model-support: Claude Code of @anthropic-ai/claude-agent-sdk 0.3.321 knows all 0 catalog Claude ids.
exit 0 — the vacuous pass from #6310, reproduced.
GREEN (post-fix, same fixture binary, real catalog with 18 ids):
check-claude-code-model-support: Claude Code of @anthropic-ai/claude-agent-sdk 0.3.321 does not know 17 catalog id(s): claude-fable-5, claude-fable-5-1, ... claude-sonnet-5-5.
--strict exits 1. (The 17-missing list is against the control-only fixture binary, not the real SDK binary; the real-binary verdict comes from the model-catalog-regen job.)
New scripts/check-claude-code-model-support.test.mjs (4 tests): fixture catalog yields the 3 bare chat ids, real catalog yields a non-zero count (18), --strict exits 1 naming the absent ids, exits 0 when the fixture binary knows all ids — node --test 4/4 pass. Adjacent script tests (release-artifacts, claude-sdk-platform-lock) pass 13/13 total. node scripts/check-pr-changelog.mjs --base origin/main passes locally (fork-only script path, no fragment needed).
Not run locally: full bun run check (no node_modules in this checkout) — CI covers it.
Summary by cubic
Fixes scripts/check-claude-code-model-support.mjs so --strict fails when the bundled Claude Code binary misses catalog model ids, and refuses to pass when the catalog yields no Claude ids at all.
Catalog keys now carry a chat: prefix, so the old claude- key filter matched nothing and the check always passed vacuously. The new exported catalogClaudeIds reads bare ids from the row's id field (falling back to the key with chat: stripped), restricted to chat rows. An empty result now prints an error and exits non-zero in both --strict and report mode instead of reporting "knows all 0 catalog Claude ids".
- The script only runs its CLI when invoked as an entry point, so tests can import
catalogClaudeIdswithout executing a check. - Test-only env hooks (
SENPI_CHECK_CATALOG_PATH/SENPI_CHECK_BINARY_PATH) let the colocated test drive--strictagainst fixture catalogs and binaries. - Adds
changes/unreleased/6586.mddocumenting the empty-catalog refusal.