@vzn/vx-reapi 0.0.639 → 0.0.641

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/README.md CHANGED
@@ -441,15 +441,15 @@ the packages a build needs. The answer is the design doc's §7.4 recipe,
441
441
  ```ts
442
442
  install: {
443
443
  exec: { command: 'pnpm install --frozen-lockfile', remote: 'only' },
444
+ inputs: { files: ['package.json', 'pnpm-lock.yaml'] },
444
445
  cache: {
445
- inputs: { files: ['package.json', 'pnpm-lock.yaml'] },
446
446
  outputs: { files: ['node_modules/**'] },
447
447
  },
448
448
  },
449
449
  build: {
450
450
  dependsOn: ['install'],
451
451
  exec: { command: 'tsc -p .' },
452
- cache: { inputs: { files: ['src/**'] }, outputs: { files: ['dist/**'] } },
452
+ inputs: { files: ['src/**'] }, cache: { outputs: { files: ['dist/**'] } },
453
453
  },
454
454
  ```
455
455
 
@@ -487,7 +487,7 @@ sorted by name — the proto requires that, so equivalent Commands hash alike:
487
487
  - **`exec.env.define`** — literal `name: value` pairs from the task config.
488
488
  They read the same on every machine, so they are safe to put into the
489
489
  action identity, and they are already in the vx cache key.
490
- - **`cache.inputs.env`** — the values this machine resolved for those names,
490
+ - **`inputs.env`** — the values this machine resolved for those names,
491
491
  for each name the task's local child would get too (it is also in
492
492
  `exec.env.passThrough`). They are in the vx cache key by definition, so a
493
493
  change to one already produces a different action. A name unset here, or
@@ -511,6 +511,6 @@ the worker has its own. Two reasons, and both matter:
511
511
  can name its digest.
512
512
 
513
513
  So a task that needs a value on a worker must `define` it (config literal) or
514
- list it in both `cache.inputs.env` and `exec.env.passThrough` (host value,
514
+ list it in both `inputs.env` and `exec.env.passThrough` (host value,
515
515
  keyed, and seen by a local run the same way). A task whose command reads
516
516
  a `passThrough` secret is one to keep local with `exec: { remote: false }`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-reapi",
3
- "version": "0.0.639",
3
+ "version": "0.0.641",
4
4
  "license": "MIT",
5
5
  "description": "Bazel Remote Execution API plugin for vx — remote cache (ActionCache + CAS) against NativeLink, BuildBuddy, Buildbarn or bazel-remote.",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "peerDependencies": {
42
- "@vzn/vx": "^0.0.639"
42
+ "@vzn/vx": "^0.0.641"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
package/src/executor.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  isLiteralPattern,
18
18
  isUserError,
19
19
  normalizeGlob,
20
+ restorableOutput,
20
21
  UserError,
21
22
  withForwardArgs,
22
23
  } from '@vzn/vx'
@@ -1269,7 +1270,7 @@ export function globToOutputPath(glob: string): string {
1269
1270
  }
1270
1271
 
1271
1272
  /**
1272
- * The action's environment: `cache.inputs.env` (values read from THIS
1273
+ * The action's environment: `inputs.env` (values read from THIS
1273
1274
  * machine's environment, already folded into the cache key) plus
1274
1275
  * `exec.env.define` (literals from the task config). A define wins on
1275
1276
  * collision — it is the more explicit statement of intent. An `inputs.env`
@@ -1407,9 +1408,19 @@ export async function materialiseOutputs(
1407
1408
  ...(req.outputs?.workspaceFiles ?? []),
1408
1409
  ].map((g) => normalizeGlob(g))
1409
1410
  const matchers = declared.map((g) => new Bun.Glob(g))
1411
+ // Core's restore gate: a `!` take-back, vx's own files and a
1412
+ // `node_modules` no glob names are no output either.
1413
+ const isOwn = restorableOutput(req.outputs?.files ?? [])
1414
+ const isWs = restorableOutput(req.outputs?.workspaceFiles ?? [])
1410
1415
  const isDeclared = (abs: string): boolean => {
1411
1416
  const rel = toPosix(path.relative(req.workspaceRoot, abs))
1412
- return declared.includes(rel) || matchers.some((m) => m.match(rel))
1417
+ const own =
1418
+ projectRel === ''
1419
+ ? rel
1420
+ : rel.startsWith(`${projectRel}/`)
1421
+ ? rel.slice(projectRel.length + 1)
1422
+ : undefined
1423
+ return (own !== undefined && isOwn(own)) || isWs(rel)
1413
1424
  }
1414
1425
  // A declared output, or a path under one a literal glob names whole.
1415
1426
  const underDeclared = (rel: string): boolean => {