From 9edcbc47b347dc7b411d61e0f55ae29cb4fe1de0 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 5 Sep 2023 12:23:51 -0400 Subject: [PATCH] agent: default autoDiscover to enabled Updates the agent discovers handler to default capture `autoDiscover` to enabled. If there is an existing capture spec, then its `autoDiscover` property (or lack thereof) is used directly. But if discovering a new capture, then `autoDiscover` will be enabled. --- ...agent__discovers__specs__tests__capture_merge_create.snap | 4 ++++ crates/agent/src/discovers/specs.rs | 5 ++++- crates/models/src/captures.rs | 4 ++-- crates/models/src/lib.rs | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/agent/src/discovers/snapshots/agent__discovers__specs__tests__capture_merge_create.snap b/crates/agent/src/discovers/snapshots/agent__discovers__specs__tests__capture_merge_create.snap index e741752e25..2f10845774 100644 --- a/crates/agent/src/discovers/snapshots/agent__discovers__specs__tests__capture_merge_create.snap +++ b/crates/agent/src/discovers/snapshots/agent__discovers__specs__tests__capture_merge_create.snap @@ -4,6 +4,10 @@ expression: json!(out) --- [ { + "autoDiscover": { + "addNewBindings": true, + "evolveIncompatibleCollections": false + }, "bindings": [ { "resource": { diff --git a/crates/agent/src/discovers/specs.rs b/crates/agent/src/discovers/specs.rs index 6a10c6dea2..aefa44f1dc 100644 --- a/crates/agent/src/discovers/specs.rs +++ b/crates/agent/src/discovers/specs.rs @@ -51,7 +51,10 @@ pub fn merge_capture( Vec::new(), models::CaptureDef::default_interval(), models::ShardTemplate::default(), - None, + Some(models::AutoDiscover { + add_new_bindings: true, + evolve_incompatible_collections: false, + }), ), }; diff --git a/crates/models/src/captures.rs b/crates/models/src/captures.rs index 73b1f9edf1..47c9240b94 100644 --- a/crates/models/src/captures.rs +++ b/crates/models/src/captures.rs @@ -46,12 +46,12 @@ pub struct CaptureDef { pub struct AutoDiscover { /// Automatically add new bindings discovered from the source. #[serde(default)] - add_new_bindings: bool, + pub add_new_bindings: bool, /// Whether to automatically evolve collections and/or materialization /// bindings to handle changes to collections that would otherwise be /// incompatible with the existing catalog. #[serde(default)] - evolve_incompatible_collections: bool, + pub evolve_incompatible_collections: bool, } /// An endpoint from which Flow will capture. diff --git a/crates/models/src/lib.rs b/crates/models/src/lib.rs index 567d40e74c..3ba953b6a7 100644 --- a/crates/models/src/lib.rs +++ b/crates/models/src/lib.rs @@ -18,7 +18,7 @@ mod source; mod tests; pub use crate::labels::{Label, LabelSelector, LabelSet}; -pub use captures::{CaptureBinding, CaptureDef, CaptureEndpoint}; +pub use captures::{AutoDiscover, CaptureBinding, CaptureDef, CaptureEndpoint}; pub use catalogs::Catalog; pub use collections::{CollectionDef, Projection}; pub use connector::ConnectorConfig;