1# tools/worktree-samples
2
3Lets the headless tools that play songs on the dev server (`tools/measure`,
4`tools/check-songs`) hear a worktree's own `samples/` when they are run from
5one.
6
7The dev server (`buck2 run //:dev`) serves one checkout, usually the main
8one, and its sample map (`website/src/pages/jev-samples/strudel.json.js`)
9points every sound at that checkout's files (`/@fs/<checkout>/samples/…`). A
10review that re-renders a vocal in its worktree, then measures it on that
11server, would hear the old file.
12
13`worktreeSamples({ url, root })` reads the server's map to see which
14checkout it serves. When that is not `root`, its `route(page)` makes a
15Playwright page:
16
17- get a sample map built from `root`'s `samples/`, by the site's own builder
18  (`website/src/jev/sampleMap.mjs`), so sounds only the worktree has are
19  listed and sounds it deleted are not;
20- get every sample file it asks for under either checkout's `samples/` from
21  `root`'s file, or a 404 when `root` has none.
22
23Each tool prints a line when it does this, naming both checkouts. Run from
24the checkout the server serves, nothing changes.
25
26| File | What it is |
27|---|---|
28| `worktree-samples.mjs` | `worktreeSamples` and `routingNote`, used by both tools. |