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

/explore filters to what changed in the last 7 or 30 days with two plain links kept in the URL #13560

Merged opened this

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

Merged

This adds only a test: the behaviour was already on main, so I changed no source. What already holds on main ?since=7d and ?since=30d (and 1d) narrow /explore. since is read as the updated window (exploreLineFrom, src/actions/explore.ts).

Notes

shipped production is serving it deploy 751373a

opened this

This adds only a test: the behaviour was already on main, so I changed no source.

What already holds on main

  • ?since=7d and ?since=30d (and 1d) narrow /explore. since is read as the updated window (exploreLineFrom, src/actions/explore.ts).
  • An unknown value such as since=9y is ignored. The page answers 200, shows the full list and a note naming 1d, 7d, 30d.
  • The Sort and time panel (src/web/studio/explore.ts) offers Any time, Today, This week and This month as plain links. The active one carries aria-current="page", and "Any time" is the clear link.
  • Sort links are built from the whole query, so they keep since.
  • The window filters on the stored last-change time, so it adds no scan.

What I added

  • test/explore-since.test.ts has two tests:

- Both windows narrow the list, and since=9y leaves it whole with the note. - The active window is marked, "Any time" drops since, and a sort link keeps it.

  • bun x tsc --noEmit, the gate, this file and test/explore-url.test.ts pass locally. I did not run the full suite.
  • Nothing in main's source changed, so these tests pass without any source change. They guard main's behaviour; they don't fail without a change.

What I left out

  • The "More results" link keeps the filter because it is built from the same query as the sort links, and test/explore-cursor-web.test.ts covers paging. I did not add a since paging test: a second page of recent rows would need more than 60 apps with fresh merges, and I did not build that fixture.

To try it

  • Open /explore?kind=app&since=7d.

Closes #13540

1 earlier comment · 1 event
commented

This adds only a test: the behaviour was already on main, so I changed no source.

What already holds on main

  • ?since=7d and ?since=30d (and 1d) narrow /explore. since is read as the updated window (exploreLineFrom, src/actions/explore.ts).
  • An unknown value such as since=9y is ignored. The page answers 200, shows the full list and a note naming 1d, 7d, 30d.
  • The Sort and time panel (src/web/studio/explore.ts) offers Any time, Today, This week and This month as plain links. The active one carries aria-current="page", and "Any time" is the clear link.
  • Sort links are built from the whole query, so they keep since.
  • The window filters on the stored last-change time, so it adds no scan.

What I added

  • test/explore-since.test.ts has two tests:

- Both windows narrow the list, and since=9y leaves it whole with the note. - The active window is marked, "Any time" drops since, and a sort link keeps it.

  • bun x tsc --noEmit, the gate, this file and test/explore-url.test.ts pass locally. I did not run the full suite.
  • Nothing in main's source changed, so these tests pass without any source change. They guard main's behaviour; they don't fail without a change.

What I left out

  • The "More results" link keeps the filter because it is built from the same query as the sort links, and test/explore-cursor-web.test.ts covers paging. I did not add a since paging test: a second page of recent rows would need more than 60 apps with fresh merges, and I did not build that fixture.

To try it

  • Open /explore?kind=app&since=7d.
Changes requested — before the latest push

No source change: the behaviour is already on main (the pull says so), so the issue is done and the right outcome is a decline naming the commit that did it, not a test-only pull. If it stays, fix the tests. (1) The narrowing assertions are toBeLessThan(2), which passes if the filter drops everything or one row; seed one recently changed and one stale app and assert exactly which slug remains. (2) The final not.toContain on aria-current depends on attribute order and passes vacuously; assert on the parsed anchor for the unfiltered Any-time state. (3) Box 3 names paging, and nothing here tests the More-results link keeping since; assert the link href from a small page size or a unit test of the link builder. (4) Box 4 needs a test that fails without a change; these cannot, by the pull own admission.

commented

Reworked the tests on the same branch per review. Still no source change: the behaviour is already on main, and this pull only adds test/explore-since.test.ts.

  • Narrowing is exact. The test seeds three apps for one owner. fresh was merged 2 days ago, stale 20 days ago, and never has no merged pull. since=7d returns exactly /pine/fresh. since=30d returns exactly fresh and stale. An unknown since=9y returns all three, answers 200, and shows the "1d, 7d, 30d" note.
  • The marked-link checks read the anchor itself. The test parses the "This week" and "Any time" links and checks aria-current on each tag, so attribute order no longer matters.

- With since=7d, "This week" carries aria-current and "Any time" does not. - Unfiltered, the two swap. - "Any time" links to /explore?kind=app&owner=pine, which drops since. - The "Forks" sort link keeps since=7d.

  • Paging is covered. The test seeds 62 apps merged yesterday, one more than a page of 60 can hold. The first page has 60 rows, and its More-results link keeps since=7d. Following that link returns the remaining 2, and together they give all 62 with no repeats.
  • The tests check real narrowing. Without a working since filter the exact-slug assertions fail, because stale and never would show up under 7d.

I disagree on one point: I'm keeping the pull rather than declining it. Box 4 asks for a test that fails without a change, which can't hold when main already does the work. The pull says up front that it is test-only, and the issue's Risks section explicitly allows adding only the missing test and saying so.

bun x tsc --noEmit, bun scripts/gate.ts --fix and bun test test/explore-since.test.ts are clean.

Try it at /explore?kind=app&since=7d.

Approved

Test-only pull; the behaviour already lives on main and the preview shows it: /explore?kind=app&since=7d marks "This week" with aria-current=page. The tests now assert exact slugs per window, parse the anchor tag for aria-current, check the Any time and Forks hrefs, and page through 62 apps with since kept. They would fail if the filter, the marking or the paging link lost since. Nothing here touches security, the terminal or README; no new behaviour, so no new doc. Two things I would do next: (1) time the 62-repo beforeAll (it creates 62 real repos); if it is over a second or two, seed rows directly or lower the page size so the pipeline-first goal of fast tests holds. (2) The anchor() helper builds a RegExp from the label; fine for these literals, but keep labels regex-free.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs