Repository navigation
Conversation
is_valid_legal_process levantava ValueError quando o número limpo não tinha 20 dígitos ou continha letras, porque os campos TR e OOOO eram convertidos com int() sem validação prévia. Também aceitava como válido um número com dígitos não ASCII, como "٠", que str.isdigit e int aceitam. Agora a função retorna False para qualquer entrada que não seja uma string com exatamente 20 dígitos ASCII depois de remover os símbolos. format_legal_process passa a usar a mesma verificação e retorna None para dígitos não ASCII. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #794 +/- ##
=======================================
Coverage 98.83% 98.84%
=======================================
Files 26 26
Lines 775 781 +6
=======================================
+ Hits 766 772 +6
Misses 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Enforce ASCII-digit input brutils/legal_process.py, tests/test_legal_process.py, CHANGELOG.md |
A shared check requires exactly 20 ASCII digits. The formatter and validator use it to reject malformed input. Tests cover malformed values and valid ASCII-digit input. The changelog records the behavior. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: marcelfox
Merge Risk: 
Minimal · up to 1f969
-
No actionable merge-blocking risk is established for the legal-process input changes. Merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
A implementação atende à issue
#793.is_validretornaFalsepara entradas que não sãostre para valores que, apósremove_symbols, não têm exatamente 20 dígitos ASCII. A validação ocorre antes das conversões comint().format_legal_processusa_is_twenty_digitse retornaNonepara dígitos não ASCII. Os testes cobrem entradas truncadas, letras, dígitos não ASCII,int,Nonee um número ASCII válido.
Full details: Out of Scope Changes check
-
Explanation
As mudanças permanecem no escopo da issue
#793. O código altera somente a validação e a formatação de processos legais. Os testes de regressão e a entrada noCHANGELOG.mddocumentam o comportamento corrigido. Não há mudança não relacionada demonstrada.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai full review |
✅ Action performed
|
Descrição
is_valid_legal_processlevantavaValueErrorquando o número limpo não tinha 20 dígitos ou continha letras, e aceitava como válido um número com dígitos não ASCII (ex.: "٠"). Este PR faz a função retornarFalsenesses casos, como os outros validadores da biblioteca.Mudanças Propostas
_is_twenty_digits, que verifica se a string tem exatamente 20 dígitos ASCII (re.fullmatch(r"\d{20}", ..., flags=re.ASCII)).str.isdigitnão basta porque aceita caracteres como "²" e "٣".is_valid_legal_processretornaFalsepara entradas que não são string e para strings que, sem os símbolos, não têm 20 dígitos ASCII, antes de converter os campos comint().format_legal_processusa a mesma verificação e retornaNonepara dígitos não ASCII.maine passam com a correção.Checklist de Revisão
Declaração de Uso de IA (OBRIGATÓRIA)
Usei o Claude Code (Anthropic) para investigar o bug, escrever a correção e os testes. Revisei o diff e conferi os resultados:
python -m unittest discover tests(178 testes passando),ruff format --check .eruff check .com a versão dopyproject.toml.Comentários Adicionais (opcional)
O PR #743 tratava parte disso, mas foi fechado sem issue associada; este segue o fluxo do CONTRIBUTING, com issue atribuída.
Issue Relacionada
Closes #793
🤖 Generated with Claude Code
Summary by CodeRabbit