Backfill coverage gaps closed by the gate - #288
Conversation
…nally disabled) Removes header.rb's width_box, dead since PR #159 (2021) replaced its only bounding_box call site with individual text_box/move_down calls without removing the method itself. Adds specs for the method_missing/respond_to_missing? delegation fallback in the 3 Document wrapper classes (nfce_lib, cce_lib, nfe_lib) - each mutation-tested locally to confirm it fails when the real `super` fallback is broken. Excludes lib/prawn/ from SimpleCov, alongside the existing spec/support/ exclusion: it's a Prawn-internals monkey-patch, not br_danfe's own product logic. The nfe_lib delegation spec is deliberately commented out in this commit to prove the coverage gate (PR #286) actually catches a real gap on live CI, not just locally. Follow-up commit re-enables it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Coverage report
|
Proves couve's changed-files gate actually flags a real regression when the file with the uncovered lines is part of the diff, unlike the previous commit where only the spec file was touched and the source file's regression was invisible to the gate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The gate verification is complete: the previous commit proved couve stayed silent when only the spec file was in the diff, and the one before that proved it fails for real once the source file is also touched. Back to the intended final state - 100% coverage, gate green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Verificação ao vivo do gate — dois experimentosAntes de fechar esta PR, testamos de propósito o comportamento do gate ( Experimento 1 — só a spec comentada, sem tocar na implementaçãoCommit Por quê: Experimento 2 — tocando a implementação tambémCommit Commit Limitação que isso revela (não é bug, é o design)O gate protege "o arquivo que esta PR está tocando", não "tudo que esta PR afeta". É possível remover/desabilitar um teste sem tocar no arquivo de produto que ele cobria, e o gate não vai perceber — a regressão só aparece quando outra PR futura tocar aquele mesmo arquivo. O |
Resumo
Quarta PR da série de migração qlty → couve (empilhada sobre #286). Fecha os 5 gaps de cobertura que o gate (
--fail-on-low-coverage) apontou.O que muda
lib/br_danfe/danfe_lib/nfce_lib/header.rb— removewidth_box, morto desde a PR Shrink licensee name to fit #159 (2021), que trocou o único call site (bounding_box(width: width_box, ...)) por chamadas individuais detext_box/move_downsem remover o método. Confirmado viagit log/git blameque não é bug latente, é código órfão de verdade.spec/br_danfe/{cce_lib,danfe_lib/nfce_lib,danfe_lib/nfe_lib}/document_spec.rb— specs novas para o fallbackmethod_missing/respond_to_missing?das 3 classesDocument(delegação pro Prawn subjacente). Cada uma foi mutation-tested localmente: quebrei osuperreal (trocando pornil/true) e confirmei que a spec nova reprova — não é um passe vazio.spec/spec_helper.rb— excluilib/prawn/do SimpleCov, ao lado da exclusão já existente despec/support/: é um monkey-patch dos internals do Prawn (cache de largura de fonte), não lógica própria dobr_danfe.Prova ao vivo de que o gate funciona
Este commit está deliberadamente incompleto: a spec de delegação do
nfe_lib/document_spec.rbestá comentada, para provar que o gate (PR #286) reprova de verdade no CI, e não só localmente. Coverage local com isso: 99,94% (295 examples, 0 failures — os testes passam, só a cobertura cai). Um commit de follow-up vai reativar a spec e confirmar o CI virar verde.O que NÃO muda
Plano de teste
bundle exec rspeclocal: 297 examples, 0 failures, 100% no estado finalbundle exec rubocop --display-cop-names --parallellocal: sem ofensassuperreal é quebrado🤖 Generated with Claude Code