Repository navigation
feat(range-reader): add streamed, coalesced byte-range reads - #806
Conversation
| with its tile offset table in hand, wants many small byte ranges at once. | ||
| This package merges the reads issued in one task into few range requests, | ||
| reads each response body as a stream and resolves every read the moment its | ||
| last byte arrives, and cancels a request as soon as nobody wants what is |
There was a problem hiding this comment.
| last byte arrives, and cancels a request as soon as nobody wants what is | |
| last byte arrives. It also cancels a request as soon as nobody wants what is |
this was a run-on sentence
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Applied as suggested in 67aa356.
🤖 Written by Claude Code
| // the gap and over-fetch limits allow. Each resolves as its bytes arrive. | ||
| const [a, b] = await Promise.all([ | ||
| reader.read(file, { offset: 1_048_576, length: 65_536 }, { | ||
| purpose: "data", |
There was a problem hiding this comment.
What are the various types of "purposes" here? I'm not sure that the reader should be aware of these purposes...
Like the reader I feel like it should only know offset and length, and should be totally generic as to what the requests are for. It's only in the context of COG specifically that some requests are header and some are data. That's not a general distinction; not sure it's worth hard-coding this into our reading abstraction.
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Kept, renamed and made optional, per the chat (355b531). The purpose drives two things the reader has to do: which cache budget a span counts against, and whether a small read is widened to a block. The same class of bytes exists in every cloud-native format we would put behind the reader, a COG's IFDs and offset tables, a sharded Zarr shard's index, a PMTiles directory, so the reader fixes a two-value vocabulary, metadata and data, without knowing any format. purpose defaults to data, so a caller with no structural reads never sees the distinction.
🤖 Written by Claude Code
| get(file: FileIdentity, range: ByteRange, purpose: Purpose): Promise<Uint8Array | undefined>; | ||
| put(file: FileIdentity, offset: number, bytes: Uint8Array, purpose: Purpose): Promise<void>; |
There was a problem hiding this comment.
👍 on having these be async to support OPFS
| * Build the {@link FileIdentity} for a URL read with `init`. Compute it once | ||
| * per file and pass it to every {@link RangeReader.read} for that file. | ||
| */ |
There was a problem hiding this comment.
We should explain here why the file identity exists. I think it's so that we don't merge ranges for the same URL with different request/auth parameters?
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Docstring added in d48caa6. The reason is that one merged request carries exactly one set of headers, credentials and mode, so reads of one URL made with different inits cannot share a request or an in-flight stream. They do not share cached bytes either, since the reader cannot know that two inits return the same bytes; that costs a refetch after a token refresh on the same URL and nothing more. The "different users in one page" story from the type's docstring is gone: not realistic, as you said.
🤖 Written by Claude Code
| export const DEFAULT_DATA_CACHE_BYTES = 64 * 1024 * 1024; | ||
|
|
||
| /** One stored span: contiguous bytes of one file, starting at `offset`. */ | ||
| interface Span { |
There was a problem hiding this comment.
Just curious why is this an interface and not type?
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
No functional difference here. The repo has 63 interfaces against 40 object type aliases and no Biome consistency rule, so the package uses interface for named object shapes and type for unions and aliases. Left as is; I will flip it if you prefer type.
🤖 Written by Claude Code
| /** One stored span: contiguous bytes of one file, starting at `offset`. */ | ||
| interface Span { | ||
| readonly id: number; | ||
| readonly fileKey: string; |
There was a problem hiding this comment.
Would it make sense to have a stricter type for fileKey than string? Especially if it could be a cleanly-templated string? I'm not sure exactly what fileKey is...
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Branded in d48caa6: FileKey is string & { readonly [brand]: true }, produced only by fileIdentity() and used for FileIdentity.key, the cache's map and Span.fileKey, so a plain string cannot be passed as a key by mistake. The field is the span's file's FileIdentity.key, which its docstring now says. A template literal type would not have constrained anything real.
🤖 Written by Claude Code
| * What to read from a file: an absolute {@link ByteRange}, the last | ||
| * `suffixLength` bytes, or `undefined` for the whole object. | ||
| */ | ||
| export type ReadRange = ByteRange | { suffixLength: number } | undefined; |
There was a problem hiding this comment.
I'm not sure if this makes any difference but I feel like ReadRange should be a known range (aka excluding undefined) and places where a full-range are accepted would then take in ReadRange | undefined 🤷♂️
Maybe it's a distinction without a difference
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Done in d48caa6: ReadRange is ByteRange | { suffixLength }, and only RangeReader.read and the stream's request take ReadRange | undefined for the whole object. The geotiff adapter follows in #807.
🤖 Written by Claude Code
| /** | ||
| * What a read is for. Header reads (file structure: IFDs, offset tables, | ||
| * metadata) and data reads (tile or chunk bytes) are merged and cached | ||
| * separately, so data churn never evicts the small reads every later read | ||
| * depends on. | ||
| */ | ||
| export type Purpose = "header" | "data"; |
There was a problem hiding this comment.
I'm on the fence here. Let's discuss more. Perhaps this is generic enough for a range-reader that specifically lives in deck.gl-raster.
There was a problem hiding this comment.
Note
This reply was written by Claude (Claude Code), not by @kylebarron.
Per the chat: kept as two fixed classes and renamed to metadata and data (355b531). Caller-defined labels were too broad, and region pinning is set aside: the code issuing a read always knows what it reads at that moment, and a region-to-purpose map could be layered on later without changing the reader.
🤖 Written by Claude Code
b617a8f to
79c3ee6
Compare
Adds the empty `@developmentseed/range-reader` workspace package and the design it will implement (streamed, coalesced byte-range reads with a budgeted byte cache, first for COGs and later for sharded Zarr). Co-Authored-By: Claude Fable 5.1 <[email protected]>
`Semaphore`, `PerOriginSemaphore`, `ConcurrencyLimiter` and `Priority` are format-agnostic and the range reader needs them, so they now live in `@developmentseed/range-reader`. geotiff re-exports the same names, keeps its chunkd `LimiterMiddleware`, and depends on the new package. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Defines the package's vocabulary (purpose, byte range, read range and result, file identity, byte cache, stats, options) and `fileIdentity`, which keys a file by its URL plus a canonical signature of the request init so reads with different credentials never share bytes. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`mergeReads` is the usgs-topo rule (offset order, longest first; contained and overlapping reads always join) with two caps: `maxOverfetchBytes` bounds the gap bytes one request carries and `maxRequestBytes` bounds its size. `widenRead` turns a small header read into its aligned block. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`MemoryByteCache` stores contiguous spans per file, serves reads by containment as views, and keeps one LRU budget per purpose so data churn never evicts header spans. Spans larger than their budget are not stored; a span contained in a stored one is dropped and spans the new one contains are replaced. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…land `RangeStream` sends one range request for a merged range, reads the body as a stream into a preallocated buffer, and resolves each member read the moment its last byte has arrived, with a view into that buffer. A read can attach while the stream is in flight. Suffix and whole-object requests serve one member at the end. Test helpers drive fake responses chunk by chunk. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A member whose signal aborts rejects at once and leaves the live set; the stream runs on for the others and is cancelled, keeping what arrived, only when the last live member leaves. A merged request takes one limiter slot before fetching, with the best priority among its live members, and releases it when the stream ends; members leaving while the slot is awaited give the wait up. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…tion A 404 resolves every read not-found; other non-2xx statuses reject them with the status. A 200 to a range request is consumed as the whole object when its Content-Length is small enough, else rejected. A body that ends before the range does is told apart by Content-Length: a clean end means the object ended there, the size is recorded and the remaining reads get what exists; a truncated transfer rejects them. A body that runs past the range is cut at the range's end. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`RangeReader.read` queues absolute reads until the end of the task, groups them by file identity and purpose, widens small header reads to aligned blocks, merges them with the caps, and runs one `RangeStream` per merged range. Suffix and whole-object reads go out at once on their own. A read aborted while queued is dropped before the flush. Received spans go to the byte cache and the stats count requests, bytes and over-fetch. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…eams Before queueing, an absolute read resolves empty past a known object size, is served from the byte cache when a span contains it, or attaches to a request already in flight for the same file and purpose. A signal that aborts during the cache lookup rejects the read without queueing it. Sizes learned from responses are recorded per file. Co-Authored-By: Claude Fable 5.1 <[email protected]>
README with usage, the option defaults and the `ByteCache` contract, plus the docs-site registration (package entry and API sidebar; the API pages are generated at build time like every other package's). Co-Authored-By: Claude Fable 5.1 <[email protected]>
…sooner Findings of the whole-branch review, each with a test that failed first: - A real fetch errors the body stream when the request is aborted or the connection drops, which rejected `run()`, left its reads pending forever and leaked an unhandled rejection. The body read is now caught: our own cancellation falls through to the cancelled outcome, anything else rejects the unresolved reads and keeps the prefix. The fake fetch now errors the body on abort too, so every cancellation test runs that path. - A cancelled or short stream handed the cache a view onto its whole preallocated buffer, so a 30-byte prefix of a 16 MiB request pinned 16 MiB outside the budget. Partial buffers are now trimmed. - The stream now cancels when the last live member resolves while bytes remain, which happens when another member left by abort: the spec's rule, and the fast-pan case the design exists for. - A suffix read answered with 200 resolved empty; its member is now placed at the end of the whole object. Also drops `packages/geotiff/tests/lerc-remote.test.ts`, an untracked file from other work that `git add packages/geotiff` swept into the limiter move; it stays in the working tree. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A COG's first tiles often sit inside its first header block, so a data read for them was fetched again. The cache now serves a read from any span that contains it; the purpose still decides which budget a span counts against. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…oss purposes A widened header block had one member, the few bytes cogeotiff asked for, so the cancel-when-nothing-is-wanted rule cut the block off after its first chunk and only that chunk was cached; the next header read a little further on requested the same block again. A keep member now covers each widened block, so it is read to its end for the cache's sake. In-flight streams are keyed by file only, so a data read inside a header block that is still streaming attaches to it instead of fetching the same bytes again; the first tiles of a COG often sit inside its first block. Merge queues stay keyed by purpose, so a tile never lands in the header budget. Both tests drive the body in two chunks, which no earlier test did; the widening test passed only because its body arrived whole. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ted keys `ReadRange` is now always a known range; only `RangeReader.read` and the stream's request take `undefined` for the whole object, so everything downstream narrows. `FileIdentity.key` is a branded `FileKey` that only `fileIdentity()` produces, used by the cache's map and the reader's maps, so a plain string cannot be passed as a key by mistake. The key's parts are separated by a space instead of NUL: a serialized URL never contains one either, and the key reads clearly when printed. The `fileIdentity` docstring says why the identity exists: one merged request carries one set of headers. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…lt to "data" "Header" named the COG case; the same class of bytes is a sharded Zarr shard's index at the end of its shard and a PMTiles directory in the middle of its archive, so the purpose is now "metadata": what a format reads before it can ask for data and what every later read depends on. Options follow: `minMetadataReadBytes`, `cache.metadataBytes`, `DEFAULT_METADATA_CACHE_BYTES`, `DEFAULT_MIN_METADATA_READ_BYTES`. `purpose` is optional and defaults to "data", so a caller with no structural reads never sees the distinction. The spec is updated to match. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e Zarr The README names sharded Zarr next to COG as a client, explains the six-connection HTTP/1.1 cap the limiter default matches and why merging still pays over HTTP/2 (per-request latency and price, interleaving), defines the metadata purpose generically with the default, and splits a run-on sentence. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… it changes chunkd's SourceHttp recorded a file's ETag on its first response and failed later reads whose ETag differed; the stack dropped that guard when it replaced chunkd. The reader now keeps each file's ETag, or Last-Modified without one, from its latest response. A response with a different one purges the file's cached spans and forgets its learned size before the new bytes are stored, so the cache holds one version of an object at a time, the rule a browser's own range cache follows, and counts the change in `stats.validatorChanges`. Every bytes result carries the validator it came from, including cache hits, so a caller that parsed a file's layout can fail its reads when the layout is stale; the geotiff adapter does that in the next PR. `ByteCache` gains an optional `delete(file)`, which the memory cache implements. The reader never sends `If-Match`: a conditional header forces a CORS preflight on every request. icechunk builds its own behind `validateChecksums` and it passes through the init unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…st's The keep member that holds a widened block open offers no priority, and "none" counted as 0, the best there is, so every widened metadata request took the top slot whatever its read asked for. A stream's priority is now the best among the members that offer one, and 0 only when none does. Co-Authored-By: Claude Fable 5.1 <[email protected]>
79c3ee6 to
5fc6c7b
Compare
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Stage 2 of the range reader (stacked on #806): `GeoTIFF.fromUrl` reads through a `RangeReader`, so the header reads cogeotiff makes (IFDs, then one offset-table entry per tile) and the tile reads are merged into few streamed range requests, each tile resolves as its bytes arrive, and everything received is cached. `GeoTIFF.open`, `fetchTile`, `fetchTiles` and the deck.gl layers are unchanged; stage 3 (next PR) makes the layers share one reader by default. Design: `dev-docs/specs/2026-10-26-range-reader-design.md`, section "`@developmentseed/geotiff` on the reader". ## Changes - `RangeReaderSource`: a chunkd `Source` over one reader, URL, purpose, limiter and request init. `fromUrl` builds two over one reader, purpose `metadata` for cogeotiff's `Tiff` and purpose `data` for tile bytes, so the two are merged and budgeted separately (and a tile that arrived inside the first metadata block is served from it, or attaches to it while it streams). Its size is seeded infinite and never updated, the #524 guard. - `GeoTIFFFromUrlOptions`: new `reader` (share one across files to share its cache and batching window; omitted, a private reader with default options) and `requestInit` (headers, credentials, mode for every request of the file; files read with different inits never share a request or a cached byte). **Breaking:** `chunkSize` and `cacheSize` are removed; they are `RangeReader` options now (`minMetadataReadBytes`, `cache.metadataBytes`). `concurrencyLimiter` and `getPriority` are unchanged. - Removed: the chunkd `SourceChunk` + `LRUCacheMiddleware` + `LimiterMiddleware` stack, `cache.ts`, `limiter.ts`, `coalesce.ts` and their tests. `@chunkd/source-http` is no longer a dependency; `@chunkd/middleware` moves to devDependencies (one test still composes a chunkd source for `GeoTIFF.open`). - `getMultipleBytes` issues one read per range in one task instead of merging with its own 1 MiB gap underneath the reader's over-fetch cap; the reader merges. - Tests: a fixture server that answers like S3 behind CORS (`206` with `Content-Length` only, streamed bodies, held and failed requests) replaces the `SourceHttp.fetch` stubs. The header-read and limiter tests keep every behavioural guarantee (one request per header block shared by the tiles that need it, one tile's abort never failing another, one limiter slot per request and none for a cache hit, a queued read dropped on abort before any fetch); the `fetchTiles` grid tests now assert the reader's request count end to end and pixel-equal tiles. The Vermont example gets its own reader with a 64 MiB metadata budget in place of `cacheSize`. ## After Kyle's review of #806 (2026-10-27) - Follows the rename to the `metadata` purpose and the narrower `ReadRange` (8c7b175). - `RangeReaderSource` remembers the validator of its first result and throws an `ETag conflict` error when a later one differs, as chunkd's `SourceHttp` did and this PR had silently dropped: a COG replaced in place mid-session now fails loudly instead of decoding garbage from stale offsets, and a reopen over the same reader works because the reader keeps only the new version (70adf3c). 🤖 Written by [Claude Code](https://claude.com/claude-code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Stage 3 of the range reader (stacked on #807): the deck.gl COG layers share one `RangeReader` by default, hand a whole selection to it in one task, and abort a tile's load the moment the tile leaves the view, so coalesced, streamed, cached range requests are the default path for every COG layer, with no change to deck.gl. Design: `dev-docs/specs/2026-10-26-range-reader-design.md`, section "deck.gl-geotiff and deck.gl-raster". Closes #273 (no `getMultiTiles` needed: the batching happens below `getTileData`), closes #747 (the gap rule and caps are reader options; defaults below), closes #762 (received bytes are cached, a pan back refetches nothing). ## Changes - `DEFAULT_RANGE_READER` in deck.gl-geotiff, next to `DEFAULT_CONCURRENCY_LIMITER`: every `COGLayer`, `MultiCOGLayer` and `MosaicLayer` on a page shares one byte cache and one batching window. `COGSource.open`, `MultiCOGSource.open` and `MosaicLayer` take `reader` and `requestInit` (headers, credentials, mode for data behind authentication) and forward them to `GeoTIFF.fromUrl`; the mosaic passes them to `getSource` like the limiter. - `COGLayer` and `MultiCOGLayer` default to `maxRequests: 256` and `debounceTime: 50`: deck.gl's six-at-a-time throttle would starve the reader, which merges a selection's reads and is capped by the per-origin limiter instead; the debounce lets a pan settle before anything is requested. `RasterTileLayer` and `MosaicLayer` keep deck.gl's defaults (#562). - `RasterTileset2D` gains an internal `abortUnwantedLoads` option: after every update, a loading tile that is neither selected nor visible is aborted. deck.gl does that only while more than `maxRequests` loads are in flight; without the rule a streamed request would run on for tiles that left the view. `RasterTileLayer` exposes it as a protected hook, off by default; the two COG layers turn it on. `ZarrLayer` is untouched until its own reader adapter lands, because zarrita's coalescer fails every read of a merged request when one of them aborts. - Docs: a "Requests, caching and authentication" section in the deck.gl-geotiff README. ## Measurements Same machine, same hour, headed Chrome 156 through the CDP harness in `dev-docs/perf-harness`, two repeats, counting only the S3 host. Before is the stage 1 tip (behaviour identical to `main`), after is this branch. Settled screenshots are pixel-identical (ImageMagick `compare -metric AE` = 0) for every scenario. The review of this PR found two things fixed in `87b49a85`: a loading tile that deck.gl evicted inside its own update kept its stream alive (now aborted through the tileset's `onTileUnload`), and the README showed `reader`/`requestInit` as `COGLayer` props, which do not exist (open the source yourself; `MosaicLayer` has the props). | Example | Scenario | Before (requests / MB) | After (requests / MB) | |---|---|---|---| | cog-basic (Sentinel-2 TCI, 1024 px tiles of ~2.4 MB) | load | 14 / 4.4 | **3 / 4.3** | | cog-basic | zoom +3, cold cache | 28 / 22.8, 18 cancelled | **9-10 / 22.8, 6-7 cancelled** | | cog-basic | zoom +3, warm | 28-29 / 22.8-23.5 | **10 / 22.8** | | cog-basic | pan 1 viewport | 8 / 19.0 | 8 / 19.0 | | cog-basic | ten fast pans (1 viewport each, 20 frames) after the zoom | 8 / 19.0, 0 cancelled | 5 / 19.0, 0 cancelled | | cog-basic | pan 3 viewports away, then back | away: 11 / 4.8 (5 cancelled); back: 5 / 4.6-9.6 | away: 11 started, all cancelled before a byte, 0 MB; back: same, 0 MB | | sentinel-2 (MultiCOGLayer, one scene's band files) | load | 36-42 / 8.5-10.5 | **9 / 10.3** | | sentinel-2 | zoom +2 | 114-117 / 36.3-37.4, 12 cancelled | **23 / 35.2, 8 cancelled** | | usgs-topo (one HTMC sheet, 128 px tiles) | load | 151-154 | **3-5** | | usgs-topo | pan 0.5 viewport | 0 | 0 | The single pan on cog-basic brings in one column of new tiles, which are not adjacent in file order, so nothing merges there and nothing is worse; the ten fast pans fetch the same bytes with fewer requests, and the pan-away-and-back is the #762 case: before, the way back refetched five tiles that had been evicted; after, every request started mid-pan was cancelled before a byte arrived and the view on return was served from cache. Settle times were too noisy on this connection to read (the 2 MB tiles are bandwidth-bound; cold zoom 2.8 / 3.2 s before against 2.7 / 5.2 s after, and the reverse spread on the warm run; sentinel-2 zoom 6.3 / 6.6 s before, 6.0 / 8.6 s after). Not run, left for the review: `naip-mosaic`, `vermont-cog-comparison`, the usgs-topo mosaic app linked against this build, the centre-tile timing, and the knob sweeps (`maxGap`, `maxOverfetchBytes`, `debounceTime`, `cacheMode`). The defaults are the spec's first-implementation values: `maxGap: "median"`, `maxOverfetchBytes` 1 MiB, `maxRequestBytes` 16 MiB, `minMetadataReadBytes` 64 KiB, cache 32 MiB metadata + 64 MiB data shared page-wide. To rerun: `dev-docs/perf-research-2026-10.md`, "How to re-run" (the harness needs the `window.__overlay` hook from its instrumentation patch applied to `examples/_shared`). ## After Kyle's review of #806 (2026-10-27) The numbers above were measured before the widened-block fix in #806 (a metadata block was cancelled after its first chunk and requested again), so the metadata-side request counts, the usgs-topo sheet load in particular, should be lower now; the gate still needs the rerun listed above. The README follows the `metadata` budget name. ## Timing (2026-10-28, with #815) Does it make things faster, and how much? Measured on the same machine with the CDP harness, cold cache, headed Chrome 156, as instant camera jumps so the numbers are request timing rather than animation: *first tile* is the time from the jump until the first newly selected tile is loaded, *all loaded* until every root layer reports loaded, both sampled per animation frame from deck's tile state, no idle floor. *Before* is `main` after #806 (chunkd path, deck.gl's six at a time), five repeats; *after* is this stack plus #815 with its 1 MiB default, three repeats. Page load is from navigation to all tiles loaded and includes the app's own bootstrap; it varies several-fold run to run in both builds (sentinel-2's ranges 1 to 9 s), so read the jump rows, not the page-load rows. Medians. **native (home link, ~45 Mbit/s, low RTT)** | Example | Step | First tile before -> after (ms) | All loaded before -> after (ms) | Speedup | Requests before -> after | MB | |---|---|---|---|---|---|---| | usgs-topo | page load | 510 -> 752 | 1988 -> 1749 | **1.14x** | **89 -> 35** | 0.3 | | usgs-topo | zoom +2 (jump) | 136 -> 197 | 1943 -> 579 | **3.36x** | **99 -> 9** | 0.6 | | usgs-topo | pan 1 viewport (jump) | 132 -> 186 | 721 -> 299 | **2.41x** | **32 -> 8** | 0.1 | | naip-mosaic | page load | **146 -> 573** | 8484 -> 9112 | 0.93x | 257 -> 257 | 47.3 | | naip-mosaic | zoom +2 (jump) | **185 -> 624** | 2993 -> 3508 | **0.85x** | 50 -> 33 | 22.0 | | naip-mosaic | pan 1 viewport (jump) | 19 -> 17 | 2376 -> 2737 | **0.87x** | 30 -> 20 | 10.8 | | sentinel-2 | page load | 691 -> 1022 | 1487 -> 3408 | **0.44x** | 75 -> 51 | 11.2 | | sentinel-2 | zoom +2 (jump) | 489 -> 532 | 5738 -> 5025 | **1.14x** | 99 -> 50 | 36.9 | | cog-basic | page load | - -> - | 618 -> 660 | 0.94x | 47 -> 36 | 4.7 | | cog-basic | zoom +3 (jump) | 747 -> 1015 | 4088 -> 4162 | 0.98x | 10 -> 10 | 23.9 | | cog-basic | pan 1 viewport (jump) | 1154 -> 920 | 3318 -> 3521 | 0.94x | 8 -> 8 | 20.0 | **emulated 200 Mbit/s, 80 ms RTT** | Example | Step | First tile before -> after (ms) | All loaded before -> after (ms) | Speedup | Requests before -> after | MB | |---|---|---|---|---|---|---| | usgs-topo | page load | 621 -> 825 | 2434 -> 1840 | **1.32x** | **92 -> 35** | 0.4 | | usgs-topo | zoom +2 (jump) | 146 -> 181 | 2164 -> 559 | **3.87x** | **99 -> 9** | 0.6 | | usgs-topo | pan 1 viewport (jump) | 142 -> 224 | 741 -> 340 | **2.18x** | **32 -> 8** | 0.1 | | naip-mosaic | page load | 232 -> 309 | 9163 -> 9258 | 0.99x | 257 -> 257 | 47.3 | | naip-mosaic | zoom +2 (jump) | **188 -> 551** | 3165 -> 2985 | 1.06x | 50 -> 33 | 22.0 | | naip-mosaic | pan 1 viewport (jump) | 16 -> 19 | 1965 -> 2403 | **0.82x** | 30 -> 20 | 10.8 | | sentinel-2 | page load | 768 -> 969 | 1712 -> 1663 | 1.03x | 75 -> 51 | 11.2 | | sentinel-2 | zoom +2 (jump) | 521 -> 635 | 5498 -> 4446 | **1.24x** | 99 -> 50 | 36.9 | | cog-basic | page load | - -> - | 798 -> 829 | 0.96x | 47 -> 36 | 4.7 | | cog-basic | zoom +3 (jump) | 1076 -> 1278 | 3258 -> 3094 | 1.05x | 10 -> 10 | 23.9 | | cog-basic | pan 1 viewport (jump) | 1031 -> 1224 | 2905 -> 2948 | 0.99x | 8 -> 8 | 20.0 | **emulated 10 Mbit/s, 150 ms RTT** | Example | Step | First tile before -> after (ms) | All loaded before -> after (ms) | Speedup | Requests before -> after | MB | |---|---|---|---|---|---|---| | usgs-topo | page load | 837 -> 1089 | 3973 -> 3410 | **1.17x** | **82 -> 35** | 0.3 | | usgs-topo | zoom +2 (jump) | 234 -> 248 | 3067 -> 928 | **3.30x** | **99 -> 9** | 0.6 | | usgs-topo | pan 1 viewport (jump) | 199 -> 278 | 1088 -> 526 | **2.07x** | **32 -> 8** | 0.1 | | naip-mosaic | page load | 751 -> 470 | 40406 -> 40332 | 1.00x | 257 -> 257 | 47.3 | | naip-mosaic | zoom +2 (jump) | **729 -> 4275** | 16904 -> 17449 | 0.97x | 50 -> 33 | 22.0 | | naip-mosaic | pan 1 viewport (jump) | 17 -> 16 | 8918 -> 9107 | 0.98x | 30 -> 20 | 10.8 | | sentinel-2 | page load | 3791 -> 3311 | 10604 -> 10351 | 1.02x | 71 -> 51 | 9.3 | | sentinel-2 | zoom +2 (jump) | 1849 -> 2192 | 29885 -> 29831 | 1.00x | 99 -> 50 | 36.9 | | cog-basic | page load | - -> - | 2049 -> 2037 | 1.01x | 47 -> 36 | 3.9 | | cog-basic | zoom +3 (jump) | 11133 -> 11147 | 19367 -> 19480 | 0.99x | 10 -> 10 | 23.9 | | cog-basic | pan 1 viewport (jump) | 11497 -> 11188 | 16274 -> 16320 | 1.00x | 8 -> 8 | 20.0 | Reading it: - **Small tiles win, everywhere.** usgs-topo's 128 px tiles: a zoom completes 3.4x to 3.9x faster and a pan 2.1x to 2.4x faster in every link condition; page load 1.1x to 1.3x. The first tile is 50 to 80 ms later, which is the new 50 ms debounce. - **Multi-file tiles win on fast links.** sentinel-2 (MultiCOGLayer, ten scenes): 1.14x native, 1.24x on the fast link, equal on the slow link where bytes are all that matters; the first tile is back at the unmerged 0.5 s after #815's round-robin launch, where the unbounded merge had it at 2.5 s. - **Big single tiles are at parity.** cog-basic's 2.4 MB tiles do not merge at a 1 MiB cap; the view is the same requests as before and loads in the same time (0.94x to 1.05x). What this stack adds there is the cache and the cancellation, not speed: the pan-away-and-back case fetches nothing on the way back. - **A mosaic of mid-size tiles is the one mixed case.** naip-mosaic's 460 KB tiles merge in pairs (50 to 33 requests); a zoom on the home link is 0.85x and a pan 0.83x, the fast link 1.13x and 0.92x, five interleaved repeats each. The request timelines say why: no metadata requests during the zoom (offsets are cached at load), five of six streams busy on average in both builds, the same 9 Mbit/s per stream in both, so this link only reaches its 45 to 50 Mbit/s with all six streams running, and this bucket is in Azure EU West at 120 ms to first byte. Merged units of about 780 KB against 460 KB single tiles leave a longer tail where fewer than six streams are busy; the latency saved by 17 fewer requests is real but smaller than that tail on this link, and the arithmetic flips on the fast link. Two launch orders were tried against it: largest-first brings the zoom to parity (1.00x home, 1.21x fast) but delays sentinel-2's first tile from 0.53 s to 1.27 s, and a first-run-then-largest hybrid keeps the first tile but loses the naip win; neither is in #815, both are on `experiment/range-reader-launch-order`. The remaining fix is an adaptive cap derived from the selection's size, so a small selection such as a pan yields enough units to keep six streams busy; that is the follow-up. - **Two bugs the benchmark found are in #815**, which this stack should land after: contiguous tiles merged without any bound because an adjacent read counted as overlapping, which is why the first pass of this benchmark showed big tiles at 0.6x on the fast link; and merged ranges launched file by file, which held every MultiCOG tile until the last band file's streams started. Not measured: your usgs-topo mosaic app against this build, and HTTP/2 hosts (all four examples read from S3 or Azure Blob, which are HTTP/1.1). 🤖 Written by [Claude Code](https://claude.com/claude-code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Adds `examples/experimental/pmtiles-terrain`. It computes relief shading on the GPU from [Mapterhorn](https://mapterhorn.com/)'s global terrain, read straight from one PMTiles archive by `RasterTileLayer`. The archive is `planet.pmtiles`: 356 GB covering zooms 0-12, as Terrarium-encoded 512 px lossless WebP. It shows three things: 1. **deck.gl-raster reads PMTiles too.** Any tiled source works, not only COG and Zarr. 2. **Hillshade is computed live on the GPU.** The sun is a slider, and moving it fetches nothing. 3. **Reads are merged.** A clustered PMTiles archive keeps a view's tiles together in the file, so the range reader merges them into a few streamed requests. A "Merge requests" switch compares that with one request per tile. This becomes the hillshade example. It ports and reviews #647's Horn kernel, halo and modes; #647 stays parked. Ref #647. The design is in [`dev-docs/specs/2026-10-27-pmtiles-terrain-design.md`](https://github.com/developmentseed/deck.gl-raster/blob/64702126264eec1cf1ff30a4ec182f2f02436531/dev-docs/specs/2026-10-27-pmtiles-terrain-design.md) and the [example's README](https://github.com/developmentseed/deck.gl-raster/blob/64702126264eec1cf1ff30a4ec182f2f02436531/examples/experimental/pmtiles-terrain/README.md). ## Built on the range reader It reads PMTiles through `@developmentseed/range-reader` (#806) and uses #809's protected `_abortUnwantedLoads` hook, both on main. Outside the example, the PR changes only the spec, one docs entry, the card image and lockfile additions. ## How it works - **No loaders.gl.** The example uses the `pmtiles` library directly. `@loaders.gl/pmtiles` takes only a URL or a `Blob`, so its reads can't merge; it calls `getZxy` without a signal; and it pins `pmtiles` 3.x. - **`RangeReaderSource`** implements `pmtiles`' `Source` on the range reader. - Tile-data reads use the `data` purpose; the header and directories use `metadata`. - Bytes are copied out, because the reader's are views into shared buffers. - A replaced archive is caught with `pmtiles`' own `etag` check. - **`PMTilesSource extends RasterSource`** describes a 512 px WebMercatorQuad grid bounded to the archive. - The layer takes its `tilesetDescriptor`; question 10 of the Sources spec stays as it is. - If `RasterTileLayer` learns to take a `source`, this plugs in there. - **Halo.** Each tile is a 514 x 514 `r32float` texture whose outer ring comes from its eight neighbors. - Nothing is fetched for a halo. A tile loads only itself and draws at once, its ring filled from the neighbors that have loaded. - A side whose neighbor hasn't loaded repeats the tile's own edge. That neighbor isn't in view, so neither is the side. - When a neighbor loads later, the tile rewrites only its ring, four strips one texel wide. - `TileBorders` keeps each loaded tile's border (8 KiB, not 1 MiB), so a tile still finds a neighbor's border after deck.gl has unloaded the neighbor. - **Ground cell size is computed per fragment** from Mercator latitude. One value per tile would make the shading jump 7% between z6 tile rows near 46°N. - **Exact decoding.** There's no premultiplied alpha or color conversion. Pixels are read back the way MapLibre reads DEM tiles: through a canvas, or through `VideoFrame` when canvas reads are altered. Where neither gives exact bytes, tiles fail with a message in the panel instead of drawing wrong elevations. - **`PMTilesTerrainLayer`** exists only to turn on #809's protected `_abortUnwantedLoads` hook, because the example raises `maxRequests`. It can go once a public prop exists. ## Measured The opening view at the Matterhorn: 12 tiles. - Each mode was measured cold, two or three times, from a toggle of the switch after the basemap had loaded, in headed Chrome 156. - Times come from polling the readout, so they're +/- 0.25 s. | Connection | Mode | HTTP requests | Data | All tiles drawn | | --- | --- | --- | --- | --- | | fast | per tile | 14 | 1.9 MB | 1.9 s | | fast | merged | **7** | 2.0 MB | 1.2-1.9 s | | 150 ms round trips, 20 Mbit/s | per tile | 14 | 1.9 MB | 2.1-2.3 s | | 150 ms round trips, 20 Mbit/s | merged | **7** | 2.0 MB | **1.8-1.9 s** | The merged opening view is seven requests: - one 64 KiB header block; - one 64 KiB block holding the leaf directory; - five tile-data requests: 951 KB and 303 KB (one run of eight adjacent tiles, split by the reader's 1 MiB request cap), 305 KB (two tiles), 166 KB and 160 KB. Mapterhorn serves over HTTP/2, so merging saves more requests than time. Decoding takes about 1.25 ms per tile on the main thread. **Halos without fetches.** At first, each tile also fetched its eight neighbors for its halo. Kyle found the example slow, and filling halos only from neighbors that load anyway made it faster: | Measured | Fetching neighbors | Loaded neighbors only | | --- | --- | --- | | Opening view, merged | 4.8 MB | **2.0 MB** | | Opening view, merged, 150 ms round trips | all drawn at 2.9 s | **all drawn at 1.8-1.9 s** | | One-screen pan, fast | 13 tiles fetched for 6 shown, 1.57 MB | **6 tiles, 0.91 MB**, all drawn at 0.6 s | | One-screen pan, 150 ms round trips | last tile at 1.27 s | **last tile at 0.93 s** | ## Verified - **Tests:** the example's 82 tests, typecheck, Biome and `vite build`. Before the halo change, `deck.gl-raster` (251) and `range-reader` (99) also passed on #809's head. - **Headed Chrome:** - All four modes render. - Moving the sun or changing the mode fetches nothing. - There are no seams at tile edges or between tile rows at z5 (the Himalaya). - After the halo change, full-resolution crops across tile edges and a corner show no seams. Every opening view rewrote 29 rings: one per pair of adjacent tiles, counting diagonals, among its 4 x 3 tiles. - Tilted to 60° at z12.5 and 65° at z9.6, no seams were visible. - Across the antimeridian (Taveuni, Fiji, at z12), the rings read back from the GPU equal the neighbors' edge columns exactly. Hillshade still shows a faint line at 180°, and it comes from the data: there, the step between Mapterhorn's two edge columns is 20-60% of the steps beside it, while at other tile edges it matches them. - With canvas noise simulated, decoding switches to the `VideoFrame` path. - **Headed Firefox 155 with `privacy.resistFingerprinting`:** canvas reads come back random and `VideoFrame` is undefined. Tiles fail with the panel message; before the fix they drew random stripes. ## Review A fresh reviewer found four Important issues, and I raised two minors to Important. All are fixed, each verified by a failing test or browser check first. - **A drawn tile's halo reads were never cancelled.** Fixed then with a signal per halo, released when the tile unloaded. The halo change has since removed those reads. - **A replaced archive could leave `pmtiles` unable to read it** until reload. Fixed by using `pmtiles`' own `etag` check. - **Each cached tile kept its 1 MiB halo array alive.** luma.gl keeps `createTexture`'s `data` prop, so the array is now uploaded with `writeData`. The COG layers do the same: [`render-pipeline.ts`](https://github.com/developmentseed/deck.gl-raster/blob/98bf4ebad9988b6ddd001e32517517afefd09afd/packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts#L207-L208) and [`multi-cog-layer.ts`](https://github.com/developmentseed/deck.gl-raster/blob/98bf4ebad9988b6ddd001e32517517afefd09afd/packages/deck.gl-geotiff/src/multi-cog-layer.ts#L908-L909). - **The stats poll rebuilt every tile's sublayers about four times a second** while tiles loaded. The readout now polls on its own; tileset `setOptions` calls during a pan load went from 4 to 0. - **Firefox with fingerprinting resistance drew random stripes as terrain.** Tiles now fail, and the panel says why. Also found in the browser: #647's shader takes `atan(0, 0)` on flat ground, and the resulting NaN drew lakes black. It's fixed here, but #647 still has it. ## Open questions - Should there be a WebAssembly WebP decoder as a fallback, so Firefox with fingerprinting resistance (and probably Safari private browsing) can draw tiles? It would be a new dependency. - Should there be an issue for the COG layers keeping `createTexture`'s `data`? - `pmtiles` caches failed directory fetches, so a network blip blanks a region until reload. That's upstream behavior and isn't filed. <details> <summary>Calls made without asking</summary> - Built on #809's newest head rather than the head named in the plan. Cost if wrong: one `rebase --onto`. - Tests use hand-derived literal values. - Borders are kept after their tiles unload, up to 2048 (16 MiB). Cost if wrong: memory, or seams where a forgotten neighbor's border is missing. - Added tests beyond the plan: the counting `FetchSource`, `getUniforms` (proven by a mutation), a released tile's refine, and `getZxy` returning nothing. - Two comment fixes in #647's small modules: ASCII, and Terrarium units. - Gave `TerrainDerivative` explicit uniform and binding types. - `loadTerrariumElevation` lives in `get-tile-data.ts`. - The experimental badge sits inline in the panel title, because `ControlPanel` has no `experimental` prop on this base. - A refined halo repaints through `map.triggerRepaint`. Cost if wrong: a refined ring could show a frame late. - Retuned the colormap ranges so valleys don't look like water: [500, 4500], [2000, 8850], [0, 2800] and [400, 3000]. - The layer allows `null` tiles, and `renderTile` draws nothing for them. - Fixed `atan(0, 0)` on flat ground. - Verified in my own headed Chrome over CDP, because the chrome-devtools profile was busy. - Each opened archive gets its own range reader, so both sides of the switch start cold. - Timed every pass from a toggle after the basemap loaded. An earlier run timed from page load was confounded by the basemap still loading, so it's excluded. - Captured a fresh 1800 x 1013 docs card. - Raised the stats-poll and canvas-fallback minors to Important. - **Superseded by review fixes:** - warning once and falling back to a distorted canvas; - adopting a new validator after one mismatch; - simulating the Firefox check in Chrome. - **Left as is:** - deck.gl's default tile cache size. Cost: hundreds of MiB of GPU memory on large high-DPR screens. - Blockiness past z12 wasn't checked. Cost: possibly blocky shading at zooms 13-14. - The colormap range follows the chosen place, not the current view. Cost: a poor range after panning far. - Borders can survive an archive swap. Cost: a stray seam right after a swap. - Safari is untested. Its private browsing would now get the error message. - StrictMode opens the archive twice in development. - A few unused deck.gl dependencies, copied from titiler-cog. - A ring is rewritten once per neighbor that loads after its tile, up to eight times. Cost: four small `writeData` calls each. - Where tiles of two zoom levels meet, the finer tile's neighbor at its own zoom may never load, so that side keeps a repeated edge. The tilted views above stayed at one tile zoom, so I didn't see it happen. - Decoding stays on the main thread. Cost: about 15 ms for the 12-tile opening view. </details> <details> <summary>Deferred minors</summary> - The center texel isn't clamped at the tile edge, which could draw a speck there. None was seen. - `performance.measure` entries pile up over a session. </details> 🤖 Written by [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Bumps `version` to `0.10.0-beta.1` in the root `package.json` and in every `packages/*/package.json`, ready for the first 0.10 beta. The publish workflow sees `beta` in the version and publishes to npm under the `beta` dist-tag, so `latest` stays on 0.9.0. `CHANGELOG.md` gets a `v0.10.0-beta.1` section listing the 19 PRs merged since v0.9.0. ## Publish `@developmentseed/range-reader` by hand before tagging `@developmentseed/range-reader` (#806) isn't on npm yet, and `@developmentseed/geotiff` and `@developmentseed/deck.gl-geotiff` depend on it. The publish workflow can't create it: it publishes only through trusted publishing (OIDC), and npm can add a trusted publisher only to a package that [already exists](https://docs.npmjs.com/cli/v11/commands/npm-trust). Pushing the tag first would fail at `range-reader`. `pnpm publish --recursive` stops at the first failure, so packages published before it in the run would be out, and the rest, including `geotiff` and `deck.gl-geotiff`, would not. Once this is merged, from an up-to-date `main`: 1. Publish it once, as a public package under the `beta` tag. Its `prepublishOnly` script builds it first. ```sh cd packages/range-reader pnpm publish --tag beta --access public --no-git-checks ``` 2. Give it the same trusted publisher as the other packages (workflow `release.yml`, environment `release`), in its settings on npmjs.com or with: ```sh npm trust github @developmentseed/range-reader --file release.yml --repo developmentseed/deck.gl-raster --env release --allow-publish ``` 3. Tag the merge commit `v0.10.0-beta.1` and push the tag. The workflow skips `range-reader`, since that version is already on npm, and publishes the other ten packages. ## Breaking changes - #799: `COGLayer` takes a single `source`: an opened `COGSource`, or any input of `COGSource.open`. `geotiff` becomes `source`, `onGeoTIFFLoad` becomes `onSourceLoad`, and `epsgResolver` and `concurrencyLimiter` move to `COGSource.open`. - #801: `MultiCOGLayer` does the same with `MultiCOGSource`. `sources: { red: { url } }` becomes `source: { red: url }`, `MultiCOGSourceConfig` is removed, and files that don't share a CRS and an extent are rejected. - #804: `MosaicLayer`'s `sources` becomes deck.gl's `data`, and `MosaicSource` becomes `MosaicItem`. The callbacks get the item's opened source as `source`, and `onViewportLoad`'s entries are `{ item, source }`. - #821: `renderSource` gets only `{ source }`, without `signal`. - #812: `ZarrLayer` takes a `ZarrSource`, or a zarrita group or array, as `source`. `node`, `variable`, `metadata` and `epsgResolver` are removed (`metadata` becomes `ZarrSource.open`'s `geoZarrMetadata`), and the type parameters are now `ZarrLayer<DataT, Dtype, Store>`. - #807: `GeoTIFF.fromUrl` no longer takes `chunkSize` or `cacheSize`. They're `RangeReader` options now (`minMetadataReadBytes`, `cache.metadataBytes`). Two behavior changes aren't marked breaking: - #809: COG tile reads are coalesced by default, and `COGLayer` and `MultiCOGLayer` default to `maxRequests: 256` and `debounceTime: 50`. - #818: changing `updateTriggers.getTileData`, or ZarrLayer's `selection`, fetches tiles again, and the old tiles are removed at once. 🤖 Written by [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Adds
@developmentseed/range-reader, a new workspace package that turns the byte-range reads a client issues in one task into few streamed HTTP range requests, resolves each read the moment its bytes arrive, cancels a request as soon as no read wants what is left of it, and keeps every received span in a byte cache. It is stage 1 of three: nothing reads through it yet. Stage 2 (next PR in this stack) putsGeoTIFF.fromUrlon it; stage 3 makes the deck.gl COG layers share one reader by default.Design:
dev-docs/specs/2026-10-26-range-reader-design.md(committed here). Background: #273, #747, #762, #690, #524; the usgs-topo prototype (kylebarron/usgs-topo#23) that measured 226 requests / 4.19 s down to 30 / 0.79 s for a zoom-12 view of 128 px tiles, which this package generalises and improves on by streaming.What is in the package
RangeReader.read(file, range, { purpose, signal, limiter, getPriority }): queues absolute reads until the end of the task, groups them by file identity (URL plus a canonical request-init signature, so different credentials never share bytes) and purpose (metadataordata;datawhen omitted), widens small metadata reads to aligned 64 KiB blocks that are read to their end, merges them with the usgs-topo rule plus two caps (maxOverfetchBytes, 1 MiB;maxRequestBytes, 16 MiB;maxGap: "median"), and runs oneRangeStreamper merged range. Before queueing, a read is served from the cache, or attached to a request already in flight, of either purpose, or resolved empty past a known object size. Suffix and whole-object reads go out at once, unmerged.reader.statscounts requests, bytes, over-fetch, cache hits, attaches and validator changes for the measurement gate.RangeStream: one range request, body read as a stream into a preallocated buffer; each member read resolves with a view the moment its last byte lands; a member whose signal aborts rejects at once and the stream runs on for the others, and is cancelled, keeping what arrived, when the last live member leaves (by abort, or by a resolve once others have left). Handles 206, 200 to a ranged request (consumed as the whole object when itsContent-Lengthis small enough, else rejected), 404 (a typed not-found outcome, since a missing Zarr chunk is data), other statuses, a body that ends before the range (end of object, told apart from a truncated transfer byContent-Length), a body that runs past the range, and body errors from a realfetchon abort or a dropped connection. One limiter slot per request, with the best priority among live members.MemoryByteCache(the defaultByteCache): contiguous spans per file, served by containment as views, one LRU budget per purpose (32 MiB metadata, 64 MiB data) so tile churn never evicts the offset tables every later read depends on; a read of either purpose is served from any span that contains it.ByteCacheis an interface (get,put, optionalbyteSizeanddelete) so a disk-backed cache (OPFS) can be supplied later.Semaphore,PerOriginSemaphore,ConcurrencyLimiter,Priority) moves here from@developmentseed/geotiff, which re-exports the same names and keeps its chunkdLimiterMiddleware. No other change to geotiff's API.88 tests drive fake responses chunk by chunk (the fake errors the body on abort, like a real
fetch). A fresh whole-branch review found two confirmed bugs (body errors rejectedrun()and hung reads; cancelled prefixes pinned their whole preallocated buffer) and two rule gaps, all fixed with tests ina28d18d1.Registered on the docs site (
range-reader); the API pages are generated at build time like every other package's.After Kyle's review (2026-10-27)
metadata, notheader: the same class of bytes is a sharded Zarr shard's index and a PMTiles directory. Options follow (minMetadataReadBytes,cache.metadataBytes);purposeis optional and defaults todata(355b531).ReadRangeno longer includesundefined;FileIdentity.keyis a brandedFileKeyonlyfileIdentity()makes; the key's parts are separated by a space, which a serialized URL never contains; thefileIdentitydocstring says why the identity exists: one merged request carries one set of headers (d48caa6).SourceHttpfailed reads whose ETag changed and the stack had dropped that guard. The reader keeps each file'sETag(orLast-Modified) from its latest response, purges the file's cached spans and forgets its size when it changes, and reports the validator on every result, cache hits included;ByteCache.deleteis the purge hook. The reader never sendsIf-Match(CORS preflight); icechunk's ownIf-Matchpasses through the init (5691502). The geotiff adapter in feat(geotiff)!: read COGs through the range reader #807 does the per-instance check.🤖 Written by Claude Code
🤖 Generated with Claude Code