Skip to content

fix: trace flag with coarser debug level is switched to use ReplayDebuggerLevels when ARD is run - W-22364952#7324

Draft
daphne-sfdc wants to merge 1 commit into
developfrom
daphne/W-22364952-debugApexTests-e2e-failure
Draft

fix: trace flag with coarser debug level is switched to use ReplayDebuggerLevels when ARD is run - W-22364952#7324
daphne-sfdc wants to merge 1 commit into
developfrom
daphne/W-22364952-debugApexTests-e2e-failure

Conversation

@daphne-sfdc
Copy link
Copy Markdown
Contributor

@daphne-sfdc daphne-sfdc commented May 14, 2026

What does this PR do?

Fixes a bug where the Apex Replay Debugger fails to run if the current trace flag is set to a level coarser than ReplayDebuggerLevels. Now the trace flag switches its debug level from the coarser level to ReplayDebuggerLevels if the user runs Apex Replay Debugger.

What issues does this PR fix or reference?

@W-22364952@

Functionality Before

Trace flag remains with the coarser debug level. User sees this error when running Apex Replay Debugger:
Screenshot 2026-05-14 at 4 26 29 PM

Functionality After

Trace flag is switched to debug level ReplayDebuggerLevels, which is compatible with Apex Replay Debugger.

Testing

Trace flag is currently set to a coarse debug level incompatible for Apex Replay Debugger.

  1. Click "Debug Test" code lens with ReplayDebuggerLevels already created -> existing trace flag switched to debug level ReplayDebuggerLevels ✅
  2. Click "Debug Test" code lens without ReplayDebuggerLevels -> create ReplayDebuggerLevels debug level + switch existing trace flag to use it ✅
  3. Run Apex Replay Debugger with ReplayDebuggerLevels already created -> existing trace flag switched to debug level ReplayDebuggerLevels ✅
  4. Run Apex Replay Debugger without ReplayDebuggerLevels -> create ReplayDebuggerLevels debug level + switch existing trace flag to use it ✅

@daphne-sfdc daphne-sfdc requested a review from a team as a code owner May 14, 2026 21:20
@daphne-sfdc daphne-sfdc marked this pull request as draft May 15, 2026 17:43
const userId = yield* traceFlagService.getUserId();
yield* traceFlagService.ensureTraceFlag(userId);
const debugLevelId = yield* traceFlagService.getOrCreateDebugLevel();
yield* traceFlagService.ensureTraceFlag(userId, undefined, undefined, debugLevelId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is ensure not doing that requires get/create before calling. Seems like a bug in the ensure logic.

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