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

/api/v1/explore rows carry the numbers the page's why-line shows: forks, ships, likes and age #13613

Merged opened this

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

Merged

Each app row from GET /api/v1/explore and the MCP explore tool now carries forks, ships, likes and updatedAt at the top level. The new tests, explorer-why, explore-parity and test/mcp-size.test.ts pass, and bun x tsc --noEmit is clean; I did not run the full suite.

Notes

shipped production is serving it deploy 751373a

opened this

Each app row from GET /api/v1/explore and the MCP explore tool now carries forks, ships, likes and updatedAt at the top level. The new tests, explorer-why, explore-parity and test/mcp-size.test.ts pass, and bun x tsc --noEmit is clean; I did not run the full suite.

What changed

  • rowsWithWhy in src/actions/explore.ts is the one function both doors use. It copies the four fields from the row's numbers and shippedAt, which are what the /explore why-line is built from, so there is no second source of numbers.
  • updatedAt is the row's shippedAt, the last ship (null when never shipped). I took that as the age the page shows; if you meant last push, say so.
  • test/explore-api-numbers.test.ts checks that the flat fields equal the numbers in the page's line, and that person rows stay without them. It also fetches a seeded app through /api/v1/explore and /explore.
  • docs/features/explore.md is updated.

Not done: person and forge rows are unchanged; they keep numbers and why. The nested numbers and figures stay as they were, so no existing consumer breaks.

To try it: open /api/v1/explore?q=kind:app and read the new fields on each item.

The push needed a "Try:" commit before the pre-push hook let it through, so the branch ends with an empty commit that says how to try the change.

Closes #13600

1 earlier comment · 1 event
commented

Each app row from GET /api/v1/explore and the MCP explore tool now carries forks, ships, likes and updatedAt at the top level. The new tests, explorer-why, explore-parity and test/mcp-size.test.ts pass, and bun x tsc --noEmit is clean; I did not run the full suite.

What changed

  • rowsWithWhy in src/actions/explore.ts is the one function both doors use. It copies the four fields from the row's numbers and shippedAt, which are what the /explore why-line is built from, so there is no second source of numbers.
  • updatedAt is the row's shippedAt, the last ship (null when never shipped). I took that as the age the page shows; if you meant last push, say so.
  • test/explore-api-numbers.test.ts checks that the flat fields equal the numbers in the page's line, and that person rows stay without them. It also fetches a seeded app through /api/v1/explore and /explore.
  • docs/features/explore.md is updated.

Not done: person and forge rows are unchanged; they keep numbers and why. The nested numbers and figures stay as they were, so no existing consumer breaks.

To try it: open /api/v1/explore?q=kind:app and read the new fields on each item.

The push needed a "Try:" commit before the pre-push hook let it through, so the branch ends with an empty commit that says how to try the change.

Changes requested — before the latest push

The preview works: /api/v1/explore?q=kind:app returns forks, ships, likes and updatedAt on the app row, equal to the numbers in figures. The change is small and has one source. Two things to fix in one round:

  1. FIRST: the MCP explore tool is claimed in the docs and the pull description, but no test covers it. Add a test that calls the MCP explore tool for a seeded app and asserts the four fields. Without it the MCP half of the behaviour could regress with every test still green.
  2. rowsWithWhy decides 'this is an app row' from figures === "". That ties the flat numbers to whether a display string happens to be empty. Branch on row.kind === "app" instead, so the API shape does not change if the wording rule does.

Smaller points:

  • The first test's figureCounts(...) assertion compares the code against itself. Assert literal values instead.
  • The test header cites #13600, but this is #13613. Make the reference match the issue.
  • updatedAt holds shippedAt (the last ship), not the last push. The doc says so, which is good. Add the same one-line note to the API field docs so consumers do not read it as a push time.

No security, README, dependency or terminal concerns. The terminal rows already say the figures. The how-to is in docs/features/explore.md.

commented

I've addressed all of juniper's points and pushed to the same branch. The new tests, explorer-why and test/mcp-size.test.ts pass, and bun x tsc --noEmit is clean. I ran those test files only, not the full suite.

  • MCP test: test/explore-api-numbers.test.ts now calls the MCP explore tool for a seeded app. It asserts forks, ships, likes and updatedAt, and the figures line.
  • Kind check: rowsWithWhy now checks row.kind === "app" to add the flat numbers. It no longer relies on figures being non-empty.
  • Literal assertions: the first test asserts the literal line "3 forks, 5 ships, 2 likes, shipped 2 days ago" instead of comparing the code against itself. The ship time is now built relative to the current time, so the "2 days ago" doesn't drift.
  • Issue reference: the test header cites #13613.
  • API docs: the GET /api/v1/explore route summary now says updatedAt is the time of the last ship, not the last push, and null when never shipped.

I didn't disagree with anything. Both doors still share the one function, so there is no second source of numbers.

🤖 Generated with Claude Code

Approved

All earlier asks are met since fe6a7852531a: the MCP test now exists and asserts the four fields and the figures line. rowsWithWhy checks row.kind === "app" instead of leaning on figures being non-empty. The first test asserts the literal line with a relative date. The test header cites #13613. The route summary says updatedAt is the last ship, null when never shipped. Both doors share rowsWithWhy, person rows are unchanged, the docs are in docs/features/explore.md and README is untouched. No new dependency. This is a JSON-only change, so there is no phone, keyboard or no-JS impact.

Next, both non-blocking:

  1. Non-blocking: the app branch in rowsWithWhy is one long ternary. Split it into a small appNumbers(row) helper so the person path reads plainly.
  2. Non-blocking: say in the pull body that the nested numbers and the flat fields now both ship, and name which one new consumers should read.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs