MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / validate_catalog

Function validate_catalog

xtask/src/extension_catalog.rs:785–904  ·  view source on GitHub ↗
(catalog: &ExtensionCatalog)

Source from the content-addressed store, hash-verified

783}
784
785fn validate_catalog(catalog: &ExtensionCatalog) -> Result<()> {
786 ensure!(
787 catalog.format_version == 1,
788 "extension catalog format must be 1"
789 );
790 let mut ids = BTreeSet::new();
791 let mut sql_names = BTreeSet::new();
792 for extension in &catalog.extensions {
793 ensure!(
794 ids.insert(extension.id.as_str()),
795 "duplicate extension id {}",
796 extension.id
797 );
798 ensure!(
799 extension.id != "live",
800 "live must not be included in SQL extension catalog"
801 );
802 ensure!(
803 extension.promotion.configured,
804 "{} is missing from {}; every discovered SQL extension must be explicitly build-requested or blocked",
805 extension.id,
806 PROMOTION_CONFIG_PATH
807 );
808 ensure!(
809 extension.promotion.requested || extension.promotion.blocker.is_some(),
810 "{} is not build-requested and has no blocker in {}",
811 extension.id,
812 PROMOTION_CONFIG_PATH
813 );
814 ensure!(
815 sql_names.insert(extension.sql_name.as_str()),
816 "duplicate SQL extension name {}",
817 extension.sql_name
818 );
819 ensure!(
820 !extension.promotion.promoted || extension.promotion.stable,
821 "{} cannot be promoted without stable=true",
822 extension.id
823 );
824 if extension.promotion.requested {
825 ensure!(
826 extension.promotion.archive.is_some(),
827 "requested extension {} must resolve to an archive path",
828 extension.id
829 );
830 ensure!(
831 extension.source_kind != "pglite-plugin",
832 "requested extension {} is not a SQL extension",
833 extension.id
834 );
835 ensure!(
836 extension.lifecycle.create_extension || !extension.lifecycle.load_sql.is_empty(),
837 "requested extension {} must declare a lifecycle operation",
838 extension.id
839 );
840 }
841 if extension.promotion.promoted {
842 ensure!(

Callers 5

extensionsFunction · 0.85
check_catalog_fileFunction · 0.85
check_build_plan_fileFunction · 0.85
promoted_build_specsFunction · 0.85

Calls 1

Tested by

no test coverage detected