-diff's removed-name budget ignores the names the -ptr pass tested

Aberta Para iniciantes
#495 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@nova-loop já está trabalhando nisso.

Desde 3/12/2026.

  • #496 de @nova-loop — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
84/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go
Domínio
cli, networking

Direção de pesquisa

Leia internal/cli/diff.go para rastrear o orçamento de nomes removidos e, em seguida, inspecione internal/output/summary.go, internal/cli/summary.go e internal/report/ptr.go para descobrir onde as contagens de varreduras PTR são registradas. Adicione a contagem PTR ao cálculo do orçamento por destino e cubra em um teste uma execução com as três passagens. Execute go test ./internal/cli/ e confirme que a verificação de nomes removidos permanece dentro de -max-queries.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: cli bug good first issue severity: low

Summary

-diff's check of removed names spends what is left of -max-queries per target. It subtracts the names the main pass and the -permute pass tested, but not the names the -ptr pass tested, because the report has no count of them. A run with -ptr can therefore test more names than -max-queries allows.

Where

  • internal/cli/diff.go (the budget: left -= t.Processed, and t.Permutation.Processed)
  • internal/output/summary.go (TargetSummary: PTRNames counts the names to be tested, not the ones that were)

Details

left := int64(s.f.maxQueries) * int64(len(summary.Targets))
for _, t := range summary.Targets {
	left -= t.Processed
	if t.Permutation != nil {
		left -= t.Permutation.Processed
	}
}

Since #478, -max-queries is one budget for a target's passes. The PTR pass's scan is one of them, and its tested names are missing here.

Impact

With -diff -ptr -max-queries N, the removed-name check can look up as many names again as the PTR pass tested, on top of the budget. The overshoot is small (PTR passes test few names), and affects only runs where the previous results had names this run did not find.

Steps to reproduce

  1. Run a scan with -ptr -max-queries 3 whose main pass tests 1 name and whose PTR pass tests 2, with -diff against a previous run that had two more names.
  2. The removed-name check looks up both, for 5 names tested under a budget of 3.

Suggested fix

Record how many names the PTR pass's scan tested (a ptr_processed field next to ptr_names, or the pass's Processed kept on the session) and subtract it in the -diff budget. Add a test with all three passes.

Acceptance criteria

  • The removed-name check's budget is -max-queries per target less the names every pass tested.
  • A test covers a run with -ptr.

Getting started

  • Relevant files: internal/cli/diff.go, internal/cli/summary.go, internal/report/ptr.go
  • How to run tests: go test ./internal/cli/
  • Related: #478, #276

Filed by repo-audit/fix-issues at b8afd4d. Severity: low. Effort: S. audit-key: bug|internal/cli/diff.go|removed-name budget

Linguagem predominante
Go
Estrelas
1
Forks
1
Merge médio
10h
PRs com merge (30d)
26

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TMHSDigital/subenum

Todas as issues de TMHSDigital/subenum

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.