Skip to content

feat: add migrate batched upload with resume - #656

Draft
SgtPooki wants to merge 8 commits into
feat/migrate-3-packfrom
feat/migrate-4-upload
Draft

feat: add migrate batched upload with resume#656
SgtPooki wants to merge 8 commits into
feat/migrate-3-packfrom
feat/migrate-4-upload

Conversation

@SgtPooki

Copy link
Copy Markdown
Collaborator

What changed

Part 4 of 5 splitting #652. Drives packed pieces through store on the primary, SP-to-SP pull to secondaries, and batched addPieces commits, persisting every transition to migrate.db. Resume is receipt-first: a commit whose outcome is unknown after a crash resolves from the PiecesAdded event, or via findPieceIdsByCid when no tx hash was captured.. a blind on-chain re-add is never issued.

pdp-verifier.ts wraps the read-only chain lookups reconciliation needs.

This intentionally does not reuse executeUpload: the SDK commits one piece per call, and migrate needs store-many-commit-once batching plus durable per-(piece,provider) state across restarts. Known gaps vs executeUpload to resolve before undraft of the stack: no recordUploadResult telemetry and no IPNI validation.

How to verify

pnpm install && pnpm run build && pnpm run test:unit

migrate-direct-upload-flow covers park/flush/reconcile against a fake context.

Notes / risks

Base: feat/migrate-3-pack. Merge order 1 through 5.

Fourth slice of the migrate command split (#652). Drives packed
pieces through store, SP-to-SP pull to secondaries, and batched
addPieces commits (up to the SDK batch cap), persisting every
transition to migrate.db. Commits whose outcome is unknown after a
crash are reconciled on resume from the PiecesAdded event, or via
findPieceIdsByCid when no tx hash was captured, so a blind on-chain
re-add is never issued.

pdp-verifier wraps the read-only chain lookups the reconciliation
needs (piece id by CID, tx receipt status, PiecesAdded event
extraction).
@FilOzzy FilOzzy added team/filecoin-pin "Filecoin Pin" project is a stakeholder for this work. team/fs-wg FOC working group is a stakeholder for this work, and thus wants to track it on their project board. labels Aug 14, 2026
@FilOzzy FilOzzy added this to FOC Aug 14, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 14, 2026
@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC Aug 19, 2026
An add_unconfirmed row whose tx had no receipt fell straight through
to the presence check and re-parked, so the next flush could issue a
second addPieces while the original tx was still in the mempool. The
same age gate the hashless path uses now holds the row until the
breadcrumb outlives any realistic confirmation window (the constant
is renamed UNCONFIRMED_REQUEUE_AFTER_MS to cover both paths).

txLanded returned false on any RPC error, so one 5xx or rate limit
looked like a dead transaction and fed that re-queue. Only viem's
TransactionReceiptNotFoundError maps to false now; other errors
abort the pass.

fetchAddPiecesEvent no longer requires a known data set id: a crash
on the first commit of a new data set records none, and the event's
own setId is the recovery path. A successful commit writes the
resolved id back onto the context so later parks carry it. hasPiece
treats only the SP's not-found answer as absence, and data set ids
stay strings end to end instead of passing through Number.
Follows the repo convention: human-facing progress goes through
src/utils/cli-logger.ts, not a migrate-private stderr logger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/filecoin-pin "Filecoin Pin" project is a stakeholder for this work. team/fs-wg FOC working group is a stakeholder for this work, and thus wants to track it on their project board.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants