@vzn/vx 0.0.152 → 0.0.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.152",
3
+ "version": "0.0.153",
4
4
  "description": "A fast, correct task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,10 +17,10 @@
17
17
  "node": ">=18"
18
18
  },
19
19
  "optionalDependencies": {
20
- "@vzn/vx-linux-x64": "0.0.152",
21
- "@vzn/vx-linux-arm64": "0.0.152",
22
- "@vzn/vx-darwin-x64": "0.0.152",
23
- "@vzn/vx-darwin-arm64": "0.0.152"
20
+ "@vzn/vx-linux-x64": "0.0.153",
21
+ "@vzn/vx-linux-arm64": "0.0.153",
22
+ "@vzn/vx-darwin-x64": "0.0.153",
23
+ "@vzn/vx-darwin-arm64": "0.0.153"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -11,6 +11,7 @@ import { lstatSync, readlinkSync } from 'node:fs'
11
11
  import path from 'node:path'
12
12
  import { fileIdentity, repoFacts } from './git-inputs.js'
13
13
  import { FILE_HASH_RACY_MS, isIndexFull, racyWindowMs } from './layer.js'
14
+ import { isPermissionError, UserError } from '../util/index.js'
14
15
 
15
16
  const FILE_HASHES_SWEPT_AT = 'file_hashes_swept_at'
16
17
  const DAY_MS = 24 * 60 * 60 * 1000
@@ -301,7 +302,19 @@ export class FileHashStore {
301
302
  * spawn per file.
302
303
  */
303
304
  private async hashFileFromDisk(filePath: string): Promise<string> {
304
- return this.hashBytes(await Bun.file(filePath).bytes(), filePath)
305
+ let bytes: Uint8Array
306
+ try {
307
+ bytes = await Bun.file(filePath).bytes()
308
+ } catch (err) {
309
+ // Left raw, the scheduler added the write hint to an input vx only
310
+ // reads: "a path vx must write is not writable by this user".
311
+ if (!isPermissionError(err)) throw err
312
+ throw new UserError(
313
+ `${filePath} is not readable by this user (${err.code}), and vx reads it to derive a ` +
314
+ 'cache key. Make it readable, or, for a task input, take it out of cache.inputs.files.',
315
+ )
316
+ }
317
+ return this.hashBytes(bytes, filePath)
305
318
  }
306
319
 
307
320
  /**