chore(deps): update synapse-core to 0.8.1 and synapse-sdk to 1.2.1 - #37
chore(deps): update synapse-core to 0.8.1 and synapse-sdk to 1.2.1#37nijoe1 wants to merge 2 commits into
Conversation
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
snissn
left a comment
There was a problem hiding this comment.
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:
- Preserve the opaque cursor without passing it through JavaScript
number; the inline comment has the concrete failure and scope. - Add a real two-page regression test for both
dataset listandwallet 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 withnextCursor, 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.
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
|
Both requested changes are addressed on head
Validation: |
snissn
left a comment
There was a problem hiding this comment.
Follow-up reviewed exact head 2c39b27285df979e1867c78b6ad818f4383f8f5f.
Both requested changes are resolved:
piece listanddataset detailsnow validate cursors as decimal strings, convert toBigIntonly at the SDK boundary, and preserve exact CTA/output values. Both commands have regression coverage above2^53.dataset listandwallet costsnow 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.
Summary
@filoz/synapse-core0.7.0 → 0.8.1 and@filoz/synapse-sdk1.1.0 → 1.2.1.{items, nextCursor}pages, default 100/page), andactivePieceCountis removed in favor of a boundedhasActivePiecesflag.dataset listandwallet costswalk every page via the SDK'spaginate()generator, preserving the old return-everything behavior for wallets with more than 100 datasets.piece listanddataset detailsswitch from--offsetto--cursor; outputhasMore/nextOffsetbecome an optionalnextCursor(absent = last page). The "fetch all N pieces" CTA goes away with the total count; the next-page CTA carries the exact--cursorcommand instead.dataset detailsreportshasActivePieces.utils.tsuses the renamedFilecoinChaintype export.Compatibility note
The JSON output of
piece listanddataset detailschanges shape:hasMore/nextOffsetare replaced by an optionalnextCursorstring, and the dataset object reportshasActivePieces: booleaninstead ofactivePieceCount. Cursors are opaque continuation values — passnextCursorback as--cursoruntil it stops appearing.Upstream notes
getPiecesWithMetadatais deprecated upstream (removal planned in feat!: remove piece metadata getters FilOzone/synapse-sdk#936; replacement isgetPiecesplusPieceAddedevents or an indexer). It still works in 0.8.1, so this PR keeps it and defers the rewrite until removal actually ships.getChain(), hardened provider health checks, and read-only calls that omit the sender.claimTokensis now strictly typed as the two-asset tuple withfaucetInfo— 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 testsbunx tsc --noEmitbun run build