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

未關閉
#134 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
半天
新手友好度
45/100
Issue 類型
重構
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
go
領域
backend

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Go
星號
0
分支
1
PR 合併指標
30 天內沒有已合併 PR

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TMHSDigital/Spackle 的其他 Issue

查看 TMHSDigital/Spackle 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。