feat(API): Remove offset query param from list workflow history endpoint - #36940
Conversation
PR review overviewBased on ownership of the 5 changed files in this PR:
|
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
No issues found across 5 files
Architecture diagram
sequenceDiagram
participant Client
participant API as Public API Handler
participant DTO as ListWorkflowHistoryQueryDto
participant Pager as Pagination Service
participant DB as Database
Note over Client,DB: Runtime flow for GET /workflows/{id}/history
Client->>API: GET request with ?limit & ?cursor & ?offset
API->>DTO: Validate query parameters
Note over DTO: CHANGED: Picks 'limit' from schema.<br/>'offset' is no longer defined.
alt Request contains 'offset'
DTO-->>API: Silently strips 'offset' (inert)
else Request contains 'cursor'
DTO-->>API: Returns limit and encoded cursor
end
API->>Pager: decodeCursor(cursor)
Note over Pager: Internal implementation still<br/>uses { offset, limit }
Pager-->>API: Return internal offset/limit
API->>DB: Query workflow history
DB-->>API: Return records (data)
API->>Pager: encodeNextCursor(nextOffset)
Pager-->>API: Opaque string (e.g. "Y3Vyc29y...")
API-->>Client: 200 OK { data, nextCursor }
Note over Client,Pager: Skill Update: Future list endpoints must<br/>only pick 'limit' from publicApiPaginationSchema.
| `v1/shared/services/pagination.service.ts`. Decode the incoming cursor to | ||
| `{ offset, limit }`, guard the decoded shape, and pass `offset`/`limit` to the | ||
| service. | ||
| service — `offset` is an internal implementation detail of the cursor here, |
|
To add why we're accepting this breaking change on the otherwise "backwards compatible" public API: Our telemetry shows that there are only a handful of customers using it. This data doesn't go as granular as to be able to tell whether the |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
Summary
Removes the
offsetquery parameter fromGET /workflows/{workflowId}/history, leaving cursor-only pagination — matching every other Public API list endpoint.This endpoint was only recently added, has low usage, and is being accepted as a breaking change without a deprecation window.
Also updates the
public-apiagent skill so future list endpoints picklimitoffpublicApiPaginationSchemainstead of spreading it, which is what letoffsetleak onto this endpoint in the first place.Demo:
https://www.loom.com/share/2cc0e4fd6c1c4e8db1cc9052abf6d1a3
How to test
GET /api/v1/workflows/{workflowId}/history?limit=2then page with the returnednextCursor— unchanged.GET /api/v1/workflows/{workflowId}/history?offset=2—offsetis now a no-op so this is a behaviour change to be aware of but not an error response.Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/API-185
Review / Merge checklist
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)