@vzn/vx 0.0.258 → 0.0.259

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.258",
3
+ "version": "0.0.259",
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.258",
21
- "@vzn/vx-linux-arm64": "0.0.258",
22
- "@vzn/vx-darwin-x64": "0.0.258",
23
- "@vzn/vx-darwin-arm64": "0.0.258"
20
+ "@vzn/vx-linux-x64": "0.0.259",
21
+ "@vzn/vx-linux-arm64": "0.0.259",
22
+ "@vzn/vx-darwin-x64": "0.0.259",
23
+ "@vzn/vx-darwin-arm64": "0.0.259"
24
24
  },
25
25
  "dependencies": {
26
26
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -359,8 +359,8 @@ export interface WhyDidThisRerun {
359
359
  function unchangedKeyNote(
360
360
  db: Database,
361
361
  runId: string,
362
- this_: { hash: string; cacheHit: number | null; startedAt: number },
363
- prev: { status: string },
362
+ this_: { hash: string; status: string; cacheHit: number | null; startedAt: number },
363
+ prev: { status: string; cacheHit: number | null; runId: string | null },
364
364
  ): string {
365
365
  if (this_.cacheHit === null) {
366
366
  return 'cache key unchanged — this run recorded no cache outcome, so whether it re-ran is unknown'
@@ -383,6 +383,24 @@ function unchangedKeyNote(
383
383
  at: number
384
384
  } | null
385
385
  )?.at
386
+ // Both runs executed the task and succeeded with the cache writable, no
387
+ // entry holds the key, and each ran beside a failure: the continue-taint
388
+ // (admission.ts), which runs a task downstream of a failure and never
389
+ // saves it. Blaming `--no-cache` / `--force` named a flag nobody passed.
390
+ if (createdAt === undefined && this_.status === 'success' && prev.status === 'success') {
391
+ const failedWithWrites = (id: string | null): number => {
392
+ if (id === null) return 0
393
+ const row = db
394
+ .query('SELECT cache_policy AS p, failed_count AS f FROM invocations WHERE run_id = ?')
395
+ .get(id) as { p: string; f: number } | null
396
+ const writes = row?.p.split(',').some((axis) => axis === 'lW' || axis === 'rW') === true
397
+ return writes ? (row?.f ?? 0) : 0
398
+ }
399
+ const now = failedWithWrites(runId)
400
+ if (prev.cacheHit === 0 && now > 0 && failedWithWrites(prev.runId) > 0) {
401
+ return `cache key unchanged — neither run saved it: each ran beside a failed task (${now} failed in this one), and a task run past a failed dependency (--continue) is never cached`
402
+ }
403
+ }
386
404
  if (createdAt !== undefined && createdAt >= this_.startedAt) {
387
405
  return 'cache key unchanged — no entry for this key was in the cache when it ran (pruned or evicted), so it executed and saved one'
388
406
  }
@@ -436,12 +454,18 @@ export function whyDidThisRerun(db: Database, runId: string, taskId: string): Wh
436
454
  // a key — a statement about inputs, made from no evidence.
437
455
  const prev = db
438
456
  .query(
439
- `SELECT hash, status, cache_hit AS cacheHit, started_at AS startedAt
457
+ `SELECT hash, status, cache_hit AS cacheHit, started_at AS startedAt, run_id AS runId
440
458
  FROM runs WHERE project = ? AND task = ? AND id < ? AND ${KEYED_RUNS_SQL}
441
459
  ORDER BY id DESC LIMIT 1`,
442
460
  )
443
461
  .get(project, task, this_.id) as
444
- | { hash: string; status: string; cacheHit: number | null; startedAt: number }
462
+ | {
463
+ hash: string
464
+ status: string
465
+ cacheHit: number | null
466
+ startedAt: number
467
+ runId: string | null
468
+ }
445
469
  | undefined
446
470
  // …and this run must have one too, or there is nothing to compare.
447
471
  const noKey = this_.hash === ''
@@ -457,7 +481,12 @@ export function whyDidThisRerun(db: Database, runId: string, taskId: string): Wh
457
481
  startedAt: this_.startedAt,
458
482
  },
459
483
  previousRun: prev
460
- ? { ...prev, cacheHit: prev.cacheHit === null ? null : Boolean(prev.cacheHit) }
484
+ ? {
485
+ hash: prev.hash,
486
+ status: prev.status,
487
+ cacheHit: prev.cacheHit === null ? null : Boolean(prev.cacheHit),
488
+ startedAt: prev.startedAt,
489
+ }
461
490
  : null,
462
491
  hashChanged: prev && !noKey ? prev.hash !== this_.hash : null,
463
492
  note: noKey