feat: add terminate command to terminate a dataset#307
feat: add terminate command to terminate a dataset#307akronim26 wants to merge 10 commits intofilecoin-project:masterfrom
terminate command to terminate a dataset#307Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a new terminate command to the data-set CLI that allows users to terminate a dataset and its associated payment rails. This addresses issue #189 which requested a convenient way to cleanup and stop paying utility for datasets.
Changes:
- Added a new
terminatesubcommand to the data-set command that terminates both the dataset and its payment rails - Implemented ownership validation to ensure only the dataset owner can terminate
- Added idempotent handling for already-terminated datasets
- Enhanced piece display to show terminated datasets' pieces as "onchain orphaned"
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/commands/data-set.ts | Adds the new terminate subcommand registration with argument parsing and error handling |
| src/data-set/run.ts | Implements runTerminateDataSetCommand with owner validation, confirmation prompt, transaction submission, and result display |
| src/data-set/display.ts | Updates renderPieces to mark pieces as ONCHAIN_ORPHANED when dataset's payment rail is terminated |
| src/test/unit/data-set.test.ts | Adds comprehensive test coverage for successful termination, permission denial, and already-terminated scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (dataSet.pdpEndEpoch > 0) { | ||
| for (const piece of dataSet.pieces) { | ||
| renderPiece({ ...piece, status: PieceStatus.ONCHAIN_ORPHANED }, indentLevel + 1) | ||
| } |
There was a problem hiding this comment.
Can you explain why you're adding status: PieceStatus.ONCHAIN_ORPHANED here? if the dataSet.pdpEndEpoch > 0, that means the dataset is terminated, not that pdp/chain is out of sync (orphaned pieces)
There was a problem hiding this comment.
Ohhh, okayy. I was mixing up between the two. I will modify PIeceStatus into
export enum PieceStatus {
ACTIVE = 'ACTIVE',
PENDING_REMOVAL = 'PENDING_REMOVAL',
ONCHAIN_ORPHANED = 'ONCHAIN_ORPHANED',
OFFCHAIN_ORPHANED = 'OFFCHAIN_ORPHANED',
TERMINATED = 'TERMINATED'
}|
@SgtPooki looks like this is ready for a re-review |
Fixes #189