-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agent: prune unbound collections during publish
Updates the publications handler to automatically prune unbound collections from the draft catalog. This is done in order to allow the UI and the discovers handler to just disable/enable bindings without needing to remove collections for disabled bindings from the draft. An "unbound" collection is defined as a draft collection spec that: - has no pre-existing live spec - is not a derivation - is not used as the `source` or `target` in any drafted or live specification During publication, unbound collections will be pruned from `live_specs`. They will still be validated, and can still cause the build to fail if they are invalid. Any pruned collections will _not_ count against the tenant's collections quota. As part of this, the agent was also updated to no longer use the `derivation` property of collection specs in order to determine whether it should count against the task quota. It now uses the `derive` property for that.
- Loading branch information
Showing
7 changed files
with
484 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
...ns/snapshots/agent__publications__specs__test__prune_unbound_collections_publication.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
--- | ||
source: crates/agent/src/publications/specs.rs | ||
expression: results | ||
--- | ||
[ | ||
ScenarioResult { | ||
draft_id: 1110000000000000, | ||
status: Success { | ||
linked_materialization_publications: [], | ||
}, | ||
errors: [], | ||
live_specs: [ | ||
LiveSpec { | ||
catalog_name: "acmeCo/CaptureA", | ||
connector_image_name: Some( | ||
"allowed_connector", | ||
), | ||
connector_image_tag: Some( | ||
"", | ||
), | ||
reads_from: None, | ||
writes_to: Some( | ||
[ | ||
"acmeCo/should_stay", | ||
], | ||
), | ||
spec: Some( | ||
Object { | ||
"bindings": Array [ | ||
Object { | ||
"resource": Object { | ||
"thingy": String("foo"), | ||
}, | ||
"target": String("acmeCo/should_stay"), | ||
}, | ||
Object { | ||
"disable": Bool(true), | ||
"resource": Object { | ||
"thingy": String("foo"), | ||
}, | ||
"target": String("acmeCo/should_stay2"), | ||
}, | ||
Object { | ||
"disable": Bool(true), | ||
"resource": Object { | ||
"thingy": String("foo"), | ||
}, | ||
"target": String("acmeCo/should_stay3"), | ||
}, | ||
Object { | ||
"disable": Bool(true), | ||
"resource": Object { | ||
"thingy": String("bar"), | ||
}, | ||
"target": String("acmeCo/should_prune"), | ||
}, | ||
], | ||
"endpoint": Object { | ||
"connector": Object { | ||
"config": Object {}, | ||
"image": String("allowed_connector"), | ||
}, | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"capture", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: None, | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay2", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: None, | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay3", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: None, | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay4", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: None, | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay5", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: None, | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
LiveSpec { | ||
catalog_name: "acmeCo/should_stay6", | ||
connector_image_name: None, | ||
connector_image_tag: None, | ||
reads_from: Some( | ||
[], | ||
), | ||
writes_to: None, | ||
spec: Some( | ||
Object { | ||
"derive": Object { | ||
"transforms": Array [], | ||
"using": Object { | ||
"sqlite": Object {}, | ||
}, | ||
}, | ||
"key": Array [ | ||
String("/id"), | ||
], | ||
"schema": Object { | ||
"type": String("object"), | ||
}, | ||
}, | ||
), | ||
spec_type: Some( | ||
"collection", | ||
), | ||
}, | ||
], | ||
}, | ||
] |
Oops, something went wrong.