Repository navigation
fix: cache paths follow HYPERFRAMES_CACHE_DIR - #6716
miguel-heygen wants to merge 3 commits into
Conversation
Every place HyperFrames keeps downloaded or built files now takes its folder from one helper, hyperframesCacheDir() in @hyperframes/core. The default stays ~/.cache/hyperframes; HYPERFRAMES_CACHE_DIR moves it.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 271 (base branch 271), smooth 185 of thoseThe gate passes. Quarantined, measured but not gated (0) |
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 3 blocker · 0 important · 1 nit · head dabb0f5b
The helper and the 20 call sites look right, and the guard scan found no remaining hand-built paths. The blockers are all CI. Comments, Lint/Preflight, Build and Fallow fail because of this PR. Regression, preview, player-perf and Windows are red only because their preflight is. ↓ inline
- nit: a relative
HYPERFRAMES_CACHE_DIRresolves against the cwd at import time for the module-level constants (CACHE_DIR,MODELS_DIR, …). The warm-check server imports them in its own cwd and only then callsprocess.chdir(request.cwd)(cli/src/warmCheck.ts:57). A warm run can therefore use a different folder than a cold one. Consider documenting that the variable should be absolute.
Scope
Read every changed file, grepped the tree at head for leftover .cache paths (only the torch and huggingface ones remain, which is correct), and checked child-process env propagation and the warm-check env digest. The fails without the fix: line names cacheDir.test.ts, which is acceptable. Studio: edit accuracy gate is also red; re-check it once the build passes.
— Genesis
| "import": "./src/atomicFile.ts", | ||
| "types": "./src/atomicFile.ts" | ||
| }, | ||
| "./cache-dir": { |
There was a problem hiding this comment.
blocker: ./cache-dir is in package.json but not in packages/core/package-subpaths.json, so check:package-subpaths fails Lint and every Preflight ("package.json is out of sync"). The descriptor's default environments are browser+node, which is why verify:packed-manifests (Build) tries to bundle dist/cacheDir.js for the browser and fails on node:path. Add the entry next to ./atomic-file with "environments": ["bun", "node"], then run bun run sync:package-subpaths.
There was a problem hiding this comment.
Fixed in 51a321f: ./cache-dir is in package-subpaths.json next to ./atomic-file, with "environments": ["bun", "node"]. check:package-subpaths passes (14 public workspaces). I could not run verify:packed-manifests to the end locally (it stops at an unbuilt package before core), so CI's Build is the check for that.
| import { closeServer } from "./pageServer"; | ||
| import { Sources, fingerprint } from "./sources"; | ||
| import type { InspectRequest, Snippet } from "./types"; | ||
| import { hyperframesCacheDir } from "@hyperframes/core/cache-dir"; |
There was a problem hiding this comment.
blocker: this is inspector's first @hyperframes/core subpath import. Its esbuild build (platform: "node") resolves the node condition to dist/cacheDir.js, and core's dist isn't built when Fallow's "Build generated inspector inputs" step runs: Could not resolve "@hyperframes/core/cache-dir". Import it relatively like the runtime-inline import above (../../core/src/cacheDir), or build core first.
There was a problem hiding this comment.
Fixed in 51a321f: inspector imports ../../core/src/cacheDir, like the htmlBundler import above it. Its build passes with packages/core/dist moved aside, in the same order as the CI step (parsers and lint, the runtime, then inspector).
| import { homedir } from "node:os"; | ||
| import { join, resolve } from "node:path"; | ||
|
|
||
| /** Where HyperFrames keeps what it downloads, builds and caches: `HYPERFRAMES_CACHE_DIR` when set, else |
There was a problem hiding this comment.
blocker: the Comments ratchet fails here: "NEW file over its package's comment share: cacheDir.ts is 20.0% (2/10), the package is 12.6%". Drop the docblock; the name and the test already say it.
There was a problem hiding this comment.
Fixed in 51a321f: the docblock is gone. On the nit: the docs now say to set HYPERFRAMES_CACHE_DIR to an absolute path, since module-level constants resolve a relative value against the working directory at import time.
…ctor from core source
There was a problem hiding this comment.
Verdict: REQUEST CHANGES — 3 resolved, 0 open, 1 new · dabb0f5b → 51a321f5
All three earlier blockers and the nit are fixed. Previously the Windows lanes stopped at preflight; now they run, and Tests on windows-latest: core fails on the new test. ↓ inline
— Genesis
|
|
||
| it("follows HYPERFRAMES_CACHE_DIR, read on each call, a relative one resolved", () => { | ||
| vi.stubEnv("HYPERFRAMES_CACHE_DIR", "/elsewhere/cache"); | ||
| expect(hyperframesCacheDir("whisper", "models")).toBe( |
There was a problem hiding this comment.
blocker: this fails on Windows (Tests on windows-latest: core): expected 'D:\\elsewhere\\cache\\whisper\\models' to be '\\elsewhere\\cache\\whisper\\models'. /elsewhere/cache isn't absolute there, so resolve adds the drive. The helper is right; fix the expectation, e.g. use an absolute dir from tmpdir(), or expect join(resolve("/elsewhere/cache"), "whisper", "models").
There was a problem hiding this comment.
Fixed in 411eb17: the override test now uses an absolute folder under tmpdir() and expects join(elsewhere, "whisper", "models"), so no drive letter is added on Windows. Passes on Linux (3/3); the Windows core lane in CI checks the rest.
What changed
hyperframesCacheDir()in@hyperframes/core/cache-dir.HYPERFRAMES_CACHE_DIRwhen it is set. The default is unchanged:~/.cache/hyperframes, so existing caches and CI caches keyed on that path keep working.How
packages/core/src/cacheDir.ts:hyperframesCacheDir(...parts)reads the variable on each call and resolves a relative value.cli,core,engine,inspectorandstudio-servernow use it in place ofjoin(homedir(), ".cache", "hyperframes", …).packages/core/src/cacheDir.test.tschecks the default and the override, and scans every package's sources so a new hand-built cache path fails the test.What I measured
tsc --noEmitexit 0 incore,engine,inspectorandstudio-server;clireports no error in any file this changes (its remaining errors come from unbuilt workspace packages).oxlint,oxfmt --checkandfallow auditare clean on the 21 changed files.packages/core/src/cacheDir.test.ts: 3 passed. fails without the fix: writing one site back by hand (tts/manager.ts) turns the scan red, naming that file.whisper/*(49),tts/*(25),browser/manager,background-removal/*,cloud/offload,utils/optionalPackages,warmCheck*, thedeterministicFonts-*andfontCompressionsuites (245),browserManager*(132) andprojectHistory*(154).What I did NOT exercise
LOCALAPPDATA, and on Linux underXDG_RUNTIME_DIRwhen set; only the fallback follows the variable.