diff options
Diffstat (limited to '.rules/plan/16-20-retarget-misc-specs.md')
| -rw-r--r-- | .rules/plan/16-20-retarget-misc-specs.md | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/.rules/plan/16-20-retarget-misc-specs.md b/.rules/plan/16-20-retarget-misc-specs.md new file mode 100644 index 0000000..6f5a631 --- /dev/null +++ b/.rules/plan/16-20-retarget-misc-specs.md @@ -0,0 +1,132 @@ +# Phase 16 — Retarget miscellaneous specs + +**Estimated time:** ~20 minutes +**Touches:** +`spec/dispatch/adapter/minimax/model_catalog_spec.rb`, +`spec/dispatch/adapter/minimax/pricing_table_spec.rb`, +`spec/dispatch/adapter/minimax/errors_spec.rb`, +`spec/dispatch/adapter/minimax/strict_fallback_spec.rb`, +`spec/dispatch/adapter/minimax/http_client_spec.rb`, +`spec/dispatch/adapter/minimax/rate_limiter_spec.rb`, +`spec/dispatch/adapter/minimax_spec.rb` (the main top-level spec). + +## Goal + +Update the remaining smaller specs so the suite passes end to end. Most +of these are mechanical: rename Claude → MiniMax, update model ids, +fixture-derived assertions, and remove references to deleted code. + +## Pre-reading + +Read each file briefly before editing. They are smaller than the chat +specs from phase 15 — most are 50–200 lines. + +## Per-file changes + +### model_catalog_spec.rb + +- Replace every Claude model id with a MiniMax id (`MiniMax-M2.7`, + etc.). +- Update `supports_vision` assertions: now `false` for all MiniMax + models (phase 07). +- Update `max_context_tokens` assertions: now `204_800` for all 7 + models. +- Update pricing assertions: every `*_per_mtok` field is `0.0`. +- Drop the `"(unrated) #{display_name}"` example (phase 07 dropped + that branch). +- Add a test that `build("MiniMax-M2.7")` returns the right + `ModelInfo` shape. +- Add a test that `build_from_api({"id"=>"MiniMax-M2","display_name"=>"M2"})` + uses the display_name as `name`. + +### pricing_table_spec.rb + +- Replace Anthropic model ids with MiniMax ids. +- Assert `lookup("MiniMax-M2.7")` returns a `ModelPricing` with all + four `*_per_mtok` fields equal to `0.0`. +- Assert `context_window("MiniMax-M2.7") == 204_800`. +- Assert `max_output_tokens("MiniMax-M2.7") == 16_384`. +- Assert `known_ids` is an array of exactly the 7 MiniMax model ids. +- DELETE any example that asserted real Anthropic price values. + +### errors_spec.rb + +- Rename `Dispatch::Adapter::ClaudeErrors` references to + `Dispatch::Adapter::MiniMaxErrors`. +- Update `PROVIDER` assertion to `"MiniMax"`. +- Add a test for the new `parse_message` fallback to top-level + `"message"` key (phase 11). +- Keep the existing tests for status-code → exception mapping (401/403 + → AuthenticationError, 429 → RateLimitError, 529 → OverloadedError, + 400/422 → RequestError, 5xx → ServerError, other → Error). +- The `OverloadedError < RateLimitError` test stays. + +### strict_fallback_spec.rb + +- Rename `ClaudeErrors` to `MiniMaxErrors` if referenced. +- Update model ids. +- Add new examples covering the broadened regex patterns from phase + 10: + - `"compiled grammar too large"` → matches. + - `"schema too complex"` → matches. + - `"grammar exceeds maximum size"` → matches. + - `"tool_schema too large"` → matches. + - `"missing required field: messages"` → does NOT match. + - Status 429 with grammar message → does NOT match (status guard). + - Non-`RequestError` exception → does NOT match. + +### http_client_spec.rb + +- Rename `ClaudeErrors` to `MiniMaxErrors` if referenced. +- Replace `https://api.anthropic.com` URLs with + `https://api.minimax.io/anthropic`. +- Drop `claude_code_only` parameter usage if any remains (it should + not — phase 04 removed it). +- Update `Authorization` header expectations to `Bearer <key>`. +- Drop OAuth-token-refresh-related examples (deleted in phase 02; if + any survived, delete them now). + +### rate_limiter_spec.rb + +- This spec exercises the `RateLimiter` class from + `dispatch-adapter-interface`. It probably does NOT have many + Claude/MiniMax-specific assertions. Check: + - The state file path (was `~/.config/dispatch/claude_rate_limit`, + now `~/.config/dispatch/minimax_rate_limit` per phase 02 step 4). + - Update path expectations accordingly. +- Drop any constant references to Claude. + +### minimax_spec.rb (the renamed claude_spec.rb) + +This is the top-level spec for the public class. + +- Rename `Dispatch::Adapter::Claude` → `Dispatch::Adapter::MiniMax` + (should already be done by phase 01; verify). +- Update constructor examples to the new kwargs (`api_key:`, + `key_path:`). +- Add a test that: + - Construction with explicit `api_key:` works. + - Construction with `ENV["MINIMAX_API_KEY"]` set works (stub via + `allow(ENV).to receive(:[]).with("MINIMAX_API_KEY").and_return("k")`). + - Construction with neither raises `ArgumentError`. +- Drop `authenticate!`, `authenticated?`, `logout!`, `usage_report` + examples (these methods were deleted in phase 02). +- Update `DEFAULT_BASE_URL` and `DEFAULT_MODEL` constant assertions. + +## Acceptance criteria + +- ALL spec files in `spec/dispatch/adapter/minimax/` pass cleanly. +- `spec/dispatch/adapter/minimax_spec.rb` passes cleanly. +- No `.skip`, no `.pending` anywhere in the spec suite. +- `grep -rn 'ClaudeErrors\|api.anthropic.com\|claude-sonnet\|claude-3\|sk-ant-oat\|is_oauth\|proxy_\|claude-cli\|x-stainless\|anthropic-beta\|anthropic-version\|X-Api-Key\|usage_report\|authenticate!\|claude_code_only\|interleaved_thinking\|extra_betas' spec/` + returns ZERO matches. +- `bundle exec rubocop --autocorrect-all` exits 0. +- `bundle exec rspec` exits 0 with no skipped or pending examples. + +## Verification + +Run `run_tests` with `project_path=reference/dispatch-adapter-minimax`. +This is the FIRST phase where the entire test suite must pass cleanly. +If anything fails, fix the implementation (or the test if and only if +the test is asserting on something that no longer exists). NEVER +weaken or skip a test to make it green. |
