Repository navigation
chore(lint): estende no-loose-number, no-raw-cents, no-double-cast e knip a scripts/** - #262
Merged
Merged
Conversation
Scope no-loose-number, no-raw-cents and no-double-cast to scripts/**, add scripts/** to the knip project, and replace the flagged Number() calls and raw cents in the mocks and guard scripts with the src helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard now parses git output with parseInteger, so a change to src/utils/parse.ts changes what the guard reads without any guard file moving. Add it to SECURITY_SURFACES, and add a test that walks the runtime imports of the guard entry points and fails on any module risk.ts does not flag, so the next shared helper cannot slip past. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: ad7575c | Docs | View more details | Give us feedback! |
fm1randa
pushed a commit
that referenced
this pull request
Nov 6, 2026
Resolve the conflicts with #262: check-eslint-disables, private-terms-history and replay-gates keep the scripts/git.ts helpers and the shared parseDiff, which now reads hunk numbers through parseInteger as #262 required of the old parsers. scripts/git.ts and scripts/behavior-change.ts join the security surfaces, since the private-data guard now loads both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
no-loose-number,no-raw-centseno-double-castsó rodavam emsrc/**etest/**, e o knip só olhavabin/**esrc/**. Por issoscripts/**acumulouNumber()frouxo e centavos crus (Math.round(x * 100)) nos mocks e nos scripts do guard, além de exports mortos que ninguém via.Mudança
eslint.config.js: as três regras passam a cobrirscripts/**/*.ts. Nenhuma isenção foi necessária.knip.json:scripts/**/*.tsentra noproject;scripts/mock-api.tsescripts/private-terms-cli.tsentram comoentry, porque overify.shos roda direto e o knip não lê shell.mock-api,mock-entries,mock-cards,mock-balances):parseId. IDs do corpo da requisição passam poridOf, que aceita número JSON ou string de dígitos, porque ocontado create é string (src/types/entry.ts).roundToCents. Campos que já sãonumberno tipo (Entry.conta,Entry.valor) deixam de ser convertidos.requiredNumber/requiredId. Um campo que não é número agora derruba a requisição em vez de ser coerçido em silêncio. Assim uma regressão da CLI que mande"12"no lugar de12aparece no e2e.check-eslint-disables.ts,private-terms.tseprivate-terms-history.ts: os números do cabeçalho do diff e dogit cat-filepassam porparseInteger. Noprivate-terms.ts, um tamanho ilegível agora cai no errounexpected git cat-file headerque já existia, em vez de virarNaN.scripts/**perdem oexport. O código continua lá, só deixa de ser exportado.Escopo
Closes #259
Checklist
GLOSSARY.mdfoi atualizado neste PR. (Não altera termos.)Risco
bun scripts/risk.tsclassifica o PR como arriscado (exit 2) porque ele tocascripts/private-terms.ts,scripts/private-terms-history.tsescripts/private-terms-corpus.ts. Análise de impacto feita à mão (não há skill/blast-radiusnesta sessão):private-terms.ts: só muda o parse do tamanho do blob emblobContents. Um cabeçalho válido produz o mesmo número de antes. Um inválido agora falha alto em vez de gerarNaN.private-terms-history.ts: só muda o parse do número de linha do hunk emdeletedLines. Mesmo resultado para qualquer cabeçalho@@ -N.src/utils/parse.ts(achado do blast radius): o guard passou a ler a saída do git comparseInteger, mas orisk.tsnão marcava esse arquivo como superfície de segurança. Um PR futuro que mexesse emparseIntegermudaria o guard sem ganhar o labelrisco. Corrigido:src/utils/parse.tsentrou emSECURITY_SURFACES. O novo testetest/risk-guard-imports.test.tspercorre os imports em tempo de execução deprivate-terms-cli.ts,private-terms-corpus.tsecheck-private-messages.tse falha quando algum módulo carregado não é superfície. A única exceção éscripts/private-terms-excused.ts, que o AGENTS.md já deixa de fora. OAGENTS.mdfoi atualizado com a nova superfície e a nova linha da tabela de cobertura.private-terms-corpus.ts: só perde oexportdehasPhrase,uncoveredRemovedTermse o re-export de tipos sem uso. Nenhuma lógica muda.test/private-terms.test.tsetest/private-terms-corpus.test.ts(com o replay da migração chore: remove referências pessoais do código e dos fixtures #177) passam sem alteração, e os passosprivate termseprivate-terms corpusdoverify.shpassam.Aguarda a decisão do mantenedor antes do merge.
Verificação
scripts/verify.sh:VERIFICAÇÃO OK(Bun 1.4.2, o fixado empackageManager), após o merge damainatual.mainfalha (ver Prova).bun run lintebun run knippassam na branch.Prova
Fails-on-main: isento — PR
choresem mudança emsrc/oubin/; a prova é a regra falhando no código damain.Web: sem equivalente na web
Antes (main)
Worktree em
origin/maincom oeslint.config.jse oknip.jsondesta branch:Depois (branch)
Superfície
src/utils/parse.tsnorisk.tstest/risk-guard-imports.test.tsrodado contra orisk.tsde antes da correção (só comsecurityDetailexportado):Na branch:
bun test test/risk-guard-imports.test.ts test/risk.test.ts test/risk-label.test.ts: 31 pass, 0 fail.O gate
riskmudou, então segue o replay (bun scripts/replay-gates.ts --gate risk). Nenhum dos 10 commits mexe emsrc/utils/parse.ts, por isso os disparos são os mesmos de antes: