fix(jsm): accept the numeric pagination the JSM tools actually send - #6386
Conversation
The JSM tools declare start/limit as type: 'number' and the block coerces Max Results with Number.parseInt, but every /api/tools/jsm/* contract typed them as z.string(). Any JSM read with pagination filled in 400'd before reaching Atlassian, and get_queues 400'd unconditionally because the block always sends includeCount as a boolean. Normalize both shapes at the contract boundary, add the missing Start Index block input, and route Max Results through the existing toOptionalInt helper so a non-numeric entry no longer sends NaN.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Contracts ( Also widens the fork sync mapping target picker from 320px to 380px so long secret keys aren’t clipped. Reviewed by Cursor Bugbot for commit b000382. Configure here. |
320px still clipped the longest secret keys the picker shows.
Greptile SummaryThe PR aligns JSM route contracts with the numeric pagination and boolean values emitted by tools while preserving existing string callers.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/api/contracts/selectors/jsm.ts | Adds bounded numeric pagination and boolean normalization consistently across JSM route contracts. |
| apps/sim/lib/api/contracts/selectors/jsm.test.ts | Covers numeric and legacy string pagination, int32 boundaries, omission, and queue boolean normalization. |
| apps/sim/blocks/blocks/jira_service_management.ts | Exposes Start Index and consistently maps optional pagination inputs across all eleven supported operations. |
| apps/sim/ee/workspace-forking/components/fork-sync/fork-sync-view.tsx | Widens the mapping target picker from 320px to 380px. |
| apps/sim/blocks/blocks/jira_service_management.test.ts | Exercises operation resolution and the block-to-tool-to-contract pagination chain for all supported operations. |
Sequence Diagram
sequenceDiagram
participant Block as JSM Block
participant Tool as JSM Tool
participant Contract as Route Contract
participant Route as API Route
participant Atlassian as Atlassian JSM
Block->>Tool: start/limit as numbers
Tool->>Contract: request body
Contract->>Contract: validate int32 and normalize to strings
Contract->>Route: parsed start/limit
Route->>Atlassian: URLSearchParams
Reviews (2): Last reviewed commit: "fix(jsm): cap pagination at the document..." | Re-trigger Greptile
Addresses review: the schema claimed the int32 range but only floored at 0, so values above 2147483647 were forwarded to Atlassian instead of being rejected at Sim's boundary. Also restores the const tuple for the paginated operation list and drops the widened ToolConfig from the test table.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b000382. Configure here.
Summary
JSM pagination (the main fix)
start/limitastype: 'number', and the block coerces Max Results withNumber.parseInt— but all 11/api/tools/jsm/*contracts typed them asz.string(). Any JSM read with pagination filled in 400'd at Sim's own boundary before reaching Atlassian.jsm_get_queueswas broken unconditionally: the block always sendsincludeCountas a boolean (params.includeCount === 'true') and the contract demanded a string.URLSearchParams. The string branch stays unconstrained so every body that parsed before still parses; the newly accepted number branch is bounded to the non-negative int32 range Atlassian documents.limitwas wired andstartwas exposed nowhere.toOptionalInthelper so a non-numeric entry drops the param instead of sendingNaN.Verified against Atlassian's JSM Cloud OpenAPI spec:
start/limitareint32andincludeCountis a boolean on all 11 endpoints, and the param names match what the routes send.Fork mapping picker (bundled)
Type of Change
Testing
jsm.test.tscovers the contract boundary; newjira_service_management.test.tswalks the real chain (blocktools.config.params→ toolrequest.body→ route contract) for all 11 paginated operations.bun run lint,check:api-validation,tool-metadata:generate,generate-docs, andintegration-catalog:checkall clean with no drift. Docs already publishedstart/limitasnumber, so this aligns the validator with the published schema rather than the reverse.Checklist