Skip to content

Commit c85b1c3

Browse files
committed
Fix CI: intersect initial array ids with the registry, docs links, doctest sizes
- Implement the intended semantics of the writer's pre-populated array context: `initial_array_ids` is the intersection of the session's enabled-edition encodings with the registered encodings, since an enabled edition may include encodings the session cannot serialize (e.g. an optional crate that is not compiled in). This completes the `initial_array_ids_are_registered_and_enabled` test and removes the unused `registry` binding and `Itertools` import that failed the lint jobs. - Qualify the intra-doc links in the editions module docs: links in the module's inner docs resolve at the facade's `pub mod` site, so unqualified links break rustdoc under -D warnings. - Restore the updated file-size golden values in the Python write-options doctests: the footer's encoding list changed with the edition-derived array context, shrinking the written files by 40 bytes. Signed-off-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CK2nCuXnyd2g3mNHQC8Lz2
1 parent 0726cb5 commit c85b1c3

3 files changed

Lines changed: 29 additions & 12 deletions

File tree

vortex-file/src/writer.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use futures::future::LocalBoxFuture;
1515
use futures::future::ready;
1616
use futures::pin_mut;
1717
use futures::select;
18-
use itertools::Itertools;
1918
use vortex_array::ArrayContext;
19+
use vortex_array::ArrayId;
2020
use vortex_array::ArrayRef;
2121
use vortex_array::dtype::DType;
2222
use vortex_array::dtype::FieldPath;
@@ -157,8 +157,9 @@ impl VortexWriteOptions {
157157
) -> VortexResult<WriteSummary> {
158158
// Pre-populate the array context with the registered encodings selected by the enabled
159159
// editions. This keeps the serialized ordering deterministic without advertising every
160-
// encoding the session happens to know how to read.
161-
let ctx = ArrayContext::new(self.session.enabled_encoding_ids())
160+
// encoding the session happens to read or every enabled encoding the session cannot
161+
// serialize.
162+
let ctx = ArrayContext::new(initial_array_ids(&self.session))
162163
// The registry supplies serialization implementations; the layout strategy applies
163164
// the enabled-edition write policy before arrays reach serialization.
164165
.with_registry(self.session.arrays().registry().clone());
@@ -529,19 +530,35 @@ impl WriteSummary {
529530
}
530531
}
531532

533+
/// The encoding ids used to pre-populate the writer's array context: every encoding of the
534+
/// session's enabled editions that is also registered with the session, in sorted order.
535+
///
536+
/// An enabled edition may include encodings the session has no registration for (e.g. an
537+
/// optional encoding crate that is not compiled in); those cannot be serialized, so they are
538+
/// not advertised in the context.
539+
fn initial_array_ids(session: &VortexSession) -> Vec<ArrayId> {
540+
let registry = session.arrays().registry().clone();
541+
session
542+
.enabled_encoding_ids()
543+
.into_iter()
544+
.filter(|id| registry.find(id).is_some())
545+
.collect()
546+
}
547+
532548
#[cfg(test)]
533549
mod tests {
534550
use vortex_array::VTable;
535551
use vortex_array::array_session;
536552
use vortex_array::arrays::Bool;
537553
use vortex_array::arrays::Primitive;
538-
use vortex_array::session::ArraySessionExt;
539554
use vortex_edition::Edition;
540555
use vortex_edition::EditionDeclaration;
541556
use vortex_edition::EditionId;
542557
use vortex_edition::EditionSession;
543558
use vortex_edition::EditionSessionExt;
544559

560+
use super::initial_array_ids;
561+
545562
#[test]
546563
fn initial_array_ids_are_registered_and_enabled() -> Result<(), vortex_edition::EditionError> {
547564
const EDITION: EditionId = EditionId::new("test", 2026, 7, 0);
@@ -557,8 +574,7 @@ mod tests {
557574
session.register_edition(&DECLARATION)?;
558575
session.enable_edition(EDITION)?;
559576

560-
let registry = session.arrays().registry().clone();
561-
let ids = session.enabled_encoding_ids();
577+
let ids = initial_array_ids(&session);
562578
assert_eq!(ids, [Primitive.id()]);
563579
assert!(!ids.contains(&Bool.id()));
564580
Ok(())

vortex-python/src/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl PyVortexWriteOptions {
258258
/// >>> vx.io.VortexWriteOptions.default().write(sprl, "chonky.vortex")
259259
/// >>> import os
260260
/// >>> os.path.getsize('chonky.vortex')
261-
/// 215940
261+
/// 215900
262262
///
263263
/// Wow, Vortex manages to use about two bytes per integer! So advanced. So tiny.
264264
///
@@ -268,7 +268,7 @@ impl PyVortexWriteOptions {
268268
///
269269
/// >>> vx.io.VortexWriteOptions.compact().write(sprl, "tiny.vortex")
270270
/// >>> os.path.getsize('tiny.vortex')
271-
/// 55068
271+
/// 55028
272272
///
273273
/// Random numbers are not (usually) composed of random bytes!
274274
#[staticmethod]

vortex/src/editions/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
//!
66
//! [`vortex_edition`] provides the types, session variables, and test harness. The actual
77
//! first-party declarations live here, one module per edition. The default session first
8-
//! registers them with [`register_default_editions`] and then selects its write policy with
9-
//! [`enable_default_editions`].
8+
//! registers them with [`crate::editions::register_default_editions`] and then selects its
9+
//! write policy with [`crate::editions::enable_default_editions`].
1010
//!
1111
//! The default file writer resolves the session's enabled editions at write time. The
12-
//! facade enables the newest frozen `core` edition, [`CORE_2026_07_0`], and additionally
13-
//! enables the latest unstable edition when the `unstable_encodings` feature is selected.
12+
//! facade enables the newest frozen `core` edition, [`crate::editions::CORE_2026_07_0`],
13+
//! and additionally enables the latest unstable edition when the `unstable_encodings`
14+
//! feature is selected.
1415
1516
pub mod core;
1617
#[cfg(test)]

0 commit comments

Comments
 (0)