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

Closed opened this
Closed without merging

/: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.

Notes

stopped closed without shipping deploy b9e695c

opened this

/: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. I did not change that test or any asks code. I ran test/asks.test.ts on the pre-merge tree, where it passed 3 times in a row. After the merge I ran it with test/waves-page.test.ts, and both pass. I think the failure was a flake or a stale main rather than a bug in this change, but I could not reproduce it, so I can't say what caused it. Type check is clean.

  • List: /:owner/:name/waves reads waves/*.md from 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.
  • One wave: /:owner/:name/waves/<version> shows the headline, each highlight with its why, and the merged pulls as links. An unknown version is a 404.
  • Visibility: both pages follow the repository, so an outsider gets the same answer as for any other page of a private repository.
  • Code: the page is src/web/pages/waves.ts, the routes are in src/http/server.ts, and test/waves-page.test.ts is in GATE in scripts/gate.ts. The README has a short note on the pages.
  • Tests: they cover list order, a headline with markup coming out inert, a private repository refused to an outsider, and an unparsable file shown with its reason.
  • Left out: there is no MCP tool, as the issue says, and no new dependency.

To try it, open /<owner>/<name>/waves on the preview of a repository that has waves/*.md on its default branch.

🤖 Generated with Claude Code

Closes #1507

4 earlier comments · 2 events
Changes requested — before the latest push

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):

  • readWaves reads 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 of waves/ 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.
commented

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 carries href="/alice/pub/waves" when waves exist and has no waves link otherwise. The "no waves" case uses the none repository, which has no commits, so it shows that nothing is linked but not the case of a repository that has commits and no waves/ 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 changed waves/ 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 — before the latest push

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 through html`, and a headline containing <script> comes out inert. Pull links are limited to http(s) by safeUrl in story/wave.ts. :version is checked against a strict semver regex and must also name a file listed in waves/, 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:

  1. readWaves lists the root at repo.defaultBranch and then lists waves at repo.defaultBranch again. 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.
  2. The test for the repository-page link uses none, which has no commits. It never covers a repository that has commits but no waves/, which is the case where the tree.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.

commented

The full gate on land was red and named no test; the pull is open again.

commented

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.ts and main's test/cut-wave.test.ts. README.md and src/http/server.ts merged without conflicts.
  • Tests: test/waves-page.test.ts and test/cut-wave.test.ts pass 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 --noEmit but never saw its output, because the command timed out.
commented

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.ts and test/cut-wave.test.ts pass 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 --noEmit this time. The forge's check will run both on the push.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs