Skip to content

fix(kit): resolve version aliases to ints in Artifact.from_uri#299

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:fix-artifact-from-uri-alias
Open

fix(kit): resolve version aliases to ints in Artifact.from_uri#299
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:fix-artifact-from-uri-alias

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

Problem

Artifact.from_uri("art://name:prod") (alias version) stored the alias string in artifact._version, which is typed int | None. The uri/art_path properties then emit a corrupted URI:

art = Artifact.from_uri("art://a:prod")
art._version   # 'prod'  (str, should be int)
art.uri        # 'art://a:vprod'  -> unresolvable on round-trip

Fix

In from_uri, only assign _version directly when the parsed version is an int; resolve alias strings through the registry entry's alias table, falling back to the latest version.

All URI forms now round-trip correctly:

art://a:prod   -> _version=1  uri=art://a:v1
art://a:v1     -> _version=1  uri=art://a:v1
art://a:1      -> _version=1  uri=art://a:v1
art://a:latest -> _version=1  uri=art://a:v1
art://a        -> _version=1  uri=art://a:v1

Testing

  • Reproduced the bug and verified the fix with a local fsspec registry (alias prod -> v1)
  • pytest tests/kit — 90 passed

Artifact.from_uri('art://name:prod') stored the alias string 'prod' in
artifact._version (typed int | None), so artifact.uri emitted the
corrupted 'art://name:vprod' instead of round-tripping to the resolved
version. Resolve alias strings through the registry entry's alias table,
falling back to the latest version when the alias is unknown.
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