Findings enter the ledger from two writers kept consistent by a side map

Offen
#134 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
Ein halber Tag
Anfängerfreundlichkeit
45/100
Issue-Typ
Refactoring
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
go
Bereich
backend

Rechercherichtung

Start with recordFindings in internal/engine/run.go (around lines 341-383) and the runner.recorded field at lines 46-49, then read the early append in internal/engine/agentic.go near lines 432-444. Done means one method owns every write of a finding to the ledger, a table test in internal/engine covers the cap when more findings are already recorded than the limit, and the existing max_findings and interrupt tests still pass under go test ./internal/engine.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

severity: low tech-debt

Summary

recordFindings is documented as "the one place a finding of a code scan or a running-target scan enters the ledger". Since the max_findings and interrupt fixes, investigateOne also appends each finished finding immediately, and a runner.recorded side map tells the cap which findings it must keep. The cap assumes the kept set fits the limit, and nothing enforces that.

Where

  • internal/engine/run.go:341-383 (recordFindings, the doc comment, and "The investigations are planned within the cap, so kept fits")
  • internal/engine/run.go:46-49 (runner.recorded)
  • internal/engine/agentic.go:432-444 (the early append)

Impact

Every rule about which findings reach the ledger (cap, validation, dedup) has to be reasoned about across two writers and a shared map. The two writers already validate differently: the early path skips an invalid finding silently, and the final path writes a reject. If planning ever stops respecting max_findings (a planner change, or resume carrying more findings), the report silently exceeds the limit.

Suggested fix

  1. Correct the doc comment at run.go:341-348 to describe both writers.
  2. Move the early append into a runner.persist(seq, f) method that owns recorded, and call it from investigateOne.
  3. Take the cap decision from a pure capFindings(findings, recorded, limit) (kept, dropped) with a table test that covers len(recorded) > limit. Clamp, or add a note, when the assumption breaks.
  4. Give both writers the same validation outcome.

Acceptance criteria

  • One method owns writes of findings to the ledger.
  • A table test covers the cap with more already-recorded findings than the limit.
  • The existing max_findings and interrupt tests still pass.

Getting started

  • Relevant files: internal/engine/run.go, internal/engine/agentic.go
  • How to run tests: go test ./internal/engine

Related: #113


Filed by repo-audit/full-audit at fffef43. Severity: low. Effort: S. audit-key: tech-debt|internal/engine/run.go|recordFindings

Vorherrschende Sprache
Go
Sterne
0
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

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/Spackle

Alle Issues in TMHSDigital/Spackle

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

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