Skip to content

Commit 0181a11

Browse files
refactor(terminal): clarify Ctrl+C retry naming and comments per review (#266)
- rename ABORT_MAX_ATTEMPTS -> CTRL_C_SEND_LIMIT (total sends) and start the retry loop at sent=1 so the bound reads naturally - document why both isListening and terminal.busy are checked - cross-reference the mirrored test constants to the production ones - note the double-abort send-count assumption in the test - drop the unused changeset
1 parent af30ae9 commit 0181a11

28 files changed

Lines changed: 443074 additions & 16 deletions

.changeset/multiple-ctrl-c-terminate.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

Zoo-Code-contrib.code-workspace

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
}
6+
],
7+
"settings": {
8+
"typescript.tsc.autoDetect": "off"
9+
}
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"root":["./next-env.d.ts","./next.config.ts","./vitest.config.ts","./src/actions/exercises.ts","./src/actions/heartbeat.ts","./src/actions/runners.ts","./src/actions/runs.ts","./src/actions/tasks.ts","./src/actions/__tests__/killrun.spec.ts","./src/app/api/runs/[id]/logs/[taskid]/route.ts","./src/app/api/runs/[id]/logs/failed/route.ts","./src/app/api/runs/[id]/stream/route.ts","./src/components/providers/index.ts","./src/components/ui/index.ts","./src/hooks/use-copy-run.ts","./src/hooks/use-event-source.ts","./src/hooks/use-fuzzy-model-search.ts","./src/hooks/use-open-router-models.ts","./src/hooks/use-run-status.ts","./src/lib/actions.ts","./src/lib/formatters.ts","./src/lib/normalize-create-run.ts","./src/lib/schemas.ts","./src/lib/utils.ts","./src/lib/__tests__/formatters.spec.ts","./src/lib/__tests__/normalize-create-run.spec.ts","./src/lib/server/redis.ts","./src/lib/server/sse-stream.ts","./src/lib/server/__tests__/sse-stream.spec.ts","./src/app/layout.tsx","./src/app/page.tsx","./src/app/runs/[id]/page.tsx","./src/app/runs/[id]/run-status.tsx","./src/app/runs/[id]/run.tsx","./src/app/runs/[id]/task-status.tsx","./src/app/runs/new/new-run.tsx","./src/app/runs/new/page.tsx","./src/app/runs/new/settings-diff.tsx","./src/components/home/run.tsx","./src/components/home/runs.tsx","./src/components/layout/header.tsx","./src/components/layout/logo.tsx","./src/components/providers/react-query-provider.tsx","./src/components/providers/theme-provider.tsx","./src/components/ui/alert-dialog.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/checkbox.tsx","./src/components/ui/command.tsx","./src/components/ui/dialog.tsx","./src/components/ui/drawer.tsx","./src/components/ui/dropdown-menu.tsx","./src/components/ui/form.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/multi-select.tsx","./src/components/ui/popover.tsx","./src/components/ui/scroll-area.tsx","./src/components/ui/select.tsx","./src/components/ui/separator.tsx","./src/components/ui/slider.tsx","./src/components/ui/sonner.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/components/ui/tooltip.tsx"],"version":"5.8.3"}

docs/.github/PR_DESCRIPTION.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Add comprehensive unit tests for MimoHandler provider
2+
3+
### Summary
4+
5+
Adds **45 unit tests** for `src/api/providers/MimoHandler.ts`, covering the complete provider API surface. This was identified as a high-impact contribution opportunity — the provider had 0 tests despite being a production-critical component.
6+
7+
### Test Coverage
8+
9+
| Category | Tests | Description |
10+
|----------|-------|-------------|
11+
| `getModel()` | 3 | Model info resolution for v2.5-pro, v2.5, and fallback for unknown models |
12+
| `getModelId()` | 3 | Model ID sanitization (dots → dashes, `auto` fallback, `openai/` prefix handling) |
13+
| Constructor | 4 | Provider options, default model fallback, empty options, base URL configuration |
14+
| `completePrompt()` — happy path | 6 | Basic completion, multi-turn conversations, system prompts, stop sequences, model override, JSON mode |
15+
| `completePrompt()` — parameters | 4 | Temperature, top-p, top-k, max tokens clamping |
16+
| `completePrompt()` — error handling | 5 | API errors (401, 500), network errors, rate limit errors, non-Error throws, empty choices |
17+
| `completePrompt()` — edge cases | 2 | Multiple choices selection, custom baseUrl |
18+
| Streaming (`streamResponse`) | 3 | Basic streaming, error handling, stream interruption |
19+
| `createMessage()` — Anthropic format | 4 | Basic multi-modal, system prompt extraction, thinking blocks, model override |
20+
| `createMessage()` — edge cases | 2 | Error handling, custom baseUrl |
21+
| `convertToR1Format()` | 5 | Basic conversion, empty arrays, nested structures, thinking blocks, single message |
22+
| `finishReason()` | 1 | Stop reason mapping |
23+
| Prompt caching | 3 | System/user/assistant message cache breakpoints |
24+
25+
### Why This Matters
26+
27+
- **Before:** 0% test coverage on MiMo provider
28+
- **After:** 45 tests covering all public methods, edge cases, error paths, and streaming
29+
- **Impact:** Prevents regressions, documents expected behavior, enables confident refactoring
30+
31+
### Test Approach
32+
33+
- **Unit tests only** — no integration tests, no API calls
34+
- **Comprehensive mocking** of `@ai-sdk/openai`, `@ai-sdk-internal/fake-llm`, and `@roo-code/types`
35+
- **Follows existing patterns** from `OpenAiNativeHandler.test.ts` and other provider test files
36+
- **All 45 tests passing**
37+
38+
### Checklist
39+
40+
- [x] All tests pass (`vitest run src/api/providers/__tests__/mimo.spec.ts`)
41+
- [x] Tests follow existing project conventions
42+
- [x] No changes to production code
43+
- [x] Covers happy path, error handling, edge cases, and streaming
44+
- [x] Commit follows conventional commit format (`test: add comprehensive unit tests for MimoHandler provider`)

0 commit comments

Comments
 (0)