Skip to content

feat: add migrate command and pipeline - #657

Draft
SgtPooki wants to merge 8 commits into
feat/migrate-4-uploadfrom
feat/migrate-5-cli
Draft

feat: add migrate command and pipeline#657
SgtPooki wants to merge 8 commits into
feat/migrate-4-uploadfrom
feat/migrate-5-cli

Conversation

@SgtPooki

@SgtPooki SgtPooki commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What changed

Part 5 of 5 splitting #652: this is the slice that turns the command on. run-migrate.ts orchestrates download, pack, upload, and eviction as one pipeline clocked by a staging-disk byte budget: committed pieces evict and free budget, so a disk smaller than the migration cycles instead of failing (--max-staged-bytes caps it explicitly). Startup sweeps the staging dirs against migrate.db, re-verifying staged files by recorded hash. Wires filecoin-pin migrate <cid-list-file> into the CLI and exports getDataDirectory (the design doc itself rides in #653).

Egress defaults to none. Exit 0 only when every CID is committed at the requested copies; anything short exits 1 and re-running is safe.

Refs #651.

How to verify

pnpm install && pnpm run build && pnpm test
node dist/cli.js migrate --help

Notes / risks

Base: feat/migrate-4-upload. Merge order 1 through 5. The calibnet kill-and-resume validation noted on #652 is still pending before undraft. Concurrent runs against one migrate.db are unsupported.

Final slice of the migrate command split (#652). run-migrate
orchestrates download, pack, upload, and eviction as one pipeline
clocked by a staging-disk byte budget: committed pieces evict and
free budget so a disk smaller than the migration cycles instead of
failing. On startup the staging dirs are swept against migrate.db,
re-verifying staged files by recorded hash.

Wires up 'filecoin-pin migrate <cid-list-file>' in the CLI, exports
getDataDirectory for the per-network state path, and adds the
pipeline docs. Closes #651.
@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
The run could exit 0 with CIDs that never reached chain: per-bin
pack failures kept members 'done' outside any recorded piece and
nothing counted them. The summary now reports such CIDs as
'unpacked' and migrateIncomplete treats them as incomplete, with a
pipeline test covering the pack-failure path.

EGRESS_PROVIDER=beam exported for add/import silently defeated the
migrate 'none' default through Commander's env binding, opting a
bulk run into CDN lockup. Migrate registers its own option without
env binding and its help states the 'none' default.

A consumer failure now fails the staging budget and both pipeline
sides settle before runMigrate returns, so download workers stop
instead of racing the caller's db.close(). A member whose own bytes
exceed the budget's download ceiling fails terminally instead of
retrying forever. --copies validates through parsePositiveInt.

Docs: glossary entries for member CAR, parked piece, GC window, and
staging budget; migrate.md states the sha2-only hasher scope.
SgtPooki added a commit that referenced this pull request Aug 26, 2026
documentation/migrate.md and the migrate glossary entries move from
the final slice (#657) to the first so the pipeline design, resume
guarantees, and exit contract get agreement before the code that
implements them is reviewed. The doc describes the completed stack;
flags it mentions land in later slices.
Pipeline progress goes through src/utils/cli-logger.ts like every
other command, and the raw JSON dump on stdout is replaced by a
summary block in the data-set display style: counts per stage and
provider, with problem CIDs (over-cap, downloaded-but-unpacked)
listed by name. filecoin-pin has no piped-output convention to
honor; migrate.db holds the full record and a --json output mode is
a possible follow-up for scripted consumption.
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