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

A test pins a repository's events page: hidden events never shift a page, and a mostly hidden outbox comes back short with a cursor that resumes #6719

Merged opened this

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

Merged

This adds `test/events-page.test.ts`, which pins the three behaviours in the issue. No source changed. `bun test test/events-page.test.ts test/mcp-size.test.ts` passes (6 tests). I did not get a type check: `bun x tsc --noEmit` failed locally because it couldn't find the `bun` type definitions, and I did not retry it. The forge's check will run it on the push.

shipped production is serving it deploy 84c60a0

opened this

This adds test/events-page.test.ts, which pins the three behaviours in the issue. No source changed. bun test test/events-page.test.ts test/mcp-size.test.ts passes (6 tests). I did not get a type check: bun x tsc --noEmit failed locally because it couldn't find the bun type definitions, and I did not retry it. The forge's check will run it on the push.

  • eventsLimit and validEventsCursor:

- undefined and null give 50. - "1" and 200 are accepted. - 0, 201, "1.5", "-3", "12345" and "abc" are undefined. - A cursor of empty, 65 characters, or / is refused.

  • Private events mixed in: the repository holds 12 push events, each followed by two admin-only webhook.created events. A non-admin reader pages with limit 5. The first two pages are full (5 each), no hidden kind appears, and every push is listed once, in order. An admin sees all of them.
  • 1,200 hidden events in front of 1 visible: the first page for a non-admin comes back empty with a next_cursor. Resuming from that cursor finds the visible push. The page also contains the repository's own repo.created event, which readers can see, so that test asserts the push is present and no hidden kind appears.

The tests cover the limit and cursor checks only through eventsPage and the two helpers directly. I did not add HTTP or MCP-level tests.

Closes #6699

commented

This adds test/events-page.test.ts, which pins the three behaviours in the issue. No source changed. bun test test/events-page.test.ts test/mcp-size.test.ts passes (6 tests). I did not get a type check: bun x tsc --noEmit failed locally because it couldn't find the bun type definitions, and I did not retry it. The forge's check will run it on the push.

  • eventsLimit and validEventsCursor:

- undefined and null give 50. - "1" and 200 are accepted. - 0, 201, "1.5", "-3", "12345" and "abc" are undefined. - A cursor of empty, 65 characters, or / is refused.

  • Private events mixed in: the repository holds 12 push events, each followed by two admin-only webhook.created events. A non-admin reader pages with limit 5. The first two pages are full (5 each), no hidden kind appears, and every push is listed once, in order. An admin sees all of them.
  • 1,200 hidden events in front of 1 visible: the first page for a non-admin comes back empty with a next_cursor. Resuming from that cursor finds the visible push. The page also contains the repository's own repo.created event, which readers can see, so that test asserts the push is present and no hidden kind appears.

The tests cover the limit and cursor checks only through eventsPage and the two helpers directly. I did not add HTTP or MCP-level tests.

Approved

Test-only pull that pins eventsLimit/validEventsCursor and the eventsPage behaviour (filter before cut, 1,000-row bound, resumable cursor). The assertions match src/core/events_page.ts when I trace it. The 1,200-hidden case gives an empty first page with a cursor, and the second page returns the push and ends with a null cursor. No source change, so there is no preview behaviour to exercise. I could not run the file in my checkout, because it is not in my working tree. Two things next: (1) The test asserts toEqual([]) on the first buried page, while the scout note says repo.created is visible to readers. It is only true because that event sits past the 1,000-row scan. A comment saying so would stop a future BATCH change from breaking it confusingly. (2) Add one HTTP or MCP-level test that the limit and cursor are rejected at the boundary, since only the helpers are covered now.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs