verify starts sandbox runs outside Box.Exec, and evidence numbering is worked out in three places

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

還沒有人認領這個 Issue。

評估

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

研究方向

Start in internal/engine/prove.go:145-193, where recordSandboxRun, the lab.box counter and nextEvidence live, and compare it with internal/agent/prover.go:63-70 (Box.Exec / Box.Record). Then read internal/engine/verify.go:137-155 and internal/engine/debug.go:243-252,320 to see the three numbering paths. Do step 1 first (return (seq, rel, err) from recordSandboxRun, drop debug's second counter and Sprintf), and run go test ./internal/engine ./internal/agent after each step; done means the new debug and verify evidence tests pass and every sandbox run goes through box.Exec or the comment names the exception.

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

描述

severity: low tech-debt

Summary

agent.Box.Exec is documented as "the one way to start a sandbox run: it counts the run against the sandbox cap, bounds it by the wall time that is left, and records it". engine.Verify still calls rt.Run directly and records the run itself. Evidence file numbering and paths are also worked out separately in three places (scan, debug, verify).

Where

  • internal/agent/prover.go:63-70 (Box.Exec doc)
  • internal/engine/verify.go:137-155 (rt.Run plus recordSandboxRun)
  • internal/engine/prove.go:145-193 (lab.box counter, recordSandboxRun, nextEvidence)
  • internal/engine/debug.go:243-252, internal/engine/debug.go:320 (second counter and a rebuilt evidence/%02d-%s.txt path)

Details

  • recordSandboxRun builds the %02d-<purpose>.txt name but returns only the ledger seq. lab.box keeps a counter per box. Debug wraps that with a second counter and rebuilds the path string with Sprintf. Verify numbers files by listing the folder.
  • Verify runs are bounded only by the sandbox's per-run timeout. They are not counted against [budget] caps.

Impact

Changing the evidence layout means editing prove.go and debug.go together. If only one changes, debug findings point at files that do not exist, and no test compares the two. A reader who trusts the Box.Exec comment assumes every sandbox run is capped, and the next change to Exec (network policy, recording) will silently skip verify.

Suggested fix

One commit per step:

  1. Make recordSandboxRun return (seq, rel, err), and have Box.Record return the path. Delete debug's second counter and its Sprintf.
  2. Move numbering into one per-finding helper seeded from nextEvidence, so scan, debug and verify number files the same way.
  3. In Verify, build an agent.Box (Root: targetDir, a budget from opts.Config.Budget, Record calling recordSandboxRun) and use box.Exec. Keep treating a sandbox error as an inconclusive verdict.

Alternatively, narrow the Box.Exec comment to say verify runs proofs directly.

Acceptance criteria

  • Every sandbox run goes through one path, or the comment states the exception.
  • A debug test checks that every path in its evidence list exists on disk.
  • A verify test checks that its evidence is numbered after the scan's files.

Getting started

  • Relevant files: internal/agent/prover.go, internal/engine/verify.go, internal/engine/prove.go, internal/engine/debug.go
  • How to run tests: go test ./internal/engine ./internal/agent

Related: #30


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

主要語言
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 摘要。