Skip to content

test(backend): elevar cobertura de testes para 99%#89

Merged
lucasbrentano merged 3 commits intodevfrom
quality/fase-1-backend-coverage
Apr 8, 2026
Merged

test(backend): elevar cobertura de testes para 99%#89
lucasbrentano merged 3 commits intodevfrom
quality/fase-1-backend-coverage

Conversation

@lucasbrentano
Copy link
Copy Markdown
Collaborator

Resumo

  • 158 testes novos (184 → 342 total), cobertura de 89% → 99%
  • Threshold do CI elevado de 80% para 90% no .coveragerc
  • Módulos que estavam abaixo de 50% agora em 100%: services/collect.py, services/youtube.py, services/seed.py, services/clean/identical.py
  • Novo arquivo tests/test_seed.py com 7 testes
  • Skill .claude/skills/quality-security.md com roadmap de qualidade (fases 2-5 em backlog)

Como testar

  • cd backend && source .venv/bin/activate
  • DATABASE_URL=... pytest -v — 342 testes passando
  • DATABASE_URL=... pytest --cov=. --cov-report=term-missing — 99% cobertura
  • ruff check . && ruff format --check . — limpo

lucasbrentano and others added 3 commits April 8, 2026 16:07
- test_collect: +70 testes cobrindo enrich (3 fases), import/export,
  next-page, _parse_youtube_error, youtube.py wrappers, CSV/JSON streaming
- test_clean: +18 testes cobrindo IdenticalSelector, ProfileSelector,
  import_dataset, import_chunk, _build_selector, thresholds
- test_annotate: +12 testes cobrindo is_admin branch, conflict reopening,
  get_all_progress, import_chunk, export com dataset_id
- test_review: +18 testes cobrindo video_id filter, export consensus,
  resolve edge cases, import_chunk, _find_dataset_for_comment
- test_auth: +7 testes cobrindo token expirado, JWT inválido, usuário
  inativo/inexistente, refresh com user deletado, logout
- test_seed: arquivo novo com 7 testes cobrindo run_seed, delete_seed,
  seed duplicado (409), requires admin
- test_dashboard: +10 testes cobrindo filtros de bots, text truncation,
  pre-1970 date, single-label consensus
- test_data: +2 testes cobrindo pg_total_relation_size exception
- test_users: +1 teste cobrindo reactivate user inexistente
- .coveragerc: threshold elevado de 80% para 90%

Co-Authored-By: Claude <noreply@anthropic.com>
- Mapeia 5 fases: cobertura backend, OWASP, frontend, E2E, monitoramento
- Detalha testes por categoria OWASP Top 10
- Define setup Vitest, Playwright e Sentry
- Inclui ordem de execução e dependências

Co-Authored-By: Claude <noreply@anthropic.com>
- Mapeia fases 2-5 pendentes (OWASP, frontend, E2E, monitoramento)
- Lista categorias OWASP Top 10 com status
- Inclui itens de monitoramento e evolução futura

Co-Authored-By: Claude <noreply@anthropic.com>
@lucasbrentano lucasbrentano merged commit 9e552c2 into dev Apr 8, 2026
3 checks passed
@lucasbrentano lucasbrentano deleted the quality/fase-1-backend-coverage branch April 8, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant