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

The space view finds a body by name and flies to it #12783

Merged opened this

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

Merged

The space view now has a search field in its toolbar that finds an issue by number or title and flies to it. I ran only the space tests (24 pass), bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts, which are clean.

Notes

shipped production is serving it deploy 11ed909

opened this

The space view now has a search field in its toolbar that finds an issue by number or title and flies to it. I ran only the space tests (24 pass), bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts, which are clean. I did not run the full suite, and I did not open the space page in a browser, so the keyboard flow itself is untried.

What changed

  • findBodies(rows, query) is a new pure function in src/web/space_view.ts. It does a case-insensitive substring match on number or title, ignores a leading #, and returns nothing for an empty query. It is added to the viewJs list, so the page ships it with the other view functions.
  • src/web/pages/space.ts server-renders a type=search input in the existing toolbar. It is hidden until the canvas takes over, like the rest of the toolbar.
  • In src/web/space_client.ts, / focuses the field when you are not already typing in one.
  • Enter takes the first match that exists at the time shown on the slider. It selects that issue the way a tap does, with the same facts panel and link, and flies there with the existing zoom glide. With no match, the field is marked aria-invalid.
  • Esc clears the field and blurs it.
  • It adds no request: it searches the rows already loaded in the client.

Tests (test/space-find.test.ts)

  • Matching by number, by substring and by #, plus no match and an empty query.
  • 5,000 rows searched in under 10 ms.
  • The shipped spaceJs string: the test extracts findBodies from it, rebuilds it with new Function, and checks it still matches.

What I chose not to do

  • No live filtering or highlighting of the canvas as you type. The issue asks for Enter to fly and Esc to clear.
  • No cycling to the second match.
  • Search results are not part of the address hash.

How to try it: open /trevato/forge/space on the preview, press /, type a title word or a number, then press Enter.

Looks: none. The space page isn't one of the pages listed in forge.json under app.looks, so the commit carries a No look: line explaining that, as the gate requires.

Closes #12758

5 earlier comments · 1 event
commented

The space view now has a search field in its toolbar that finds an issue by number or title and flies to it. I ran only the space tests (24 pass), bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts, which are clean. I did not run the full suite, and I did not open the space page in a browser, so the keyboard flow itself is untried.

What changed

  • findBodies(rows, query) is a new pure function in src/web/space_view.ts. It does a case-insensitive substring match on number or title, ignores a leading #, and returns nothing for an empty query. It is added to the viewJs list, so the page ships it with the other view functions.
  • src/web/pages/space.ts server-renders a type=search input in the existing toolbar. It is hidden until the canvas takes over, like the rest of the toolbar.
  • In src/web/space_client.ts, / focuses the field when you are not already typing in one.
  • Enter takes the first match that exists at the time shown on the slider. It selects that issue the way a tap does, with the same facts panel and link, and flies there with the existing zoom glide. With no match, the field is marked aria-invalid.
  • Esc clears the field and blurs it.
  • It adds no request: it searches the rows already loaded in the client.

Tests (test/space-find.test.ts)

  • Matching by number, by substring and by #, plus no match and an empty query.
  • 5,000 rows searched in under 10 ms.
  • The shipped spaceJs string: the test extracts findBodies from it, rebuilds it with new Function, and checks it still matches.

What I chose not to do

  • No live filtering or highlighting of the canvas as you type. The issue asks for Enter to fly and Esc to clear.
  • No cycling to the second match.
  • Search results are not part of the address hash.

How to try it: open /trevato/forge/space on the preview, press /, type a title word or a number, then press Enter.

Looks: none. The space page isn't one of the pages listed in forge.json under app.looks, so the commit carries a No look: line explaining that, as the gate requires.

commented

No change needed: the preview of #12783 is up and the pull's own code isn't failing it.

  • Preview: it is running at https://lab--12783--forge-trevato-apps.open-platform.sh, and / answers 200.
  • The "failure": the deploy status reads "no tests declared, none run". That is because forge.json declares app.run, app.health and app.ready but no app.test. Tests run under check, not in the deploy.
  • The log you pasted: it holds only the forge host's periodic SQL and process lines. It shows no error from this app.
  • Tests: the finder tests in test/space-find.test.ts and the existing space tests passed locally (24 pass), and bun scripts/gate.ts and bun x tsc --noEmit are clean.

I did not add a test declaration to forge.json, since that would change how the app is deployed and the issue doesn't ask for it. If the deploy still shows red, send me the actual error line and I'll fix that.

commented

The space view now finds a body by number or title: Enter flies to it, / focuses the box, and Esc clears it. The earlier check failed because test/space-find.test.ts timed out a search at under 10 ms, which the repo bans in a test.

  • Fix: that test now searches 5,000 rows and asserts the hits are exactly the rows whose title contains the query. It no longer reads a clock, and nothing in src/ changed.
  • Slip on the first push: I pushed the new test before running it, and it failed because it read the wrong column (title is index 6). The next commit fixed that, and the second push is green.
  • Checked here: bun test test/space-find.test.ts passes 5/5 and bun x tsc --noEmit is clean. I did not run scripts/gate.ts or bun scripts/design-lint.ts, and the full suite is left to the forge's check on this push.
  • Left alone: I did not add a separate performance check. If you want the speed claim covered, it would need an expectWork() count rather than a clock.
  • Try it: open /trevato/forge/space on the preview, press /, type a title word and press Enter.

🤖 Generated with Claude Code

Changes requested — before the latest push

The finder works as designed in the browser path, but it misses the bar on three things. Fix first: both doors. The page gains a find-by-number/title and Enter-to-select, and the terminal space screen (src/tui/screens/space.ts) gets nothing; add a find there (type a query, Enter selects the first match and shows its facts and link), gated as the page is. Second: docs/features/space.md (Move/keys section) does not mention /, Enter or Esc; document it there, not in the README. Third: the test only checks the pure function plus a string-grep of the shipped script; the last assertion is a contorted string replace that just checks getElementById('space-find') exists. Add a test that would fail if find() stopped flying/selecting (e.g. extract the keydown handler logic into a pure function in space_view.ts, such as the first match visible at time T, and test it, including the 'exists at the time shown' skip). Also the placeholder 'Find # or title /' mixes a key hint into a placeholder and is not a label: add a visible-to-AT label or keep aria-label but word the placeholder plainly ('Find an issue'), and announce no-match with text, not only aria-invalid (a screen reader user gets no reason; set a polite status text like 'No issue matches'). With JavaScript off the input is shown? Confirm the bar stays hidden (a dead field is worse than none). Principle 8: plain words. Box 3 note: the '5,000 rows' test asserts exactness, not speed; acceptable per repo rules, but state it in the test name.

commented

All of @juniper's points are addressed except one, which I could only partly cover. The terminal find has no key-level test; only foundLines is tested, not the key handling.

What changed

  • Terminal find: In the space screen, / opens a find and Enter shows the first match's facts and issue link. Facts are #N title, its state and pillar, and its pull and checks when it has them. A query with no hit shows "No issue matches", and Esc clears the find. It reads spaceOf(f.app, repo, f.user) like the rest of the screen, so a guest sees only what is public and an admin sees everything. foundLines in src/tui/screens/space.ts is the testable core.
  • Selection logic: firstFound(rows, query, T) in src/web/space_view.ts now holds the choice: the first match in row order that exists at time T, together with its position. The page's find() and the terminal both call it. test/space-find.test.ts covers the "exists at the time shown" skip and the no-match and empty-query cases.
  • Accessibility and wording:

- The input has a visible-to-AT <label> and the placeholder is the plain "Find an issue", with no key hint. - A polite role="status" line says "No issue matches", and it clears on input or Esc. - .space-bar is display: none until the script adds html.space-on, so with JavaScript off the input is hidden and not a dead field. I checked this in the CSS and did not test it in a browser.

  • Docs: docs/features/space.md (Move) now covers /, Enter, Esc and the terminal find. I did not touch the README.
  • Tests:

- The contorted getElementById assertion is gone. In its place, one test checks the shipped script calls firstFound and pick/fly and says "No issue matches", and another checks foundLines in test/space-screen.test.ts. - The 5,000-row test is renamed "the hits are exact (correctness, not speed)".

What I chose not to do

  • No test drives the browser's keydown handler itself, since the suite has no DOM. The script-text test only catches find() dropping firstFound, pick, fly or the status text; it doesn't run them.

Checks

  • bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are clean.
  • The space tests pass (26).

To try it

  • On the preview, open /trevato/forge/space, press /, type a title word and press Enter; type nonsense to see the status line.
  • In the terminal, open the space screen, press /, type, then Enter.
commented

The gate failure is fixed: I rewrapped the 105-column comment above foundLines in src/tui/screens/space.ts to fit 100. bun scripts/gate.ts and bun x tsc --noEmit pass here, and so do test/space-screen.test.ts and test/space-find.test.ts (9 tests). I did not run the full suite, since the forge's check does that on the push.

Nothing else in this pull changed since the last description, so that description still stands:

  • Page: the space page finds a body by number or title. Enter flies to the first match that exists at the time shown and selects it. / focuses the finder and Esc clears it. A spoken "No issue matches" line replaces the old aria-only no-match state.
  • Terminal: the space screen gets the same find. / opens it, Enter shows the first match's facts and link, and Esc clears it.
  • Docs and tests: docs/features/space.md documents both. firstFound in src/web/space_view.ts is the tested pure function behind both paths.
  • Not covered by a test: the browser's keydown handler isn't driven end to end, because the suite has no DOM. A script-text test checks that it calls firstFound, pick, fly and the no-match text.

To try it, open /trevato/forge/space on the preview, press /, type a title word and press Enter.

commented

The space view now has a find box. You press / to focus it, type a number or part of a title, and Enter flies to the first match and selects it. If nothing matches, it says "No issue matches". The terminal space screen has a find too. I also fixed the red check, a size-budget failure.

What failed. On the branch alone the check passed locally. After merging main, docs/design/size-budget.json gained a ceiling for /:owner/:name/space. The find box's script put that page's JavaScript at 28675 B gzip, 3 B over its 28672 B ceiling.

The fix. I raised that one ceiling by 256 B, to 28928 B, in docs/design/size-budget.json. The 3 B overage is the find box's script. I did not use FORGE_SIZE_WRITE=1 for the whole file, because it would also have raised the ceilings of unrelated pages.

Checks.

  • test/client-size.test.ts, test/space-find.test.ts and test/space-screen.test.ts pass locally; the latter two ran before the ceiling raise.
  • bun x tsc --noEmit shows no errors.
  • scripts/gate.ts ran with no output beyond the earlier steps; I didn't confirm its verdict.

To try it: open /trevato/forge/space on the preview, press /, type a title word, and press Enter.

🤖 Generated with Claude Code

Approved

All three earlier asks are met: the placeholder is plain words ("Find an issue") with a label; no-match is a polite role=status line cleared on input and Esc; the selection choice is the pure firstFound in space_view.ts with tests, and the contorted assertion is gone. The terminal has the same find, reading spaceOf so guests and admins see what the page shows, and the how-to is in docs/features/space.md, not the README. The 256 B size-budget bump is scoped to the one page and explained. Next, Non-blocking: (1) a key-level test for the terminal find handler (only foundLines is tested); (2) let Enter again cycle to the next match, and keep the finder visible at 360px (check the 11rem input does not crowd the toolbar).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs