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

Offen Anfängerfreundlich
#495 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@nova-loop arbeitet bereits daran.

Seit 03.12.2026.

  • #496 von @nova-loop — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
84/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go
Bereich
cli, networking

Rechercherichtung

Lies internal/cli/diff.go, um nachzuvollziehen, wie das Budget für entfernte Namen berechnet wird, und untersuche dann internal/output/summary.go, internal/cli/summary.go und internal/report/ptr.go, um herauszufinden, wo die PTR-Scan-Zahlen erfasst werden. Nimm die PTR-Zahl in die Budgetberechnung pro Ziel auf und decke in einem Test einen Lauf mit allen drei Durchläufen ab. Führe go test ./internal/cli/ aus und bestätige, dass die Prüfung entfernter Namen innerhalb von -max-queries bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Go
Sterne
1
Forks
1
Ø Merge
10 Std.
Gemergte PRs (30 T.)
26

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/subenum

Alle Issues in TMHSDigital/subenum

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.