shouldUpdate method

bool shouldUpdate(
  1. ABUSResult result
)

Check if this result should trigger an update

Implementation

bool shouldUpdate(ABUSResult result) {
  // Apply custom filter first
  if (customFilter != null && !customFilter!(result)) {
    return false;
  }

  // Special handling for rollback
  final isRollback = result.metadata?['rollback'] == true;

  if (isRollback && !rebuildOnRollback) return false;
  if (!isRollback) {
    // Check success/error preferences
    if (result.isSuccess && !rebuildOnSuccess) return false;
    if (!result.isSuccess && !rebuildOnError) return false;
  }

  // Check interaction ID filter
  if (interactionIds != null && result.interactionId != null) {
    if (!interactionIds!.contains(result.interactionId)) return false;
  }

  // Check tags filter
  if (tags != null && result.metadata?['tags'] is List) {
    final resultTags = Set<String>.from(result.metadata!['tags'] as List);
    if (!tags!.any((tag) => resultTags.contains(tag))) return false;
  }

  return true;
}