@indigoai-us/hq-cloud 6.14.6 → 6.14.8

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.
Files changed (97) hide show
  1. package/dist/backup-prune.d.ts +68 -0
  2. package/dist/backup-prune.d.ts.map +1 -0
  3. package/dist/backup-prune.js +196 -0
  4. package/dist/backup-prune.js.map +1 -0
  5. package/dist/backup-prune.test.d.ts +2 -0
  6. package/dist/backup-prune.test.d.ts.map +1 -0
  7. package/dist/backup-prune.test.js +89 -0
  8. package/dist/backup-prune.test.js.map +1 -0
  9. package/dist/bin/backup-prune-runner.d.ts +3 -0
  10. package/dist/bin/backup-prune-runner.d.ts.map +1 -0
  11. package/dist/bin/backup-prune-runner.js +50 -0
  12. package/dist/bin/backup-prune-runner.js.map +1 -0
  13. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  14. package/dist/bin/sync-runner-watch-loop.js +28 -0
  15. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  16. package/dist/bin/sync-runner.d.ts +2 -0
  17. package/dist/bin/sync-runner.d.ts.map +1 -1
  18. package/dist/bin/sync-runner.js.map +1 -1
  19. package/dist/cli/reindex.d.ts.map +1 -1
  20. package/dist/cli/reindex.js +5 -3
  21. package/dist/cli/reindex.js.map +1 -1
  22. package/dist/cli/rescue-classify-ordering.test.js +105 -0
  23. package/dist/cli/rescue-classify-ordering.test.js.map +1 -1
  24. package/dist/cli/rescue-core.d.ts +7 -0
  25. package/dist/cli/rescue-core.d.ts.map +1 -1
  26. package/dist/cli/rescue-core.js +509 -282
  27. package/dist/cli/rescue-core.js.map +1 -1
  28. package/dist/cli/rescue-snapshot.d.ts +14 -0
  29. package/dist/cli/rescue-snapshot.d.ts.map +1 -0
  30. package/dist/cli/rescue-snapshot.js +39 -0
  31. package/dist/cli/rescue-snapshot.js.map +1 -0
  32. package/dist/cli/rescue-snapshot.test.d.ts +2 -0
  33. package/dist/cli/rescue-snapshot.test.d.ts.map +1 -0
  34. package/dist/cli/rescue-snapshot.test.js +46 -0
  35. package/dist/cli/rescue-snapshot.test.js.map +1 -0
  36. package/dist/cli/rescue.test.js +24 -0
  37. package/dist/cli/rescue.test.js.map +1 -1
  38. package/dist/cli/share.d.ts.map +1 -1
  39. package/dist/cli/share.js +12 -11
  40. package/dist/cli/share.js.map +1 -1
  41. package/dist/cli/sync.d.ts.map +1 -1
  42. package/dist/cli/sync.js +41 -6
  43. package/dist/cli/sync.js.map +1 -1
  44. package/dist/cli/sync.test.js +51 -0
  45. package/dist/cli/sync.test.js.map +1 -1
  46. package/dist/local-path-codec.d.ts +19 -0
  47. package/dist/local-path-codec.d.ts.map +1 -0
  48. package/dist/local-path-codec.js +69 -0
  49. package/dist/local-path-codec.js.map +1 -0
  50. package/dist/object-io.d.ts +19 -2
  51. package/dist/object-io.d.ts.map +1 -1
  52. package/dist/object-io.js +168 -32
  53. package/dist/object-io.js.map +1 -1
  54. package/dist/object-io.test.js +157 -1
  55. package/dist/object-io.test.js.map +1 -1
  56. package/dist/s3.d.ts +8 -0
  57. package/dist/s3.d.ts.map +1 -1
  58. package/dist/s3.js +52 -22
  59. package/dist/s3.js.map +1 -1
  60. package/dist/scope-shrink.d.ts.map +1 -1
  61. package/dist/scope-shrink.js +4 -3
  62. package/dist/scope-shrink.js.map +1 -1
  63. package/dist/signals/get.test.js +21 -1
  64. package/dist/signals/get.test.js.map +1 -1
  65. package/dist/signals/list.test.js +21 -1
  66. package/dist/signals/list.test.js.map +1 -1
  67. package/dist/sources/get.test.js +21 -1
  68. package/dist/sources/get.test.js.map +1 -1
  69. package/dist/sources/list.test.js +21 -1
  70. package/dist/sources/list.test.js.map +1 -1
  71. package/package.json +3 -2
  72. package/scripts/presign-transport-e2e.mjs +57 -10
  73. package/scripts/vault-rebaseline.sh +49 -1
  74. package/scripts/vault-rescue.sh +42 -1
  75. package/src/backup-prune.test.ts +98 -0
  76. package/src/backup-prune.ts +182 -0
  77. package/src/bin/backup-prune-runner.ts +33 -0
  78. package/src/bin/sync-runner-watch-loop.ts +18 -0
  79. package/src/bin/sync-runner.ts +2 -0
  80. package/src/cli/reindex.ts +5 -3
  81. package/src/cli/rescue-classify-ordering.test.ts +121 -0
  82. package/src/cli/rescue-core.ts +311 -89
  83. package/src/cli/rescue-snapshot.test.ts +57 -0
  84. package/src/cli/rescue-snapshot.ts +51 -0
  85. package/src/cli/rescue.test.ts +34 -0
  86. package/src/cli/share.ts +12 -11
  87. package/src/cli/sync.test.ts +62 -0
  88. package/src/cli/sync.ts +51 -7
  89. package/src/local-path-codec.ts +95 -0
  90. package/src/object-io.test.ts +175 -0
  91. package/src/object-io.ts +213 -32
  92. package/src/s3.ts +61 -12
  93. package/src/scope-shrink.ts +4 -3
  94. package/src/signals/get.test.ts +26 -2
  95. package/src/signals/list.test.ts +26 -2
  96. package/src/sources/get.test.ts +26 -2
  97. package/src/sources/list.test.ts +26 -2
@@ -369,4 +369,125 @@ exec ${JSON.stringify(realGit)} "$@"
369
369
  expect(lexists(link)).toBe(true);
370
370
  expect(fs.existsSync(path.join(hqRoot, "core/a.md"))).toBe(true);
371
371
  });
372
+
373
+ it("fails with a typed state-change error when reindex replaces a classified symlink before apply", () => {
374
+ const hqRoot = makeHqRoot();
375
+ const target = path.join(hqRoot, "personal/skills/foreman/tests");
376
+ fs.mkdirSync(target, { recursive: true });
377
+ const link = path.join(hqRoot, ".claude/skills/personal:foreman/tests");
378
+ fs.mkdirSync(path.dirname(link), { recursive: true });
379
+ fs.symlinkSync("../../../personal/skills/foreman/tests", link);
380
+
381
+ const args = [
382
+ "--hq-root", hqRoot,
383
+ "--source", "test/repo",
384
+ "--ref", "main",
385
+ "--floor-sha", floorSha,
386
+ "--yes",
387
+ "--no-backup",
388
+ ];
389
+ const r = runRescueCapture(args, {
390
+ ...baseEnv,
391
+ HQ_RESCUE_FAULT_BEFORE_APPLY_REL: ".claude/skills/personal:foreman/tests",
392
+ HQ_RESCUE_FAULT_BEFORE_APPLY_KIND: "directory",
393
+ });
394
+ const out = `${r.stdout}\n${r.stderr}\n${String(r.threw ?? "")}`;
395
+
396
+ expect(r.threw, out).toBeInstanceOf(Error);
397
+ expect(out).toContain("changed after classification");
398
+ expect(out).toContain("expected symlink, found directory");
399
+ expect(out).not.toContain("EISDIR");
400
+ expect(fs.readFileSync(path.join(hqRoot, "core/a.md"), "utf-8")).toBe("v1\n");
401
+ });
402
+
403
+ it("keeps the full default wipe set out of worktrees and omits transient build state from the snapshot", () => {
404
+ const hqRoot = makeHqRoot();
405
+ const backupRoot = path.join(workDir, `backups-${caseSeq}`);
406
+ const writeTransient = (rel: string) => {
407
+ const dest = path.join(hqRoot, rel, "large.bin");
408
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
409
+ fs.writeFileSync(dest, "reproducible\n");
410
+ };
411
+ for (const rel of [
412
+ "worktrees/repo",
413
+ ".worktrees/repo",
414
+ ".sst-sandbox-home/runtime",
415
+ ".tmp-codex-asar/cache",
416
+ ".claude/worktrees/agent/repo",
417
+ ".claude/skills/demo/node_modules/pkg",
418
+ ".claude/skills/demo/.pnpm-store/v3",
419
+ ".claude/skills/demo/.sst/build",
420
+ ".claude/skills/demo/.next/cache",
421
+ ".claude/skills/demo/target/debug",
422
+ ]) {
423
+ writeTransient(rel);
424
+ }
425
+
426
+ const r = runRescueCapture(
427
+ [
428
+ "--hq-root", hqRoot,
429
+ "--source", "test/repo",
430
+ "--ref", "main",
431
+ "--floor-sha", floorSha,
432
+ "--backup-dir", backupRoot,
433
+ "--yes",
434
+ ],
435
+ baseEnv,
436
+ );
437
+ const out = `${r.stdout}\n${r.stderr}\n${String(r.threw ?? "")}`;
438
+
439
+ expect(r.threw, out).toBeUndefined();
440
+ expect(r.status, out).toBe(0);
441
+ for (const rel of ["worktrees", ".worktrees", ".sst-sandbox-home", ".tmp-codex-asar"]) {
442
+ expect(fs.existsSync(path.join(hqRoot, rel, "repo", "large.bin")) ||
443
+ fs.existsSync(path.join(hqRoot, rel, "runtime", "large.bin")) ||
444
+ fs.existsSync(path.join(hqRoot, rel, "cache", "large.bin")), rel).toBe(true);
445
+ }
446
+
447
+ const snapshots = fs.readdirSync(backupRoot).filter((name) => name.startsWith("pre-update-"));
448
+ expect(snapshots).toHaveLength(1);
449
+ const snapshot = path.join(backupRoot, snapshots[0]);
450
+ expect(fs.existsSync(path.join(snapshot, "core/a.md"))).toBe(true);
451
+ expect(fs.existsSync(path.join(snapshot, "RECOVERY.md"))).toBe(true);
452
+ for (const rel of [
453
+ "worktrees",
454
+ ".worktrees",
455
+ ".sst-sandbox-home",
456
+ ".tmp-codex-asar",
457
+ ".claude/worktrees",
458
+ ".claude/skills/demo/node_modules",
459
+ ".claude/skills/demo/.pnpm-store",
460
+ ".claude/skills/demo/.sst",
461
+ ".claude/skills/demo/.next",
462
+ ".claude/skills/demo/target",
463
+ ]) {
464
+ expect(lexists(path.join(snapshot, rel)), `snapshot unexpectedly contains ${rel}`).toBe(false);
465
+ }
466
+ });
467
+
468
+ it("dry-run never allocates or prunes snapshots", () => {
469
+ const hqRoot = makeHqRoot();
470
+ const backupRoot = path.join(workDir, `dry-backups-${caseSeq}`);
471
+ const existing = path.join(backupRoot, "pre-update-existing");
472
+ fs.mkdirSync(existing, { recursive: true });
473
+ fs.writeFileSync(path.join(existing, "keep.txt"), "do not prune\n");
474
+
475
+ const r = runRescueCapture(
476
+ [
477
+ "--hq-root", hqRoot,
478
+ "--source", "test/repo",
479
+ "--ref", "main",
480
+ "--floor-sha", floorSha,
481
+ "--backup-dir", backupRoot,
482
+ "--dry-run",
483
+ ],
484
+ baseEnv,
485
+ );
486
+ const out = `${r.stdout}\n${r.stderr}\n${String(r.threw ?? "")}`;
487
+
488
+ expect(r.threw, out).toBeUndefined();
489
+ expect(r.status, out).toBe(0);
490
+ expect(fs.readdirSync(backupRoot)).toEqual(["pre-update-existing"]);
491
+ expect(fs.readFileSync(path.join(existing, "keep.txt"), "utf-8")).toBe("do not prune\n");
492
+ });
372
493
  });