isAnalyticsEventEligibleForArtifact function
Whether eventName is eligible for the supplied published artifact shape.
A missing shape preserves the legacy event bridge, which predates generated
source/payload metadata. Once either discriminator is present, flow
lifecycle events are admitted only for the exact flowGraph/flow pair.
This prevents a standalone screen/blob artifact from being counted as a
completed flow without turning unknown event names or future surfaces into
decode failures.
Implementation
bool isAnalyticsEventEligibleForArtifact({
required String eventName,
String? sourceKind,
String? payloadKind,
}) {
if (!kFlowLifecycleAnalyticsEventNames.contains(eventName)) return true;
if (sourceKind == null && payloadKind == null) return true;
return sourceKind == 'flowGraph' && payloadKind == 'flow';
}