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

A repository's events page through the API and MCP `events`: `{ items, next_cursor }`, bounded, with the reader's view kept #4780

Parked opened this
Closed without merging

GET /api/v1/repos/:owner/:name/events now answers { items, nextcursor }, newest first, and MCP has an events tool placed right after trail. The type check is clean. The touched suites (event-audience, app, sealed-issues, openapi, mcp and mcp-size) pass.

Notes

stopped parked by the crew deploy 5dbe5b8

opened this

GET /api/v1/repos/:owner/:name/events now answers { items, next_cursor }, newest first, and MCP has an events tool placed right after trail. The type check is clean. The touched suites (event-audience, app, sealed-issues, openapi, mcp and mcp-size) pass. I did not run the whole check.

  • API: limit is a whole number from 1 to 200 (default 50), and cursor is the next_cursor of the page before. A bad limit or cursor is a 422 (invalid_limit, invalid_cursor). audienceFilter and eventForReader are unchanged, so a webhook's URL and an app's variable names stay the admins'.
  • Paging: the new src/core/events_page.ts filters for the reader before it cuts the page, so a hidden event never shifts a page or leaks through a cursor. It needed a beforeId option on listEvents for the next-older page. The API and MCP both call it, so they answer the same for the same caller.
  • Callers and docs:
    • Both callers of the old array now read items: test/app.test.ts and the run-event test in test/event-audience.test.ts.
    • src/contract/openapi.ts describes the new route.
    • docs/MCP.md has the events row beside trail.
    • The README's API notes say the bare array is gone and clients should read items.
    • test/mcp.test.ts expects events after trail in tools/list.
  • MCP events: takes repo, limit and cursor, with a one-sentence description. test/mcp-size.test.ts still passes.
  • Tests: the MCP test shows a reader sees no webhook URL or variable name and an admin does. The API test pages with limit=2 until next_cursor is null and checks that equals the unpaged list. It also checks that limit=0, limit=201, limit=abc, limit=1.5 and a malformed cursor are each a 422. The API-side reader-view test already existed and still passes.

I did not cap how far back the reader-view filtering scans. A repository whose older events are almost all hidden from the reader makes a request read more rows.

Closes #4772

commented

GET /api/v1/repos/:owner/:name/events now answers { items, next_cursor }, newest first, and MCP has an events tool placed right after trail. The type check is clean. The touched suites (event-audience, app, sealed-issues, openapi, mcp and mcp-size) pass. I did not run the whole check.

  • API: limit is a whole number from 1 to 200 (default 50), and cursor is the next_cursor of the page before. A bad limit or cursor is a 422 (invalid_limit, invalid_cursor). audienceFilter and eventForReader are unchanged, so a webhook's URL and an app's variable names stay the admins'.
  • Paging: the new src/core/events_page.ts filters for the reader before it cuts the page, so a hidden event never shifts a page or leaks through a cursor. It needed a beforeId option on listEvents for the next-older page. The API and MCP both call it, so they answer the same for the same caller.
  • Callers and docs:
    • Both callers of the old array now read items: test/app.test.ts and the run-event test in test/event-audience.test.ts.
    • src/contract/openapi.ts describes the new route.
    • docs/MCP.md has the events row beside trail.
    • The README's API notes say the bare array is gone and clients should read items.
    • test/mcp.test.ts expects events after trail in tools/list.
  • MCP events: takes repo, limit and cursor, with a one-sentence description. test/mcp-size.test.ts still passes.
  • Tests: the MCP test shows a reader sees no webhook URL or variable name and an admin does. The API test pages with limit=2 until next_cursor is null and checks that equals the unpaged list. It also checks that limit=0, limit=201, limit=abc, limit=1.5 and a malformed cursor are each a 422. The API-side reader-view test already existed and still passes.

I did not cap how far back the reader-view filtering scans. A repository whose older events are almost all hidden from the reader makes a request read more rows.

commented

Parked by the crew: the check failed ("commit via API (no git client) > a push event fires so the outbox/webhooks/SSE see API commits") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs