Repository navigation
hub: serve REPO@REVISION and the snapshot fallback; Windows build notes - #6405
joshuaswarren wants to merge 5 commits into
Conversation
|
Thanks @joshuaswarren. The walk is right: an explicit revision reads only its own ref or snapshot and never falls back, the fallback needs Two small things are left, and we'll do them ourselves on this branch:
Nothing more is needed from you.
|
|
@joshuaswarren, thank you for the shared cache walk and the revision serving. The resolution reads correctly: an explicit revision reads only its own ref or snapshot and never falls back, the fallback needs refs/main or a snapshot with a readable config.json, and the joined path always stays inside the cache. The host suites pass on today's main. Two small things are left, and we will make them ourselves on this branch. First, a bare "." revision passes the shape check and resolves to the snapshots folder itself, so serve Org/Name@. fails later with a confusing load error; we will refuse it, and have the explicit path require a config.json the way the fallback does, which also covers a sha naming an empty snapshot. We will add a test where the ".." form would reach a real snapshot, so that refusal is pinned too. Second, cli/hub.zig still carries its own copy of the cache walk; we will point it at the shared module so the two cannot drift. No change is needed from you.
|
The native server's model argument (server/hub.zig resolve) read only refs/main and refused owner/name@revision, while pull, rm and the tfq3 converter already split REPO@REVISION and info/models/plan already reach the newest-snapshot fallback through cachedSnapshot. A cache filled by 'hf download --revision' listed but did not serve. The cache-layout walk now lives in core/hub_cache.zig and both sides share it: resolve accepts REPO@REVISION (refs/<rev>, then snapshots/<rev>) and, with no refs/main, the newest snapshot holding a config.json; info and plan accept the revision too; servedName keeps the repo name over the snapshot sha. On Windows zig build native install failed on the POSIX-only tf-muse and tf-qwen3-asr tools; their install steps now skip the artifacts there. docs/WINDOWS.md notes: benchmark unsupported, WDDM free-memory queries not counting other processes' allocations, and the CRLF panic a pre-eol=lf clone hits at configure time; the boundary-check panics name line endings as the suspect. Fixes ashhart#6390
…cit path serve Org/Name@. resolved to the snapshots dir itself and a sha naming an empty snapshot served, while the fallback walk requires a config.json. revisionOk now refuses the bare ".", and the explicit-revision path applies the same config.json bar as the fallback. cli/hub.zig re-exports the shared core/hub_cache walk instead of keeping its own copy, so the two cannot drift. resolve tests cover @., @.., and a sha/ref naming an empty snapshot.
1e88daf to
6db99c0
Compare
|
Both changes are in
Ran |
|
READY to land on this head. Thanks @joshuaswarren: 6db99c0 refuses the bare '.' revision, applies the same config.json bar to an explicit revision as to the fallback walk, and cli/hub.zig now re-exports the shared core/hub_cache walk, with resolve tests for @., @.. and an empty snapshot. Checks pass on this head, and model path resolution does not change any served tokens.
|
Fixes #6390
What
serve/plan/drafter/chat/benchmarkacceptREPO@REVISIONand the server's model resolution gains the CLI's cache-layout walk.server/hub.zigpreviously read onlyrefs/mainand refusedowner/name@revision; a cache filled byhf download --revisionlisted undermodels/infobut would not serve. The walk lives inzig/src/core/hub_cache.zig(cachedSnapshotRev:refs/<rev>thensnapshots/<rev>; with norefs/main, the newest snapshot holding aconfig.json), wired as a shared module likecheckpoint_config.servedNamenames the repo, not the snapshot sha, forREPO@REVISION.revisionOknow refuses a bare.alongside..;cachedSnapshotRevrequires a readableconfig.jsonon the explicit revision path too — arefs/<rev>orsnapshots/<rev>dir that resolves but holds no config no longer serves as a model.cli/hub.zigdeduplicated ontohub_cache: the ~140 lines of copy-pasted helpers (revisionOk,isDir,readSmall,ensureDirPath,trimTrailingSeps,envValue,cachedSnapshotRev,cachedSnapshot,resolve:) are nowpub constre-exports of the shared module, so CLI and server share one implementation.tf-museandtf-qwen3-asrare POSIX-only (fabric/tp,std.c.clock_gettime); their install steps skip the artifacts on Windows sozig build native installexits 0 and reachesstart --check. The named build steps remain for explicit builds.docs/WINDOWS.md:tensorfold benchmarkis unsupported on Windows; WDDM free-memory queries do not count other processes' allocations; a pre-eol=lfclone keeps CRLF and panics at configure time — and every... boundaries changedpanic text now names a stale CRLF checkout as a suspect.info/modelsare unchanged: both resolve throughzig/src/cli/hub.zig, which open lead-train PRs cli: tensorfold mcp, a Model Context Protocol server on stdio for this machine's models and local servers #3549 and server: tensorfold serve --router answers for several models at one address, each a serve child loaded on demand #3540 rewrite;REPO@REVISIONsupport there lands cleanly on top of either.Tests
resolve:tests inserver/hub.zigcover: ref revision, bare snapshot sha, invalid revision refusal (.,.., empty),servedName, the no-refs/mainsnapshot fallback, and refusing a ref that names a snapshot dir with noconfig.json.pull.zigrevision test refuses.and...zig build test-pull-securityandtest-pull-hostgreen;server/hub.zigtests green including the new cases;zig fmtclean.