clawhdf5-remote: a failed first fetch is Error::Remote

cached() mapped an error of its open-time prefetch (a network error, a
changed file) to Error::Hdf5(Format(Storage)), misclassifying it for
callers that match on the variant. It is now Error::Remote
(RemoteError::Backend with the backend's message). open_object and the
s3/gs/az URLs fetch the first block of an ObjectStoreStorage directly, so
their errors keep their kind (FileChanged, ObjectStore).

Test: cached() over a backend whose reads fail gives Error::Remote(Backend)
(Error::Hdf5 before).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-26 18:36:35 -05:00
co-authored by Claude Opus 5.5
parent c5b2afbc35
commit ef480746da
3 changed files with 48 additions and 5 deletions
+5
View File
@@ -138,6 +138,11 @@ impl ObjectStoreStorage {
o
}
/// The object's first `n` bytes (fewer if it is shorter).
pub(crate) fn fetch_first(&self, n: u64) -> Result<Vec<u8>, RemoteError> {
Ok(self.fetch_all(&[0..n])?.pop().unwrap_or_default())
}
fn fetch_all(&self, ranges: &[Range<u64>]) -> Result<Vec<Vec<u8>>, RemoteError> {
let len = self.meta.size;
let jobs: Vec<(usize, Range<u64>)> = ranges