Skip to content

fix(typescript): ignore pagination field mismatches in wire test mock server#11490

Merged
fern-support merged 12 commits intomainfrom
devin/1767992758-fix-ts-sdk-top-level-cursor
Jan 12, 2026
Merged

fix(typescript): ignore pagination field mismatches in wire test mock server#11490
fern-support merged 12 commits intomainfrom
devin/1767992758-fix-ts-sdk-top-level-cursor

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 9, 2026

Description

Refs: Customer bug report (Square)

Fixes wire test failures when pagination tests call getNextPage(). The SDK correctly sends the cursor/offset from the response, but the mock server was rejecting the request because the value didn't match the original request body.

Link to Devin run: https://app.devin.ai/sessions/569f5162819c47c4ba95afbfde8313de
Requested by: @jsklan

Changes Made

  • Added WithJsonOptions interface to withJson.ts with an ignoredFields parameter for specifying fields to ignore during request body comparison
  • Removed hardcoded !key.startsWith("pagination.") filtering from withJson.ts (per reviewer feedback)
  • Updated mockEndpointBuilder.ts to pass ignoredFields through the jsonBody method
  • Updated TestGenerator.ts to extract pagination field paths from the IR for both cursor AND offset pagination types, building the full path (e.g., "pagination.cursor", "cursor", "pagination.offset")
  • Added test fixture listWithTopLevelBodyCursorPagination with a top-level cursor field in the request body to demonstrate the bug
  • Updated IR generator test snapshots for the pagination fixture
  • Updated README.md generator (not applicable)

Testing

  • Seed tests pass for pagination fixture (2/2 test cases)
  • Verified generated tests include correct ignoredFields for both top-level and nested pagination fields
  • Manual testing completed against customer's Square SDK - all 659 tests pass
  • IR generator test snapshots updated

Updates Since Last Revision

  • Addressed reviewer feedback to remove hardcoded pagination. filtering from withJson.ts
  • Updated TestGenerator.ts to build full paths for ALL pagination types (cursor and offset), not just top-level cursor fields
  • Uses originalName for PropertyPathItem.name and wireValue for property.name to correctly construct field paths
  • Updated IR generator test snapshots (pagination.json in dynamic-snippets and ir test-definitions)

Human Review Checklist

  • Verify the path construction logic in TestGenerator.ts correctly handles both nested paths (e.g., pagination.cursor) and top-level paths (e.g., cursor)
  • Verify the type distinction: PropertyPathItem.name uses originalName, while property.name uses wireValue
  • Confirm offset pagination tests still pass (the pagination.offset field should now be in ignoredFields)
  • Verify the new listWithTopLevelBodyCursorPagination endpoint properly demonstrates the bug

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title fix(ts-sdk): ignore top-level cursor mismatches in wire test mock server fix(typescript): ignore top-level cursor mismatches in wire test mock server Jan 9, 2026
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we push pagination. into the tests themselves instead of the helpers?

devin-ai-integration bot and others added 2 commits January 12, 2026 18:08
…ields

Address reviewer feedback to remove hardcoded pagination. filtering from
withJson.ts and instead pass pagination field paths from the IR.

Changes:
- Remove hardcoded !key.startsWith("pagination.") check from withJson.ts
- Update TestGenerator.ts to build full path for both cursor and offset
  pagination types (e.g., "pagination.cursor" or "cursor" or "pagination.offset")
- Use originalName for PropertyPathItem.name and wireValue for property.name

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration devin-ai-integration bot changed the title fix(typescript): ignore top-level cursor mismatches in wire test mock server fix(typescript): ignore pagination field mismatches in wire test mock server Jan 12, 2026
@fern-support fern-support merged commit ea22532 into main Jan 12, 2026
499 of 503 checks passed
@fern-support fern-support deleted the devin/1767992758-fix-ts-sdk-top-level-cursor branch January 12, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments