Skip to content

Read virtual chunk containers from config.yaml for v1 repositories - #31

Merged
espg merged 1 commit into
mainfrom
v1-config-containers
Nov 20, 2026
Merged

espg merged 1 commit into
mainfrom
v1-config-containers

Conversation

@espg

@espg espg commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

A v2 repository keeps its config in the repo file, and since #27 its virtual chunk containers (URL prefix, S3 region, endpoint, path style) decide how an s3:// chunk location becomes an HTTPS URL. A v1 repository keeps the same config in config.yaml, which was never read, so v1 sessions ran with no containers.

For a bucket with a dot in its name that means path-style addressing on the global endpoint, https://s3.amazonaws.com/<bucket>/<key>. Outside us-east-1 that answers with a 301 that carries no CORS headers, so a browser cannot read the chunk even when the bucket's CORS is set up correctly. Node follows the redirect, which is why this only shows up in browsers. It came up opening the ISMIP6 store on source.coop (us-west-2.opendata.source.coop, spec v1) in gridlook.

What changes

  • For a v1 repository, checkoutBranch, checkoutTag and checkoutSnapshot read config.yaml and give the session its containers, as the v2 path already does. The read runs alongside the ref lookup and is cached per Repository.
  • src/format/config-yaml.ts reads the virtual_chunk_containers section and hands it to the same code that reads the v2 config, so both formats produce the same containers.
  • No new dependency. The reader covers the layout Icechunk 1.x writes, not YAML in general. A section it cannot read yields no containers, which is the behaviour before this change.

Behaviour changes for v1 repositories

  • A configured endpoint is now honoured. A v1 repository whose container names an endpoint_url, region or path style now has its virtual chunks addressed that way, matching v2. Two integration tests encoded the old URL (testbucket.s3.amazonaws.com) for the v1 fixture and now expect what the v2 test already expected (localhost:4200/testbucket).
  • One more request per v1 open. A repository that never saved a config has no config.yaml, so opening it in a browser logs a 404 (403 on an S3 bucket that cannot be listed).
  • vcc:// names are checked. With containers present, a vcc://name/... location whose name is unknown is an error, as in v2.

v2 repositories are unaffected and never request config.yaml.

The config.yaml reader

It handles nested key: value mappings, plain and quoted scalars, the !s3 / !s3_compatible / !tigris store tags, and the ? key / : value form Icechunk writes for a key longer than 128 characters. Anything else in the section (a sequence, a comment, a block or flow value, a double-quoted escape JSON lacks) makes it report no containers for that config.

To check it against real output, 69 configs were written with Python icechunk 1.1.18 (dotted buckets, spaces, quotes, unicode, #, : , values such as null / yes / 1 as strings, long keys, mixed store types) and compared with the containers Icechunk itself reports: 64 match exactly, 5 are read as no containers (prefixes or regions holding control characters or a line break), none is read wrongly.

Failure handling

  • Missing config.yaml (404, or 403 from S3): no containers, cached.
  • Unparseable section: no containers, cached.
  • Any other error (503, network): no containers for that session, not cached, so the next checkout asks again.
  • Abort: propagates, nothing cached.

Testing

  • npm test: 452 passed, 2 skipped (was 432 passed). typecheck, format:check and build are clean.
  • New unit tests for the reader, including the upstream v1 fixtures and agreement with the repo file of the same repository after upgrade (test-repo-v2-migrated).
  • New repository tests for branch, tag and snapshot sessions, caching, missing and unreadable configs, a transient failure, a 403, an abort, and v2 not requesting the file.
  • Against the live ISMIP6 store with redirects disabled, a virtual chunk is now fetched from s3.us-west-2.amazonaws.com directly.

Not in this PR

  • Concurrent first checkouts on one Repository can each fetch config.yaml. Sharing the in-flight request would let one caller's abort fail another's checkout, so it is left as a duplicate request.
  • The existing fallback that reads the region from the 301 still cannot work in a browser; with the config read, v1 repositories no longer depend on it.

@espg

espg commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Mostly written by claude; merging as is (already had an adversarial review, doesn't change behavior for v2 stores and fixes it for v1 stores).

@espg
espg merged commit 9ce84a9 into main Nov 20, 2026
12 checks passed
@espg
espg deleted the v1-config-containers branch November 20, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant