fix(tests): fix version assertion and ask-user TS type error - #65
fix(tests): fix version assertion and ask-user TS type error#65ldangelo wants to merge 8 commits into
Conversation
…ases Adds PRD and TRD for replacing opus/sonnet/haiku aliases with high/medium/low tier aliases backed by a project-level .claude/ensemble-model-config.json file. Includes /ensemble:map-model wizard and /ensemble:migrate-model-config commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… schema, config-loader, model-resolver - Add packages/core/lib/known-model-ids.js: frozen KNOWN_MODEL_IDS array (single source of truth) - Add schemas/ensemble-model-config-schema.json: JSON Schema draft-07 for .claude/ensemble-model-config.json - Rewrite packages/core/lib/config-loader.js: findProjectRoot, getProjectConfigPath, getDefaultConfig (tiers: high/medium/low), validateConfig (rejects legacy opus/sonnet/haiku keys), loadConfig (project-local file), checkLegacyXdgFile (one-time migration warning), emitFirstRunHint (first-run sentinel) - Rewrite packages/core/lib/model-resolver.js: PreflightError, preflightValidate, resolveModel, selectModel (ENSEMBLE_MODEL_OVERRIDE must be tier alias; legacy aliases and raw model IDs rejected) - Update packages/core/lib/index.js: export new tier-based APIs alongside existing exports - Add/update all tests: known-model-ids, schema, config-loader (incl. TRD-006 first-run hint), model-resolver, usage-logger (self-contained config), integration suite - Close beads: cow2, aecg, wkad, 22ic, 7xe6, 0ez5, 6bd2, onms, 0cez, ropv, u4ir, s2z9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…migration, YAML migration, agent tier assignments - Update command-yaml-schema.json model enum: opus/sonnet/haiku → high/medium/low - Add optional model field to agent-yaml-schema.json metadata properties - Migrate 7 command YAMLs: opus → high (configure-team, create-trd-foreman, create-trd, refine-trd, refine-prd, feature, create-prd) - Migrate 11 command YAMLs: sonnet → medium (discover-standards, inject-standards, analyze-requirements, beads-build, beads-plan, fix-issue, implement-bead, implement-trd, requirement-status, implement-trd-beads, validate-requirements) - Migrate inline model refs in fix-issue.yaml: haiku → low, sonnet → medium - Add model: high to 9 high-tier agent YAMLs (ensemble-orchestrator, tech-lead-orchestrator, product-management-orchestrator, qa-orchestrator, infrastructure-orchestrator, code-reviewer, deep-debugger, agent-meta-engineer, release-agent) - Add model: medium to 15 medium-tier agent YAMLs (backend-developer, frontend-developer, infrastructure-developer, documentation-specialist, api-documentation-specialist, postgresql-specialist, helm-chart-specialist, build-orchestrator, deployment-orchestrator, playwright-tester, test-runner, github-specialist, git-workflow, manager-dashboard-agent, general-purpose) - Add model: low to 3 low-tier agent YAMLs (file-creator, context-fetcher, directory-monitor) - Update 18 generated .md frontmatter files to match YAML sources Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…igrator, command definitions - Add map-model-wizard.js with runWizard (TTY interactive), runOneShotUpdate (non-interactive), and writeConfigAtomic helper - Add legacy-config-migrator.js with findLegacyConfig, migrateLegacyConfig (opus→high, sonnet→medium, haiku→low mapping, commandOverrides/costTracking warnings) - Add map-model.yaml and migrate-model-config.yaml command definitions with generated .md files - Add 22 tests covering writeConfigAtomic, runOneShotUpdate, runWizard TTY detection, findLegacyConfig, and migrateLegacyConfig edge cases - BYPASS_COMMANDS in config-loader.js already included both map-model and migrate-model-config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ELOG, README, usage-logger cleanup - TRD-019: Add scripts/lint-model-ids.js — scans all command/agent YAMLs, validates model: values against KNOWN_MODEL_IDS + tier aliases, exits 0/1 - TRD-019-TEST: Add scripts/tests/lint-model-ids.test.js — unit tests for extractModelValue and integration test for exit codes - TRD-020: Add lint:model-ids script to root package.json; integrate into validate chain - TRD-020-TEST: Smoke test confirmed — 58 files scanned, exit 0 on clean codebase - TRD-021: Add [5.0.0] breaking-change entry to packages/core/CHANGELOG.md - TRD-022: Add "Model Tier Configuration" section to root README.md - TRD-023: Update usage-logger.js — hardcoded XDG log path, remove costTracking guard, MODEL_PRICING updated to current model IDs - TRD-023-TEST: Rewrite usage-logger.test.js for new API (always-log, new model IDs, new tier aliases) - All TRD-001 through TRD-023-TEST checkboxes marked complete in TRD Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…loper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update version assertion in auto-team-trd-parser.test.js from 2.12.0 to 2.13.0 to
match the current implement-trd-beads.yaml metadata version. Fix TS2322 type error in
ask-user.ts by replacing the JSON Schema object structure with the flat Record<string,
{ type; description }> shape required by ExtensionAPI.parameters.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code ReviewOverviewThe PR title says "fix version assertion and ask-user TS type error" and the description lists only two small bug fixes, but the actual diff is 99 files, +4 308 / -766 lines — it implements an entirely new Tiered Model Aliases feature (PRD/TRD-2026-021). The two stated fixes are included, but they are minor relative to the bulk of this PR. Reviewers should be aware of the true scope before approving. 🔴 Critical1. Runtime state files committed to git (
2. In const BYPASS_COMMANDS = ['map-model', 'migrate-model-config'];In function preflightValidate(config, commandName) {
if (BYPASS_COMMANDS.includes(commandName)) { return; }
...
}But the command YAML declares const BYPASS_COMMANDS = ['map-model', 'migrate-model-config', 'ensemble:map-model', 'ensemble:migrate-model-config'];🟡 High3.
4. Test duplicates the function it's testing
// --- Replicated helpers (must stay in sync with lint-model-ids.js) ---
function extractModelValue(yamlContent) { ... }The comment "must stay in sync" is a maintenance smell. The fix is to export helpers from the script using a guard: // in lint-model-ids.js
if (require.main === module) { main(); }
module.exports = { extractModelValue, findYamlFiles, collectYamlFiles };This lets tests import the real functions instead of duplicating them. 🟠 Medium5. "tiers": { "additionalProperties": false }, // strict
...
"additionalProperties": true // root: permissiveA typo like 6. The migrator conceptually has no dependency on the interactive wizard; it imports 7. The 🟢 Low / Suggestions8.
9. Mass YAML regeneration obscures the meaningful diff ~60 agent/command YAML files were bulk-updated solely to rename ✅ What's Good
SummaryThe implementation quality of the tiered model aliases feature is generally solid, but items #1 ( |
|
Closing — branch was accidentally created from feature/trd-2026-021-tiered-model-aliases instead of main. Recreating with only the two targeted fixes. |
Summary
packages/development/tests/auto-team-trd-parser.test.jsfrom2.12.0to2.13.0to match the currentimplement-trd-beads.yamlmetadata versionTS2322type error inpackages/pi/extensions/ask-user.tsline 30 by replacing the JSON Schema wrapper object ({ type: 'object', properties: {...}, required: [...] }) with the flatRecord<string, { type: string; description: string }>shape required by theExtensionAPI.parametersinterfaceRoot Cause
Failure 1:
implement-trd-beads.yamlwas bumped to2.13.0without updating the version assertion in the corresponding test.Failure 2:
ask-user.tsused a JSON Schema-styleparametersobject with atype: 'object'wrapper. TheExtensionAPIinterface and the test both expect a flat map of parameter names to{ type, description }descriptors.Test plan
auto-team-trd-parser.test.jspasses with the updated2.13.0assertionask-user.test.tspasses withcapturedConfig.parameters.question.type === 'string'resolving correctly🤖 Generated with Claude Code