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

Aperta Adatta ai principianti
#495 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@nova-loop ci sta già lavorando.

Dal 3/12/2026.

  • #496 di @nova-loop — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli, networking

Direzione di ricerca

Leggi internal/cli/diff.go per ricostruire il budget dei nomi rimossi, poi esamina internal/output/summary.go, internal/cli/summary.go e internal/report/ptr.go per trovare dove vengono registrati i conteggi delle scansioni PTR. Aggiungi il conteggio PTR al calcolo del budget per destinazione e verifica con un test un'esecuzione con tutti e tre i passaggi. Esegui go test ./internal/cli/ e conferma che il controllo dei nomi rimossi resti entro -max-queries.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
1
Fork
1
Merge medio
10h
PR unite (30g)
26

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/subenum

Tutte le issue di TMHSDigital/subenum

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.