Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jb/add trace flag auto delete #3812

Merged
merged 20 commits into from
Feb 14, 2022
Merged

Conversation

jeffb-sfdc
Copy link
Contributor

@jeffb-sfdc jeffb-sfdc commented Feb 9, 2022

What does this PR do?

Implements the auto removal of temporary trace flags.

What issues does this PR fix or reference?

@W-10288383@

Functionality Before

With the new updates to the "SFDX: Launch Apex Replay Debugger with Current File” command, a trace flag was created behind the scenes, but wasn't cleaned up after the debugging session finished.

Functionality After

Now, after finished debugging, if the trace flag was created by the command, it is deleted from the org (existing trace flags are left untouched)

@jeffb-sfdc jeffb-sfdc requested a review from a team as a code owner February 9, 2022 00:50
import { Connection } from '@salesforce/core';

/**
* TraceFlagsRemover is a singleton which deletes trace flags not created by the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is confusing. Did you mean "deletes trace flags created by the user"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In ensureTraceFlags(), the code checks whether an existing trace flag exists (getTraceFlagForUser()). If a trace flag doesn't exist, we create a trace flag ourselves (automatically/programmatically). When we create a trace flag, this class (TraceFlagsRemover) then cleans up and removed the trace flag.

Would, "TraceFlagsRemover is a singleton which deletes trace flags programmatically created when an existing trace flag isn't present" be better?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe ...which deletes trace flags created by the extensions.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sgtm... I'll change it to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@randi274
Copy link
Contributor

Looking great. I'm good to approve once I can test locally with the .vsix

@jeffb-sfdc jeffb-sfdc merged commit 6ea76b9 into develop Feb 14, 2022
@jeffb-sfdc jeffb-sfdc deleted the jb/add-trace-flag-auto-delete branch February 14, 2022 21:41
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.

None yet

3 participants