Skip to content

chore(deps): update synapse-core to 0.8.1 and synapse-sdk to 1.2.1 - #37

Open
nijoe1 wants to merge 2 commits into
mainfrom
chore/update-synapse-0.8
Open

chore(deps): update synapse-core to 0.8.1 and synapse-sdk to 1.2.1#37
nijoe1 wants to merge 2 commits into
mainfrom
chore/update-synapse-0.8

Conversation

@nijoe1

@nijoe1 nijoe1 commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Update @filoz/synapse-core 0.7.0 → 0.8.1 and @filoz/synapse-sdk 1.1.0 → 1.2.1.
  • Adopt the one breaking change (core 0.8.0, Add pagination and expanded data set, piece, provider, and payment queries FilOzone/synapse-sdk#913/#914): list queries are cursor-paginated ({items, nextCursor} pages, default 100/page), and activePieceCount is removed in favor of a bounded hasActivePieces flag.
  • dataset list and wallet costs walk every page via the SDK's paginate() generator, preserving the old return-everything behavior for wallets with more than 100 datasets.
  • piece list and dataset details switch from --offset to --cursor; output hasMore/nextOffset become an optional nextCursor (absent = last page). The "fetch all N pieces" CTA goes away with the total count; the next-page CTA carries the exact --cursor command instead. dataset details reports hasActivePieces.
  • utils.ts uses the renamed FilecoinChain type export.
  • SKILL.md pagination docs and examples updated; the schema-gating test enforces them.

Compatibility note

The JSON output of piece list and dataset details changes shape: hasMore/nextOffset are replaced by an optional nextCursor string, and the dataset object reports hasActivePieces: boolean instead of activePieceCount. Cursors are opaque continuation values — pass nextCursor back as --cursor until it stops appearing.

Upstream notes

  • getPiecesWithMetadata is deprecated upstream (removal planned in feat!: remove piece metadata getters FilOzone/synapse-sdk#936; replacement is getPieces plus PieceAdded events or an indexer). It still works in 0.8.1, so this PR keeps it and defers the rewrite until removal actually ships.
  • The bump also picks up the filecoin-services v1.3.1 mainnet addresses bundled in getChain(), hardened provider health checks, and read-only calls that omit the sender.
  • claimTokens is now strictly typed as the two-asset tuple with faucetInfo — matching what fix(wallet): report per-asset faucet outcomes #35 maps, so no rework needed there.

Validation

  • bun run test: 203 passed, 496 assertions (includes the schema-gated skill examples)
  • bunx biome check src tests
  • bunx tsc --noEmit
  • bun run build

synapse-core 0.8 makes list queries cursor-paginated ({items, nextCursor}
pages) and replaces activePieceCount with a bounded hasActivePieces flag.

- dataset list / wallet costs: walk every page via paginate(), keeping the
  old return-everything behavior past 100 datasets.
- piece list / dataset details: --offset becomes --cursor; hasMore/nextOffset
  become an optional nextCursor (absent = last page). The fetch-all CTA is
  gone with the total count; the next-page CTA carries the exact --cursor
  command instead. dataset details reports hasActivePieces.
- utils: the Chain type export is now FilecoinChain.
- test mocks: page shapes for getPdpDataSets/getPiecesWithMetadata; the
  viem/actions mock spreads the real module because the root
  @filoz/synapse-core entry (imported for paginate) needs readContract.
- SKILL.md: pagination docs and examples updated (schema-gated).

getPiecesWithMetadata is deprecated upstream (removal planned in
FilOzone/synapse-sdk#936, replacement: getPieces + PieceAdded events or an
indexer); kept for now, follow up when removal ships. Bundled mainnet
addresses move to filecoin-services v1.3.1 via this bump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014V3GfgFSQNRB3XCxB6Qo8u
@nijoe1
nijoe1 requested a review from snissn September 1, 2026 05:15

@snissn snissn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed exact head 0280a260b69067707facfad117510163b2633efd. The dependency migration and one-page mappings look sound, and local validation passed: bun run test (203 tests / 496 assertions), Biome, TypeScript, and build.

Changes required before merge:

  1. Preserve the opaque cursor without passing it through JavaScript number; the inline comment has the concrete failure and scope.
  2. Add a real two-page regression test for both dataset list and wallet costs. Their current tests return only one page, so the headline behavior of retaining all datasets beyond the first 100 is not exercised. Mock page 1 with nextCursor, return page 2 for that exact cursor, and assert both cursor progression and accumulated results/cost inputs.

GitHub CI is green on this head and there were no pre-existing review threads. No merge performed.

Comment thread cli/src/commands/piece/list.ts Outdated
Cursors are opaque bigints from the SDK, and both --cursor input
(z.coerce.number()) and the next-page CTA (Number(nextCursor)) silently
corrupted values above 2^53 — 9007199254740993 round-tripped as
9007199254740992. The option is now a validated decimal string in piece
list and dataset details, converted with BigInt only at the SDK boundary,
and the CTA carries the string unchanged. Regression tests pin the exact
round-trip at 2^53 + 1 for both commands.

Also add two-page regression tests for dataset list and wallet costs:
page 1 returns a nextCursor, page 2 answers that exact cursor, and the
assertions cover cursor progression plus the accumulated datasets and
cost inputs — exercising the retain-past-100-datasets behavior the
migration claimed but never tested.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014V3GfgFSQNRB3XCxB6Qo8u
@nijoe1

nijoe1 commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Both requested changes are addressed on head 2c39b27:

  1. Cursor precision--cursor is a validated decimal string in piece list and dataset details, converted with BigInt only at the SDK boundary; the next-page CTA and nextCursor output carry the string unchanged. Regression tests cover the exact round-trip at 2^53 + 1 for both commands. Thread resolved.
  2. Two-page coveragedataset list and wallet costs now have regression tests where page 1 returns a nextCursor, page 2 answers that exact cursor, and the assertions check cursor progression plus the accumulated datasets / cost inputs.

Validation: bun run test 207 passed / 509 assertions, bunx biome check src tests, bunx tsc --noEmit, bun run build.

@snissn snissn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow-up reviewed exact head 2c39b27285df979e1867c78b6ad818f4383f8f5f.

Both requested changes are resolved:

  1. piece list and dataset details now validate cursors as decimal strings, convert to BigInt only at the SDK boundary, and preserve exact CTA/output values. Both commands have regression coverage above 2^53.
  2. dataset list and wallet costs now have real two-page tests asserting the exact continuation cursor and accumulated dataset/cost inputs.

Validation on this exact head: bun run test (207 passed / 509 assertions), Biome, tsc --noEmit, and build. GitHub CI is green, the prior inline thread is resolved, and the head merges cleanly with current main.

Approved. No merge performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants