Public: anyone can read this; the crew can change it.

The 404 page offers the three most likely pages by edit distance to the path asked #13351

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The 404 page now offers up to three top-level pages nearest the path asked, as links. A near typo like /explroe shows "Pages like it: Explore", and a far path shows only the actions it had before. The new tests and not-found-asset.test.ts pass, and tsc, the gate and the design lint are clean.

Notes

shipped production is serving it deploy 59903fa

opened this

The 404 page now offers up to three top-level pages nearest the path asked, as links. A near typo like /explroe shows "Pages like it: Explore", and a far path shows only the actions it had before. The new tests and not-found-asset.test.ts pass, and tsc, the gate and the design lint are clean. I ran only those two test files, not the wider suite.

  • Where the links come from: The new src/web/near_pages.ts matches the path's first segment against the forge's one page table (GO_PAGES in src/web/go_pages.ts), at edit distance 3 or less, nearest first, with Home left out. notFoundPage in src/web/chrome.ts shows the links under the existing actions. The issue named src/web/failed_page.ts, but that file is the 500 page. The 404 is notFoundPage.
  • Who sees what: The table is narrowed to what the viewer may open. A stranger asking for /sytem is offered nothing, so admin pages are never named. Names are escaped, as the other links on the page already are.
  • Tests: test/near-pages.test.ts covers a near typo, a far path, the root, a bad percent-escape, the admin narrowing, and the rendered page for both a near and a far path. It also checks that an injected <b> comes back escaped.
  • Not done: Only the first segment is matched, so /apps/x offers Apps. The repo "Did you mean" line is unchanged. There is no terminal door and no app.looks page, and I said so in the commit lines the gate asks for. The #13006 wording is untouched.
  • Known noise: With a limit of 3, very short paths such as /ab can match several short page names.

To try it, open /explroe on the preview and tap Explore. Then open /zzzzzzzzzzzzzzzzzzzz and see no "Pages like it" line.

Closes #13334

2 earlier comments · 2 events
commented

The 404 page now offers up to three top-level pages nearest the path asked, as links. A near typo like /explroe shows "Pages like it: Explore", and a far path shows only the actions it had before. The new tests and not-found-asset.test.ts pass, and tsc, the gate and the design lint are clean. I ran only those two test files, not the wider suite.

  • Where the links come from: The new src/web/near_pages.ts matches the path's first segment against the forge's one page table (GO_PAGES in src/web/go_pages.ts), at edit distance 3 or less, nearest first, with Home left out. notFoundPage in src/web/chrome.ts shows the links under the existing actions. The issue named src/web/failed_page.ts, but that file is the 500 page. The 404 is notFoundPage.
  • Who sees what: The table is narrowed to what the viewer may open. A stranger asking for /sytem is offered nothing, so admin pages are never named. Names are escaped, as the other links on the page already are.
  • Tests: test/near-pages.test.ts covers a near typo, a far path, the root, a bad percent-escape, the admin narrowing, and the rendered page for both a near and a far path. It also checks that an injected <b> comes back escaped.
  • Not done: Only the first segment is matched, so /apps/x offers Apps. The repo "Did you mean" line is unchanged. There is no terminal door and no app.looks page, and I said so in the commit lines the gate asks for. The #13006 wording is untouched.
  • Known noise: With a limit of 3, very short paths such as /ab can match several short page names.

To try it, open /explroe on the preview and tap Explore. Then open /zzzzzzzzzzzzzzzzzzzz and see no "Pages like it" line.

Changes requested — before the latest push

The preview works: /explroe offers Explore, a far path shows only the old actions, and the injected <b> is escaped. Two things block it.

Fix first: both doors. The change adds a feature module (src/web/near_pages.ts) and edits an existing page, so it needs a change under src/tui/ and a docs/features/<name>.md with its row in docs/features/README.md. A commit line saying No door does not meet the list. The terminal has a not-found moment too, so give it the same near-page suggestion.

Then: the three-item cap is only covered with a weak assertion, and very short paths such as /ab offer Apps on the preview. Scale the allowed distance to the length of the asked name (for example no more than half its length) so short noise matches nothing, and add a test for it.

Smaller: the chrome.ts comment rewrap on RepoHeaderOptions is unrelated and belongs to the gate run, not this change; keep the import grouped with the other ./ imports.

commented

I've pushed changes for all of juniper's points. bun scripts/gate.ts is clean, tsc is clean, and the near-pages, did-you-mean and tui-dashboard-explore tests pass (48 tests, run together). I did not run the wider suite.

  • Both doors: the terminal now has the same suggestion. When the palette's repository prompt finds no repository and none is near, it answers "not found — pages like it, on the web: /explore". The doc is docs/features/near-pages.md, with its row in docs/features/README.md. The change is in src/tui/forge.ts.
  • Short paths: the allowed distance is now at most half the asked name's length, and never more than 3. /ab and /a offer nothing. The new test also checks the three-item cap on admin paths. /boar offers more than one page.
  • One hint line: the 404 now shows a single "Try …" line with pages first, then near repositories, instead of two lines.
  • Cleanup: I reverted the unrelated RepoHeaderOptions comment rewrap, and the import now sits with the other ./ imports.
  • Commit lines: the gate asked for a Direction: line (pipeline-first rule) that I only saw after pushing. It is an empty commit, because I can't force-push. The Looks: and Try: lines are in the second commit.
  • Old tests: the "Did you mean" label for repositories on the web 404 became "Try". The tests that name that label are test/did-you-mean.test.ts, test/tui-dashboard-explore.test.ts and test/explore-unknown-words.test.ts, and they still pass. The terminal's own "did you mean" wording is unchanged.
Changes requested — before the latest push

Round 2. The web 404 works on the preview: /explroe shows "Try Explore" as a link, and a far path shows no hint line. Earlier asks met: terminal door and doc added, short-path noise fixed, one hint line, import and comment cleanup. Fix first: the new terminal answer (not found, pages like it, on the web) in src/tui/forge.ts has no test, and the Tests rule says every behaviour needs one that fails without it. Add one next to the palette repo-prompt tests in test/tui-dashboard-explore.test.ts: a typo like explroe gives a page hint, and a guest is not offered /system. Also, the far-path assertion in test/near-pages.test.ts checks not.toContain("Pages like it"), but that label no longer exists, so it passes whatever the page says. Assert on the Try line instead.

commented

A 404 on the web now offers up to three top-level pages close to the path that was asked for, as one "Try" line of links. A path that is close to nothing gets no line. The terminal's "Open a repository" prompt does the same: when nothing is found, it replies not found — pages like it, on the web: …. Pages the viewer can't open are never offered, so a guest is never shown /system.

This round adds the tests review asked for:

  • Terminal tests in test/tui-dashboard-explore.test.ts. They drive the palette's "Open a repository" prompt through a headless terminal:

- explroe gets the answer pages like it, on the web: /explore. - sytem offers /system to an admin, but a guest just gets not found with no /system.

I checked that these tests catch a missing hint: with the hint list emptied in src/tui/forge.ts, both fail.

  • Far-path check in test/near-pages.test.ts: it now checks that the page has no Try line. It used to check for "Pages like it", a label the page no longer shows, so it could never fail.

Both test files pass (26 tests). bun scripts/gate.ts --fix changed nothing and bun x tsc --noEmit is clean. No app code changed this round.

To try it, open /explroe on the preview, or press Ctrl+K in the terminal, choose "Open a repository" and type explroe.

🤖 Generated with Claude Code

Approved

Earlier asks are met: the terminal door and its how-to (docs/features/near-pages.md, not README), short paths capped at half the name length, one Try line, the unrelated comment rewrap reverted, and terminal tests plus a far-path test that can now fail. On the preview /explroe is a 404 with Try <a href=/explore>Explore</a> in plain HTML (works with JS off), and a far path shows no Try line. Guests are never offered /system. The change is small, single-purpose and has no new dependency. Next, non-blocking: 1) Non-blocking: match only the first segment today, so /apps/x offers Apps; fine. 2) Non-blocking: the terminal reply names web paths as plain text; a later pull could make that a copyable link.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs