Skip to content

Test Coverage Gaps: Avatars, Rate Limits, Payments, and test-runner.md sync #84

Closed

Description

@vybe

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 PNG
  • POST /api/agents/{name}/avatar/generate — Generate avatar
  • DELETE /api/agents/{name}/avatar — Remove avatar
  • GET /api/agents/{name}/avatar/reference — Serve reference image
  • POST /api/agents/{name}/avatar/regenerate — Variation from reference
  • GET /api/agents/{name}/avatar/emotions — List emotion variants
  • GET /api/agents/{name}/avatar/emotion/{emotion} — Serve emotion PNG
  • POST /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_avatar flag)
  • Avatar prompt seeding from template.yaml avatar_prompt field
  • 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_type and error_message fields on ExecutionMetadata
  • Rate limit detection in both /api/chat and /api/task modes

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:

  1. Test count: Says ~649, actual is ~2,092
  2. 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
  3. Known Issues date: Still says 2026-02-20
  4. SUB-001 references: Should reflect SUB-002 rewrite
  5. Smoke test count: Documented as ~196, likely higher now
  6. Recent Test Additions section: Missing entries for March 2026

Acceptance Criteria

  • test_avatars.py created with 40+ tests
  • SUB-002 rate limit tests added (8+ tests)
  • NVM-001 payment flow tests added (10+ tests)
  • test-runner.md updated with accurate counts and all test files
  • All new tests pass in Tier 2 (core) run
  • Known Issues table updated with current state

Activity

  1. added
    priority-p1
    type-bug
    status-in-progress
    on Mar 9, 2026
  2. self-assigned this
    on Mar 14, 2026
  3. added a commit that references this issue on Mar 14, 2026
  4. added
    complexity-medium
    on Jun 3, 2026
  5. removed
    status-in-progress
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumpriority-p1type-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions