fix(cli): apply --quick and size guard to registry ids in inspect - #38
Merged
Conversation
`forge inspect metaworld` (a registry id) skipped both the --quick metadata-only path and the ">500MB, offer --quick" size guard, because those branches only recognised explicit HF URLs. The id resolved to an hf_hub source *inside* _resolve_dataset_path and downloaded the whole dataset (45.86 GB for metaworld) with no prompt and no metadata-only option. Rewrite a bare registry id to its hf:// source up front (via new _registry_id_to_hf_url helper) so both branches apply uniformly. Non-HF sources (gcs/http) still fall through to _resolve_dataset_path unchanged. Now `forge inspect metaworld --quick` reads Hub metadata only, and the plain form warns about size and offers --quick. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
forge inspect metaworld(a registry id) downloaded the entire dataset — 45.86 GB — with no size warning and no metadata-only option:--quickwas silently ignored: the branch is gated onis_hf_url(path), and a bare id likemetaworldisn't an HF URL.--quick" size guard was also skipped for the same reason.The id only resolved to its
hf_hubsource inside_resolve_dataset_path, well after both branches — so it went straight to a fullsnapshot_download.Fix
Rewrite a bare registry id to its
hf://source up front, via a small_registry_id_to_hf_urlhelper, so the--quickand size-guard branches apply to registry ids just like explicit HF URLs. Non-HF sources (gcs/http/…) returnNoneand fall through to_resolve_dataset_pathunchanged, preserving their current handling.get_sourcealready prefershf_hub, so multi-source datasets (e.g.droid) resolve to their HF repo.Behavior after
Tests
TestRegistryIdToHfUrl(5 cases): hf-backed id →hf://…, hf-preferred over gcs (droid), unknown id →None, repo-ids/paths ignored, and a local dir shadowing a registry id.test_inspect_zarr/test_inspect_with_format_flagsetup errors are an unrelated zarr-fixture API drift (confirmed identical onmain).🤖 Generated with Claude Code