Skip to content

refactor(wt-perf): place fixtures under target/wt-perf, not the cache dir - #3547

Merged
max-sixty merged 2 commits into
mainfrom
wt-perf-fixtures-in-target
Jul 22, 2026
Merged

max-sixty merged 2 commits into
mainfrom
wt-perf-fixtures-in-target

Conversation

@max-sixty

@max-sixty max-sixty commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

What

Move every wt-perf on-disk fixture out of the per-user cache dir and under the cargo target dir at <target>/wt-perf/, resolved by a renamed wt_perf_fixture_dir():

  • setup <config> fixtures → <target>/wt-perf/<config> (was ~/.cache/wt-perf/<config>).
  • The rust-lang/rust clone and prune-real fixtures → <target>/wt-perf/bench-repos/ (was ~/.cache/wt-perf/bench-repos/).
  • wt_perf_cache_dir() → wt_perf_fixture_dir(). The target dir is derived from the running executable's own path (it lives inside whichever dir cargo built into — <target>/debug/wt-perf, <target>/release/deps/<bench>), so it honors CARGO_TARGET_DIR, a config-file build.target-dir, and cargo-llvm-cov's target/llvm-cov-target/ — none of which a bare CARGO_TARGET_DIR env read covers. Falls back to <workspace>/target if the binary isn't under a recognizable profile dir. The etcetera dependency is dropped.
  • The WT_PERF_CACHE_DIR env override (and the empty-value guard it required) is removed; the benchmarks workflow now caches the deterministic target/wt-perf/bench-repos path directly.
  • In-process throwaway fixtures (create_repo) are unchanged — they keep using tempfile::TempDir.

This reverses the location decision from #3542, which had moved these into ~/.cache/wt-perf.

Why

target/ is the conventional home for build/test-generated artifacts — gitignored, reaped by cargo clean, and already where criterion writes (target/criterion). Keeping every wt-perf fixture there gives one predictable location under the repo that cargo clean fully resets. Deriving the target dir from the running binary (rather than assuming <workspace>/target) keeps that property intact even when the target dir is relocated.

Tradeoff (accepted)

target/ is not shared across git worktrees (worktrees don't share it) and is wiped by cargo clean. So the ~15 GiB prune-real rust clone re-clones per worktree and after every cargo clean — the cost #3542 avoided by using the cache dir. This is deliberate and documented on wt_perf_fixture_dir; it's cheap for the synthetic setup fixtures, which rebuild in seconds.

Testing

  • cargo build -p wt-perf --all-targets, cargo test -p wt-perf — clean.
  • New unit test target_dir_from_exe_finds_cargo_target covers the resolution logic (relocated CARGO_TARGET_DIR, bench binary under release/deps/, cargo-llvm-cov's nested target, closest-profile-wins, and the outside-any-target fallback).
  • pre-commit run --all-files (fmt, clippy, yaml, typos, cargo-lock, custom hooks) — clean.
  • Smoke-tested end-to-end: setup branches-2 lands at <worktree>/target/wt-perf/branches-2 and writes nothing to ~/.cache/; a copy of the binary run from a fake <dir>/debug/wt-perf correctly resolves fixtures to <dir>/wt-perf/, proving a relocated target dir is honored.

This was written by Claude Code on behalf of Maximilian

max-sixty and others added 2 commits July 22, 2026 12:11
… dir

#3542 moved wt-perf's benchmark/debug fixtures into the per-user cache dir
(`~/.cache/wt-perf`) to share the expensive rust clone across worktrees and
survive `cargo clean`. Move every fixture back under `<workspace>/target/wt-perf/`
instead: one location, reaped by `cargo clean` like any build artifact
(criterion already writes `target/criterion`).

- `wt_perf_cache_dir()` -> `wt_perf_fixture_dir()`, resolved from the crate's
  compile-time manifest dir (three levels below the workspace root) rather than
  the XDG cache dir. Drops the `etcetera` dependency.
- `setup <config>` fixtures -> `target/wt-perf/<config>`; the rust clone and
  prune-real fixtures -> `target/wt-perf/bench-repos/`.
- Drops the `WT_PERF_CACHE_DIR` override and the empty-value guard it needed;
  the benchmarks workflow now caches the deterministic
  `target/wt-perf/bench-repos` path directly, so there's nothing to pin.

Tradeoff (accepted): `target/` isn't shared across git worktrees and is wiped
by `cargo clean`, so the ~15 GiB rust clone re-clones per worktree and after
every clean. Documented on `wt_perf_fixture_dir`. Cheap for the synthetic
fixtures, which rebuild in seconds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The initial move hardcoded `<workspace>/target/wt-perf` off CARGO_MANIFEST_DIR,
so a relocated target dir (a CARGO_TARGET_DIR / build.target-dir override, or
cargo-llvm-cov's target/llvm-cov-target/) would strand fixtures in a `target/`
cargo never builds into or cleans — defeating the reason for using `target/`.

Derive the target dir from the running executable instead: it lives inside
whichever dir cargo used (`<target>/debug/wt-perf`,
`<target>/release/deps/<bench>`), so the parent of the closest `debug`/`release`
profile dir is the real target dir. This honors CARGO_TARGET_DIR, a config-file
build.target-dir, and cargo-llvm-cov, none of which a bare env-var read covers.
Falls back to `<workspace>/target` if the binary isn't under a profile dir.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the refactor — the resolution logic is correct and the move is clean. Verified:

  • target_dir_from_exe holds against the full test matrix: closest debug/release ancestor wins (so .../release/proj/target/debug/wt-perf → target, not the stray release), release/deps/<bench> and cargo-llvm-cov's llvm-cov-target nesting both resolve, and a binary outside any target dir returns None → workspace fallback. The cargo_target_dir fallback (CARGO_MANIFEST_DIR .nth(3)) lands on the workspace root, since tests/helpers/wt-perf sits exactly three levels down.
  • The CI cache path (target/wt-perf/bench-repos) matches what wt-perf writes — no CARGO_TARGET_DIR is set anywhere in .github/, so the bench binary resolves to <workspace>/target and the two stay in lockstep.
  • No dangling references to wt_perf_cache_dir / WT_PERF_CACHE_DIR remain, and etcetera correctly stays in Cargo.lock — the main crate still uses it (src/config/user/path.rs, src/shell/paths.rs); only wt-perf's edge was dropped.
  • Dropping the WT_PERF_CACHE_DIR empty-value guard is safe: cargo_target_dir() always returns an absolute path, so the relative-cwd footgun that guard defended against (an empty override → remove_dir_all of a relative <config>) can no longer arise.

One note per this repo's data-loss-surface review policy (review-pr.md): the diff touches std::fs::remove_dir_all in tests/helpers/wt-perf/src/main.rs (the setup <config> rebuild). It only removes disposable target/wt-perf/<config> fixtures wt-perf itself created, and fires only after parse_config has validated config to a known fixture name — so no user work is at risk here. Flagging it for the record rather than auto-approving; the merge call is yours.

@max-sixty
max-sixty merged commit a7c4a7a into main Jul 22, 2026
41 checks passed
@max-sixty
max-sixty deleted the wt-perf-fixtures-in-target branch July 22, 2026 20:44
max-sixty pushed a commit to max-sixty/tend that referenced this pull request Jul 25, 2026
…#787)

## What

Adds a bullet to the `review-reviewers` skill's **Non-issues** list:
`tend-review` staying silent on a **draft** PR with no actionable
findings is expected skill-designed behavior, not a silent omission —
the sibling of the already-documented self-authored-PR case.

## Why

GitHub's `state` field reports draft PRs as `OPEN`, so the survey step's
negative signal "bot posted no review despite a `tend-review` run
completing on an open PR" fires on drafts. The bundled `review` skill's
draft-mode explicitly runs a lighter COMMENT-only review and authorizes
"Stay silent if there's nothing actionable; don't post a 'looks fine'
comment" (GitHub also blocks APPROVE on drafts). So a silent tend-review
on a clean draft is correct — but without this in the durable Non-issues
list, each analysis run re-derives it via an expensive escalation to
session logs.

## Evidence

Recurring across analysis runs, and structural (draft PR + nothing
actionable → always silent):

- **This run**
([29954129033](https://github.com/max-sixty/tend/actions/runs/29954129033)):
two `tend-review` runs on max-sixty/worktrunk PRs
[#3547](max-sixty/worktrunk#3547) and
[#3548](max-sixty/worktrunk#3548) — both `draft:
true`, human-authored (max-sixty), zero reviews/comments posted. The
survey subagent flagged them as "concerning: no review on open
human-authored PR"; I escalated to a session-log investigation, which
confirmed the bot correctly detected draft status and applied draft-mode
silence in every case. The escalation was only necessary because the
pattern wasn't codified.
- **Prior run** (recorded in the evidence gist): already tracked a
counter "tend-review correct silent exit (draft-nothing-actionable): +2"
and verified the same outcome against `review/SKILL.md` — i.e. the
pattern was observed and re-derived a window earlier too.

This is an **invisible, recurring failure mode**: the wasted session-log
escalation never surfaces as a CI failure, so without codification it
keeps costing tokens every window a draft PR is open and gets pushed to.

## Gate assessment

- **Gate 1 (confidence)**: structural; observed across 2+ analysis runs
(prior +2, this run 2 more). Passes.
- **Gate 2 (magnitude)**: one bullet added to an existing enumerated
list, mirroring the adjacent self-authored bullet — targeted, no
structural change. Passes.

Evidence log: https://gist.github.com/b923bbc52f3c6606931d59abdae616a3

The target-repo bot behavior this window was otherwise all-clear: three
`tend-review` runs correct (draft/re-review), three `tend-notifications`
benign, one `tend-ci-fix` skip. No human pushback, no corruption. This
PR improves the *analysis* skill, not the target bot.

Co-authored-by: tend-agent <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants