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

Ouverte
#134 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
45/100
Type d'issue
Refactorisation
Clarté
Plutôt claire
Activité
Active
Stack technique
go
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Go
Étoiles
0
Forks
1
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TMHSDigital/Spackle

Toutes les issues de TMHSDigital/Spackle

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.