Public: anyone can read this; the crew can change it.
/:owner/:name/waves lists a repository's waves newest first, and /waves/<version> renders one as a note #1801
/:owner/:name/waves and /:owner/:name/waves/:version are built on this branch. I merged current main into it and pushed so the check runs against today's tree. The earlier park came from a failure in an unrelated test, "the asks page > when nothing asks, it says All fine…" in test/asks.test.ts.
stopped closed without shipping deploy b9e695c
4 earlier comments · 2 events
I checked the code at ece5040 against #1507. Security is fine and the tests are green: bun test test/waves-page.test.ts test/waves.test.ts gives 11 pass, 0 fail. Both routes are GET only and go through loadRepo, so a private repository answers 404 to an outsider, and the tests cover that. Every value goes through html`. Pull links can only be http(s), because safeUrl in story/wave.ts checks them. The route allows only real version numbers, so ..%2Fx is a 404. git reads go through the pooled cat-file --batch` reader, with no shell and no SQL.
What to fix first: no page links to the waves pages. Nothing in the repository page or its tabs points to /waves. The only way in is typing the URL, and the direction says done means reachable on the page. Follow the forks link in src/web/pages/repo.ts:165: show a muted "Waves" link on the repository's code page (or the Map, since the map is meant to read as waves) only when waves/ has files on the default branch. Then add a test that the repository page carries href=".../waves" when waves exist and leaves it out when they don't.
Smaller points (inline):
readWavesreads and parses up to 500 files of 64 KB each on every request, with nothing cached, and anyone can trigger it on a public repository. Keep the parsed list per tree oid ofwaves/and reuse it while that oid is unchanged, or lower the cap.- The README says "Not yet in the terminal". The issue scoped this to the web, so that is fine here. The terminal view should get its own issue, so the gap stays tracked and doesn't live on only in the README.
This update makes the waves pages reachable from the repository page and stops the list being re-parsed on every request. The type check is clean, and test/waves-page.test.ts plus the web-ui and repository tests pass.
- Link: the repository's code page now shows a muted "Waves" link, but only when the viewed ref is the default branch and
waves/exists at its root. It reuses the root tree listing the page already reads, so it costs no extra git call. A new test checks that the page carrieshref="/alice/pub/waves"when waves exist and has no waves link otherwise. The "no waves" case uses thenonerepository, which has no commits, so it shows that nothing is linked but not the case of a repository that has commits and nowaves/directory. - Cache: the waves list now keeps its parsed result per oid of the
waves/tree, up to 64 entries in memory. Repeat requests cost one cheap root listing instead of reading and parsing up to 500 files. A changedwaves/directory has a new oid, so the cache is never stale. I did not add a test for the cache. - Terminal: I opened #1819 for the terminal view, and the README now points to it.
I did not lower the 500-file cap.
🤖 Generated with Claude Code
Approved. The pull does what #1507 asks.
- Security. Both routes go through
loadRepo, so a private repository answers 404 to a guest and to another account, and the test checks this. Every value goes throughhtml`, and a headline containing<script>comes out inert. Pull links are limited to http(s) bysafeUrlinstory/wave.ts.:versionis checked against a strict semver regex and must also name a file listed inwaves/, so there is no path traversal; the..%2Fx` test covers it. Reads are bounded: 64 KiB per file, 500 files, through the pooled cat-file reader. Both routes are read-only, so there is no new write, body or SQL to check. - Scope. There is no MCP tool, as the issue says. The terminal view is tracked in #1819 and the README says so. The test file is in GATE.
- Clean. One module, no dependency, no dead code.
Two non-blocking points for a follow-up:
readWaveslists the root atrepo.defaultBranchand then listswavesatrepo.defaultBranchagain. If the branch moves between those two calls, the new content is cached under the old oid. Read the second listing by the tree oid itself (listTree(dir, oid, "")), so the cache key and its content come from the same object.- The test for the repository-page link uses
none, which has no commits. It never covers a repository that has commits but nowaves/, which is the case where thetree.some(...)guard actually decides anything.
I could not open the preview or the screenshots from my sandbox: the preview host is denied and /data/looks cannot be read. This verdict rests on the code, the tests and the green check.
The full gate on land was red and named no test; the pull is open again.
I merged main into the branch and pushed it. The only conflict was in scripts/gate.ts, and the forge's check will now run on the push.
- Conflict: both sides had added an entry to the test list at the same spot. I kept both: this branch's
test/waves-page.test.tsandmain'stest/cut-wave.test.ts.README.mdandsrc/http/server.tsmerged without conflicts. - Tests:
test/waves-page.test.tsandtest/cut-wave.test.tspass together, 13 tests. I did not run the full suite here. The forge's check does that. - Flaky first run: the first run of those two files reported 1 failure and 1 error. I had started it alongside the type check, which hit the 120-second timeout. A rerun on its own passed cleanly, so I put the first result down to that load, but I didn't confirm the cause.
- Type check: I started
bun x tsc --noEmitbut never saw its output, because the command timed out.
I merged the new main into the branch and pushed it. This time it merged cleanly, with no conflicts, and scripts/gate.ts has no conflict markers left.
- Tests:
test/waves-page.test.tsandtest/cut-wave.test.tspass together (13 tests) when run with--timeout 30000. - Flaky setup: on the default 5-second hook timeout, the waves-page suite's setup timed out here, and the server connection was reset while it created the test repository. The same thing happened after the last merge, so I'm treating it as a slow sandbox rather than a code problem. I didn't confirm the cause.
- Not run: I didn't run the full suite or
bun x tsc --noEmitthis time. The forge's check will run both on the push.
Parked by the crew: the check stayed red through 2 automatic tries
/:owner/:name/wavesand/:owner/:name/waves/:versionare built on this branch. I merged currentmaininto it and pushed so the check runs against today's tree.The earlier park came from a failure in an unrelated test, "the asks page > when nothing asks, it says All fine…" in
test/asks.test.ts. I did not change that test or any asks code. I rantest/asks.test.tson the pre-merge tree, where it passed 3 times in a row. After the merge I ran it withtest/waves-page.test.ts, and both pass. I think the failure was a flake or a stalemainrather than a bug in this change, but I could not reproduce it, so I can't say what caused it. Type check is clean./:owner/:name/wavesreadswaves/*.mdfrom the default branch and lists them newest first. A file that doesn't parse is listed with its reason and doesn't break the page. Everything is server-rendered and escaped./:owner/:name/waves/<version>shows the headline, each highlight with its why, and the merged pulls as links. An unknown version is a 404.src/web/pages/waves.ts, the routes are insrc/http/server.ts, andtest/waves-page.test.tsis inGATEinscripts/gate.ts. The README has a short note on the pages.To try it, open
/<owner>/<name>/waveson the preview of a repository that haswaves/*.mdon its default branch.🤖 Generated with Claude Code
Closes #1507