handleLiveTestCampaign method

void handleLiveTestCampaign(
  1. LiveTestInvocation invocation
)

Handles one campaign_test SSE event: ACKs received, then routes the inline campaign through the same _routeStoredCampaign path an organic CEP trigger uses.

The catch is the outermost half of "every invocation ends in a terminal ACK". This runs on an SSE callback with nothing above it, so before this any throw anywhere in parsing or routing escaped into the stream handler and the dashboard row simply stopped — the PM's only signal being a timeout fifteen seconds later that said nothing about why.

Implementation

void handleLiveTestCampaign(LiveTestInvocation invocation) {
  try {
    _handleLiveTestCampaign(invocation);
  } catch (error, stackTrace) {
    _log.e('Live test failed — routing threw',
        error: error, stackTrace: stackTrace);
    // Through the context when one exists, so the single-fire guard holds
    // and the watchdog is disarmed; directly otherwise, because a throw
    // before the context was built still owes the dashboard an answer.
    final context =
        _liveTestContexts[liveTestCepId(invocation.testInvocationId)];
    if (context != null) {
      context.reportFailed(DropReason.error, '$error');
    } else {
      LiveTestAckReporter.instance.postFailed(
        invocation.testInvocationId,
        DropReason.error,
        '$error',
      );
    }
  }
}