@vzn/vx-reapi 0.0.640 → 0.0.642

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
@@ -309,8 +309,11 @@ Once a worker reports EXECUTING, the task's `exec.timeout` (or
309
309
  `executeTimeoutMs`) bounds the wait, and the bound holds across a
310
310
  re-attach: firing during the backoff between a dropped stream and its
311
311
  `WaitExecution`, it ends the task there rather than being lost.
312
- The run stopping (Ctrl-C, an embedder's abort) cancels the operation
313
- stream the same way, and an action not yet submitted is not sent.
312
+ The run stopping (Ctrl-C, an embedder's abort) or the task's `exec.timeout`
313
+ closes the stream and cancels the operation with `CancelOperation`, and an
314
+ action not yet submitted is not sent. The task then ends as a killed local
315
+ one does (exit 143, `SIGTERM`): past `exec.timeout` it is `failed (timed
316
+ out)` with its key in `vx last`.
314
317
 
315
318
  A ByteStream Read, like every unary call, retries UNAVAILABLE,
316
319
  RESOURCE_EXHAUSTED and INTERNAL three times (100, 400 and 1600 ms) before it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-reapi",
3
- "version": "0.0.640",
3
+ "version": "0.0.642",
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.640"
42
+ "@vzn/vx": "^0.0.642"
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'
@@ -935,9 +936,20 @@ export function reapiExecutor(client: ReapiClient, opts: ReapiExecutorOptions =
935
936
  )
936
937
  } catch (err) {
937
938
  if (req.signal?.aborted === true) {
938
- throw new UserError(
939
- `vx/reapi: ${req.taskId}: the run stopped before its remote execution finished`,
940
- )
939
+ // Core aborts on the run's stop and on `exec.timeout`. A refusal
940
+ // read as a plain failure (exit 1, no key, not timed out), and the
941
+ // closed stream left the action running on its worker. The action
942
+ // is cancelled and the task ends as a killed local one does: 143,
943
+ // which core reports timed out when its timer fired.
944
+ if (operation !== '') await client.cancelOperation(operation).catch(() => undefined)
945
+ return {
946
+ exitCode: 143,
947
+ durationMs: Math.round((Bun.nanoseconds() - started) / 1e6),
948
+ stdout: '',
949
+ stderr: '',
950
+ violations: [],
951
+ signal: 'SIGTERM',
952
+ }
941
953
  }
942
954
  if (queued.signal.aborted) {
943
955
  // Best effort: a server without the service, or one that has lost
@@ -1407,9 +1419,19 @@ export async function materialiseOutputs(
1407
1419
  ...(req.outputs?.workspaceFiles ?? []),
1408
1420
  ].map((g) => normalizeGlob(g))
1409
1421
  const matchers = declared.map((g) => new Bun.Glob(g))
1422
+ // Core's restore gate: a `!` take-back, vx's own files and a
1423
+ // `node_modules` no glob names are no output either.
1424
+ const isOwn = restorableOutput(req.outputs?.files ?? [])
1425
+ const isWs = restorableOutput(req.outputs?.workspaceFiles ?? [], 'workspace')
1410
1426
  const isDeclared = (abs: string): boolean => {
1411
1427
  const rel = toPosix(path.relative(req.workspaceRoot, abs))
1412
- return declared.includes(rel) || matchers.some((m) => m.match(rel))
1428
+ const own =
1429
+ projectRel === ''
1430
+ ? rel
1431
+ : rel.startsWith(`${projectRel}/`)
1432
+ ? rel.slice(projectRel.length + 1)
1433
+ : undefined
1434
+ return (own !== undefined && isOwn(own)) || isWs(rel)
1413
1435
  }
1414
1436
  // A declared output, or a path under one a literal glob names whole.
1415
1437
  const underDeclared = (rel: string): boolean => {