:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(capture): route the AI lane on the $ai_ prefix only (#112116)
Eli Reisman3cbab20212bd
diff --git a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.mdindex 9de962a5e2a8..7f58fca28bdb 100644--- a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md+++ b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md@@ -81,7 +81,7 @@ Emitted by capture for its two dedicated AI endpoints, `/i/v0/ai` (a single even| Type | What happened | Fix || ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `invalid_ai_event` | Event rejected: the name isn't one of the six `$ai_*` types, or `$ai_model` is missing or not a string | Read [references/fixing-ai-endpoint-rejections.md](references/fixing-ai-endpoint-rejections.md) — usually ordinary analytics pointed at the AI endpoint |+| `invalid_ai_event` | Event rejected: the name doesn't start with `$ai_`, or `$ai_model` is missing or not a string | Read [references/fixing-ai-endpoint-rejections.md](references/fixing-ai-endpoint-rejections.md) — usually ordinary analytics pointed at the AI endpoint || `invalid_ai_payload` | Request rejected: malformed multipart or OTLP body, or too many spans in one export | Read [references/fixing-ai-endpoint-rejections.md](references/fixing-ai-endpoint-rejections.md) — `format`, `stage`, and `part` details name which check failed || `no_ai_spans_ingested` | OTLP export accepted with a 200 but contained no AI spans, so nothing was ingested | Read [references/fixing-ai-endpoint-rejections.md](references/fixing-ai-endpoint-rejections.md) — instrumentation is emitting spans no AI provider convention matches || `misrouted_event` | An event whose name does not start with `$ai_` reached the AI batch endpoint (`/i/v1/ai/events`); only that event was discarded, the rest of the batch landed | Read [references/fixing-ai-endpoint-rejections.md](references/fixing-ai-endpoint-rejections.md) — `eventName` names the offender; send it through the standard capture endpoint |diff --git a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-ai-endpoint-rejections.md b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-ai-endpoint-rejections.mdindex 99348b201c63..1e8f993b304b 100644--- a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-ai-endpoint-rejections.md+++ b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-ai-endpoint-rejections.md@@ -18,9 +18,9 @@ The event reached the endpoint and parsed, but isn't a valid AI event.Two causes, told apart by the details:-**An unsupported event name** (`eventName` is present). The endpoint accepts only `$ai_generation`, `$ai_trace`, `$ai_span`, `$ai_embedding`, `$ai_metric`, and `$ai_feedback`. Anything else is rejected.+**An unsupported event name** (`eventName` is present). The endpoint accepts any name that starts with `$ai_`. Anything else is rejected.-If `eventName` is something like `$pageview` or a custom event, ordinary analytics is being pointed at the AI endpoint. That is usually a misconfigured host or proxy rule rather than deliberate. Send those to `/i/v0/e` or `/batch` instead. If it looks like an AI event with the wrong name (`ai_generation` without the `$`, or `$ai_completion`), fix the name at the callsite.+If `eventName` is something like `$pageview` or a custom event, ordinary analytics is being pointed at the AI endpoint. That is usually a misconfigured host or proxy rule rather than deliberate. Send those to `/i/v0/e` or `/batch` instead. If it looks like an AI event with the wrong name (`ai_generation` without the `$`, or `$AI_generation`), fix the name at the callsite.**No usable `$ai_model`** (no `eventName` in the details). Every AI event must carry `$ai_model` as a non-empty string. A model set to `null`, a number, or an empty string is rejected the same as a missing one. This usually means the value is unset at the callsite: the variable holding the model name is empty when the provider call fails early, or the SDK wrapper wasn't given a model.diff --git a/rust/capture/docs/ai-endpoint-parity.md b/rust/capture/docs/ai-endpoint-parity.mdindex d61b01990c6c..1eb9dcd978b5 100644--- a/rust/capture/docs/ai-endpoint-parity.md+++ b/rust/capture/docs/ai-endpoint-parity.md@@ -29,7 +29,7 @@ This document compares the `/i/v0/ai` endpoint with the `/i/v0/e` (events) endpo|---------|-------------|-------|| Multipart form-data parsing | Parse and validate multipart requests with an event part and an optional properties part | AI-specific || Authorization header requirement | Require `Bearer <token>` in Authorization header | AI-specific |-| AI event name validation | `CAPTURE_AI_LANE_PREDICATE=allowlist`: 6 allowed names (`$ai_generation`, `$ai_trace`, `$ai_span`, `$ai_embedding`, `$ai_metric`, `$ai_feedback`); `prefix`: any `$ai_*` name | AI-specific |+| AI event name validation | Any `$ai_*` name | AI-specific || `$ai_model` property validation | Ensure `$ai_model` is present and non-empty | AI-specific || Strict size limits per part type | 32KB event, 960KB properties + event | AI-specific |@@ -103,6 +103,6 @@ flag.- The AI endpoint's unique features (multipart parsing, AI event validation, etc.) are intentional and should be preserved- Some differences are by design rather than gaps:- - **Event type filtering**: `/e` uses denylist (blocks `$performance_event`), AI accepts only AI-lane names (6-name allowlist or the `$ai_` prefix, per `CAPTURE_AI_LANE_PREDICATE`)+ - **Event type filtering**: `/e` uses denylist (blocks `$performance_event`), AI accepts only `$ai_*` names- **Single event vs batch**: AI processes single events, `/e` supports batches- Focus parity efforts on security, billing, and abuse prevention featuresdiff --git a/rust/capture/docs/llma-capture-overview.md b/rust/capture/docs/llma-capture-overview.mdindex 835a8db85142..f0f5cb6b397b 100644--- a/rust/capture/docs/llma-capture-overview.md+++ b/rust/capture/docs/llma-capture-overview.md@@ -13,10 +13,7 @@ This document covers only the single-event multipart endpoint.## Supported events-Which event names the endpoint accepts depends on the deployment's `CAPTURE_AI_LANE_PREDICATE`.-Under `allowlist` (the default) it accepts exactly six names (`ALLOWED_AI_EVENTS` in `ai_rejection.rs`):-`$ai_generation`, `$ai_trace`, `$ai_span`, `$ai_embedding`, `$ai_metric`, and `$ai_feedback`.-Under `prefix` it accepts any name that starts with `$ai_`.+The endpoint accepts any event name that starts with `$ai_` (`is_ai_event` in `v0_request.rs`).Every event must carry a non-empty string `$ai_model` property, a `distinct_id`, and a client-supplied `uuid`.## Request formatdiff --git a/rust/capture/src/ai_endpoint.rs b/rust/capture/src/ai_endpoint.rsindex 9db9319a25ec..4697cc0d2ff4 100644--- a/rust/capture/src/ai_endpoint.rs+++ b/rust/capture/src/ai_endpoint.rs@@ -18,7 +18,7 @@ use uuid::Uuid;use common_ingestion_warnings::WarningRequestContext;-use crate::ai_rejection::{AiFailure, AiRejection, ALLOWED_AI_EVENTS};+use crate::ai_rejection::{AiFailure, AiRejection};use crate::api::{CaptureError, CaptureResponse, CaptureResponseCode};use crate::event_restrictions::{AppliedRestrictions, EventContext as RestrictionEventContext, Pipeline,@@ -34,7 +34,7 @@ use crate::router::State as AppState;use crate::timestamp;use crate::token::validate_token;use crate::v0_request::{- exceeds_max_ai_event_bytes, AiLanePredicate, DataType, ProcessedEvent, ProcessedEventMetadata,+ exceeds_max_ai_event_bytes, is_ai_event, DataType, ProcessedEvent, ProcessedEventMetadata,};use crate::v1::gateway_provenance as gp;@@ -310,7 +310,7 @@ async fn ai_handler_inner(retrieve_multipart_parts(&mut multipart, event_metadata, state.ai_max_event_bytes).await?;// Step 6: Parse the parts- let mut parsed = parse_multipart_data(parts, state.ai_lane_predicate)?;+ let mut parsed = parse_multipart_data(parts)?;// AI-gateway provenance: stamp the trusted marker (overwriting client values) on a// verified event, else strip the whole $ai_gateway* namespace so a forged marker@@ -783,7 +783,6 @@ async fn retrieve_multipart_parts(/// Parse retrieved multipart parts and validate event structure.fn parse_multipart_data(parts: RetrievedMultipartParts,- ai_lane_predicate: AiLanePredicate,) -> Result<ParsedMultipartData, AiRejection> {// Merge properties into the eventlet mut event = parts.event_json;@@ -794,7 +793,7 @@ fn parse_multipart_data(}// Now validate the complete event structure- validate_event_structure(&event, ai_lane_predicate)?;+ validate_event_structure(&event)?;// Extract event_name, distinct_id, uuid, and timestamp for later uselet event_name = event@@ -846,10 +845,7 @@ fn parse_multipart_data(}/// Validate the structure and content of an AI event-fn validate_event_structure(- event: &Value,- ai_lane_predicate: AiLanePredicate,-) -> Result<(), AiRejection> {+fn validate_event_structure(event: &Value) -> Result<(), AiRejection> {// Check if event is an objectlet event_obj = event.as_object().ok_or(AiRejection::EventNotObject)?;@@ -863,16 +859,8 @@ fn validate_event_structure(return Err(AiRejection::EventNameEmpty);}- // The rejection names the rule the deployment applied, so the client's 400- // body (and the warning details) say what a valid name looks like here.- match ai_lane_predicate {- AiLanePredicate::Allowlist if !ALLOWED_AI_EVENTS.contains(&event_name) => {- return Err(AiRejection::EventNameNotAllowed(event_name.to_string()));- }- AiLanePredicate::Prefix if !ai_lane_predicate.is_ai_event(event_name) => {- return Err(AiRejection::EventNameNotAiPrefixed(event_name.to_string()));- }- _ => {}+ if !is_ai_event(event_name) {+ return Err(AiRejection::EventNameNotAiPrefixed(event_name.to_string()));}// Validate distinct_iddiff --git a/rust/capture/src/ai_rejection.rs b/rust/capture/src/ai_rejection.rsindex 4f4789c9acd6..fb2c52953386 100644--- a/rust/capture/src/ai_rejection.rs+++ b/rust/capture/src/ai_rejection.rs@@ -18,18 +18,6 @@ use std::fmt;use crate::api::CaptureError;use crate::v0_request::AI_LANE_NAME_PREFIX;-/// Event names the endpoint accepts under `AiLanePredicate::Allowlist`; under-/// `Prefix` any `$ai_*` name is accepted. Anything else is ordinary analytics-/// sent to the AI path.-pub const ALLOWED_AI_EVENTS: [&str; 6] = [- "$ai_generation",- "$ai_trace",- "$ai_span",- "$ai_embedding",- "$ai_metric",- "$ai_feedback",-];-/// Which `CaptureError` a rejection becomes, and so which HTTP status the client/// sees. Preserved per-condition from before the enum existed.enum ErrorKind {@@ -83,9 +71,7 @@ pub enum AiRejection {EventUuidRequired,EventUuidInvalid(String),- // AI-specific validation. The name rejection follows the deployment's- // `AiLanePredicate`: `EventNameNotAllowed` or `EventNameNotAiPrefixed`.- EventNameNotAllowed(String),+ // AI-specific validation.EventNameNotAiPrefixed(String),AiModelMissing,AiModelNotString,@@ -140,11 +126,6 @@ impl AiRejection {Self::EventUuidRequired => "Event UUID is required".to_string(),Self::EventUuidInvalid(e) => format!("Invalid UUID format: {e}"),- Self::EventNameNotAllowed(event_name) => format!(- "Event name must be one of: {}, got '{}'",- ALLOWED_AI_EVENTS.join(", "),- event_name- ),Self::EventNameNotAiPrefixed(event_name) => format!("Event name must start with '{AI_LANE_NAME_PREFIX}', got '{event_name}'"),@@ -185,7 +166,6 @@ impl AiRejection {| Self::DistinctIdEmpty| Self::EventUuidRequired| Self::EventUuidInvalid(_)- | Self::EventNameNotAllowed(_)| Self::EventNameNotAiPrefixed(_)| Self::AiModelMissing| Self::AiModelNotString@@ -298,10 +278,6 @@ pub(crate) fn all_variants_with_messages() -> Vec<(AiRejection, &'static str)> {AiRejection::EventUuidInvalid("invalid length".to_string()),"Invalid UUID format: invalid length",),- (- AiRejection::EventNameNotAllowed("$pageview".to_string()),- "Event name must be one of: $ai_generation, $ai_trace, $ai_span, $ai_embedding, $ai_metric, $ai_feedback, got '$pageview'",- ),(AiRejection::EventNameNotAiPrefixed("$pageview".to_string()),"Event name must start with '$ai_', got '$pageview'",@@ -407,7 +383,7 @@ mod tests {);assert_eq!(listed.len(),- 30,+ 29,"variant count changed — add the new variant to all_variants_with_messages \and update this expected count");@@ -423,7 +399,7 @@ mod tests {#[case::missing_event_part(AiRejection::MissingEventPart, 400)]#[case::unknown_field(AiRejection::UnknownField("x".to_string()), 400)]#[case::event_not_json(AiRejection::EventPartNotJson, 400)]- #[case::event_name_not_allowed(AiRejection::EventNameNotAllowed("$pageview".to_string()), 400)]+ #[case::event_name_not_ai_prefixed(AiRejection::EventNameNotAiPrefixed("$pageview".to_string()), 400)]#[case::ai_model_missing(AiRejection::AiModelMissing, 400)]#[case::event_part_too_big(AiRejection::EventPartTooBig { size: 1, max: 0 }, 413)]#[case::combined_too_big(AiRejection::EventAndPropertiesTooBig { size: 1, max: 0 }, 413)]@@ -435,7 +411,7 @@ mod tests {#[test]fn message_survives_the_round_trip_through_ai_failure() {- let rejection = AiRejection::EventNameNotAllowed("$pageview".to_string());+ let rejection = AiRejection::EventNameNotAiPrefixed("$pageview".to_string());let expected = rejection.message();let failure: AiFailure = rejection.into();diff --git a/rust/capture/src/config.rs b/rust/capture/src/config.rsindex 9c1b01187d6b..f4b94d2e4c36 100644--- a/rust/capture/src/config.rs+++ b/rust/capture/src/config.rs@@ -5,7 +5,6 @@ use envconfig::Envconfig;use tracing::Level;use crate::producers::ProducerName;-use crate::v0_request::AiLanePredicate;#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]pub enum CaptureMode {@@ -370,12 +369,6 @@ pub struct Config {#[envconfig(default = "8388608")] // 8MiBpub ai_max_event_bytes: u64,- /// AI lane membership: `allowlist` (exact `AI_EVENT_NAMES`) or `prefix` (any `$ai_*`).- /// Set `prefix` only once the environment's AI ingestion pipeline admits by prefix,- /// or it DLQs every unlisted `$ai_*` name capture diverts.- #[envconfig(from = "CAPTURE_AI_LANE_PREDICATE", default = "allowlist")]- pub ai_lane_predicate: AiLanePredicate,-// HMAC-SHA256 key shared with the AI gateway. When set, $ai_generation events// carrying a valid PostHog-Ai-Gateway-* signature are stamped verified and// exempted from the llm_events quota limiter. Unset disables verification@@ -670,7 +663,6 @@ pub struct KafkaConfig {mod tests {use super::{CaptureMode, Config};use crate::producers::ProducerName;- use crate::v0_request::AiLanePredicate;use std::collections::HashMap;use std::str::FromStr;@@ -786,26 +778,6 @@ mod tests {assert!(config.outputs_completeness_check_enabled);}- #[test]- fn ai_lane_predicate_binds_to_its_env_var_and_defaults_to_allowlist() {- // Unset must mean `allowlist` so the toggle is a no-op until an env opts in.- let config: Config =- envconfig::Envconfig::init_from_hashmap(&required_config_env()).unwrap();- assert_eq!(config.ai_lane_predicate, AiLanePredicate::Allowlist);-- let mut env = required_config_env();- env.insert("CAPTURE_AI_LANE_PREDICATE".into(), "prefix".into());- let config: Config = envconfig::Envconfig::init_from_hashmap(&env).unwrap();- assert_eq!(config.ai_lane_predicate, AiLanePredicate::Prefix);-- env.insert("CAPTURE_AI_LANE_PREDICATE".into(), "everything".into());- let bad: Result<Config, _> = envconfig::Envconfig::init_from_hashmap(&env);- assert!(- bad.is_err(),- "an unknown predicate must fail startup, not silently fall back"- );- }-#[test]fn capture_mode_from_str_and_tag_roundtrip() {// Locks the CAPTURE_MODE env contract, including the new `import` modediff --git a/rust/capture/src/event_restrictions/types.rs b/rust/capture/src/event_restrictions/types.rsindex 765fee87f18f..b954e8247022 100644--- a/rust/capture/src/event_restrictions/types.rs+++ b/rust/capture/src/event_restrictions/types.rs@@ -45,9 +45,9 @@ impl Pipeline {/// Pipelines a given capture deployment produces events to. The events/// deployment writes to `analytics` (normal events), `errortracking`/// (`$exception` events split off in `process_single_event`), and `ai`- /// (names the deployment's `AiLanePredicate` accepts), so its restriction service- /// must serve restrictions for all three pipelines. `Import` is an events- /// deployment restricted to backfills, so it serves the same three.+ /// (`$ai_` names), so its restriction service must serve restrictions for+ /// all three pipelines. `Import` is an events deployment restricted to+ /// backfills, so it serves the same three.////// `Ai` serves only `ai`. That deployment registers no analytics route,/// and `process_events` rejects a batch carrying anything off the AI lane,diff --git a/rust/capture/src/events/ai_byte_limit.rs b/rust/capture/src/events/ai_byte_limit.rsindex 8a72982f6dd5..208648a9a645 100644--- a/rust/capture/src/events/ai_byte_limit.rs+++ b/rust/capture/src/events/ai_byte_limit.rs@@ -1,6 +1,6 @@//! The AI lane's per-project byte budget. The lane is the whole gate: every-//! event the deployment's `AiLanePredicate` accepts is bound for the AI Kafka-//! topic on every deployment, stamped `DataType::AiEvents` in v0 and+//! `$ai_` event (`v0_request::is_ai_event`) is bound for the AI Kafka topic on+//! every deployment, stamped `DataType::AiEvents` in v0 and//! `Destination::AiEvents` in v1. Import deployments are exempt — backfills//! are never throttled, matching the other limiters — which setup enforces by//! not building the limiter at all in import mode.diff --git a/rust/capture/src/events/analytics.rs b/rust/capture/src/events/analytics.rsindex da5a297ce788..e95cd73ad509 100644--- a/rust/capture/src/events/analytics.rs+++ b/rust/capture/src/events/analytics.rs@@ -130,11 +130,7 @@ pub fn process_single_event(Span::current().record("is_mirror_deploy", context.is_mirror_deploy);Span::current().record("request_id", &context.request_id);- let data_type = DataType::from_event_name(- &event.event,- context.historical_migration,- context.ai_lane_predicate,- );+ let data_type = DataType::from_event_name(&event.event, context.historical_migration);// Redact the IP address of internally-generated events when tagged as suchlet resolved_ip = if event.properties.contains_key("capture_internal") {@@ -379,8 +375,8 @@ async fn process_events_inner(// abort path emits an `invalid_ai_event` ingestion warning alongside the// 400, so the project owner sees it too.//- // Lane membership follows the deployment's `AiLanePredicate`, the same- // answer `DataType::from_event_name` stamped on each event above.+ // Lane membership is the same answer `DataType::from_event_name` stamped on+ // each event above.if context.capture_mode == crate::config::CaptureMode::Ai {if let Some(offender) = events.iter()@@ -663,7 +659,7 @@ mod tests {use super::*;use crate::ingestion_warnings::SdkAttribution;use crate::utils::uuid_v7_from_datetime;- use crate::v0_request::{AiLanePredicate, OverflowReason, ProcessingContext};+ use crate::v0_request::{OverflowReason, ProcessingContext};use chrono::{DateTime, TimeZone, Utc};use common_ingestion_warnings::test_support::CollectingEmitter;use common_ingestion_warnings::WarningType;@@ -690,7 +686,6 @@ mod tests {chatty_debug_enabled: false,capture_mode: crate::config::CaptureMode::Events,ai_max_event_bytes: 0,- ai_lane_predicate: AiLanePredicate::Allowlist,sdk_attribution: crate::ingestion_warnings::SdkAttribution::default(),}}@@ -1340,7 +1335,7 @@ mod tests {}/// The AI lane assignment holds across capture modes: `Events` and- /// `Import` both divert every allowlisted AI event (only the AI lane has AI+ /// `Import` both divert every AI event (only the AI lane has AI/// processing, so imports must divert too), winning over historical./// Non-AI events stay on their normal route in every mode. The topic/// itself is resolved in the kafka sink from `DataType::AiEvents`, not@@ -1667,41 +1662,24 @@ mod tests {/// second event is the one under test.struct AiLaneGateCase {second_event: &'static str,- predicate: AiLanePredicate,rejected: bool,}#[rstest]#[case::analytics_event_is_rejected(AiLaneGateCase {second_event: "$pageview",- predicate: AiLanePredicate::Allowlist,- rejected: true,- })]- #[case::analytics_event_is_rejected_under_prefix(AiLaneGateCase {- second_event: "$pageview",- predicate: AiLanePredicate::Prefix,- rejected: true,- })]- // Under `Allowlist` a prefixed-but-unlisted name resolves to AnalyticsMain,- // so it is rejected too; under `Prefix` the same name is on the lane.- #[case::prefixed_but_unlisted_name_is_rejected(AiLaneGateCase {- second_event: "$ai_call",- predicate: AiLanePredicate::Allowlist,rejected: true,})]- #[case::prefixed_but_unlisted_name_passes_under_prefix(AiLaneGateCase {+ #[case::any_ai_prefixed_name_passes(AiLaneGateCase {second_event: "$ai_call",- predicate: AiLanePredicate::Prefix,rejected: false,})]#[case::exception_is_rejected(AiLaneGateCase {second_event: "$exception",- predicate: AiLanePredicate::Allowlist,rejected: true,})]- #[case::second_allowlisted_event_passes(AiLaneGateCase {+ #[case::second_ai_event_passes(AiLaneGateCase {second_event: "$ai_span",- predicate: AiLanePredicate::Allowlist,rejected: false,})]#[tokio::test]@@ -1713,7 +1691,6 @@ mod tests {.with_timezone(&Utc);let mut context = create_test_context(now, None);context.capture_mode = crate::config::CaptureMode::Ai;- context.ai_lane_predicate = case.predicate;let events = vec![create_test_event_with_name("$ai_generation", None, None, None),@@ -1855,7 +1832,7 @@ mod tests {let ai_topic = topics.topic_for(&crate::sinks::registry::Destination::AiMain);assert_eq!(&*records[0].topic, ai_topic,- "an allowlisted AI event diverts to the AI lane under Ai mode too"+ "an AI event diverts to the AI lane under Ai mode too");}diff --git a/rust/capture/src/events/recordings.rs b/rust/capture/src/events/recordings.rsindex 63685963d2a1..5f8fdd38d09b 100644--- a/rust/capture/src/events/recordings.rs+++ b/rust/capture/src/events/recordings.rs@@ -865,7 +865,6 @@ mod tests {path: "/s/".to_string(),capture_mode: crate::config::CaptureMode::Recordings,ai_max_event_bytes: 0,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,sdk_attribution: crate::ingestion_warnings::SdkAttribution::default(),}}diff --git a/rust/capture/src/ingestion_warnings/ai.rs b/rust/capture/src/ingestion_warnings/ai.rsindex 1b9cb126af05..953c07348df6 100644--- a/rust/capture/src/ingestion_warnings/ai.rs+++ b/rust/capture/src/ingestion_warnings/ai.rs@@ -24,8 +24,9 @@ use crate::api::CaptureError;/// Five of these reuse types the analytics paths already emit, because the/// condition is identical and a reader of the v2 table shouldn't have to learn a/// second vocabulary for the same mistake. The AI-specific types cover what has-/// no analytics equivalent: this endpoint accepts only six event names and-/// requires `$ai_model`, and its payload is multipart rather than a JSON batch.+/// no analytics equivalent: this endpoint accepts only `$ai_`-prefixed event+/// names and requires `$ai_model`, and its payload is multipart rather than a+/// JSON batch.////// Exhaustive with no catch-all, so a new rejection variant fails to compile/// until someone decides whether customers should see a warning for it.@@ -33,8 +34,7 @@ pub fn warning_for_ai_rejection(rejection: &AiRejection) -> Option<WarningType>match rejection {// Sending ordinary analytics to the AI path, or omitting the one// property every AI event needs.- AiRejection::EventNameNotAllowed(_)- | AiRejection::EventNameNotAiPrefixed(_)+ AiRejection::EventNameNotAiPrefixed(_)| AiRejection::AiModelMissing| AiRejection::AiModelNotString| AiRejection::AiModelEmpty => Some(WarningType::InvalidAiEvent),@@ -139,13 +139,6 @@ fn warning_for_ai_failure(fn details_for(rejection: &AiRejection) -> Map<String, serde_json::Value> {let mut details = Map::new();match rejection {- AiRejection::EventNameNotAllowed(event_name) => {- details.insert("eventName".to_string(), json!(bounded_detail(event_name)));- details.insert(- "allowed".to_string(),- json!(crate::ai_rejection::ALLOWED_AI_EVENTS),- );- }AiRejection::EventNameNotAiPrefixed(event_name) => {details.insert("eventName".to_string(), json!(bounded_detail(event_name)));details.insert(@@ -183,10 +176,6 @@ mod tests {#[rstest]#[case::wrong_event_name(- AiRejection::EventNameNotAllowed("$pageview".to_string()),- Some(WarningType::InvalidAiEvent)- )]- #[case::wrong_event_name_under_prefix(AiRejection::EventNameNotAiPrefixed("$pageview".to_string()),Some(WarningType::InvalidAiEvent))]@@ -272,7 +261,7 @@ mod tests {emit_ai_failure_warning(Some(&emitter),&request(),- &AiFailure::Rejected(AiRejection::EventNameNotAllowed("$pageview".to_string())),+ &AiFailure::Rejected(AiRejection::EventNameNotAiPrefixed("$pageview".to_string())),);let emitted = emitter.emitted();@@ -286,6 +275,10 @@ mod tests {warning.extra_details.get("eventName"),Some(&json!("$pageview")));+ assert_eq!(+ warning.extra_details.get("requiredPrefix"),+ Some(&json!("$ai_"))+ );assert_eq!(warning.extra_details.get("lib"),Some(&json!("posthog-python"))@@ -372,7 +365,7 @@ mod tests {// message or its stored row. Truncation is marked and char-safe.#[rstest]#[case::event_name(- AiRejection::EventNameNotAllowed("$".to_string() + &"n".repeat(500)),+ AiRejection::EventNameNotAiPrefixed("$".to_string() + &"n".repeat(500)),"eventName")]#[case::part_name(diff --git a/rust/capture/src/ingestion_warnings/legacy.rs b/rust/capture/src/ingestion_warnings/legacy.rsindex 2baace9440d3..79dc0d97c685 100644--- a/rust/capture/src/ingestion_warnings/legacy.rs+++ b/rust/capture/src/ingestion_warnings/legacy.rs@@ -171,7 +171,6 @@ mod tests {chatty_debug_enabled: false,capture_mode: crate::config::CaptureMode::Events,ai_max_event_bytes: 0,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,sdk_attribution: attribution,}}diff --git a/rust/capture/src/ingestion_warnings/replay.rs b/rust/capture/src/ingestion_warnings/replay.rsindex c99d6405d8ce..8868754d615d 100644--- a/rust/capture/src/ingestion_warnings/replay.rs+++ b/rust/capture/src/ingestion_warnings/replay.rs@@ -273,7 +273,6 @@ mod tests {chatty_debug_enabled: false,capture_mode: CaptureMode::Recordings,ai_max_event_bytes: 0,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,sdk_attribution: attribution,}}diff --git a/rust/capture/src/overflow_parity.rs b/rust/capture/src/overflow_parity.rsindex 58da53979913..15c9ea4cfe56 100644--- a/rust/capture/src/overflow_parity.rs+++ b/rust/capture/src/overflow_parity.rs@@ -115,7 +115,6 @@ fn v0_context(now: DateTime<Utc>) -> ProcessingContext {chatty_debug_enabled: false,capture_mode: crate::config::CaptureMode::Events,ai_max_event_bytes: 0,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,sdk_attribution: crate::ingestion_warnings::SdkAttribution::default(),}}diff --git a/rust/capture/src/payload/analytics.rs b/rust/capture/src/payload/analytics.rsindex 99a9ddaff083..d5c91bc4475e 100644--- a/rust/capture/src/payload/analytics.rs+++ b/rust/capture/src/payload/analytics.rs@@ -134,7 +134,6 @@ pub async fn handle_event_payload(chatty_debug_enabled,capture_mode: state.capture_mode,ai_max_event_bytes: state.ai_max_event_bytes,- ai_lane_predicate: state.ai_lane_predicate,sdk_attribution,};debug_or_info!(chatty_debug_enabled, context=?context, event_count=?events.len(), "processing complete");diff --git a/rust/capture/src/payload/recordings.rs b/rust/capture/src/payload/recordings.rsindex 45f1a0c52079..1423f8365aad 100644--- a/rust/capture/src/payload/recordings.rs+++ b/rust/capture/src/payload/recordings.rs@@ -136,7 +136,6 @@ pub async fn handle_recording_payload(chatty_debug_enabled,capture_mode: state.capture_mode,ai_max_event_bytes: 0,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,sdk_attribution: attribution_from_event(&events[0], metadata.user_agent),};diff --git a/rust/capture/src/router.rs b/rust/capture/src/router.rsindex 3093585b021b..31288c8e5ba2 100644--- a/rust/capture/src/router.rs+++ b/rust/capture/src/router.rs@@ -20,7 +20,7 @@ use crate::global_rate_limiter::GlobalRateLimiter;use crate::otel;use crate::outputs::OutputRegistry;use crate::test_endpoint;-use crate::v0_request::{AiLanePredicate, DataType};+use crate::v0_request::DataType;use crate::{ai_endpoint, time::TimeSource, v0_endpoint};use common_ingestion_warnings::WarningEmitter;use common_redis::Client;@@ -70,9 +70,6 @@ pub struct State {/// Largest AI-lane event this deployment accepts (`AI_MAX_EVENT_BYTES`)./// `0` disables the ceiling.pub ai_max_event_bytes: u64,- /// How this deployment decides an event name is on the AI lane- /// (`CAPTURE_AI_LANE_PREDICATE`).- pub ai_lane_predicate: AiLanePredicate,pub body_chunk_read_timeout: Option<Duration>,pub body_read_chunk_size_kb: usize,pub capture_v1_max_compressed_body_bytes: usize,@@ -189,7 +186,6 @@ pub fn router<TZ: TimeSource + Send + Sync + 'static, R: Client + Send + Sync +verbose_sample_percent: f32,ai_max_sum_of_parts_bytes: usize,ai_max_event_bytes: u64,- ai_lane_predicate: AiLanePredicate,body_chunk_read_timeout_ms: Option<u64>,body_read_chunk_size_kb: usize,capture_v1_max_compressed_body_bytes: usize,@@ -221,7 +217,6 @@ pub fn router<TZ: TimeSource + Send + Sync + 'static, R: Client + Send + Sync +verbose_sample_percent,ai_max_sum_of_parts_bytes,ai_max_event_bytes,- ai_lane_predicate,body_chunk_read_timeout: body_chunk_read_timeout_ms.map(Duration::from_millis),body_read_chunk_size_kb,capture_v1_max_compressed_body_bytes,diff --git a/rust/capture/src/setup.rs b/rust/capture/src/setup.rsindex b98608e91a03..504610712df5 100644--- a/rust/capture/src/setup.rs+++ b/rust/capture/src/setup.rs@@ -401,7 +401,6 @@ pub async fn build_components(config.verbose_sample_percent,config.ai_max_sum_of_parts_bytes,config.ai_max_event_bytes,- config.ai_lane_predicate,config.body_chunk_read_timeout_ms,config.body_read_chunk_size_kb,config.capture_v1_max_compressed_body_bytes,@@ -421,10 +420,6 @@ pub async fn build_components("config: is_mirror_deploy == {:?} ; log_level == {:?}",config.is_mirror_deploy, config.log_level);- info!(- ai_lane_predicate = config.ai_lane_predicate.as_tag(),- "AI lane membership predicate"- );CaptureComponents {app,diff --git a/rust/capture/src/v0_request.rs b/rust/capture/src/v0_request.rsindex 081323130664..c39ea48c5552 100644--- a/rust/capture/src/v0_request.rs+++ b/rust/capture/src/v0_request.rs@@ -153,9 +153,6 @@ pub struct ProcessingContext {/// `AI_MAX_EVENT_BYTES`. `0` disables the ceiling. See/// [`exceeds_max_ai_event_bytes`].pub ai_max_event_bytes: u64,- /// How this deployment decides an event name is on the AI lane, from- /// `CAPTURE_AI_LANE_PREDICATE`. See [`AiLanePredicate`].- pub ai_lane_predicate: AiLanePredicate,/// SDK identity snapshotted from the batch's first event, for ingestion/// warning attribution. Captured at batch construction because the events/// are typed there; downstream stages hold serialized payloads and would@@ -191,66 +188,12 @@ pub enum DataType {AiEvents,}-/// AI lane membership under [`AiLanePredicate::Prefix`]. The ingestion AI pipeline-/// admits by the same prefix (`isAiEventName` in `nodejs/src/ingestion/common/ai-event-types.ts`).pub const AI_LANE_NAME_PREFIX: &str = "$ai_";-/// AI lane membership under [`AiLanePredicate::Allowlist`]. Remove once every-/// environment runs [`AiLanePredicate::Prefix`].-pub const AI_EVENT_NAMES: &[&str] = &[- "$ai_generation",- "$ai_embedding",- "$ai_evaluation",- "$ai_span",- "$ai_trace",- "$ai_metric",- "$ai_feedback",- "$ai_tag",- "$ai_generation_summary",- "$ai_trace_summary",- "$ai_evaluation_report",-];--/// How a deployment decides an event name is on the AI lane (`CAPTURE_AI_LANE_PREDICATE`).-/// Every "is this an AI event" check goes through [`AiLanePredicate::is_ai_event`] so-/// one deployment never mixes the two answers.-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Default)]-pub enum AiLanePredicate {- /// Exact membership in [`AI_EVENT_NAMES`].- #[default]- Allowlist,- /// Any name starting with [`AI_LANE_NAME_PREFIX`].- Prefix,-}--impl AiLanePredicate {- pub fn is_ai_event(self, name: &str) -> bool {- match self {- Self::Allowlist => AI_EVENT_NAMES.contains(&name),- Self::Prefix => name.starts_with(AI_LANE_NAME_PREFIX),- }- }-- pub fn as_tag(self) -> &'static str {- match self {- Self::Allowlist => "allowlist",- Self::Prefix => "prefix",- }- }-}--impl std::str::FromStr for AiLanePredicate {- type Err = String;-- fn from_str(s: &str) -> Result<Self, Self::Err> {- match s.trim().to_lowercase().as_ref() {- "allowlist" => Ok(Self::Allowlist),- "prefix" => Ok(Self::Prefix),- _ => Err(format!(- "Unknown AI lane predicate: {s} (expected `allowlist` or `prefix`)"- )),- }- }+/// The single AI-lane membership rule; the ingestion AI pipeline admits by the+/// same prefix (`isAiEventName` in `nodejs/src/ingestion/common/ai-event-types.ts`).+pub fn is_ai_event(name: &str) -> bool {+ name.starts_with(AI_LANE_NAME_PREFIX)}/// Whether an AI-lane event's body exceeds the deployment's per-event ceiling.@@ -276,23 +219,19 @@ impl DataType {/// `apply_restrictions` so the analytics → exception → heatmap →/// ingestion-warning split stays in one place.///- /// AI events (per [`AiLanePredicate::is_ai_event`]) divert to `AiEvents`+ /// AI events (per [`is_ai_event`]) divert to `AiEvents`/// on every deployment, winning over historical (in v1 the historical/// reroute only applies to the analytics-main destination). Mirrors v1's/// `destination_for_event_name`.////// `SnapshotMain` is not produced here — replay events arrive on a/// separate endpoint and never flow through analytics processing.- pub fn from_event_name(- event_name: &str,- historical_migration: bool,- ai_lane_predicate: AiLanePredicate,- ) -> Self {+ pub fn from_event_name(event_name: &str, historical_migration: bool) -> Self {match event_name {"$$client_ingestion_warning" => Self::ClientIngestionWarning,"$exception" => Self::ExceptionErrorTracking,"$$heatmap" => Self::HeatmapMain,- _ if ai_lane_predicate.is_ai_event(event_name) => Self::AiEvents,+ _ if is_ai_event(event_name) => Self::AiEvents,_ if historical_migration => Self::AnalyticsHistorical,_ => Self::AnalyticsMain,}@@ -412,129 +351,50 @@ mod tests {use serde::Deserialize;use serde_json::json;- use super::{AiLanePredicate, CaptureError, Compression, DataType, RawRequest};+ use super::{CaptureError, Compression, DataType, RawRequest};/// Mirrors v1's `destination_for_event_name` mapping tests: the/// dedicated-name lanes always win, an AI name diverts on every deployment/// (beating historical), and everything else falls through to- /// main/historical per the batch flag. The AI lane membership differs by- /// predicate only for `$ai_`-prefixed names outside the allowlist.+ /// main/historical per the batch flag.#[rstest::rstest]- // Dedicated-name lanes are unaffected by the historical flag or predicate.- #[case(- "$exception",- false,- DataType::ExceptionErrorTracking,- DataType::ExceptionErrorTracking- )]- #[case(- "$exception",- true,- DataType::ExceptionErrorTracking,- DataType::ExceptionErrorTracking- )]- #[case("$$heatmap", false, DataType::HeatmapMain, DataType::HeatmapMain)]- #[case("$$heatmap", true, DataType::HeatmapMain, DataType::HeatmapMain)]- #[case(- "$$client_ingestion_warning",- false,- DataType::ClientIngestionWarning,- DataType::ClientIngestionWarning- )]- #[case(- "$$client_ingestion_warning",- true,- DataType::ClientIngestionWarning,- DataType::ClientIngestionWarning- )]+ // Dedicated-name lanes are unaffected by the historical flag.+ #[case("$exception", false, DataType::ExceptionErrorTracking)]+ #[case("$exception", true, DataType::ExceptionErrorTracking)]+ #[case("$$heatmap", false, DataType::HeatmapMain)]+ #[case("$$heatmap", true, DataType::HeatmapMain)]+ #[case("$$client_ingestion_warning", false, DataType::ClientIngestionWarning)]+ #[case("$$client_ingestion_warning", true, DataType::ClientIngestionWarning)]// Non-AI events keep the main/historical split.- #[case("$pageview", false, DataType::AnalyticsMain, DataType::AnalyticsMain)]- #[case(- "custom_event",- false,- DataType::AnalyticsMain,- DataType::AnalyticsMain- )]- #[case(- "$pageview",- true,- DataType::AnalyticsHistorical,- DataType::AnalyticsHistorical- )]+ #[case("$pageview", false, DataType::AnalyticsMain)]+ #[case("custom_event", false, DataType::AnalyticsMain)]+ #[case("$pageview", true, DataType::AnalyticsHistorical)]// Names that only look like the prefix never divert.- #[case(- "ai_generation",- false,- DataType::AnalyticsMain,- DataType::AnalyticsMain- )]- #[case(- "$AI_generation",- false,- DataType::AnalyticsMain,- DataType::AnalyticsMain- )]- #[case("$ai", false, DataType::AnalyticsMain, DataType::AnalyticsMain)]- // Allowlisted AI events divert under both predicates, and win over historical.- #[case("$ai_generation", false, DataType::AiEvents, DataType::AiEvents)]- #[case("$ai_span", false, DataType::AiEvents, DataType::AiEvents)]- #[case("$ai_trace", false, DataType::AiEvents, DataType::AiEvents)]- #[case(- "$ai_generation_summary",- false,- DataType::AiEvents,- DataType::AiEvents- )]- #[case("$ai_generation", true, DataType::AiEvents, DataType::AiEvents)]- // Prefixed-but-unlisted names divert only under the prefix predicate.- #[case("$ai_call", false, DataType::AnalyticsMain, DataType::AiEvents)]- #[case(- "$ai_generation_enriched",- false,- DataType::AnalyticsMain,- DataType::AiEvents- )]- #[case(- "$ai_model_failover",- false,- DataType::AnalyticsMain,- DataType::AiEvents- )]- #[case(- "$ai_model_failover",- true,- DataType::AnalyticsHistorical,- DataType::AiEvents- )]- #[case("$ai_", false, DataType::AnalyticsMain, DataType::AiEvents)]+ #[case("ai_generation", false, DataType::AnalyticsMain)]+ #[case("$AI_generation", false, DataType::AnalyticsMain)]+ #[case("$ai", false, DataType::AnalyticsMain)]+ // Every `$ai_` name diverts, and wins over historical.+ #[case("$ai_generation", false, DataType::AiEvents)]+ #[case("$ai_span", false, DataType::AiEvents)]+ #[case("$ai_trace", false, DataType::AiEvents)]+ #[case("$ai_generation_summary", false, DataType::AiEvents)]+ #[case("$ai_generation", true, DataType::AiEvents)]+ #[case("$ai_call", false, DataType::AiEvents)]+ #[case("$ai_generation_enriched", false, DataType::AiEvents)]+ #[case("$ai_model_failover", false, DataType::AiEvents)]+ #[case("$ai_model_failover", true, DataType::AiEvents)]+ #[case("$ai_", false, DataType::AiEvents)]fn from_event_name_mapping(#[case] event_name: &str,#[case] historical_migration: bool,- #[case] expected_allowlist: DataType,- #[case] expected_prefix: DataType,+ #[case] expected: DataType,) {assert_eq!(- DataType::from_event_name(event_name, historical_migration, AiLanePredicate::Allowlist),- expected_allowlist- );- assert_eq!(- DataType::from_event_name(event_name, historical_migration, AiLanePredicate::Prefix),- expected_prefix+ DataType::from_event_name(event_name, historical_migration),+ expected);}- #[rstest::rstest]- #[case("allowlist", Ok(AiLanePredicate::Allowlist))]- #[case(" Prefix ", Ok(AiLanePredicate::Prefix))]- #[case("regex", Err(()))]- #[case("", Err(()))]- fn ai_lane_predicate_from_str(- #[case] raw: &str,- #[case] expected: Result<AiLanePredicate, ()>,- ) {- assert_eq!(raw.parse::<AiLanePredicate>().map_err(|_| ()), expected);- }-#[test]fn decode_compression_param() {#[derive(Deserialize, Debug)]diff --git a/rust/capture/src/v1/analytics/process.rs b/rust/capture/src/v1/analytics/process.rsindex de03304e3ee9..1f898bec62cb 100644--- a/rust/capture/src/v1/analytics/process.rs+++ b/rust/capture/src/v1/analytics/process.rs@@ -21,7 +21,7 @@ use super::types::{Batch, Event, EventResult, OptionKeys, Options, WrappedEvent}use crate::event_restrictions::{EventContext, EventRestrictionService};use crate::events::ai_byte_limit::charge_ai_bytes;use crate::global_rate_limiter::{GlobalRateLimitKey, GlobalRateLimiter};-use crate::v0_request::{exceeds_max_ai_event_bytes, AiLanePredicate};+use crate::v0_request::{exceeds_max_ai_event_bytes, is_ai_event};use limiters::overflow::{OverflowLimiter, OverflowLimiterResult};use tracing::Level;@@ -46,14 +46,14 @@ use common_ingestion_warnings::{/// (extractHeatmapDataStep) handles extraction when `skip_heatmap_processing` is unset/// in Kafka headers — removing that fallback would break scroll-depth heatmaps for v1.///-/// AI events (per the deployment's [`AiLanePredicate`]) are diverted to-/// `Destination::AiEvents` on every deployment.-fn destination_for_event_name(name: &str, ai_lane_predicate: AiLanePredicate) -> Destination {+/// AI events (per [`is_ai_event`]) are diverted to `Destination::AiEvents` on+/// every deployment.+fn destination_for_event_name(name: &str) -> Destination {match name {"$exception" => Destination::ExceptionErrorTracking,"$$heatmap" => Destination::HeatmapMain,"$$client_ingestion_warning" => Destination::ClientIngestionWarning,- _ if ai_lane_predicate.is_ai_event(name) => Destination::AiEvents,+ _ if is_ai_event(name) => Destination::AiEvents,_ => Destination::AnalyticsMain,}}@@ -91,7 +91,7 @@ async fn run_pipeline(}context.set_batch_metadata(&batch);- let mut events = match validate_events(context, state.ai_lane_predicate, batch) {+ let mut events = match validate_events(context, batch) {Ok(events) => events,Err(err) => {emit_batch_abort_warning(state, context, &err, batch_len);@@ -150,20 +150,10 @@ async fn run_pipeline(.await;}- apply_ai_event_size_limit(- state.ai_max_event_bytes,- state.ai_lane_predicate,- &mut events,- );+ apply_ai_event_size_limit(state.ai_max_event_bytes, &mut events);if let Some(ref limiter) = state.ai_byte_rate_limiter {- apply_ai_byte_limits(- limiter,- &context.api_token,- state.ai_lane_predicate,- &mut events,- )- .await;+ apply_ai_byte_limits(limiter, &context.api_token, &mut events).await;}apply_historical_rerouting(&state.historical_cfg, context, &mut events);@@ -525,11 +515,7 @@ fn validate_batch(batch: &Batch) -> Result<(), Error> {Ok(())}-fn validate_events(- context: &RequestContext,- ai_lane_predicate: AiLanePredicate,- batch: Batch,-) -> Result<Vec<WrappedEvent>, Error> {+fn validate_events(context: &RequestContext, batch: Batch) -> Result<Vec<WrappedEvent>, Error> {let batch_len = batch.batch.len();let mut events: Vec<WrappedEvent> = Vec::with_capacity(batch_len);let mut seen: HashSet<Uuid> = HashSet::with_capacity(batch_len);@@ -549,7 +535,7 @@ fn validate_events());}- let destination = destination_for_event_name(&event.event, ai_lane_predicate);+ let destination = destination_for_event_name(&event.event);match validate_event(&event) {Ok(raw_ts) => {@@ -969,7 +955,7 @@ fn drop_non_ai_events(state: &router::State, context: &Context, events: &mut [Wr// cannot ride an analytics lane out of an AI deployment. Neither case// is reachable at this point today; both make the gate correct on its// own terms rather than on its position in the pipeline.- if !event.should_publish() || on_ai_lane(event, state.ai_lane_predicate) {+ if !event.should_publish() || on_ai_lane(event) {continue;}event.result = EventResult::Drop;@@ -1025,10 +1011,10 @@ fn drop_non_ai_events(state: &router::State, context: &Context, events: &mut [Wr/// operator redirected: `force_overflow` retargets an AI event to/// `AiEventsOverflow`, which is still the AI lane, and a `redirect_to_topic`/// or DLQ restriction moves it off `AiEvents` without taking it off the wire.-/// The predicate is the same one v0 stamps `DataType::AiEvents` from, so both+/// [`is_ai_event`] is the same rule v0 stamps `DataType::AiEvents` from, so both/// pipelines charge and measure the same set.-fn on_ai_lane(event: &WrappedEvent, ai_lane_predicate: AiLanePredicate) -> bool {- ai_lane_predicate.is_ai_event(&event.event.event)+fn on_ai_lane(event: &WrappedEvent) -> bool {+ is_ai_event(&event.event.event)}/// Drop AI-lane events past the deployment's per-event size ceiling.@@ -1041,11 +1027,7 @@ fn on_ai_lane(event: &WrappedEvent, ai_lane_predicate: AiLanePredicate) -> bool////// Charged bytes are the event's properties, which dominate an AI event's wire/// size; the serialized envelope is not built until the sink.-fn apply_ai_event_size_limit(- max_event_bytes: u64,- ai_lane_predicate: AiLanePredicate,- events: &mut [WrappedEvent],-) {+fn apply_ai_event_size_limit(max_event_bytes: u64, events: &mut [WrappedEvent]) {if max_event_bytes == 0 {return;}@@ -1053,7 +1035,7 @@ fn apply_ai_event_size_limit(let mut dropped: u64 = 0;for event in events.iter_mut() {- if event.result != EventResult::Ok || !on_ai_lane(event, ai_lane_predicate) {+ if event.result != EventResult::Ok || !on_ai_lane(event) {continue;}if exceeds_max_ai_event_bytes(event.event.properties.get().len(), max_event_bytes) {@@ -1075,7 +1057,7 @@ fn apply_ai_event_size_limit(/// (`events::ai_byte_limit`), so a token's bytes count once no matter which/// pipeline carries them.///-/// Membership comes from the deployment's lane predicate, not the current+/// Membership comes from the event name ([`is_ai_event`]), not the current/// destination: a restriction that retargets an AI event still spends the/// project's bytes, and `force_overflow` keeps it on the AI lane outright. The/// `EventResult::Ok` guard keeps every upstream drop — validation, quota, a@@ -1087,13 +1069,12 @@ fn apply_ai_event_size_limit(async fn apply_ai_byte_limits(limiter: &GlobalRateLimiter,token: &str,- ai_lane_predicate: AiLanePredicate,events: &mut [WrappedEvent],) {let mut dropped: u64 = 0;for event in events.iter_mut() {- if event.result != EventResult::Ok || !on_ai_lane(event, ai_lane_predicate) {+ if event.result != EventResult::Ok || !on_ai_lane(event) {continue;}if charge_ai_bytes(limiter, token, event.event.properties.get().len()).await {@@ -1566,7 +1547,7 @@ mod tests {let normal = valid_event();let normal_uuid = Uuid::parse_str(&normal.uuid).unwrap();let batch = valid_batch(vec![perf, normal]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 2);// Vec preserves input order: perf first, normal second.let p = &events[0];@@ -1590,7 +1571,7 @@ mod tests {..valid_event()};let batch = valid_batch(vec![p1, p2]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 2);for ev in &events {assert_eq!(ev.result, EventResult::Drop);@@ -1606,7 +1587,7 @@ mod tests {illegal_event.distinct_id = id.to_string();let legal_event = valid_event();let batch = valid_batch(vec![illegal_event, legal_event]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 2, "id={id:?}");let flagged = &events[0];@@ -1631,7 +1612,7 @@ mod tests {let ctx = test_utils::test_context();let event = deserialized_event(&Uuid::new_v4().to_string(), " NULL ");let batch = valid_batch(vec![event]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events[0].result, EventResult::Ok);assert!(events[0].force_disable_person_processing);assert_eq!(events[0].details, Some(DETAIL_PERSON_PROCESSING_DISABLED));@@ -1644,7 +1625,7 @@ mod tests {let mut illegal_event = valid_event();illegal_event.distinct_id = id.to_string();let batch = valid_batch(vec![illegal_event]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 1, "id={id:?}");assert!(events[0].should_publish(), "id={id:?}");}@@ -1671,7 +1652,7 @@ mod tests {},],};- let err = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err();+ let err = validate_events(&ctx, batch).unwrap_err();assert!(matches!(err, Error::DuplicateEventUuid(_)));}@@ -1687,7 +1668,7 @@ mod tests {..valid_event()}],};- let err = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err();+ let err = validate_events(&ctx, batch).unwrap_err();assert!(matches!(err, Error::InvalidEventUuid(_)));}@@ -1703,7 +1684,7 @@ mod tests {..valid_event()}],};- let err = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err();+ let err = validate_events(&ctx, batch).unwrap_err();assert!(matches!(err, Error::MissingEventUuid));}@@ -1735,7 +1716,7 @@ mod tests {let count = dropped_count("duplicate_event_uuid", "validation_abort", || {assert!(matches!(- validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err(),+ validate_events(&ctx, batch).unwrap_err(),Error::DuplicateEventUuid(_)));});@@ -1757,7 +1738,7 @@ mod tests {let count = dropped_count("invalid_event_uuid", "validation_abort", || {assert!(matches!(- validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err(),+ validate_events(&ctx, batch).unwrap_err(),Error::InvalidEventUuid(_)));});@@ -1777,7 +1758,7 @@ mod tests {let count = dropped_count("missing_event_uuid", "validation_abort", || {assert!(matches!(- validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err(),+ validate_events(&ctx, batch).unwrap_err(),Error::MissingEventUuid));});@@ -1825,7 +1806,7 @@ mod tests {let event = deserialized_event(&padded_uuid, "user-42");assert_eq!(event.uuid, inner_uuid.to_string());let batch = valid_batch(vec![event]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 1);assert_eq!(events[0].uuid, inner_uuid);}@@ -1844,7 +1825,7 @@ mod tests {capture_internal: None,batch: vec![bad_event],};- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events.len(), 1);let event = &events[0];assert_eq!(event.uuid, uuid);@@ -1892,7 +1873,7 @@ mod tests {("result", "malformed"),("error", expected_drop.unwrap_or("none")),],- || events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap(),+ || events = validate_events(&ctx, batch).unwrap(),);assert_eq!(events[0].result, EventResult::Ok);@@ -1929,7 +1910,7 @@ mod tests {capture_internal: None,batch: vec![ev1, ev2],};- let result = validate_events(&ctx, AiLanePredicate::Allowlist, batch);+ let result = validate_events(&ctx, batch);assert!(result.is_ok());let events = result.unwrap();assert_eq!(events[0].result, EventResult::Drop);@@ -1951,7 +1932,7 @@ mod tests {capture_internal: None,batch: vec![ev],};- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events[0].result, EventResult::Ok);assert_eq!(events[0].options.disable_skew_correction, Some(true));}@@ -1975,7 +1956,7 @@ mod tests {capture_internal: None,batch: vec![ev],};- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(events[0].result, EventResult::Drop);assert_eq!(events[0].details, Some("missing_event_name"));}@@ -2246,7 +2227,7 @@ mod tests {let mut events = vec![oversized, small];- apply_ai_event_size_limit(700, AiLanePredicate::Allowlist, &mut events);+ apply_ai_event_size_limit(700, &mut events);let big = find_by_did(&events, "user-big");assert_eq!(big.result, EventResult::Drop);@@ -2271,7 +2252,7 @@ mod tests {test_utils::raw_obj(&format!(r#"{{"$ai_input":"{}"}}"#, "x".repeat(800)));let mut events = vec![oversized];- apply_ai_event_size_limit(0, AiLanePredicate::Allowlist, &mut events);+ apply_ai_event_size_limit(0, &mut events);assert_eq!(events[0].result, EventResult::Ok);assert_eq!(events[0].destination, Destination::AiEvents);@@ -2288,7 +2269,7 @@ mod tests {oversized.destination = Destination::AiEventsOverflow;let mut events = vec![oversized];- apply_ai_event_size_limit(700, AiLanePredicate::Allowlist, &mut events);+ apply_ai_event_size_limit(700, &mut events);assert_eq!(events[0].result, EventResult::Drop);assert_eq!(events[0].destination, Destination::Drop);@@ -2318,13 +2299,7 @@ mod tests {event.destination = destination.clone();}- apply_ai_byte_limits(- &limiter,- "phc_token",- AiLanePredicate::Allowlist,- &mut events,- )- .await;+ apply_ai_byte_limits(&limiter, "phc_token", &mut events).await;assert_eq!(events[0].result, EventResult::Ok);assert_eq!(events[0].destination, destination);@@ -2343,13 +2318,7 @@ mod tests {wrapped_event("$pageview", "user-2"),];- apply_ai_byte_limits(- &limiter,- "phc_token",- AiLanePredicate::Allowlist,- &mut events,- )- .await;+ apply_ai_byte_limits(&limiter, "phc_token", &mut events).await;for event in &events {assert_eq!(event.result, EventResult::Ok);@@ -2375,13 +2344,7 @@ mod tests {let mut events = vec![already_dropped, publishable];- apply_ai_byte_limits(- &limiter,- "phc_token",- AiLanePredicate::Allowlist,- &mut events,- )- .await;+ apply_ai_byte_limits(&limiter, "phc_token", &mut events).await;let ev = find_by_did(&events, "user-1");assert_eq!(@@ -2520,67 +2483,30 @@ mod tests {// --- destination_for_event_name ---- /// Every non-AI row is identical in both modes; only `$ai_`-prefixed names- /// off the allowlist move, and only under `Prefix`.#[rstest::rstest]- #[case(- "$exception",- Destination::ExceptionErrorTracking,- Destination::ExceptionErrorTracking- )]- #[case("$$heatmap", Destination::HeatmapMain, Destination::HeatmapMain)]- #[case(- "$$client_ingestion_warning",- Destination::ClientIngestionWarning,- Destination::ClientIngestionWarning- )]- #[case("$pageview", Destination::AnalyticsMain, Destination::AnalyticsMain)]- #[case("custom_event", Destination::AnalyticsMain, Destination::AnalyticsMain)]- #[case("$autocapture", Destination::AnalyticsMain, Destination::AnalyticsMain)]- // Allowlisted AI events divert on every deployment in both modes.- #[case("$ai_generation", Destination::AiEvents, Destination::AiEvents)]- #[case("$ai_span", Destination::AiEvents, Destination::AiEvents)]- #[case("$ai_trace", Destination::AiEvents, Destination::AiEvents)]- #[case("$ai_generation_summary", Destination::AiEvents, Destination::AiEvents)]- // `$ai_`-prefixed names absent from the allowlist: Main under `Allowlist`- // (the AI pipeline of that era would DLQ them), AI lane under `Prefix`.- #[case("$ai_call", Destination::AnalyticsMain, Destination::AiEvents)]- #[case(- "$ai_generation_enriched",- Destination::AnalyticsMain,- Destination::AiEvents- )]- #[case(- "$ai_model_failover",- Destination::AnalyticsMain,- Destination::AiEvents- )]+ #[case("$exception", Destination::ExceptionErrorTracking)]+ #[case("$$heatmap", Destination::HeatmapMain)]+ #[case("$$client_ingestion_warning", Destination::ClientIngestionWarning)]+ #[case("$pageview", Destination::AnalyticsMain)]+ #[case("custom_event", Destination::AnalyticsMain)]+ #[case("$autocapture", Destination::AnalyticsMain)]+ // Every `$ai_` name diverts on every deployment.+ #[case("$ai_generation", Destination::AiEvents)]+ #[case("$ai_span", Destination::AiEvents)]+ #[case("$ai_trace", Destination::AiEvents)]+ #[case("$ai_generation_summary", Destination::AiEvents)]+ #[case("$ai_call", Destination::AiEvents)]+ #[case("$ai_generation_enriched", Destination::AiEvents)]+ #[case("$ai_model_failover", Destination::AiEvents)]// Prefix means `$ai_`, not `$ai`: a name without the underscore never diverts.- #[case("$ai", Destination::AnalyticsMain, Destination::AnalyticsMain)]- #[case(- "$aigeneration",- Destination::AnalyticsMain,- Destination::AnalyticsMain- )]- #[case(- "ai_generation",- Destination::AnalyticsMain,- Destination::AnalyticsMain- )]- fn destination_for_event_name_mapping(- #[case] event_name: &str,- #[case] under_allowlist: Destination,- #[case] under_prefix: Destination,- ) {+ #[case("$ai", Destination::AnalyticsMain)]+ #[case("$aigeneration", Destination::AnalyticsMain)]+ #[case("ai_generation", Destination::AnalyticsMain)]+ fn destination_for_event_name_mapping(#[case] event_name: &str, #[case] expected: Destination) {assert_eq!(- destination_for_event_name(event_name, AiLanePredicate::Allowlist),- under_allowlist,- "allowlist: {event_name}"- );- assert_eq!(- destination_for_event_name(event_name, AiLanePredicate::Prefix),- under_prefix,- "prefix: {event_name}"+ destination_for_event_name(event_name),+ expected,+ "{event_name}");}@@ -3442,7 +3368,7 @@ mod tests {};let batch = valid_batch(vec![normal_a, perf, normal_b, normal_c]);- let events = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap();+ let events = validate_events(&ctx, batch).unwrap();assert_eq!(distinct_id_sequence(&events),@@ -3456,7 +3382,7 @@ mod tests {let ctx = test_utils::test_context();let (first, second) = test_utils::realistic_dup_uuid_pair();let batch = valid_batch(vec![first, second]);- let err = validate_events(&ctx, AiLanePredicate::Allowlist, batch).unwrap_err();+ let err = validate_events(&ctx, batch).unwrap_err();assert!(matches!(err, Error::DuplicateEventUuid(_)));}@@ -4159,7 +4085,7 @@ mod tests {});}- /// process_batch wiring: an allowlisted AI event lands on the AI topic.+ /// process_batch wiring: an AI event lands on the AI topic.#[tokio::test]async fn process_batch_routes_ai_events_to_ai_topic() {let ts = TestStateBuilder::new().build();@@ -4712,43 +4638,32 @@ mod tests {});}- /// Under `Allowlist` an unlisted `$ai_*` name drops like any non-AI event; under- /// `Prefix` it is admitted. Non-AI names drop in both modes.+ /// Any `$ai_*` name is admitted; every other name drops.#[rstest::rstest]- #[case::allowlisted("$ai_generation", EventResult::Ok, EventResult::Ok)]- #[case::allowlisted_span("$ai_span", EventResult::Ok, EventResult::Ok)]- #[case::prefixed_but_unlisted("$ai_not_a_real_event", EventResult::Drop, EventResult::Ok)]- #[case::analytics("$pageview", EventResult::Drop, EventResult::Drop)]- #[case::exception("$exception", EventResult::Drop, EventResult::Drop)]- #[case::heatmap("$$heatmap", EventResult::Drop, EventResult::Drop)]- #[case::prefix_needs_underscore("$aigeneration", EventResult::Drop, EventResult::Drop)]+ #[case::generation("$ai_generation", EventResult::Ok)]+ #[case::span("$ai_span", EventResult::Ok)]+ #[case::any_ai_prefixed("$ai_not_a_real_event", EventResult::Ok)]+ #[case::analytics("$pageview", EventResult::Drop)]+ #[case::exception("$exception", EventResult::Drop)]+ #[case::heatmap("$$heatmap", EventResult::Drop)]+ #[case::prefix_needs_underscore("$aigeneration", EventResult::Drop)]#[tokio::test]- async fn ai_mode_gates_on_the_ai_lane_predicate(+ async fn ai_mode_gates_on_the_ai_prefix(#[case] event_name: &str,- #[case] under_allowlist: EventResult,- #[case] under_prefix: EventResult,+ #[case] expected: EventResult,) {- for (predicate, expected) in [- (AiLanePredicate::Allowlist, under_allowlist),- (AiLanePredicate::Prefix, under_prefix),- ] {- let ts = TestStateBuilder::new()- .with_capture_mode(CaptureMode::Ai)- .with_ai_lane_predicate(predicate)- .build();- let mut ctx = test_utils::test_analytics_context();- let batch = valid_batch(vec![named_event(event_name)]);-- let resp = process_batch(&ts.state, &mut ctx, batch).await.unwrap();-- let (_, entry) = &resp.entries()[0];- assert_eq!(- entry.result, expected,- "event={event_name} predicate={predicate:?}"- );- if expected == EventResult::Drop {- assert_eq!(entry.details, Some(DETAIL_MISROUTED_EVENT));- }+ let ts = TestStateBuilder::new()+ .with_capture_mode(CaptureMode::Ai)+ .build();+ let mut ctx = test_utils::test_analytics_context();+ let batch = valid_batch(vec![named_event(event_name)]);++ let resp = process_batch(&ts.state, &mut ctx, batch).await.unwrap();++ let (_, entry) = &resp.entries()[0];+ assert_eq!(entry.result, expected, "event={event_name}");+ if expected == EventResult::Drop {+ assert_eq!(entry.details, Some(DETAIL_MISROUTED_EVENT));}}@@ -4788,7 +4703,7 @@ mod tests {let batch = valid_batch(vec![named_event("$pageview"),named_event("$exception"),- named_event("$ai_not_a_real_event"),+ named_event("$aigeneration"),]);let resp = process_batch(&ts.state, &mut ctx, batch).await.unwrap();@@ -4834,7 +4749,7 @@ mod tests {assert_eq!(events[0].result,EventResult::Ok,- "an allowlisted AI event stays on the lane wherever it was pointed"+ "an AI event stays on the lane wherever it was pointed");assert_eq!(events[0].destination, destination);assert_eq!(events[0].details, None);diff --git a/rust/capture/src/v1/quota_limiter_shim.rs b/rust/capture/src/v1/quota_limiter_shim.rsindex a3ff3b8bf70a..ae134b08c7f2 100644--- a/rust/capture/src/v1/quota_limiter_shim.rs+++ b/rust/capture/src/v1/quota_limiter_shim.rs@@ -208,7 +208,6 @@ mod tests {s3_fallback_prefix: String::new(),ai_max_sum_of_parts_bytes: 26_214_400,ai_max_event_bytes: 8_388_608,- ai_lane_predicate: crate::v0_request::AiLanePredicate::Allowlist,ai_gateway_signing_secret: None,http1_header_read_timeout_ms: Some(5000),body_chunk_read_timeout_ms: None,diff --git a/rust/capture/src/v1/test_utils.rs b/rust/capture/src/v1/test_utils.rsindex e08dcfb748d8..5574a5ed9ccd 100644--- a/rust/capture/src/v1/test_utils.rs+++ b/rust/capture/src/v1/test_utils.rs@@ -678,7 +678,6 @@ use crate::global_rate_limiter::GlobalRateLimiter;use crate::quota_limiters::CaptureQuotaLimiter;use crate::router::{self, HistoricalConfig};use crate::time::TimeSource;-use crate::v0_request::AiLanePredicate;use crate::v1::sinks::kafka::mock::MockProducer;use crate::v1::sinks::kafka::sink::KafkaSink;use crate::v1::sinks::sink::Sink;@@ -707,7 +706,6 @@ pub struct TestStateBuilder {ingestion_warning_emitter: Option<Arc<dyn common_ingestion_warnings::WarningEmitter>>,capture_mode: CaptureMode,ai_max_event_bytes: u64,- ai_lane_predicate: AiLanePredicate,}impl Default for TestStateBuilder {@@ -733,7 +731,6 @@ impl TestStateBuilder {ingestion_warning_emitter: None,capture_mode: CaptureMode::Events,ai_max_event_bytes: 0,- ai_lane_predicate: AiLanePredicate::Allowlist,}}@@ -834,11 +831,6 @@ impl TestStateBuilder {self}- pub fn with_ai_lane_predicate(mut self, predicate: AiLanePredicate) -> Self {- self.ai_lane_predicate = predicate;- self- }-pub fn build(self) -> TestState {let mut manager = lifecycle::Manager::builder("test_state").with_trap_signals(false)@@ -952,7 +944,6 @@ impl TestStateBuilder {verbose_sample_percent: 0.0,ai_max_sum_of_parts_bytes: 100 * 1024 * 1024,ai_max_event_bytes: self.ai_max_event_bytes,- ai_lane_predicate: self.ai_lane_predicate,body_chunk_read_timeout: None,body_read_chunk_size_kb: 64,capture_v1_max_compressed_body_bytes: 2 * 1024 * 1024,diff --git a/rust/capture/tests/common/integration_utils.rs b/rust/capture/tests/common/integration_utils.rsindex de058a6e89df..229aff1e1712 100644--- a/rust/capture/tests/common/integration_utils.rs+++ b/rust/capture/tests/common/integration_utils.rs@@ -12,7 +12,7 @@ use capture::{quota_limiters::CaptureQuotaLimiter,router::router,time::TimeSource,- v0_request::{AiLanePredicate, DataType, ProcessedEvent},+ v0_request::{DataType, ProcessedEvent},v1::test_utils::TestStateBuilder,};use chrono::{DateTime, Utc};@@ -1121,9 +1121,8 @@ fn build_router_for_mode_at(historical_rerouting_threshold_days,is_mirror_deploy,verbose_sample_percent,- 26_214_400, // 25MB default for AI endpoint- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 26_214_400, // 25MB default for AI endpoint+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytesdiff --git a/rust/capture/tests/common/utils.rs b/rust/capture/tests/common/utils.rsindex 3886a3a0dd52..ad404326fb75 100644--- a/rust/capture/tests/common/utils.rs+++ b/rust/capture/tests/common/utils.rs@@ -141,7 +141,6 @@ pub static DEFAULT_CONFIG: Lazy<Config> = Lazy::new(|| Config {s3_fallback_prefix: String::new(),ai_max_sum_of_parts_bytes: 26_214_400, // 25MB defaultai_max_event_bytes: 8_388_608, // 8MiB default- ai_lane_predicate: capture::v0_request::AiLanePredicate::Allowlist,ai_gateway_signing_secret: None,http1_header_read_timeout_ms: Some(5000), // 5 seconds defaultbody_chunk_read_timeout_ms: None, // disabled by default in testsdiff --git a/rust/capture/tests/integration_ai_endpoint.rs b/rust/capture/tests/integration_ai_endpoint.rsindex 09fe2caa3540..4e845775844c 100644--- a/rust/capture/tests/integration_ai_endpoint.rs+++ b/rust/capture/tests/integration_ai_endpoint.rs@@ -12,7 +12,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, OverflowReason, ProcessedEvent};+use capture::v0_request::{OverflowReason, ProcessedEvent};use chrono::{DateTime, TimeZone, Utc};use common_ingestion_warnings::test_support::CollectingEmitter;use common_ingestion_warnings::{WarningEmitter, WarningType, CAPTURE_AI_EVENTS};@@ -133,10 +133,6 @@ fn create_ai_event_form(event_name: &str, distinct_id: &str, properties: Value)// Helper to setup test routerfn setup_ai_test_router() -> Router {- setup_ai_test_router_with_predicate(AiLanePredicate::Allowlist)-}--fn setup_ai_test_router_with_predicate(ai_lane_predicate: AiLanePredicate) -> Router {let (readiness, liveness, _monitor) = test_lifecycle_handlers();let sink = TestSink;@@ -171,9 +167,8 @@ fn setup_ai_test_router_with_predicate(ai_lane_predicate: AiLanePredicate) -> Ro1_i64,false,0.0_f32,- 26_214_400, // 25MB default for AI endpoint- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- ai_lane_predicate,+ 26_214_400, // 25MB default for AI endpoint+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -231,7 +226,6 @@ fn setup_ai_router_collecting_warnings() -> (Router, Arc<CollectingEmitter>) {0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024,@@ -628,85 +622,30 @@ async fn test_invalid_event_name_custom_event_returns_400() {assert_eq!(response.status(), StatusCode::BAD_REQUEST);}+/// The endpoint accepts any `$ai_*` name and refuses the rest with a message+/// naming the prefix rule. `$ai_model` is still required either way.#[tokio::test]-async fn test_all_allowed_ai_event_types_accepted() {+async fn accepts_any_ai_prefixed_name_on_the_ai_endpoint() {let router = setup_ai_test_router();let test_client = TestClient::new(router);+ let token = Some("phc_VXRzc3poSG9GZm1JenRianJ6TTJFZGh4OWY2QXzx9f3");- let allowed_events = vec![+ for event_name in ["$ai_generation","$ai_trace","$ai_span","$ai_embedding","$ai_metric","$ai_feedback",- ];-- for event_name in allowed_events {- let properties = json!({- "$ai_model": "test-model"- });-- let form = create_ai_event_form(event_name, "test_user", properties);-- let response = send_multipart_request(- &test_client,- form,- Some("phc_VXRzc3poSG9GZm1JenRianJ6TTJFZGh4OWY2QXzx9f3"),- )- .await;- assert_eq!(- response.status(),- StatusCode::OK,- "Event type {event_name} should be accepted"- );- }-}--#[tokio::test]-async fn test_invalid_ai_event_type_returns_400() {- let router = setup_ai_test_router();- let test_client = TestClient::new(router);-- let invalid_events = vec!["$ai_unknown", "$ai_custom", "$ai_"];-- for event_name in invalid_events {- let properties = json!({- "$ai_model": "test-model"- });-- let form = create_ai_event_form(event_name, "test_user", properties);-- let response = send_multipart_request(- &test_client,- form,- Some("phc_VXRzc3poSG9GZm1JenRianJ6TTJFZGh4OWY2QXzx9f3"),- )- .await;- assert_eq!(- response.status(),- StatusCode::BAD_REQUEST,- "Event type {event_name} should be rejected"- );- }-}--/// Under `CAPTURE_AI_LANE_PREDICATE=prefix` the endpoint accepts any `$ai_*`-/// name and refuses the rest with a message naming the prefix rule, not the-/// allowlist. `$ai_model` is still required either way.-#[tokio::test]-async fn prefix_predicate_accepts_any_ai_prefixed_name_on_the_ai_endpoint() {- let router = setup_ai_test_router_with_predicate(AiLanePredicate::Prefix);- let test_client = TestClient::new(router);- let token = Some("phc_VXRzc3poSG9GZm1JenRianJ6TTJFZGh4OWY2QXzx9f3");-- for event_name in ["$ai_generation", "$ai_unknown", "$ai_custom"] {+ "$ai_unknown",+ "$ai_custom",+ ] {let form = create_ai_event_form(event_name, "test_user", json!({"$ai_model": "m"}));let response = send_multipart_request(&test_client, form, token).await;assert_eq!(response.status(),StatusCode::OK,- "Event type {event_name} should be accepted under prefix"+ "Event type {event_name} should be accepted");}@@ -716,7 +655,7 @@ async fn prefix_predicate_accepts_any_ai_prefixed_name_on_the_ai_endpoint() {assert_eq!(response.status(),StatusCode::BAD_REQUEST,- "Event type {event_name} should be rejected under prefix"+ "Event type {event_name} should be rejected");let body = response.text().await;assert!(@@ -1335,9 +1274,8 @@ fn setup_ai_test_router_with_capturing_sink() -> (Router, CapturingSink) {1_i64,false,0.0_f32,- 26_214_400, // 25MB default for AI endpoint- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 26_214_400, // 25MB default for AI endpoint+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -2008,7 +1946,6 @@ fn setup_ai_test_router_with_token_dropper(token_dropper: TokenDropper) -> (Rout0.0, // verbose_sample_percent26_214_400, // ai_max_sum_of_parts_bytes983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -2076,7 +2013,6 @@ fn setup_ai_test_router_with_byte_limiter() -> (Router, CapturingSink) {0.0, // verbose_sample_percent26_214_400, // ai_max_sum_of_parts_bytes983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -2339,8 +2275,7 @@ fn setup_ai_test_router_with_llm_quota_limited(token: &str) -> (Router, Capturinfalse,0.0_f32,26_214_400,- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -2500,7 +2435,6 @@ fn setup_ai_test_router_with_overflow_limiter(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -2643,7 +2577,6 @@ fn ai_router(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024,diff --git a/rust/capture/tests/integration_ai_restrictions.rs b/rust/capture/tests/integration_ai_restrictions.rsindex 42a48d01a7f0..30f7b8e4a8bb 100644--- a/rust/capture/tests/integration_ai_restrictions.rs+++ b/rust/capture/tests/integration_ai_restrictions.rs@@ -15,7 +15,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, DataType, OverflowReason, ProcessedEvent};+use capture::v0_request::{DataType, OverflowReason, ProcessedEvent};use chrono::{DateTime, Utc};use common_redis::MockRedisClient;use futures::StreamExt;@@ -169,7 +169,6 @@ async fn setup_ai_router_with_restriction(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -492,7 +491,6 @@ async fn setup_ai_router_with_redirect_to_topic(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -573,7 +571,6 @@ async fn setup_ai_router_with_force_overflow_and_limiter(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024, // capture_v1_max_compressed_body_bytesdiff --git a/rust/capture/tests/integration_ai_route_surface.rs b/rust/capture/tests/integration_ai_route_surface.rsindex a9dc57152d61..47a727d0c24f 100644--- a/rust/capture/tests/integration_ai_route_surface.rs+++ b/rust/capture/tests/integration_ai_route_surface.rs@@ -10,8 +10,8 @@//! wrong deployment accepts traffic no restriction there governs, which is//! silent rather than loud, so the split is asserted directly here.//!-//! The pipeline-level gates cover the other half — an event name off the AI-//! allowlist arriving on a path that IS registered: `events::analytics` for the+//! The pipeline-level gates cover the other half — an event name without the+//! `$ai_` prefix arriving on a path that IS registered: `events::analytics` for the//! v0 paths, `v1::analytics::process` for `/i/v1/ai/events`.#[path = "common/integration_utils.rs"]diff --git a/rust/capture/tests/integration_analytics_ai_routing.rs b/rust/capture/tests/integration_analytics_ai_routing.rsindex 10f73d7ef8ed..55328e837714 100644--- a/rust/capture/tests/integration_analytics_ai_routing.rs+++ b/rust/capture/tests/integration_analytics_ai_routing.rs@@ -18,7 +18,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, DataType, OverflowReason, ProcessedEvent};+use capture::v0_request::{DataType, OverflowReason, ProcessedEvent};use chrono::{DateTime, Utc};use common_redis::MockRedisClient;use integration_utils::{test_lifecycle_handlers, DEFAULT_CONFIG, DEFAULT_TEST_TIME};@@ -75,7 +75,6 @@ fn setup_analytics_router() -> (Router, CapturingSink) {setup_router_for_mode(CaptureMode::Events,- AiLanePredicate::Allowlist,ai_events_overflow_enabled,overflow_limiter,ai_events_overflow_limiter,@@ -84,7 +83,6 @@ fn setup_analytics_router(fn setup_router_for_mode(capture_mode: CaptureMode,- ai_lane_predicate: AiLanePredicate,ai_events_overflow_enabled: bool,overflow_limiter: Option<Arc<OverflowLimiter>>,ai_events_overflow_limiter: Option<Arc<OverflowLimiter>>,@@ -126,7 +124,6 @@ fn setup_router_for_mode(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- ai_lane_predicate,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -164,7 +161,7 @@ fn mixed_batch_payload() -> String {.to_string()}-// Two allowlisted AI event names. capture-ai rejects a batch carrying anything+// Two AI event names. capture-ai rejects a batch carrying anything// else, so its lane-assignment coverage has to use an all-AI batch.fn ai_only_batch_payload() -> String {json!({@@ -307,13 +304,7 @@ async fn mixed_batch_diverts_only_ai_events(#[case] ai_events_overflow_enabled:/// half of the old version of this test now lives below.#[tokio::test]async fn ai_mode_diverts_ai_events_like_every_other_mode() {- let (router, sink) = setup_router_for_mode(- CaptureMode::Ai,- AiLanePredicate::Allowlist,- false,- None,- None,- );+ let (router, sink) = setup_router_for_mode(CaptureMode::Ai, false, None, None);let client = TestClient::new(router);let response = client@@ -331,22 +322,14 @@ async fn ai_mode_diverts_ai_events_like_every_other_mode() {events.iter().all(|e| e.metadata.data_type == DataType::AiEvents),- "every allowlisted AI event must land on the AI lane under Ai mode"+ "every AI event must land on the AI lane under Ai mode");}-/// `CAPTURE_AI_LANE_PREDICATE` decides where an `$ai_`-prefixed name off the-/// allowlist lands, end to end through `/batch`: analytics lane under-/// `allowlist`, AI lane under `prefix`. The listed name diverts either way.-#[rstest]-#[case::allowlist(AiLanePredicate::Allowlist, DataType::AnalyticsMain)]-#[case::prefix(AiLanePredicate::Prefix, DataType::AiEvents)]+/// Any `$ai_`-prefixed name lands on the AI lane, end to end through `/batch`.#[tokio::test]-async fn unlisted_ai_prefixed_name_follows_the_configured_predicate(- #[case] predicate: AiLanePredicate,- #[case] expected_unlisted_lane: DataType,-) {- let (router, sink) = setup_router_for_mode(CaptureMode::Events, predicate, false, None, None);+async fn any_ai_prefixed_name_diverts_to_the_ai_lane() {+ let (router, sink) = setup_router_for_mode(CaptureMode::Events, false, None, None);let client = TestClient::new(router);let payload = json!({@@ -371,7 +354,7 @@ async fn unlisted_ai_prefixed_name_follows_the_configured_predicate(.data_type};assert_eq!(lane_of("$ai_generation"), DataType::AiEvents);- assert_eq!(lane_of("$ai_custom_step"), expected_unlisted_lane);+ assert_eq!(lane_of("$ai_custom_step"), DataType::AiEvents);assert_eq!(lane_of("$pageview"), DataType::AnalyticsMain);}@@ -380,13 +363,7 @@ async fn unlisted_ai_prefixed_name_follows_the_configured_predicate(/// rejection is reachable through the router and surfaces as a 400.#[tokio::test]async fn ai_mode_rejects_a_mixed_batch_through_the_endpoint() {- let (router, sink) = setup_router_for_mode(- CaptureMode::Ai,- AiLanePredicate::Allowlist,- false,- None,- None,- );+ let (router, sink) = setup_router_for_mode(CaptureMode::Ai, false, None, None);let client = TestClient::new(router);let response = client@@ -516,7 +493,6 @@ async fn ai_lane_overflow_isolated_from_analytics_limiter() {async fn import_mode_historical_batch_never_overflows() {let (router, sink) = setup_router_for_mode(CaptureMode::Import,- AiLanePredicate::Allowlist,false,Some(force_keyed_limiter()),None,diff --git a/rust/capture/tests/integration_analytics_restrictions.rs b/rust/capture/tests/integration_analytics_restrictions.rsindex 5892ad5ab6f0..9d4f881e267e 100644--- a/rust/capture/tests/integration_analytics_restrictions.rs+++ b/rust/capture/tests/integration_analytics_restrictions.rs@@ -15,7 +15,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, DataType, ProcessedEvent};+use capture::v0_request::{DataType, ProcessedEvent};use chrono::{DateTime, Utc};use common_redis::MockRedisClient;use integration_utils::{test_lifecycle_handlers, DEFAULT_CONFIG, DEFAULT_TEST_TIME};@@ -119,7 +119,6 @@ async fn setup_analytics_router_with_restriction(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -547,7 +546,6 @@ async fn setup_analytics_router_with_redirect_to_topic(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytesdiff --git a/rust/capture/tests/integration_otel_endpoint.rs b/rust/capture/tests/integration_otel_endpoint.rsindex e025ec8fdfd2..d221647cc673 100644--- a/rust/capture/tests/integration_otel_endpoint.rs+++ b/rust/capture/tests/integration_otel_endpoint.rs@@ -14,7 +14,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::{is_llm_event, CaptureQuotaLimiter, EventInfo};use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, DataType, OverflowReason, ProcessedEvent};+use capture::v0_request::{DataType, OverflowReason, ProcessedEvent};use chrono::{DateTime, Utc};use common_ingestion_warnings::test_support::CollectingEmitter;use common_ingestion_warnings::{WarningEmitter, WarningType, CAPTURE_AI_OTEL};@@ -188,7 +188,6 @@ fn make_test_client_with_options(sink: &CapturingSink, options: TestClientOption0.0_f32, // verbose_sample_percent26_214_400, // ai_max_sum_of_parts_bytesoptions.ai_max_event_bytes.unwrap_or(983_040), // ai_max_event_bytes- AiLanePredicate::Allowlist, // ai_lane_predicateNone, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytesdiff --git a/rust/capture/tests/integration_person_processing_matrix.rs b/rust/capture/tests/integration_person_processing_matrix.rsindex 2a9645b6e8bf..190dc4c12302 100644--- a/rust/capture/tests/integration_person_processing_matrix.rs+++ b/rust/capture/tests/integration_person_processing_matrix.rs@@ -48,7 +48,6 @@ use capture::sinks::kafka::KafkaSinkBase;use capture::sinks::producer::MockKafkaProducer;use capture::sinks::registry::OutputTable;use capture::time::TimeSource;-use capture::v0_request::AiLanePredicate;use capture::v1::router::{router as v1_router, RouterConfig as V1RouterConfig};use capture::v1::test_utils::TestStateBuilder;use chrono::{DateTime, Utc};@@ -256,7 +255,6 @@ async fn run_v0(inputs: Inputs, distinct_ids: &[&str]) -> Batch {0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024,diff --git a/rust/capture/tests/integration_replay_restrictions.rs b/rust/capture/tests/integration_replay_restrictions.rsindex e1305440a482..1d4963416fe7 100644--- a/rust/capture/tests/integration_replay_restrictions.rs+++ b/rust/capture/tests/integration_replay_restrictions.rs@@ -15,7 +15,7 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::{AiLanePredicate, DataType, ProcessedEvent};+use capture::v0_request::{DataType, ProcessedEvent};use chrono::{DateTime, Utc};use common_redis::MockRedisClient;use integration_utils::{test_lifecycle_handlers, DEFAULT_CONFIG, DEFAULT_TEST_TIME};@@ -116,7 +116,6 @@ async fn setup_recordings_router_with_restriction(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -490,7 +489,6 @@ async fn setup_recordings_router_with_redirect_to_topic(0.0_f32,26_214_400,983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,None,256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytesdiff --git a/rust/capture/tests/integration_wire_body_limits.rs b/rust/capture/tests/integration_wire_body_limits.rsindex 3655216f4f49..4f7da52735ee 100644--- a/rust/capture/tests/integration_wire_body_limits.rs+++ b/rust/capture/tests/integration_wire_body_limits.rs@@ -10,7 +10,6 @@ use capture::outputs::{OutputRegistry, PublishEvents};use capture::quota_limiters::CaptureQuotaLimiter;use capture::router::{router, BATCH_BODY_SIZE};use capture::time::TimeSource;-use capture::v0_request::AiLanePredicate;use capture::v0_request::ProcessedEvent;use chrono::{DateTime, Utc};use common_redis::MockRedisClient;@@ -93,7 +92,6 @@ fn make_test_client(mode: CaptureMode) -> (TestClient, CapturingSink) {// Far above any body this file sends: the AI-lane event ceiling must not// be what produces a 413 here, or the wire cap would go untested.BATCH_BODY_SIZE as u64 * 5, // ai_max_event_bytes- AiLanePredicate::Allowlist,None,256,10 * 1024 * 1024,@@ -118,9 +116,9 @@ fn body_of_len(len: usize) -> String {named_body_of_len(len, "e")}-/// The same, with the event name chosen. Capture-ai rejects any event outside the-/// `AI_EVENT_NAMES` allowlist with a 400 before the size check is reached, so an-/// AI-lane body has to carry a listed name to exercise the cap at all.+/// The same, with the event name chosen. Capture-ai rejects any event without the+/// `$ai_` prefix with a 400 before the size check is reached, so an AI-lane body+/// has to carry an `$ai_` name to exercise the cap at all.fn named_body_of_len(len: usize, event: &str) -> String {let envelope = format!(r#"{{"token":"phc_test","event":"{event}","distinct_id":"d","properties":{{"big":""}}}}"#diff --git a/rust/capture/tests/quota_limiters.rs b/rust/capture/tests/quota_limiters.rsindex 20d1eca636e5..01e3dfd45936 100644--- a/rust/capture/tests/quota_limiters.rs+++ b/rust/capture/tests/quota_limiters.rs@@ -22,7 +22,6 @@ use capture::quota_limiters::{};use capture::router::router;use capture::time::TimeSource;-use capture::v0_request::AiLanePredicate;use capture::v0_request::ProcessedEvent;use chrono::{DateTime, Utc};@@ -131,15 +130,14 @@ async fn setup_router_with_limits(None, // event_restriction_serviceNone, // recorder_handleCaptureMode::Events,- None, // concurrency_limit- 1024 * 1024, // event_payload_size_limit- false, // enable_historical_rerouting- 1, // historical_rerouting_threshold_days- false, // is_mirror_deploy- 0.0, // verbose_sample_percent- 26_214_400, // ai_max_sum_of_parts_bytes (25MB)- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ None, // concurrency_limit+ 1024 * 1024, // event_payload_size_limit+ false, // enable_historical_rerouting+ 1, // historical_rerouting_threshold_days+ false, // is_mirror_deploy+ 0.0, // verbose_sample_percent+ 26_214_400, // ai_max_sum_of_parts_bytes (25MB)+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -1194,8 +1192,7 @@ async fn test_survey_quota_cross_batch_first_submission_allowed() {false,0.0,26_214_400,- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -1288,8 +1285,7 @@ async fn test_survey_quota_cross_batch_duplicate_submission_dropped() {false,0.0,26_214_400,- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -1386,8 +1382,7 @@ async fn test_survey_quota_cross_batch_redis_error_fail_open() {false,0.0,26_214_400,- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes@@ -1821,8 +1816,7 @@ async fn test_ai_quota_cross_batch_redis_error_fail_open() {false,0.0,26_214_400,- 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)- AiLanePredicate::Allowlist,+ 983_040, // ai_max_event_bytes (960KB, the previous hardcoded limit)None, // body_chunk_read_timeout_ms256, // body_read_chunk_size_kb10 * 1024 * 1024, // capture_v1_max_compressed_body_bytes