Skip to content

Conversation

@cristiand391
Copy link
Member

@cristiand391 cristiand391 commented Jan 19, 2026

What does this PR do?

While working on supporting ignoreConflicts in the deploy/retrieve tools for the dx mcp here we found some issues:
salesforcecli/mcp#321

Unlike CLI, the mcp is a long running process and a new SourceTracking instance gets created on each tool call.
STL handles events by attaching listeners to a global singleton (sfdx-core's Lifecycle), in an mcp process all deploy/retrieve tool calls would listen to the events (or not) depending on if the first call did set ignoreConflicts.

We now clean the pre events inside maybeSubscribeLifecycleEvents (always called when instantiating SourceTracking) so ensure each instance is clean.
Each instance can subscribe to the pre events by setting ignoreConflicts.

What issues does this PR fix or reference?

@W-20002028@

@cristiand391 cristiand391 marked this pull request as ready for review January 22, 2026 21:38
});

it.only('automatically commits moved files and leaves other changes alone', async () => {
it('automatically commits moved files and leaves other changes alone', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this was added a while ago, after removing it got a few failures that are fixed here (separate PR for easier review):
#829

* test: fix removeSourceTracking UTs

* test: fix pathIsInFolder UTs

* chore: getNonSequential handle empty pkgDir

* test: platform-specific test

* chore: bump sdr
@soridalac soridalac merged commit 1a83d93 into main Jan 23, 2026
21 checks passed
@soridalac soridalac deleted the cd/events-cleanup branch January 23, 2026 22:21
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.

3 participants