diff --git a/Cargo.lock b/Cargo.lock index 6647a4ff108..bf637fb4dc0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10977,6 +10977,7 @@ name = "vortex-edition" version = "0.1.0" dependencies = [ "parking_lot", + "vortex-error", "vortex-session", ] diff --git a/encodings/zstd/src/editions.rs b/encodings/zstd/src/editions.rs index 9abff4da2fe..43f695a42e2 100644 --- a/encodings/zstd/src/editions.rs +++ b/encodings/zstd/src/editions.rs @@ -34,14 +34,14 @@ pub static DECLARATION: EditionDeclaration = EditionDeclaration { #[cfg(test)] mod tests { - use vortex_edition::EditionError; use vortex_edition::EditionSessionExt; use vortex_edition::test_harness::validate_edition; + use vortex_error::VortexResult; use super::*; #[test] - fn zstd_edition_is_valid() -> Result<(), EditionError> { + fn zstd_edition_is_valid() -> VortexResult<()> { let session = vortex_array::array_session(); crate::initialize(&session); validate_edition(&session.editions(), &ZSTD_2026_02) diff --git a/vortex-btrblocks/tests/golden.rs b/vortex-btrblocks/tests/golden.rs index dce743751b1..fc636252c27 100644 --- a/vortex-btrblocks/tests/golden.rs +++ b/vortex-btrblocks/tests/golden.rs @@ -59,7 +59,6 @@ use vortex_edition::EditionSession; use vortex_edition::EditionSessionExt; use vortex_edition::declarations::core::CORE_2026_08_3; use vortex_error::VortexResult; -use vortex_error::vortex_err; use vortex_session::VortexSession; static SESSION: LazyLock = LazyLock::new(vortex_array::array_session); @@ -404,20 +403,13 @@ fn without_onpair(builder: BtrBlocksCompressorBuilder) -> BtrBlocksCompressorBui fn edition_session(editions: &[EditionId]) -> VortexResult { let session = vortex_array::array_session().with::(); for family in EDITION_FAMILIES { - session - .editions() - .declare_family(family) - .map_err(|error| vortex_err!("{error}"))?; + session.editions().declare_family(family)?; } for declaration in EDITION_DECLARATIONS { - session - .register_edition(declaration) - .map_err(|error| vortex_err!("{error}"))?; + session.register_edition(declaration)?; } for edition in editions { - session - .enable_edition(*edition) - .map_err(|error| vortex_err!("{error}"))?; + session.enable_edition(*edition)?; } Ok(session) } @@ -471,9 +463,7 @@ fn golden_onpair() -> VortexResult<()> { fn golden_compact() -> VortexResult<()> { let session = edition_session(&[CORE_2026_08_3])?; vortex_zstd::initialize(&session); - session - .enable_edition(vortex_zstd::editions::ZSTD_2026_02) - .map_err(|error| vortex_err!("{error}"))?; + session.enable_edition(vortex_zstd::editions::ZSTD_2026_02)?; let compressor = compressor_for_session( &session, BtrBlocksCompressorBuilder::default().with_compact(), diff --git a/vortex-edition/Cargo.toml b/vortex-edition/Cargo.toml index 9619d1b44a9..cd2f9d3eb75 100644 --- a/vortex-edition/Cargo.toml +++ b/vortex-edition/Cargo.toml @@ -21,4 +21,5 @@ workspace = true [dependencies] parking_lot = { workspace = true } +vortex-error = { workspace = true } vortex-session = { workspace = true } diff --git a/vortex-edition/src/lib.rs b/vortex-edition/src/lib.rs index 24fa0a40e64..ba2382ec02b 100644 --- a/vortex-edition/src/lib.rs +++ b/vortex-edition/src/lib.rs @@ -37,7 +37,6 @@ pub mod test_harness; #[cfg(test)] mod tests; -use std::error::Error; use std::fmt; use std::fmt::Debug; use std::fmt::Display; @@ -48,6 +47,8 @@ pub use declarations::EDITION_FAMILIES; pub use session::EditionSession; pub use session::EditionSessionExt; pub use session::EnabledEditions; +use vortex_error::VortexResult; +use vortex_error::vortex_bail; use vortex_session::registry::Id; /// The identifier of an edition, e.g. `core2026.07.0`. @@ -92,21 +93,15 @@ impl EditionId { /// and a month in 01-12. Checked for every declared edition by /// [`EditionSession::validate`] and per edition by /// [`test_harness::validate_edition`]. - pub fn validate(&self) -> Result<(), EditionError> { + pub fn validate(&self) -> VortexResult<()> { if self.family.is_empty() || !self.family.chars().all(|c| c.is_ascii_lowercase()) { - return Err(EditionError::new(format!( - "edition {self} must have a non-empty lowercase family, e.g. `core`" - ))); + vortex_bail!("edition {self} must have a non-empty lowercase family, e.g. `core`"); } if !(1000..=9999).contains(&self.year) { - return Err(EditionError::new(format!( - "edition {self} must have a four-digit year" - ))); + vortex_bail!("edition {self} must have a four-digit year"); } if !(1..=12).contains(&self.month) { - return Err(EditionError::new(format!( - "edition {self} must have a month in 01-12" - ))); + vortex_bail!("edition {self} must have a month in 01-12"); } Ok(()) } @@ -143,24 +138,21 @@ pub struct EditionFamily { impl EditionFamily { /// Validate the family's form: a non-empty lowercase name, origin, and doc. Checked for every /// declared family by [`EditionSession::validate`]. - pub fn validate(&self) -> Result<(), EditionError> { + pub fn validate(&self) -> VortexResult<()> { if self.name.is_empty() || !self.name.chars().all(|c| c.is_ascii_lowercase()) { - return Err(EditionError::new(format!( + vortex_bail!( "edition family {:?} must have a non-empty lowercase name, e.g. `core`", self.name - ))); + ); } if self.origin.trim().is_empty() { - return Err(EditionError::new(format!( + vortex_bail!( "edition family {} must name its origin library or project", self.name - ))); + ); } if self.doc.trim().is_empty() { - return Err(EditionError::new(format!( - "edition family {} must document what it is for", - self.name - ))); + vortex_bail!("edition family {} must document what it is for", self.name); } Ok(()) } @@ -367,7 +359,7 @@ impl EditionInclusion { /// Validate the declaration's form: a lowercase `namespace.name` component id and, if /// recorded, a well-formed `major.minor.patch` release. Checked for every declared /// inclusion by [`EditionSession::validate`]. - pub fn validate(&self) -> Result<(), EditionError> { + pub fn validate(&self) -> VortexResult<()> { let id = self.component_id.as_str(); let well_formed = !id.starts_with('.') && !id.ends_with('.') @@ -376,18 +368,18 @@ impl EditionInclusion { .chars() .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || "._-".contains(c)); if !well_formed { - return Err(EditionError::new(format!( + vortex_bail!( "invalid {} id {id:?}: expected lowercase `namespace.name`, e.g. `vortex.alp`", self.kind - ))); + ); } if let Some(release) = self.required_vortex_release && parse_release(release).is_none() { - return Err(EditionError::new(format!( + vortex_bail!( "{} {id} declares malformed required_vortex_release {release:?}", self.kind - ))); + ); } Ok(()) } @@ -401,22 +393,3 @@ pub(crate) fn parse_release(release: &str) -> Option> { .collect::>()?; (parts.len() == 3).then_some(parts) } - -/// Error raised when edition declarations are inconsistent. -#[derive(Debug)] -pub struct EditionError(String); - -impl EditionError { - /// Create an error with the given message. - pub fn new(msg: impl Into) -> Self { - Self(msg.into()) - } -} - -impl Display for EditionError { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str(&self.0) - } -} - -impl Error for EditionError {} diff --git a/vortex-edition/src/session.rs b/vortex-edition/src/session.rs index a80327726df..4b192e3d7d9 100644 --- a/vortex-edition/src/session.rs +++ b/vortex-edition/src/session.rs @@ -8,6 +8,8 @@ use std::collections::BTreeMap; use std::sync::Arc; use parking_lot::RwLock; +use vortex_error::VortexResult; +use vortex_error::vortex_bail; use vortex_session::ArcSwapMap; use vortex_session::SessionExt; use vortex_session::SessionGuard; @@ -17,7 +19,6 @@ use vortex_session::registry::Id; use crate::ComponentKind; use crate::Edition; use crate::EditionDeclaration; -use crate::EditionError; use crate::EditionFamily; use crate::EditionId; use crate::EditionInclusion; @@ -87,7 +88,7 @@ impl EditionSession { /// Declare an edition together with the members added at it. Each entry's membership /// (`since`) is the declared edition; earlier entries are inherited and must not be restated. - pub fn declare(&self, declaration: &EditionDeclaration) -> Result<(), EditionError> { + pub fn declare(&self, declaration: &EditionDeclaration) -> VortexResult<()> { self.declare_edition(declaration.edition)?; for member in declaration.added { self.declare_inclusion(EditionInclusion::new( @@ -102,13 +103,10 @@ impl EditionSession { /// Declare an edition family. Errors if a family with the same name is already /// declared. Every family must be declared before [`EditionSession::validate`] will /// accept editions belonging to it. - pub fn declare_family(&self, family: &EditionFamily) -> Result<(), EditionError> { + pub fn declare_family(&self, family: &EditionFamily) -> VortexResult<()> { let mut inner = self.inner.write(); if inner.families.contains_key(family.name) { - return Err(EditionError::new(format!( - "duplicate edition family {}", - family.name - ))); + vortex_bail!("duplicate edition family {}", family.name); } inner.families.insert(family.name.to_string(), *family); Ok(()) @@ -125,11 +123,11 @@ impl EditionSession { } /// Declare an edition. Errors if an edition with the same id is already declared. - pub fn declare_edition(&self, edition: Edition) -> Result<(), EditionError> { + pub fn declare_edition(&self, edition: Edition) -> VortexResult<()> { let mut inner = self.inner.write(); let key = edition.id.to_string(); if inner.editions.contains_key(&key) { - return Err(EditionError::new(format!("duplicate edition {key}"))); + vortex_bail!("duplicate edition {key}"); } inner.editions.insert(key, edition); Ok(()) @@ -138,7 +136,7 @@ impl EditionSession { /// Declare an edition inclusion. A component may belong to multiple families but joins each /// family only once. A newer wire representation uses a new component ID. Kind is part of the /// key, so an array encoding and a layout may share an id. - pub fn declare_inclusion(&self, inclusion: EditionInclusion) -> Result<(), EditionError> { + pub fn declare_inclusion(&self, inclusion: EditionInclusion) -> VortexResult<()> { let mut inner = self.inner.write(); let by_id = inner.inclusions.entry(inclusion.kind).or_default(); let history = by_id.entry(inclusion.component_id).or_default(); @@ -154,10 +152,13 @@ impl EditionSession { }); if let Some(previous) = previous { - return Err(EditionError::new(format!( + vortex_bail!( "{} {} already joined family {} in edition {}", - inclusion.kind, inclusion.component_id, inclusion.since.family, previous.since, - ))); + inclusion.kind, + inclusion.component_id, + inclusion.since.family, + previous.since, + ); } history.push(inclusion); history.sort_by_key(|entry| { @@ -222,7 +223,7 @@ impl EditionSession { /// inclusions referencing undeclared editions, editions out of chronological order within /// a family (unversioned drafts must be newest), malformed version strings, and members /// requiring a release newer than their edition declares. - pub fn validate(&self) -> Result<(), EditionError> { + pub fn validate(&self) -> VortexResult<()> { let editions = self.editions(); for family in self.families() { @@ -232,19 +233,20 @@ impl EditionSession { for edition in &editions { edition.id.validate()?; if self.find_family(edition.id.family).is_none() { - return Err(EditionError::new(format!( + vortex_bail!( "edition {} belongs to undeclared family {}; declare the family before \ its editions", - edition.id, edition.id.family, - ))); + edition.id, + edition.id.family, + ); } if let Some(version) = edition.min_library_version && parse_release(version).is_none() { - return Err(EditionError::new(format!( + vortex_bail!( "edition {} declares malformed min_library_version {version:?}", edition.id - ))); + ); } } @@ -253,10 +255,11 @@ impl EditionSession { for pair in editions.windows(2) { let (prev, next) = (&pair[0], &pair[1]); if prev.id.family == next.id.family && prev.is_draft() && !next.is_draft() { - return Err(EditionError::new(format!( + vortex_bail!( "frozen edition {} follows draft {}; drafts must be newest in a family", - next.id, prev.id, - ))); + next.id, + prev.id, + ); } } @@ -270,24 +273,26 @@ impl EditionSession { inclusion.validate()?; let Some(edition) = inner.editions.get(&inclusion.since.to_string()) else { - return Err(EditionError::new(format!( + vortex_bail!( "{} {} is included in undeclared edition {}", - inclusion.kind, inclusion.component_id, inclusion.since - ))); + inclusion.kind, + inclusion.component_id, + inclusion.since + ); }; if let Some(required) = inclusion.required_vortex_release.and_then(parse_release) && let Some(declared) = edition.min_library_version.and_then(parse_release) && required > declared { - return Err(EditionError::new(format!( + vortex_bail!( "{} {} requires release {}, newer than edition {}'s declared \ min_library_version", inclusion.kind, inclusion.component_id, inclusion.required_vortex_release.unwrap_or_default(), edition.id, - ))); + ); } } @@ -331,7 +336,7 @@ pub trait EditionSessionExt: SessionExt { } /// Register an edition declaration with this session. - fn register_edition(&self, declaration: &EditionDeclaration) -> Result<(), EditionError> { + fn register_edition(&self, declaration: &EditionDeclaration) -> VortexResult<()> { self.editions().declare(declaration) } @@ -340,11 +345,9 @@ pub trait EditionSessionExt: SessionExt { /// Enabling an edition replaces the enabled edition from the same family. An edition /// must be registered first so a typo or unavailable third-party declaration cannot /// silently produce an empty writable set. - fn enable_edition(&self, edition: EditionId) -> Result<(), EditionError> { + fn enable_edition(&self, edition: EditionId) -> VortexResult<()> { if self.editions().find(&edition).is_none() { - return Err(EditionError::new(format!( - "cannot enable unregistered edition {edition}" - ))); + vortex_bail!("cannot enable unregistered edition {edition}"); } self.enabled_editions().enable(edition); Ok(()) diff --git a/vortex-edition/src/test_harness.rs b/vortex-edition/src/test_harness.rs index d98315bc240..0594ccf9756 100644 --- a/vortex-edition/src/test_harness.rs +++ b/vortex-edition/src/test_harness.rs @@ -6,7 +6,9 @@ //! Each edition definition should call [`validate_edition`] once from its `#[cfg(test)]` //! module, so every declared edition has a test proving its constraints hold. -use crate::EditionError; +use vortex_error::VortexResult; +use vortex_error::vortex_bail; + use crate::EditionId; use crate::EditionSession; @@ -18,20 +20,15 @@ use crate::EditionSession; /// #[cfg(test)] /// mod tests { /// #[test] -/// fn edition_is_valid() -> Result<(), vortex_edition::EditionError> { +/// fn edition_is_valid() -> vortex_error::VortexResult<()> { /// vortex_edition::test_harness::validate_edition(&edition_session(), &CORE_2026_01_0) /// } /// } /// ``` -pub fn validate_edition( - editions: &EditionSession, - edition: &EditionId, -) -> Result<(), EditionError> { +pub fn validate_edition(editions: &EditionSession, edition: &EditionId) -> VortexResult<()> { edition.validate()?; if editions.find(edition).is_none() { - return Err(EditionError::new(format!( - "{edition} is not declared in the session" - ))); + vortex_bail!("{edition} is not declared in the session"); } editions.validate() } diff --git a/vortex-edition/src/tests.rs b/vortex-edition/src/tests.rs index 4e0d3846682..63cf003d11f 100644 --- a/vortex-edition/src/tests.rs +++ b/vortex-edition/src/tests.rs @@ -1,6 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright the Vortex contributors +use vortex_error::VortexResult; +use vortex_error::vortex_err; use vortex_session::VortexSession; use crate::ComponentKind; @@ -66,7 +68,7 @@ fn session() -> EditionSession { } #[test] -fn editions_pass_the_test_harness() -> Result<(), crate::EditionError> { +fn editions_pass_the_test_harness() -> VortexResult<()> { crate::test_harness::validate_edition(&session(), &FIRST)?; crate::test_harness::validate_edition(&session(), &SECOND)?; @@ -77,7 +79,7 @@ fn editions_pass_the_test_harness() -> Result<(), crate::EditionError> { } #[test] -fn membership_is_transitive() -> Result<(), crate::EditionError> { +fn membership_is_transitive() -> VortexResult<()> { let editions = session(); let first = editions.components_in(&FIRST, ComponentKind::Array); @@ -95,17 +97,17 @@ fn membership_is_transitive() -> Result<(), crate::EditionError> { let alpha = second .iter() .find(|i| i.component_id.as_str() == "test.alpha") - .ok_or_else(|| crate::EditionError::new("test.alpha is a member"))?; + .ok_or_else(|| vortex_err!("test.alpha is a member"))?; assert_eq!(alpha.since, FIRST); let alpha_v2 = second .iter() .find(|i| i.component_id.as_str() == "test.alpha_v2") - .ok_or_else(|| crate::EditionError::new("test.alpha_v2 is a member"))?; + .ok_or_else(|| vortex_err!("test.alpha_v2 is a member"))?; assert_eq!(alpha_v2.since, SECOND); let beta = second .iter() .find(|i| i.component_id.as_str() == "test.beta") - .ok_or_else(|| crate::EditionError::new("test.beta is a member"))?; + .ok_or_else(|| vortex_err!("test.beta is a member"))?; assert_eq!(beta.since, FIRST); // The second edition's delta is exactly the members declared at it. @@ -173,7 +175,7 @@ fn session_exposes_edition_registry() { } #[test] -fn registered_and_enabled_editions_are_separate() -> Result<(), crate::EditionError> { +fn registered_and_enabled_editions_are_separate() -> VortexResult<()> { let session = VortexSession::empty().with::(); for declaration in DECLARATIONS { session.register_edition(declaration)?; @@ -216,7 +218,7 @@ fn enabling_requires_registration() { } #[test] -fn enabled_editions_are_independent_across_families() -> Result<(), crate::EditionError> { +fn enabled_editions_are_independent_across_families() -> VortexResult<()> { const OTHER: EditionId = EditionId::new("other", 2026, 4, 0); static OTHER_DECLARATION: EditionDeclaration = EditionDeclaration { edition: Edition { @@ -243,7 +245,7 @@ fn enabled_editions_are_independent_across_families() -> Result<(), crate::Editi } #[test] -fn serialized_array_ids_can_be_added_by_an_opt_in_family() -> Result<(), crate::EditionError> { +fn serialized_array_ids_can_be_added_by_an_opt_in_family() -> VortexResult<()> { const OPT_IN: EditionId = EditionId::new("other", 2026, 8, 0); static OPT_IN_DECLARATION: EditionDeclaration = EditionDeclaration { edition: Edition { @@ -292,7 +294,7 @@ fn duplicate_declarations_error() { } #[test] -fn validate_rejects_inconsistent_declarations() -> Result<(), crate::EditionError> { +fn validate_rejects_inconsistent_declarations() -> VortexResult<()> { // An inclusion referencing an undeclared edition. let editions = EditionSession::empty(); editions.declare_inclusion(EditionInclusion::array("test.alpha", FIRST))?; @@ -358,7 +360,7 @@ fn edition_id_display() { } #[test] -fn families_must_be_declared_before_their_editions() -> Result<(), crate::EditionError> { +fn families_must_be_declared_before_their_editions() -> VortexResult<()> { // An edition whose family was never declared: the name would otherwise be whatever the // declaration happened to spell, and a typo would mint a family of one. let editions = EditionSession::empty(); @@ -401,7 +403,7 @@ fn families_must_name_their_origin() { } #[test] -fn kinds_are_resolved_independently() -> Result<(), crate::EditionError> { +fn kinds_are_resolved_independently() -> VortexResult<()> { // `test.alpha` is declared under both kinds: same id, two distinct members. static MIXED: EditionDeclaration = EditionDeclaration { edition: Edition { diff --git a/vortex-file/src/writer.rs b/vortex-file/src/writer.rs index ec45653f5c1..8167d31ede2 100644 --- a/vortex-file/src/writer.rs +++ b/vortex-file/src/writer.rs @@ -773,7 +773,7 @@ mod tests { use super::*; #[test] - fn array_context_only_permits_enabled_encodings() -> Result<(), vortex_edition::EditionError> { + fn array_context_only_permits_enabled_encodings() -> VortexResult<()> { const EDITION: EditionId = EditionId::new("test", 2026, 7, 0); static DECLARATION: EditionDeclaration = EditionDeclaration { edition: Edition { @@ -815,7 +815,7 @@ mod tests { /// This test edition declares only arrays, so every other kind must forbid all components. #[test] - fn kind_filters_are_active_when_empty() -> Result<(), vortex_edition::EditionError> { + fn kind_filters_are_active_when_empty() -> VortexResult<()> { const EDITION: EditionId = EditionId::new("test", 2026, 8, 0); static ARRAYS_ONLY: EditionDeclaration = EditionDeclaration { edition: Edition { @@ -870,12 +870,8 @@ mod tests { }; let session = array_session().with::(); - session - .register_edition(&DECLARATION) - .map_err(|error| vortex_err!("{error}"))?; - session - .enable_edition(EDITION) - .map_err(|error| vortex_err!("{error}"))?; + session.register_edition(&DECLARATION)?; + session.enable_edition(EDITION)?; let date = DType::Extension(Date::new(TimeUnit::Days, Nullability::NonNullable).erased()); let nested = DType::struct_([("date", date)], Nullability::NonNullable); diff --git a/vortex-json/src/editions.rs b/vortex-json/src/editions.rs index a6630352eb7..239d55042d6 100644 --- a/vortex-json/src/editions.rs +++ b/vortex-json/src/editions.rs @@ -40,9 +40,9 @@ pub static DECLARATION: EditionDeclaration = EditionDeclaration { #[cfg(test)] mod tests { use vortex_edition::ComponentKind; - use vortex_edition::EditionError; use vortex_edition::EditionSessionExt; use vortex_edition::test_harness::validate_edition; + use vortex_error::VortexResult; use super::*; @@ -53,7 +53,7 @@ mod tests { } #[test] - fn json_edition_is_valid() -> Result<(), EditionError> { + fn json_edition_is_valid() -> VortexResult<()> { let session = json_session(); validate_edition(&session.editions(), &JSON_2026_08) } diff --git a/vortex-spatial/src/editions.rs b/vortex-spatial/src/editions.rs index f236cd3a503..298848a4be7 100644 --- a/vortex-spatial/src/editions.rs +++ b/vortex-spatial/src/editions.rs @@ -50,14 +50,14 @@ pub static DECLARATION: EditionDeclaration = EditionDeclaration { #[cfg(test)] mod tests { use vortex_edition::ComponentKind; - use vortex_edition::EditionError; use vortex_edition::EditionSessionExt; use vortex_edition::test_harness::validate_edition; + use vortex_error::VortexResult; use super::*; #[test] - fn spatial_edition_is_valid() -> Result<(), EditionError> { + fn spatial_edition_is_valid() -> VortexResult<()> { let session = crate::test_harness::spatial_session(); validate_edition(&session.editions(), &SPATIAL_2026_08) } diff --git a/vortex-tensor/src/editions.rs b/vortex-tensor/src/editions.rs index 99a510784ae..bd34ca7102a 100644 --- a/vortex-tensor/src/editions.rs +++ b/vortex-tensor/src/editions.rs @@ -42,14 +42,14 @@ pub static DECLARATION: EditionDeclaration = EditionDeclaration { #[cfg(test)] mod tests { - use vortex_edition::EditionError; use vortex_edition::EditionSessionExt; use vortex_edition::test_harness::validate_edition; + use vortex_error::VortexResult; use super::*; #[test] - fn tensor_edition_is_valid() -> Result<(), EditionError> { + fn tensor_edition_is_valid() -> VortexResult<()> { let session = vortex_array::array_session(); crate::initialize(&session); validate_edition(&session.editions(), &TENSOR_2026_04) diff --git a/vortex-test/compat-gen/src/fixtures/arrays/datasets/mod.rs b/vortex-test/compat-gen/src/fixtures/arrays/datasets/mod.rs index f3d506539fd..55aac492306 100644 --- a/vortex-test/compat-gen/src/fixtures/arrays/datasets/mod.rs +++ b/vortex-test/compat-gen/src/fixtures/arrays/datasets/mod.rs @@ -24,7 +24,6 @@ mod tests { use vortex::session::VortexSession; use vortex_arrow::ArrowSessionExt; use vortex_error::VortexResult; - use vortex_error::vortex_err; use super::fixtures; use crate::adapter; @@ -36,9 +35,7 @@ mod tests { #[test] fn roundtrip_non_clickbench_fixtures_to_bytes() -> VortexResult<()> { let session = VortexSession::default(); - session - .enable_edition(CORE_2026_08_3) - .map_err(|error| vortex_err!("{error}"))?; + session.enable_edition(CORE_2026_08_3)?; for dataset in fixtures() .into_iter() .filter(|fixture| !is_clickbench_fixture(fixture.name())) diff --git a/vortex/src/editions/tests.rs b/vortex/src/editions/tests.rs index e501466c795..98a4f4a7d30 100644 --- a/vortex/src/editions/tests.rs +++ b/vortex/src/editions/tests.rs @@ -19,7 +19,6 @@ use vortex_buffer::ByteBufferMut; use vortex_edition::ComponentKind; use vortex_edition::Edition; use vortex_edition::EditionDeclaration; -use vortex_edition::EditionError; use vortex_edition::EditionId; use vortex_edition::EditionInclusion; use vortex_edition::EditionMember; @@ -47,7 +46,7 @@ use super::DEFAULT_PREVIEW_EDITION; use super::EDITION_DECLARATIONS; use super::PREVIEW_2026_08_0; -fn session() -> Result { +fn session() -> VortexResult { let session = EditionSession::empty(); for family in super::EDITION_FAMILIES { session.declare_family(family)?; @@ -59,7 +58,7 @@ fn session() -> Result { } #[test] -fn every_declared_edition_validates() -> Result<(), EditionError> { +fn every_declared_edition_validates() -> VortexResult<()> { let session = session()?; for declaration in EDITION_DECLARATIONS { validate_edition(&session, &declaration.edition.id)?; @@ -379,12 +378,8 @@ fn writer_test_session() -> VortexResult { .with::() .with::(); vortex_file::register_default_encodings(&session); - session - .register_edition(&WRITER_TEST_DECLARATION) - .map_err(|error| vortex_err!("{error}"))?; - session - .enable_edition(WRITER_TEST_EDITION) - .map_err(|error| vortex_err!("{error}"))?; + session.register_edition(&WRITER_TEST_DECLARATION)?; + session.enable_edition(WRITER_TEST_EDITION)?; Ok(session) } @@ -474,12 +469,10 @@ fn session_declaring(members: &[(ComponentKind, Id)]) -> VortexResult(); vortex_file::register_default_encodings(&session); let editions = session.editions(); - editions - .declare_edition(Edition { - id: EDITION, - min_library_version: None, - }) - .map_err(|error| vortex_err!("{error}"))?; + editions.declare_edition(Edition { + id: EDITION, + min_library_version: None, + })?; for inclusion in session .arrays() .registry() @@ -497,13 +490,9 @@ fn session_declaring(members: &[(ComponentKind, Id)]) -> VortexResult