Skip to content

Conversation

Copy link

Copilot AI commented Nov 28, 2025

  • Implement "new-remove" command following the same pattern as "new-up" command
    • Create new-remove.ts - the remove command implementation
    • Create new-remove.test.ts - comprehensive tests for the remove command (24 tests)
    • Add assertStorageRemoved helper in tests/storage.ts
    • Update MockedFinished type in tests/plugin.ts to include 'removed' status
  • Fix linting issues
    • Add /* eslint-disable no-await-in-loop */ at top of file like new-up.ts
    • Fix import order in test file
    • Use for...of instead of .forEach() in assertStorageRemoved (unicorn/no-array-for-each)
  • Changed migration filtering logic
    • Migrations with wrong name are now ignored (just continue) instead of skipped
    • Only the removed migration (or failed removal) is included in finished migrations list
    • Updated tests to reflect this behavior
  • Added test for pre-aborted abortSignal scenario
  • Simplified remove command
    • Removed unnecessary lock call (remove doesn't require locking)
    • Moved context.remove() call inside the for loop with break for fast finish
  • Ensure tests pass (all 24 tests pass)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@changeset-bot
Copy link

changeset-bot bot commented Nov 28, 2025

⚠️ No Changeset found

Latest commit: d812cae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Refactor plugin system with hooks and migration logic feat(plugins): implement new-remove command Nov 28, 2025
Copilot AI requested a review from joakimbeng November 28, 2025 15:19
@joakimbeng
Copy link
Member

@copilot please fix the linting issues now when I've rebased this PR (the "no-await-in-loop" rule can be disabled for the whole file, like it's done for the "new-up.ts" file).

Also change the logic of the "new-remove" command so that migrations with the wrong name are not skipped but instead just ignored (just do continue in that case)? I.e. only the removed migration (or the failed removal of it) should only be included in the finished migrations list. So make sure to update the tests accordingly

Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot please fix the linting issues now when I've rebased this PR (the "no-await-in-loop" rule can be disabled for the whole file, like it's done for the "new-up.ts" file).

Also change the logic...

Fixed in commit a2d24ac:

  1. Added /* eslint-disable no-await-in-loop */ at the top of new-remove.ts (matching new-up.ts style)
  2. Changed the migration filtering logic - migrations with wrong names are now ignored (just continue) instead of being skipped
  3. Updated all 8 plugin callback tests to reflect that only the removed migration (or failed removal) is included in the finished migrations list

Copy link
Member

@joakimbeng joakimbeng left a comment

Choose a reason for hiding this comment

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

@copilot only one little thing

@joakimbeng
Copy link
Member

@copilot Fix the lint issue

Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot Fix the lint issue

Fixed in commit d8e7ea9. Changed forEach to for...of in assertStorageRemoved function to comply with the unicorn/no-array-for-each lint rule.

Comment on lines 54 to 55
// The lock call is required by the context's state machine to enable execution
await context.lock(toRemove);
Copy link
Member

Choose a reason for hiding this comment

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

This is not correct and should be removed. The remove method does not require locking the migration before removing it

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in commit 1911183. Removed the unnecessary lock call and its comment.

Comment on lines 57 to 59
for (const migration of toRemove) {
await context.remove(migration);
}
Copy link
Member

Choose a reason for hiding this comment

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

As there will only be one migration to remove, the await context.remove(migration) call can be moved inside the for loop above, i.e. by replacing the toRemove.push(migration) line.
And then it can be followed by a break statement for a fast finish of the loop

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in commit 1911183. Moved await context.remove(migration) inside the for loop and added a break statement for fast finish.

@joakimbeng
Copy link
Member

@copilot address my latest comments

Copilot AI and others added 5 commits December 1, 2025 09:57
Co-authored-by: joakimbeng <1427383+joakimbeng@users.noreply.github.com>
…tering logic

Co-authored-by: joakimbeng <1427383+joakimbeng@users.noreply.github.com>
Co-authored-by: joakimbeng <1427383+joakimbeng@users.noreply.github.com>
Co-authored-by: joakimbeng <1427383+joakimbeng@users.noreply.github.com>
Co-authored-by: joakimbeng <1427383+joakimbeng@users.noreply.github.com>
@joakimbeng joakimbeng marked this pull request as ready for review December 1, 2025 08:59
@joakimbeng joakimbeng merged commit 6827036 into v2 Dec 1, 2025
2 checks passed
@joakimbeng joakimbeng deleted the copilot/sub-pr-246 branch December 1, 2025 09:00
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