Repository navigation
Description
Summary
Test coverage audit (2026-03-09) identified significant gaps in API test coverage for recent features. The test-runner.md agent doc is also stale and undercounts tests (~649 documented vs ~2,092 actual).
Critical Gaps
1. Avatar Generation (AVATAR-001/002/003) — NO TESTS
Severity: High — 3-part feature, 8 endpoints, zero test coverage
Untested endpoints:
GET /api/agents/{name}/avatar— Serve cached PNGPOST /api/agents/{name}/avatar/generate— Generate avatarDELETE /api/agents/{name}/avatar— Remove avatarGET /api/agents/{name}/avatar/reference— Serve reference imagePOST /api/agents/{name}/avatar/regenerate— Variation from referenceGET /api/agents/{name}/avatar/emotions— List emotion variantsGET /api/agents/{name}/avatar/emotion/{emotion}— Serve emotion PNGPOST /api/agents/avatars/generate-defaults— Admin bulk generation
Tests needed (~40-50):
- Auth requirements on all endpoints
- Avatar generation (mock Gemini, verify disk write)
- Avatar serving (cache-busting, 404 when missing)
- Reference image system (save, serve, regenerate variation)
- Emotion variants (list, serve, cleanup on delete)
- Default avatar generation (admin-only, skip custom,
is_default_avatarflag) - Avatar prompt seeding from
template.yamlavatar_promptfield - Cleanup on agent delete (base + emotions + reference)
- Rename handling (file rename for base + emotions + reference)
- Identity prompt CRUD (
GET/POST /avatar/identity)
New file: tests/test_avatars.py
2. Subscription Rate Limit Errors (SUB-002) — NO TESTS
Severity: High — User-facing error handling with zero coverage
Untested functionality:
_is_rate_limit_message()detection from stream-json output_format_rate_limit_error()message formatting- HTTP 429 passthrough in
src/backend/routers/chat.py error_typeanderror_messagefields onExecutionMetadata- Rate limit detection in both
/api/chatand/api/taskmodes
Tests needed (~8-10):
- Rate limit message detection (positive/negative cases)
- Error message formatting includes reset time
- 429 status preserved from agent → backend → client
- ExecutionMetadata includes error_type/error_message fields
Add to: tests/test_subscriptions.py or new tests/test_rate_limits.py
3. Nevermined Payments (NVM-001) — PARTIAL
Severity: Medium — 11 tests exist for permissions, but payment flow untested
Existing: tests/test_nevermined_permissions.py (11 tests, auth/permissions only)
Missing:
-
POST /api/paid/{agent_name}/chat— 402 response when no payment header -
GET /api/paid/{agent_name}/info— Public info response structure - 403 response for invalid payment token
- Settlement retry endpoint
- Settlement failure listing (admin)
Tests needed (~10-15): add to existing file or new tests/test_nevermined_payments.py
Stale Known Gaps (from test-runner.md, still open)
-
test_tags.py(ORG-001) — ~20 tests needed for tag CRUD, validation, filtering -
test_system_views.py(ORG-001) — ~15 tests needed for view CRUD, agent_count -
test_trinity_connect.py— WebSocket auth, event filtering, protocol tests
test-runner.md Sync Required
The .claude/agents/test-runner.md file is out of date:
- Test count: Says ~649, actual is ~2,092
- Missing test file entries:
test_dynamic_thinking_status.py,test_model_selection.py,test_monitoring.py,test_operator_queue.py,test_agent_rename.py,test_playbooks.py,test_image_generation.py,test_nevermined_permissions.py - Known Issues date: Still says 2026-02-20
- SUB-001 references: Should reflect SUB-002 rewrite
- Smoke test count: Documented as ~196, likely higher now
- Recent Test Additions section: Missing entries for March 2026
Acceptance Criteria
-
test_avatars.pycreated with 40+ tests - SUB-002 rate limit tests added (8+ tests)
- NVM-001 payment flow tests added (10+ tests)
-
test-runner.mdupdated with accurate counts and all test files - All new tests pass in Tier 2 (core) run
- Known Issues table updated with current state
Activity
feat: Add test coverage for avatars, rate limits, and payments (#84)
Merge pull request #130 from Abilityai/feature/84-test-coverage-gaps
fix(security): patch 4 Dependabot alerts — happy-dom + vite (#486)
docs(planning): #408 dissolution gated on #428, not #306 (re-audit) (#…
Release: v0.5.0 (#608)