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

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

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
45/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go
Domaine
backend

Piste de recherche

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.

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

Description

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

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.