# Test Evidence Storage > Nota interna del proyecto no-mistakes. Se usa al cambiar la recogida de evidencia de test, su publicación en una rama huérfana, sus rutas bajo el app root, la retención o la limpieza del scratch. Fuente: https://skillsagentes.com/skills/kunchenguid/no-mistakes/test-evidence-storage Markdown: https://skillsagentes.com/skills/kunchenguid/no-mistakes/test-evidence-storage.md Repositorio: https://github.com/kunchenguid/no-mistakes Autor: kunchenguid Licencia: MIT Actualizado: hace 3 días Coste de contexto: 26 tok instalada, 1.2k tok al activarse, 1.2k tok con todos los archivos del bundle Bundle: 1 archivo, 5 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent claude-code # Cursor npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent cursor # Codex npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent codex # Gemini CLI npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent gemini # Windsurf npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent windsurf # Cline npx -y skills add kunchenguid/no-mistakes --skill test-evidence-storage --agent cline ``` ## Qué hace - Nota interna: el paso de test siempre recoge la evidencia FUERA del worktree, en `StepContext.EvidenceDir`, y nada la stagea ni comitea a la rama empujada, así que nunca llega a la historia de la rama default. - Con `test.evidence.store_in_repo` y un link base de GitHub derivable, el paso de PR copia el directorio a una rama huérfana de evidencia vía `internal/evidence`, que usa solo plumbing de Git. - Los links del PR se fijan al COMMIT de evidencia, no a la rama, así que un run posterior que sobrescriba las mismas rutas no cambia lo que muestra un PR viejo. - La evidencia vive en `/evidence/`, nunca en `os.TempDir()`, porque la unidad de servicio del daemon no exporta `TMPDIR` y `/tmp` es un tmpfs que consumía RAM. - La limpieza es propia en tres capas (`cleanupRunEvidence`, `reapEvidence`, `reapLegacyEvidence`), todas con el guard de pending/running y best effort; ningún timer del OS es load-bearing. ## Cuándo usarla - Se cambia la recogida de evidencia de test, su publicación, sus rutas, la retención o la limpieza del directorio de scratch. ## Qué la activa - "Voy a tocar la publicación de evidencia de test en no-mistakes" - "Revisa que la evidencia no llegue a la rama empujada" - "Cambia la política de retención del directorio de evidencia" ## Archivos - SKILL.md — 5 KB ## SKILL.md Reproducido tal cual desde kunchenguid/no-mistakes bajo MIT. Esta sección es el documento original y está en inglés. **Test Evidence Lives on an Orphan Branch, Never in the Code Branch** - The test step always collects evidence OUTSIDE the worktree, in the directory the executor resolved once as `StepContext.EvidenceDir`; nothing stages or commits it into the pushed branch, so evidence can never reach the default branch's history. With `test.evidence.store_in_repo` and a derivable GitHub link base, the PR step calls `publishRunEvidence` (`internal/pipeline/steps/evidence_publish.go`), which copies the directory onto the push-target repo's orphan evidence branch through `internal/evidence` and hands the PR body its links. A provider without derivable links does not push the branch. - `internal/evidence` owns the mechanism and its fail-closed rules: plumbing only (scratch `GIT_INDEX_FILE` + `hash-object`/`write-tree`/`commit-tree`), so HEAD, the index, and the worktree are untouched and a detached or shallow clone works; the parent is the just-fetched remote tip so the push is a plain fast-forward and never a force; an existing branch without the `.no-mistakes-evidence` marker at its tip is refused, which is what makes a wrong branch name (`main`) harmless. Every failure returns an error and the PR body falls back to local-path references rather than links that would not resolve. - PR links are pinned to the evidence COMMIT, not the branch, so a later run overwriting the same paths cannot change what an old PR shows. Link bases come from `Repo.UpstreamURL`/`ForkURL`, never the push URL, which can carry a credential. - `test.evidence.branch` is trusted-only in `EffectiveRepoConfig` (it names a ref the daemon pushes to); `local_root`/`retention`/`max_runs` are global-only (`applyEvidenceStorageOverrides` is called from `Merge` with `GlobalConfig` alone); the rest of `test.evidence` stays pushed-readable. Invalid branch names, relative `local_root`, unparseable `retention`, and negative `max_runs` all fail the config at parse time (`validateTestRaw`). - Regressions: `internal/evidence/publish_test.go`, `internal/evidence/branch_test.go`, `internal/pipeline/steps/evidence_publish_test.go`, `TestPushStep_DoesNotPublishTestEvidenceIntoThePushedBranch`, `TestEffectiveRepoConfig_EvidenceBranchTrustedOnly`, `TestLoadGlobalConfig_InvalidEvidenceBranchFailsClosed`, `internal/config/evidence_storage_test.go`. **no-mistakes Owns Its Own Scratch (never the shared system temp dir)** - Evidence lives at `/evidence/` (`paths.EvidenceDir`/`EvidenceRoot`/`RunEvidenceDir`), never `os.TempDir()`. The daemon's service unit exports only HOME, PATH, and proxy vars, so `TMPDIR` is unset and `os.TempDir()` resolved to the shared `/tmp` - a systemd tmpfs on Ubuntu 24.10+, so evidence consumed RAM. The app root is disk-backed on all three platforms, so there is deliberately NO `runtime.GOOS` branch; do not add one. - One owner for the path: the executor resolves it (`Executor.runEvidenceDir`) into `StepContext.EvidenceDir`, and `agent.WithSteering(a, evidenceRoot)` takes it as an argument. Steps and the steering preamble must never rebuild it - two independent `os.TempDir()` copies is exactly the drift this replaced. - Cleanup is ours, in three layers: `RunManager.cleanupRunEvidence` removes a finished run's dir when empty (`os.Remove`, never `RemoveAll` - the test step creates the dir before the agent decides it has anything to write, and that litter was 94% of observed accumulation), `reapEvidence` bounds the directory by age and count oldest-first, and `reapLegacyEvidence` drains the pre-relocation temp directory under the same policy. All three reuse `skipWorktreeCleanup`'s pending/running guard and are best effort. No OS temp timer is load-bearing. - HELD SCOPE: `internal/eval/replay.go` sandboxes stay in the system temp directory. They are the largest scratch this program creates, but a replay materializes its own nested NM_HOME and worktree while `Store.Prune`, the case records, and the object pools all live under `/eval` - so relocating the sandbox inside the app root nests it in the state it is replaying, which e2e `TestEvalJourney` refuses on purpose. Moving it needs a disk-backed root outside NM_HOME, which does not exist yet; do not "fix" it by weakening that assertion. Every remaining `os.MkdirTemp("", ...)` caller is auto-named and self-cleaning with `defer`; keep it that way. - Regressions: `internal/paths/evidence_test.go`, `internal/config/evidence_storage_test.go`, `internal/daemon/evidence_reap_test.go`, `TestSteeringNamesTheConfiguredEvidenceRoot`, `TestTestEvidenceDir_DefaultResolutionStaysUnderTheAppRoot`, e2e `TestTestEvidenceLivesUnderAppRootNotSharedTemp` / `TestRunCleanupLeavesNoEmptyEvidenceDirectory`. ## Dónde encaja - Categoría: [Testing y QA](https://skillsagentes.com/categorias/testing-qa.md) — Flujos de testing unitario, de integración y end-to-end. - Creador: [kunchenguid](https://skillsagentes.com/creators/kunchenguid.md) — 16 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [No Mistakes](https://skillsagentes.com/skills/kunchenguid/no-mistakes/no-mistakes.md): Valida tus cambios de código por el pipeline de no-mistakes (review de código automatizado, tests, lint, docs, push, PR y CI) antes de que lleguen al destino de push configurado. Se activa con `/no-mistakes`. - [Testing Conventions](https://skillsagentes.com/skills/kunchenguid/no-mistakes/testing-conventions.md): Nota interna del proyecto no-mistakes. Se usa al añadir o cambiar tests, el harness e2e, el aislamiento de procesos de test o el sharding de tests en CI. - [Pr Publication Safety](https://skillsagentes.com/skills/kunchenguid/no-mistakes/pr-publication-safety.md): Nota interna de seguridad del proyecto no-mistakes. Se usa al cambiar el render del cuerpo del PR, la redacción de rutas de home, la publicación de rutas de artefacto o los marcadores de attestation de pipeline. - [Ci Monitor](https://skillsagentes.com/skills/kunchenguid/no-mistakes/ci-monitor.md): Nota interna del proyecto no-mistakes. Se usa al cambiar la readiness de CI, la recogida de checks del forge, los reruns, los timeouts de CI o la monitorización del ciclo de vida del PR. - [Pipeline Review And Agents](https://skillsagentes.com/skills/kunchenguid/no-mistakes/pipeline-review-and-agents.md): Nota interna del proyecto no-mistakes. Se usa al cambiar las sesiones de review, las decisiones sobre findings, los timeouts de agente, el comportamiento del Test local o la conformidad con la intención. ## Skills relacionadas - [Systematic Debugging](https://skillsagentes.com/skills/obra/superpowers/systematic-debugging.md): Úsalo ante cualquier bug, fallo de test o comportamiento inesperado, antes de proponer arreglos. - [Receiving Code Review](https://skillsagentes.com/skills/obra/superpowers/receiving-code-review.md): Úsalo al recibir feedback de code review, antes de implementar sugerencias, sobre todo si el feedback parece poco claro o técnicamente cuestionable: exige rigor técnico y verificación, no acuerdo performativo ni implementación ciega. - [Verification Before Completion](https://skillsagentes.com/skills/obra/superpowers/verification-before-completion.md): Úsalo antes de afirmar que un trabajo está completo, corregido o pasando, antes de hacer commit o crear PRs: exige ejecutar comandos de verificación y confirmar la salida antes de cualquier afirmación de éxito. - [Tdd](https://skillsagentes.com/skills/mattpocock/skills/tdd.md): Desarrollo guiado por tests. Úsalo cuando quieras construir features o arreglar bugs test-first, cuando menciones "red-green-refactor", o cuando quieras tests de integración. - [Migrate To Shoehorn](https://skillsagentes.com/skills/mattpocock/skills/migrate-to-shoehorn.md): Migra archivos de test de aserciones de tipo `as` a @total-typescript/shoehorn. Úsalo cuando menciones shoehorn, quieras reemplazar `as` en tests, o necesites datos de test parciales. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)