@indigoai-us/hq-cloud 6.18.44-alpha.8 → 6.18.44
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/dist/bin/sync-runner-planning.d.ts +12 -0
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +18 -0
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +18 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +75 -6
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +22 -1
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +33 -4
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/cli/conflict.d.ts.map +1 -1
- package/dist/cli/conflict.js +2 -1
- package/dist/cli/conflict.js.map +1 -1
- package/dist/cli/rescue-core.d.ts +6 -0
- package/dist/cli/rescue-core.d.ts.map +1 -1
- package/dist/cli/rescue-core.js +10 -1
- package/dist/cli/rescue-core.js.map +1 -1
- package/dist/cli/rescue-windows-test-harness.d.ts +19 -0
- package/dist/cli/rescue-windows-test-harness.d.ts.map +1 -0
- package/dist/cli/rescue-windows-test-harness.js +443 -0
- package/dist/cli/rescue-windows-test-harness.js.map +1 -0
- package/dist/company-resolver.d.ts +22 -0
- package/dist/company-resolver.d.ts.map +1 -1
- package/dist/company-resolver.js +1 -1
- package/dist/company-resolver.js.map +1 -1
- package/dist/ignore.d.ts +4 -1
- package/dist/ignore.d.ts.map +1 -1
- package/dist/ignore.js +10 -12
- package/dist/ignore.js.map +1 -1
- package/dist/journal-snapshot-decoder.js +15 -2
- package/dist/journal-snapshot-decoder.js.map +1 -1
- package/dist/sync/durable-apply.d.ts +2 -0
- package/dist/sync/durable-apply.d.ts.map +1 -1
- package/dist/sync/durable-apply.js +9 -12
- package/dist/sync/durable-apply.js.map +1 -1
- package/dist/sync/fsync-compat.d.ts +13 -0
- package/dist/sync/fsync-compat.d.ts.map +1 -0
- package/dist/sync/fsync-compat.js +33 -0
- package/dist/sync/fsync-compat.js.map +1 -0
- package/dist/sync/multipart-uploader.d.ts.map +1 -1
- package/dist/sync/multipart-uploader.js +2 -1
- package/dist/sync/multipart-uploader.js.map +1 -1
- package/dist/sync/scope-inventory-client.d.ts.map +1 -1
- package/dist/sync/scope-inventory-client.js +7 -2
- package/dist/sync/scope-inventory-client.js.map +1 -1
- package/dist/telemetry.d.ts +31 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +177 -17
- package/dist/telemetry.js.map +1 -1
- package/dist/usage-company-fallback.d.ts +104 -0
- package/dist/usage-company-fallback.d.ts.map +1 -0
- package/dist/usage-company-fallback.js +599 -0
- package/dist/usage-company-fallback.js.map +1 -0
- package/dist/watch-owner-lease.d.ts +3 -0
- package/dist/watch-owner-lease.d.ts.map +1 -1
- package/dist/watch-owner-lease.js +14 -3
- package/dist/watch-owner-lease.js.map +1 -1
- package/package.json +2 -2
- package/dist/active-company.test.d.ts +0 -2
- package/dist/active-company.test.d.ts.map +0 -1
- package/dist/active-company.test.js +0 -149
- package/dist/active-company.test.js.map +0 -1
- package/dist/agent-codex-instructions.test.d.ts +0 -2
- package/dist/agent-codex-instructions.test.d.ts.map +0 -1
- package/dist/agent-codex-instructions.test.js +0 -271
- package/dist/agent-codex-instructions.test.js.map +0 -1
- package/dist/backup-prune.test.d.ts +0 -2
- package/dist/backup-prune.test.d.ts.map +0 -1
- package/dist/backup-prune.test.js +0 -154
- package/dist/backup-prune.test.js.map +0 -1
- package/dist/bandwidth.test.d.ts +0 -2
- package/dist/bandwidth.test.d.ts.map +0 -1
- package/dist/bandwidth.test.js +0 -342
- package/dist/bandwidth.test.js.map +0 -1
- package/dist/best-effort-error.test.d.ts +0 -2
- package/dist/best-effort-error.test.d.ts.map +0 -1
- package/dist/best-effort-error.test.js +0 -54
- package/dist/best-effort-error.test.js.map +0 -1
- package/dist/bin/area-ledger-migration.test.d.ts +0 -2
- package/dist/bin/area-ledger-migration.test.d.ts.map +0 -1
- package/dist/bin/area-ledger-migration.test.js +0 -410
- package/dist/bin/area-ledger-migration.test.js.map +0 -1
- package/dist/bin/backup-prune-runner.test.d.ts +0 -2
- package/dist/bin/backup-prune-runner.test.d.ts.map +0 -1
- package/dist/bin/backup-prune-runner.test.js +0 -22
- package/dist/bin/backup-prune-runner.test.js.map +0 -1
- package/dist/bin/journal-repair.test.d.ts +0 -2
- package/dist/bin/journal-repair.test.d.ts.map +0 -1
- package/dist/bin/journal-repair.test.js +0 -53
- package/dist/bin/journal-repair.test.js.map +0 -1
- package/dist/bin/layout-compatibility.test.d.ts +0 -2
- package/dist/bin/layout-compatibility.test.d.ts.map +0 -1
- package/dist/bin/layout-compatibility.test.js +0 -87
- package/dist/bin/layout-compatibility.test.js.map +0 -1
- package/dist/bin/outpost-heartbeat.test.d.ts +0 -7
- package/dist/bin/outpost-heartbeat.test.d.ts.map +0 -1
- package/dist/bin/outpost-heartbeat.test.js +0 -84
- package/dist/bin/outpost-heartbeat.test.js.map +0 -1
- package/dist/bin/outpost-session-host.test.d.ts +0 -7
- package/dist/bin/outpost-session-host.test.d.ts.map +0 -1
- package/dist/bin/outpost-session-host.test.js +0 -52
- package/dist/bin/outpost-session-host.test.js.map +0 -1
- package/dist/bin/sync-mutation.test.d.ts +0 -2
- package/dist/bin/sync-mutation.test.d.ts.map +0 -1
- package/dist/bin/sync-mutation.test.js +0 -64
- package/dist/bin/sync-mutation.test.js.map +0 -1
- package/dist/bin/sync-runner-args.test.d.ts +0 -2
- package/dist/bin/sync-runner-args.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-args.test.js +0 -82
- package/dist/bin/sync-runner-args.test.js.map +0 -1
- package/dist/bin/sync-runner-auth-wait.test.d.ts +0 -2
- package/dist/bin/sync-runner-auth-wait.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-auth-wait.test.js +0 -406
- package/dist/bin/sync-runner-auth-wait.test.js.map +0 -1
- package/dist/bin/sync-runner-backoff.regression.test.d.ts +0 -29
- package/dist/bin/sync-runner-backoff.regression.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-backoff.regression.test.js +0 -224
- package/dist/bin/sync-runner-backoff.regression.test.js.map +0 -1
- package/dist/bin/sync-runner-company.test.d.ts +0 -2
- package/dist/bin/sync-runner-company.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-company.test.js +0 -2439
- package/dist/bin/sync-runner-company.test.js.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts +0 -2
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js +0 -648
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts +0 -2
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js +0 -329
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js.map +0 -1
- package/dist/bin/sync-runner-events.test.d.ts +0 -2
- package/dist/bin/sync-runner-events.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-events.test.js +0 -364
- package/dist/bin/sync-runner-events.test.js.map +0 -1
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts +0 -2
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-heap-telemetry.test.js +0 -1966
- package/dist/bin/sync-runner-heap-telemetry.test.js.map +0 -1
- package/dist/bin/sync-runner-manifest.test.d.ts +0 -12
- package/dist/bin/sync-runner-manifest.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-manifest.test.js +0 -921
- package/dist/bin/sync-runner-manifest.test.js.map +0 -1
- package/dist/bin/sync-runner-planning.test.d.ts +0 -2
- package/dist/bin/sync-runner-planning.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-planning.test.js +0 -448
- package/dist/bin/sync-runner-planning.test.js.map +0 -1
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts +0 -2
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-post-sync-flags.test.js +0 -64
- package/dist/bin/sync-runner-post-sync-flags.test.js.map +0 -1
- package/dist/bin/sync-runner-publish-expansion.test.d.ts +0 -2
- package/dist/bin/sync-runner-publish-expansion.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-publish-expansion.test.js +0 -54
- package/dist/bin/sync-runner-publish-expansion.test.js.map +0 -1
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts +0 -2
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js +0 -379
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js.map +0 -1
- package/dist/bin/sync-runner-rollup.test.d.ts +0 -2
- package/dist/bin/sync-runner-rollup.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-rollup.test.js +0 -24
- package/dist/bin/sync-runner-rollup.test.js.map +0 -1
- package/dist/bin/sync-runner-watch-loop.test.d.ts +0 -2
- package/dist/bin/sync-runner-watch-loop.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-watch-loop.test.js +0 -734
- package/dist/bin/sync-runner-watch-loop.test.js.map +0 -1
- package/dist/bin/sync-runner-watch-routes.test.d.ts +0 -2
- package/dist/bin/sync-runner-watch-routes.test.d.ts.map +0 -1
- package/dist/bin/sync-runner-watch-routes.test.js +0 -181
- package/dist/bin/sync-runner-watch-routes.test.js.map +0 -1
- package/dist/bin/sync-runner.test.d.ts +0 -10
- package/dist/bin/sync-runner.test.d.ts.map +0 -1
- package/dist/bin/sync-runner.test.js +0 -18984
- package/dist/bin/sync-runner.test.js.map +0 -1
- package/dist/cli/case-alias.test.d.ts +0 -2
- package/dist/cli/case-alias.test.d.ts.map +0 -1
- package/dist/cli/case-alias.test.js +0 -96
- package/dist/cli/case-alias.test.js.map +0 -1
- package/dist/cli/conflict-recovery.test.d.ts +0 -2
- package/dist/cli/conflict-recovery.test.d.ts.map +0 -1
- package/dist/cli/conflict-recovery.test.js +0 -201
- package/dist/cli/conflict-recovery.test.js.map +0 -1
- package/dist/cli/conflict-winner.test.d.ts +0 -7
- package/dist/cli/conflict-winner.test.d.ts.map +0 -1
- package/dist/cli/conflict-winner.test.js +0 -98
- package/dist/cli/conflict-winner.test.js.map +0 -1
- package/dist/cli/doctor.test.d.ts +0 -13
- package/dist/cli/doctor.test.d.ts.map +0 -1
- package/dist/cli/doctor.test.js +0 -607
- package/dist/cli/doctor.test.js.map +0 -1
- package/dist/cli/invite.test.d.ts +0 -5
- package/dist/cli/invite.test.d.ts.map +0 -1
- package/dist/cli/invite.test.js +0 -178
- package/dist/cli/invite.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner-regressions.test.js +0 -300
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +0 -1
- package/dist/cli/onepass-pull-planner.test.d.ts +0 -2
- package/dist/cli/onepass-pull-planner.test.d.ts.map +0 -1
- package/dist/cli/onepass-pull-planner.test.js +0 -266
- package/dist/cli/onepass-pull-planner.test.js.map +0 -1
- package/dist/cli/push-scan-exclusions.test.d.ts +0 -2
- package/dist/cli/push-scan-exclusions.test.d.ts.map +0 -1
- package/dist/cli/push-scan-exclusions.test.js +0 -99
- package/dist/cli/push-scan-exclusions.test.js.map +0 -1
- package/dist/cli/reindex-knowledge.test.d.ts +0 -12
- package/dist/cli/reindex-knowledge.test.d.ts.map +0 -1
- package/dist/cli/reindex-knowledge.test.js +0 -260
- package/dist/cli/reindex-knowledge.test.js.map +0 -1
- package/dist/cli/reindex.test.d.ts +0 -11
- package/dist/cli/reindex.test.d.ts.map +0 -1
- package/dist/cli/reindex.test.js +0 -811
- package/dist/cli/reindex.test.js.map +0 -1
- package/dist/cli/rescue-breaker.test.d.ts +0 -2
- package/dist/cli/rescue-breaker.test.d.ts.map +0 -1
- package/dist/cli/rescue-breaker.test.js +0 -812
- package/dist/cli/rescue-breaker.test.js.map +0 -1
- package/dist/cli/rescue-classify-ordering.test.d.ts +0 -2
- package/dist/cli/rescue-classify-ordering.test.d.ts.map +0 -1
- package/dist/cli/rescue-classify-ordering.test.js +0 -500
- package/dist/cli/rescue-classify-ordering.test.js.map +0 -1
- package/dist/cli/rescue-clone-diagnostics.test.d.ts +0 -2
- package/dist/cli/rescue-clone-diagnostics.test.d.ts.map +0 -1
- package/dist/cli/rescue-clone-diagnostics.test.js +0 -101
- package/dist/cli/rescue-clone-diagnostics.test.js.map +0 -1
- package/dist/cli/rescue-clone-network-retry.test.d.ts +0 -2
- package/dist/cli/rescue-clone-network-retry.test.d.ts.map +0 -1
- package/dist/cli/rescue-clone-network-retry.test.js +0 -415
- package/dist/cli/rescue-clone-network-retry.test.js.map +0 -1
- package/dist/cli/rescue-core-stamp.test.d.ts +0 -2
- package/dist/cli/rescue-core-stamp.test.d.ts.map +0 -1
- package/dist/cli/rescue-core-stamp.test.js +0 -364
- package/dist/cli/rescue-core-stamp.test.js.map +0 -1
- package/dist/cli/rescue-drift-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-drift-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-drift-reconcile.test.js +0 -162
- package/dist/cli/rescue-drift-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts +0 -2
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts.map +0 -1
- package/dist/cli/rescue-drop-dir-symlink.test.js +0 -255
- package/dist/cli/rescue-drop-dir-symlink.test.js.map +0 -1
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts +0 -2
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts.map +0 -1
- package/dist/cli/rescue-exec-bit-preserve.test.js +0 -177
- package/dist/cli/rescue-exec-bit-preserve.test.js.map +0 -1
- package/dist/cli/rescue-hq-root-guard.test.d.ts +0 -2
- package/dist/cli/rescue-hq-root-guard.test.d.ts.map +0 -1
- package/dist/cli/rescue-hq-root-guard.test.js +0 -210
- package/dist/cli/rescue-hq-root-guard.test.js.map +0 -1
- package/dist/cli/rescue-journal-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-journal-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-journal-reconcile.test.js +0 -186
- package/dist/cli/rescue-journal-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-keep-local-ignore.test.d.ts +0 -2
- package/dist/cli/rescue-keep-local-ignore.test.d.ts.map +0 -1
- package/dist/cli/rescue-keep-local-ignore.test.js +0 -315
- package/dist/cli/rescue-keep-local-ignore.test.js.map +0 -1
- package/dist/cli/rescue-move.test.d.ts +0 -2
- package/dist/cli/rescue-move.test.d.ts.map +0 -1
- package/dist/cli/rescue-move.test.js +0 -166
- package/dist/cli/rescue-move.test.js.map +0 -1
- package/dist/cli/rescue-mtime-preserve.test.d.ts +0 -2
- package/dist/cli/rescue-mtime-preserve.test.d.ts.map +0 -1
- package/dist/cli/rescue-mtime-preserve.test.js +0 -186
- package/dist/cli/rescue-mtime-preserve.test.js.map +0 -1
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts +0 -2
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts.map +0 -1
- package/dist/cli/rescue-preserve-copy-symlink.test.js +0 -483
- package/dist/cli/rescue-preserve-copy-symlink.test.js.map +0 -1
- package/dist/cli/rescue-realpath.test.d.ts +0 -2
- package/dist/cli/rescue-realpath.test.d.ts.map +0 -1
- package/dist/cli/rescue-realpath.test.js +0 -109
- package/dist/cli/rescue-realpath.test.js.map +0 -1
- package/dist/cli/rescue-restore-flag.test.d.ts +0 -2
- package/dist/cli/rescue-restore-flag.test.d.ts.map +0 -1
- package/dist/cli/rescue-restore-flag.test.js +0 -82
- package/dist/cli/rescue-restore-flag.test.js.map +0 -1
- package/dist/cli/rescue-rsync-preflight.test.d.ts +0 -2
- package/dist/cli/rescue-rsync-preflight.test.d.ts.map +0 -1
- package/dist/cli/rescue-rsync-preflight.test.js +0 -579
- package/dist/cli/rescue-rsync-preflight.test.js.map +0 -1
- package/dist/cli/rescue-rsync-status.test.d.ts +0 -2
- package/dist/cli/rescue-rsync-status.test.d.ts.map +0 -1
- package/dist/cli/rescue-rsync-status.test.js +0 -406
- package/dist/cli/rescue-rsync-status.test.js.map +0 -1
- package/dist/cli/rescue-settings-reconcile.test.d.ts +0 -2
- package/dist/cli/rescue-settings-reconcile.test.d.ts.map +0 -1
- package/dist/cli/rescue-settings-reconcile.test.js +0 -610
- package/dist/cli/rescue-settings-reconcile.test.js.map +0 -1
- package/dist/cli/rescue-snapshot-copy.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot-copy.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot-copy.test.js +0 -790
- package/dist/cli/rescue-snapshot-copy.test.js.map +0 -1
- package/dist/cli/rescue-snapshot-recovery.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot-recovery.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot-recovery.test.js +0 -265
- package/dist/cli/rescue-snapshot-recovery.test.js.map +0 -1
- package/dist/cli/rescue-snapshot.test.d.ts +0 -2
- package/dist/cli/rescue-snapshot.test.d.ts.map +0 -1
- package/dist/cli/rescue-snapshot.test.js +0 -46
- package/dist/cli/rescue-snapshot.test.js.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.d.ts +0 -2
- package/dist/cli/rescue-source-switch-floor.test.d.ts.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.js +0 -247
- package/dist/cli/rescue-source-switch-floor.test.js.map +0 -1
- package/dist/cli/rescue-unchanged-delete.test.d.ts +0 -2
- package/dist/cli/rescue-unchanged-delete.test.d.ts.map +0 -1
- package/dist/cli/rescue-unchanged-delete.test.js +0 -305
- package/dist/cli/rescue-unchanged-delete.test.js.map +0 -1
- package/dist/cli/rescue.reindex.test.d.ts +0 -2
- package/dist/cli/rescue.reindex.test.d.ts.map +0 -1
- package/dist/cli/rescue.reindex.test.js +0 -72
- package/dist/cli/rescue.reindex.test.js.map +0 -1
- package/dist/cli/rescue.test.d.ts +0 -2
- package/dist/cli/rescue.test.d.ts.map +0 -1
- package/dist/cli/rescue.test.js +0 -127
- package/dist/cli/rescue.test.js.map +0 -1
- package/dist/cli/share-plan-limit-presign.test.d.ts +0 -2
- package/dist/cli/share-plan-limit-presign.test.d.ts.map +0 -1
- package/dist/cli/share-plan-limit-presign.test.js +0 -271
- package/dist/cli/share-plan-limit-presign.test.js.map +0 -1
- package/dist/cli/share-presign-transport.test.d.ts +0 -22
- package/dist/cli/share-presign-transport.test.d.ts.map +0 -1
- package/dist/cli/share-presign-transport.test.js +0 -388
- package/dist/cli/share-presign-transport.test.js.map +0 -1
- package/dist/cli/share.test.d.ts +0 -5
- package/dist/cli/share.test.d.ts.map +0 -1
- package/dist/cli/share.test.js +0 -12335
- package/dist/cli/share.test.js.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +0 -15
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +0 -1
- package/dist/cli/streaming-pull-planner.bench.test.js +0 -273
- package/dist/cli/streaming-pull-planner.bench.test.js.map +0 -1
- package/dist/cli/sync-scope.test.d.ts +0 -22
- package/dist/cli/sync-scope.test.d.ts.map +0 -1
- package/dist/cli/sync-scope.test.js +0 -903
- package/dist/cli/sync-scope.test.js.map +0 -1
- package/dist/cli/sync.test.d.ts +0 -5
- package/dist/cli/sync.test.d.ts.map +0 -1
- package/dist/cli/sync.test.js +0 -9028
- package/dist/cli/sync.test.js.map +0 -1
- package/dist/cli/tombstones.test.d.ts +0 -2
- package/dist/cli/tombstones.test.d.ts.map +0 -1
- package/dist/cli/tombstones.test.js +0 -120
- package/dist/cli/tombstones.test.js.map +0 -1
- package/dist/cli/watch-event-push-conflict.test.d.ts +0 -25
- package/dist/cli/watch-event-push-conflict.test.d.ts.map +0 -1
- package/dist/cli/watch-event-push-conflict.test.js +0 -230
- package/dist/cli/watch-event-push-conflict.test.js.map +0 -1
- package/dist/client-info.test.d.ts +0 -11
- package/dist/client-info.test.d.ts.map +0 -1
- package/dist/client-info.test.js +0 -168
- package/dist/client-info.test.js.map +0 -1
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts +0 -11
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts.map +0 -1
- package/dist/cognito-auth-lock-no-hard-links.test.js +0 -76
- package/dist/cognito-auth-lock-no-hard-links.test.js.map +0 -1
- package/dist/cognito-auth.test.d.ts +0 -9
- package/dist/cognito-auth.test.d.ts.map +0 -1
- package/dist/cognito-auth.test.js +0 -745
- package/dist/cognito-auth.test.js.map +0 -1
- package/dist/company-resolver.test.d.ts +0 -7
- package/dist/company-resolver.test.d.ts.map +0 -1
- package/dist/company-resolver.test.js +0 -533
- package/dist/company-resolver.test.js.map +0 -1
- package/dist/company-slug.test.d.ts +0 -7
- package/dist/company-slug.test.d.ts.map +0 -1
- package/dist/company-slug.test.js +0 -43
- package/dist/company-slug.test.js.map +0 -1
- package/dist/company-vault-transport.test.d.ts +0 -12
- package/dist/company-vault-transport.test.d.ts.map +0 -1
- package/dist/company-vault-transport.test.js +0 -97
- package/dist/company-vault-transport.test.js.map +0 -1
- package/dist/context.test.d.ts +0 -7
- package/dist/context.test.d.ts.map +0 -1
- package/dist/context.test.js +0 -646
- package/dist/context.test.js.map +0 -1
- package/dist/entity-resolver.test.d.ts +0 -10
- package/dist/entity-resolver.test.d.ts.map +0 -1
- package/dist/entity-resolver.test.js +0 -244
- package/dist/entity-resolver.test.js.map +0 -1
- package/dist/getindigo-dead-refs-contract.test.d.ts +0 -2
- package/dist/getindigo-dead-refs-contract.test.d.ts.map +0 -1
- package/dist/getindigo-dead-refs-contract.test.js +0 -58
- package/dist/getindigo-dead-refs-contract.test.js.map +0 -1
- package/dist/hermetic-test-env.test.d.ts +0 -2
- package/dist/hermetic-test-env.test.d.ts.map +0 -1
- package/dist/hermetic-test-env.test.js +0 -61
- package/dist/hermetic-test-env.test.js.map +0 -1
- package/dist/hq-root-recovery.test.d.ts +0 -2
- package/dist/hq-root-recovery.test.d.ts.map +0 -1
- package/dist/hq-root-recovery.test.js +0 -65
- package/dist/hq-root-recovery.test.js.map +0 -1
- package/dist/ignore.test.d.ts +0 -10
- package/dist/ignore.test.d.ts.map +0 -1
- package/dist/ignore.test.js +0 -926
- package/dist/ignore.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -26
- package/dist/index.test.js.map +0 -1
- package/dist/journal-area-ledger-read-boundary.test.d.ts +0 -2
- package/dist/journal-area-ledger-read-boundary.test.d.ts.map +0 -1
- package/dist/journal-area-ledger-read-boundary.test.js +0 -420
- package/dist/journal-area-ledger-read-boundary.test.js.map +0 -1
- package/dist/journal-baseline.test.d.ts +0 -2
- package/dist/journal-baseline.test.d.ts.map +0 -1
- package/dist/journal-baseline.test.js +0 -218
- package/dist/journal-baseline.test.js.map +0 -1
- package/dist/journal-decode-window.test.d.ts +0 -2
- package/dist/journal-decode-window.test.d.ts.map +0 -1
- package/dist/journal-decode-window.test.js +0 -99
- package/dist/journal-decode-window.test.js.map +0 -1
- package/dist/journal-delta-writes.test.d.ts +0 -2
- package/dist/journal-delta-writes.test.d.ts.map +0 -1
- package/dist/journal-delta-writes.test.js +0 -159
- package/dist/journal-delta-writes.test.js.map +0 -1
- package/dist/journal-ledger-index.test.d.ts +0 -15
- package/dist/journal-ledger-index.test.d.ts.map +0 -1
- package/dist/journal-ledger-index.test.js +0 -269
- package/dist/journal-ledger-index.test.js.map +0 -1
- package/dist/journal-public-boundary.test.d.ts +0 -2
- package/dist/journal-public-boundary.test.d.ts.map +0 -1
- package/dist/journal-public-boundary.test.js +0 -216
- package/dist/journal-public-boundary.test.js.map +0 -1
- package/dist/journal-row-store.test.d.ts +0 -2
- package/dist/journal-row-store.test.d.ts.map +0 -1
- package/dist/journal-row-store.test.js +0 -729
- package/dist/journal-row-store.test.js.map +0 -1
- package/dist/journal-snapshot-memory-helpers.d.ts +0 -33
- package/dist/journal-snapshot-memory-helpers.d.ts.map +0 -1
- package/dist/journal-snapshot-memory-helpers.js +0 -212
- package/dist/journal-snapshot-memory-helpers.js.map +0 -1
- package/dist/journal-snapshot-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-memory.test.js +0 -47
- package/dist/journal-snapshot-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-memory.test.js +0 -24
- package/dist/journal-snapshot-v4-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-writer-memory.test.js +0 -76
- package/dist/journal-snapshot-v4-writer-memory.test.js.map +0 -1
- package/dist/journal-snapshot-v4-writer.test.d.ts +0 -2
- package/dist/journal-snapshot-v4-writer.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4-writer.test.js +0 -282
- package/dist/journal-snapshot-v4-writer.test.js.map +0 -1
- package/dist/journal-snapshot-v4.test.d.ts +0 -2
- package/dist/journal-snapshot-v4.test.d.ts.map +0 -1
- package/dist/journal-snapshot-v4.test.js +0 -281
- package/dist/journal-snapshot-v4.test.js.map +0 -1
- package/dist/journal-store.test.d.ts +0 -2
- package/dist/journal-store.test.d.ts.map +0 -1
- package/dist/journal-store.test.js +0 -1227
- package/dist/journal-store.test.js.map +0 -1
- package/dist/journal-streaming.heap.test.d.ts +0 -2
- package/dist/journal-streaming.heap.test.d.ts.map +0 -1
- package/dist/journal-streaming.heap.test.js +0 -190
- package/dist/journal-streaming.heap.test.js.map +0 -1
- package/dist/journal.test.d.ts +0 -9
- package/dist/journal.test.d.ts.map +0 -1
- package/dist/journal.test.js +0 -1074
- package/dist/journal.test.js.map +0 -1
- package/dist/kms10-etag-safe-pull.test.d.ts +0 -2
- package/dist/kms10-etag-safe-pull.test.d.ts.map +0 -1
- package/dist/kms10-etag-safe-pull.test.js +0 -53
- package/dist/kms10-etag-safe-pull.test.js.map +0 -1
- package/dist/lib/cloud-authoritative.test.d.ts +0 -2
- package/dist/lib/cloud-authoritative.test.d.ts.map +0 -1
- package/dist/lib/cloud-authoritative.test.js +0 -42
- package/dist/lib/cloud-authoritative.test.js.map +0 -1
- package/dist/lib/conflict-reconcile.test.d.ts +0 -7
- package/dist/lib/conflict-reconcile.test.d.ts.map +0 -1
- package/dist/lib/conflict-reconcile.test.js +0 -246
- package/dist/lib/conflict-reconcile.test.js.map +0 -1
- package/dist/lib/conflict.test.d.ts +0 -9
- package/dist/lib/conflict.test.d.ts.map +0 -1
- package/dist/lib/conflict.test.js +0 -340
- package/dist/lib/conflict.test.js.map +0 -1
- package/dist/lib/describe-error.test.d.ts +0 -2
- package/dist/lib/describe-error.test.d.ts.map +0 -1
- package/dist/lib/describe-error.test.js +0 -148
- package/dist/lib/describe-error.test.js.map +0 -1
- package/dist/lib/machine-id.test.d.ts +0 -8
- package/dist/lib/machine-id.test.d.ts.map +0 -1
- package/dist/lib/machine-id.test.js +0 -228
- package/dist/lib/machine-id.test.js.map +0 -1
- package/dist/lib/net-errors.test.d.ts +0 -2
- package/dist/lib/net-errors.test.d.ts.map +0 -1
- package/dist/lib/net-errors.test.js +0 -111
- package/dist/lib/net-errors.test.js.map +0 -1
- package/dist/lib/ontology-entity-meta.test.d.ts +0 -2
- package/dist/lib/ontology-entity-meta.test.d.ts.map +0 -1
- package/dist/lib/ontology-entity-meta.test.js +0 -79
- package/dist/lib/ontology-entity-meta.test.js.map +0 -1
- package/dist/lib/ontology-entity-push.test.d.ts +0 -2
- package/dist/lib/ontology-entity-push.test.d.ts.map +0 -1
- package/dist/lib/ontology-entity-push.test.js +0 -156
- package/dist/lib/ontology-entity-push.test.js.map +0 -1
- package/dist/lib/personal-connector-settings-sync.test.d.ts +0 -2
- package/dist/lib/personal-connector-settings-sync.test.d.ts.map +0 -1
- package/dist/lib/personal-connector-settings-sync.test.js +0 -34
- package/dist/lib/personal-connector-settings-sync.test.js.map +0 -1
- package/dist/lib/readlink-safe.test.d.ts +0 -2
- package/dist/lib/readlink-safe.test.d.ts.map +0 -1
- package/dist/lib/readlink-safe.test.js +0 -34
- package/dist/lib/readlink-safe.test.js.map +0 -1
- package/dist/lib/s3-content-checksum.test.d.ts +0 -2
- package/dist/lib/s3-content-checksum.test.d.ts.map +0 -1
- package/dist/lib/s3-content-checksum.test.js +0 -26
- package/dist/lib/s3-content-checksum.test.js.map +0 -1
- package/dist/lib/skill-register-landed-bytes.test.d.ts +0 -2
- package/dist/lib/skill-register-landed-bytes.test.d.ts.map +0 -1
- package/dist/lib/skill-register-landed-bytes.test.js +0 -83
- package/dist/lib/skill-register-landed-bytes.test.js.map +0 -1
- package/dist/local-path-codec.test.d.ts +0 -14
- package/dist/local-path-codec.test.d.ts.map +0 -1
- package/dist/local-path-codec.test.js +0 -122
- package/dist/local-path-codec.test.js.map +0 -1
- package/dist/machine-auth.test.d.ts +0 -14
- package/dist/machine-auth.test.d.ts.map +0 -1
- package/dist/machine-auth.test.js +0 -1482
- package/dist/machine-auth.test.js.map +0 -1
- package/dist/machine-token-cache-isolation.test.d.ts +0 -24
- package/dist/machine-token-cache-isolation.test.d.ts.map +0 -1
- package/dist/machine-token-cache-isolation.test.js +0 -284
- package/dist/machine-token-cache-isolation.test.js.map +0 -1
- package/dist/manifest/US-002.acceptance.test.d.ts +0 -11
- package/dist/manifest/US-002.acceptance.test.d.ts.map +0 -1
- package/dist/manifest/US-002.acceptance.test.js +0 -160
- package/dist/manifest/US-002.acceptance.test.js.map +0 -1
- package/dist/manifest/US-004.acceptance.test.d.ts +0 -12
- package/dist/manifest/US-004.acceptance.test.d.ts.map +0 -1
- package/dist/manifest/US-004.acceptance.test.js +0 -173
- package/dist/manifest/US-004.acceptance.test.js.map +0 -1
- package/dist/manifest/build-manifest-resident-parity.test.d.ts +0 -2
- package/dist/manifest/build-manifest-resident-parity.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest-resident-parity.test.js +0 -69
- package/dist/manifest/build-manifest-resident-parity.test.js.map +0 -1
- package/dist/manifest/build-manifest.bench.test.d.ts +0 -22
- package/dist/manifest/build-manifest.bench.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest.bench.test.js +0 -930
- package/dist/manifest/build-manifest.bench.test.js.map +0 -1
- package/dist/manifest/build-manifest.test.d.ts +0 -10
- package/dist/manifest/build-manifest.test.d.ts.map +0 -1
- package/dist/manifest/build-manifest.test.js +0 -1217
- package/dist/manifest/build-manifest.test.js.map +0 -1
- package/dist/manifest/contract.test.d.ts +0 -17
- package/dist/manifest/contract.test.d.ts.map +0 -1
- package/dist/manifest/contract.test.js +0 -346
- package/dist/manifest/contract.test.js.map +0 -1
- package/dist/manifest/import-graph.test.d.ts +0 -25
- package/dist/manifest/import-graph.test.d.ts.map +0 -1
- package/dist/manifest/import-graph.test.js +0 -120
- package/dist/manifest/import-graph.test.js.map +0 -1
- package/dist/manifest/ledger-shard-isolation.test.d.ts +0 -18
- package/dist/manifest/ledger-shard-isolation.test.d.ts.map +0 -1
- package/dist/manifest/ledger-shard-isolation.test.js +0 -153
- package/dist/manifest/ledger-shard-isolation.test.js.map +0 -1
- package/dist/manifest/snapshot-store.test.d.ts +0 -11
- package/dist/manifest/snapshot-store.test.d.ts.map +0 -1
- package/dist/manifest/snapshot-store.test.js +0 -206
- package/dist/manifest/snapshot-store.test.js.map +0 -1
- package/dist/manifest/upload-manifest.test.d.ts +0 -10
- package/dist/manifest/upload-manifest.test.d.ts.map +0 -1
- package/dist/manifest/upload-manifest.test.js +0 -1335
- package/dist/manifest/upload-manifest.test.js.map +0 -1
- package/dist/manifest-reconcile.test.d.ts +0 -2
- package/dist/manifest-reconcile.test.d.ts.map +0 -1
- package/dist/manifest-reconcile.test.js +0 -1029
- package/dist/manifest-reconcile.test.js.map +0 -1
- package/dist/object-io.test.d.ts +0 -11
- package/dist/object-io.test.d.ts.map +0 -1
- package/dist/object-io.test.js +0 -2376
- package/dist/object-io.test.js.map +0 -1
- package/dist/operation-lock.test.d.ts +0 -5
- package/dist/operation-lock.test.d.ts.map +0 -1
- package/dist/operation-lock.test.js +0 -796
- package/dist/operation-lock.test.js.map +0 -1
- package/dist/outcome-telemetry.test.d.ts +0 -9
- package/dist/outcome-telemetry.test.d.ts.map +0 -1
- package/dist/outcome-telemetry.test.js +0 -663
- package/dist/outcome-telemetry.test.js.map +0 -1
- package/dist/outposts/client.test.d.ts +0 -9
- package/dist/outposts/client.test.d.ts.map +0 -1
- package/dist/outposts/client.test.js +0 -415
- package/dist/outposts/client.test.js.map +0 -1
- package/dist/outposts/command.test.d.ts +0 -18
- package/dist/outposts/command.test.d.ts.map +0 -1
- package/dist/outposts/command.test.js +0 -1230
- package/dist/outposts/command.test.js.map +0 -1
- package/dist/outposts/replica-sync.test.d.ts +0 -2
- package/dist/outposts/replica-sync.test.d.ts.map +0 -1
- package/dist/outposts/replica-sync.test.js +0 -224
- package/dist/outposts/replica-sync.test.js.map +0 -1
- package/dist/outposts/self-deploy.test.d.ts +0 -2
- package/dist/outposts/self-deploy.test.d.ts.map +0 -1
- package/dist/outposts/self-deploy.test.js +0 -218
- package/dist/outposts/self-deploy.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-bounds.test.d.ts +0 -25
- package/dist/outposts/session-heartbeat-bounds.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-bounds.test.js +0 -156
- package/dist/outposts/session-heartbeat-bounds.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-guard.test.d.ts +0 -16
- package/dist/outposts/session-heartbeat-guard.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-guard.test.js +0 -88
- package/dist/outposts/session-heartbeat-guard.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-publisher.test.d.ts +0 -10
- package/dist/outposts/session-heartbeat-publisher.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-publisher.test.js +0 -153
- package/dist/outposts/session-heartbeat-publisher.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts +0 -18
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-retain-guard.test.js +0 -106
- package/dist/outposts/session-heartbeat-retain-guard.test.js.map +0 -1
- package/dist/outposts/session-heartbeat-scan.test.d.ts +0 -20
- package/dist/outposts/session-heartbeat-scan.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat-scan.test.js +0 -241
- package/dist/outposts/session-heartbeat-scan.test.js.map +0 -1
- package/dist/outposts/session-heartbeat.test.d.ts +0 -11
- package/dist/outposts/session-heartbeat.test.d.ts.map +0 -1
- package/dist/outposts/session-heartbeat.test.js +0 -370
- package/dist/outposts/session-heartbeat.test.js.map +0 -1
- package/dist/outposts/session-host-auth.test.d.ts +0 -16
- package/dist/outposts/session-host-auth.test.d.ts.map +0 -1
- package/dist/outposts/session-host-auth.test.js +0 -284
- package/dist/outposts/session-host-auth.test.js.map +0 -1
- package/dist/outposts/session-host-command.test.d.ts +0 -10
- package/dist/outposts/session-host-command.test.d.ts.map +0 -1
- package/dist/outposts/session-host-command.test.js +0 -180
- package/dist/outposts/session-host-command.test.js.map +0 -1
- package/dist/outposts/session-host-connection.test.d.ts +0 -18
- package/dist/outposts/session-host-connection.test.d.ts.map +0 -1
- package/dist/outposts/session-host-connection.test.js +0 -392
- package/dist/outposts/session-host-connection.test.js.map +0 -1
- package/dist/outposts/session-host-fakes.d.ts +0 -61
- package/dist/outposts/session-host-fakes.d.ts.map +0 -1
- package/dist/outposts/session-host-fakes.js +0 -115
- package/dist/outposts/session-host-fakes.js.map +0 -1
- package/dist/outposts/session-host-ndjson.test.d.ts +0 -11
- package/dist/outposts/session-host-ndjson.test.d.ts.map +0 -1
- package/dist/outposts/session-host-ndjson.test.js +0 -73
- package/dist/outposts/session-host-ndjson.test.js.map +0 -1
- package/dist/outposts/session-host-protocol.test.d.ts +0 -15
- package/dist/outposts/session-host-protocol.test.d.ts.map +0 -1
- package/dist/outposts/session-host-protocol.test.js +0 -0
- package/dist/outposts/session-host-protocol.test.js.map +0 -1
- package/dist/outposts/session-host-server.test.d.ts +0 -10
- package/dist/outposts/session-host-server.test.d.ts.map +0 -1
- package/dist/outposts/session-host-server.test.js +0 -118
- package/dist/outposts/session-host-server.test.js.map +0 -1
- package/dist/outposts/session-host-sessions.test.d.ts +0 -18
- package/dist/outposts/session-host-sessions.test.d.ts.map +0 -1
- package/dist/outposts/session-host-sessions.test.js +0 -439
- package/dist/outposts/session-host-sessions.test.js.map +0 -1
- package/dist/outposts/terminal.test.d.ts +0 -2
- package/dist/outposts/terminal.test.d.ts.map +0 -1
- package/dist/outposts/terminal.test.js +0 -146
- package/dist/outposts/terminal.test.js.map +0 -1
- package/dist/outposts/transport.test.d.ts +0 -10
- package/dist/outposts/transport.test.d.ts.map +0 -1
- package/dist/outposts/transport.test.js +0 -205
- package/dist/outposts/transport.test.js.map +0 -1
- package/dist/packed-journal-phase2.test.d.ts +0 -2
- package/dist/packed-journal-phase2.test.d.ts.map +0 -1
- package/dist/packed-journal-phase2.test.js +0 -273
- package/dist/packed-journal-phase2.test.js.map +0 -1
- package/dist/path-ancestors.test.d.ts +0 -2
- package/dist/path-ancestors.test.d.ts.map +0 -1
- package/dist/path-ancestors.test.js +0 -21
- package/dist/path-ancestors.test.js.map +0 -1
- package/dist/personal-vault-exclusions.test.d.ts +0 -22
- package/dist/personal-vault-exclusions.test.d.ts.map +0 -1
- package/dist/personal-vault-exclusions.test.js +0 -294
- package/dist/personal-vault-exclusions.test.js.map +0 -1
- package/dist/personal-vault.test.d.ts +0 -18
- package/dist/personal-vault.test.d.ts.map +0 -1
- package/dist/personal-vault.test.js +0 -1099
- package/dist/personal-vault.test.js.map +0 -1
- package/dist/plan-limit-pause.test.d.ts +0 -2
- package/dist/plan-limit-pause.test.d.ts.map +0 -1
- package/dist/plan-limit-pause.test.js +0 -150
- package/dist/plan-limit-pause.test.js.map +0 -1
- package/dist/plan-limit.fixtures.d.ts +0 -34
- package/dist/plan-limit.fixtures.d.ts.map +0 -1
- package/dist/plan-limit.fixtures.js +0 -96
- package/dist/plan-limit.fixtures.js.map +0 -1
- package/dist/plan-limit.test.d.ts +0 -2
- package/dist/plan-limit.test.d.ts.map +0 -1
- package/dist/plan-limit.test.js +0 -132
- package/dist/plan-limit.test.js.map +0 -1
- package/dist/prefix-coalesce.test.d.ts +0 -2
- package/dist/prefix-coalesce.test.d.ts.map +0 -1
- package/dist/prefix-coalesce.test.js +0 -260
- package/dist/prefix-coalesce.test.js.map +0 -1
- package/dist/private-folder-transport.test.d.ts +0 -2
- package/dist/private-folder-transport.test.d.ts.map +0 -1
- package/dist/private-folder-transport.test.js +0 -33
- package/dist/private-folder-transport.test.js.map +0 -1
- package/dist/public-surface.test.d.ts +0 -15
- package/dist/public-surface.test.d.ts.map +0 -1
- package/dist/public-surface.test.js +0 -110
- package/dist/public-surface.test.js.map +0 -1
- package/dist/qmd-reindex.test.d.ts +0 -14
- package/dist/qmd-reindex.test.d.ts.map +0 -1
- package/dist/qmd-reindex.test.js +0 -899
- package/dist/qmd-reindex.test.js.map +0 -1
- package/dist/read-only-state-dir.test.d.ts +0 -27
- package/dist/read-only-state-dir.test.d.ts.map +0 -1
- package/dist/read-only-state-dir.test.js +0 -167
- package/dist/read-only-state-dir.test.js.map +0 -1
- package/dist/remote-pull.test.d.ts +0 -2
- package/dist/remote-pull.test.d.ts.map +0 -1
- package/dist/remote-pull.test.js +0 -1147
- package/dist/remote-pull.test.js.map +0 -1
- package/dist/s3-download-stream-hash.test.d.ts +0 -2
- package/dist/s3-download-stream-hash.test.d.ts.map +0 -1
- package/dist/s3-download-stream-hash.test.js +0 -70
- package/dist/s3-download-stream-hash.test.js.map +0 -1
- package/dist/s3.list-cost.test.d.ts +0 -2
- package/dist/s3.list-cost.test.d.ts.map +0 -1
- package/dist/s3.list-cost.test.js +0 -51
- package/dist/s3.list-cost.test.js.map +0 -1
- package/dist/s3.rename-retry.test.d.ts +0 -2
- package/dist/s3.rename-retry.test.d.ts.map +0 -1
- package/dist/s3.rename-retry.test.js +0 -217
- package/dist/s3.rename-retry.test.js.map +0 -1
- package/dist/s3.symlink-materialize.test.d.ts +0 -18
- package/dist/s3.symlink-materialize.test.d.ts.map +0 -1
- package/dist/s3.symlink-materialize.test.js +0 -579
- package/dist/s3.symlink-materialize.test.js.map +0 -1
- package/dist/s3.test.d.ts +0 -9
- package/dist/s3.test.d.ts.map +0 -1
- package/dist/s3.test.js +0 -2047
- package/dist/s3.test.js.map +0 -1
- package/dist/s3.windows-portability.test.d.ts +0 -12
- package/dist/s3.windows-portability.test.d.ts.map +0 -1
- package/dist/s3.windows-portability.test.js +0 -223
- package/dist/s3.windows-portability.test.js.map +0 -1
- package/dist/schemas/signal-types.test.d.ts +0 -2
- package/dist/schemas/signal-types.test.d.ts.map +0 -1
- package/dist/schemas/signal-types.test.js +0 -65
- package/dist/schemas/signal-types.test.js.map +0 -1
- package/dist/schemas/source-channels.test.d.ts +0 -2
- package/dist/schemas/source-channels.test.d.ts.map +0 -1
- package/dist/schemas/source-channels.test.js +0 -65
- package/dist/schemas/source-channels.test.js.map +0 -1
- package/dist/scope-shrink.test.d.ts +0 -13
- package/dist/scope-shrink.test.d.ts.map +0 -1
- package/dist/scope-shrink.test.js +0 -558
- package/dist/scope-shrink.test.js.map +0 -1
- package/dist/session-log-capture.test.d.ts +0 -2
- package/dist/session-log-capture.test.d.ts.map +0 -1
- package/dist/session-log-capture.test.js +0 -533
- package/dist/session-log-capture.test.js.map +0 -1
- package/dist/session-log-retention.test.d.ts +0 -2
- package/dist/session-log-retention.test.d.ts.map +0 -1
- package/dist/session-log-retention.test.js +0 -383
- package/dist/session-log-retention.test.js.map +0 -1
- package/dist/signals/get.test.d.ts +0 -5
- package/dist/signals/get.test.d.ts.map +0 -1
- package/dist/signals/get.test.js +0 -254
- package/dist/signals/get.test.js.map +0 -1
- package/dist/signals/list.test.d.ts +0 -9
- package/dist/signals/list.test.d.ts.map +0 -1
- package/dist/signals/list.test.js +0 -330
- package/dist/signals/list.test.js.map +0 -1
- package/dist/skill-telemetry.test.d.ts +0 -2
- package/dist/skill-telemetry.test.d.ts.map +0 -1
- package/dist/skill-telemetry.test.js +0 -1484
- package/dist/skill-telemetry.test.js.map +0 -1
- package/dist/sources/get.test.d.ts +0 -5
- package/dist/sources/get.test.d.ts.map +0 -1
- package/dist/sources/get.test.js +0 -236
- package/dist/sources/get.test.js.map +0 -1
- package/dist/sources/list.test.d.ts +0 -8
- package/dist/sources/list.test.d.ts.map +0 -1
- package/dist/sources/list.test.js +0 -318
- package/dist/sources/list.test.js.map +0 -1
- package/dist/sts-credential-refresh.test.d.ts +0 -2
- package/dist/sts-credential-refresh.test.d.ts.map +0 -1
- package/dist/sts-credential-refresh.test.js +0 -181
- package/dist/sts-credential-refresh.test.js.map +0 -1
- package/dist/swallowed-error-sites.test.d.ts +0 -2
- package/dist/swallowed-error-sites.test.d.ts.map +0 -1
- package/dist/swallowed-error-sites.test.js +0 -199
- package/dist/swallowed-error-sites.test.js.map +0 -1
- package/dist/swallowed-error-w32.test.d.ts +0 -2
- package/dist/swallowed-error-w32.test.d.ts.map +0 -1
- package/dist/swallowed-error-w32.test.js +0 -171
- package/dist/swallowed-error-w32.test.js.map +0 -1
- package/dist/swallowed-error-w33.test.d.ts +0 -2
- package/dist/swallowed-error-w33.test.d.ts.map +0 -1
- package/dist/swallowed-error-w33.test.js +0 -125
- package/dist/swallowed-error-w33.test.js.map +0 -1
- package/dist/swallowed-error-w34.test.d.ts +0 -2
- package/dist/swallowed-error-w34.test.d.ts.map +0 -1
- package/dist/swallowed-error-w34.test.js +0 -110
- package/dist/swallowed-error-w34.test.js.map +0 -1
- package/dist/swallowed-error-w35.test.d.ts +0 -2
- package/dist/swallowed-error-w35.test.d.ts.map +0 -1
- package/dist/swallowed-error-w35.test.js +0 -223
- package/dist/swallowed-error-w35.test.js.map +0 -1
- package/dist/sync/area-ledger-auto-migration.test.d.ts +0 -2
- package/dist/sync/area-ledger-auto-migration.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-auto-migration.test.js +0 -291
- package/dist/sync/area-ledger-auto-migration.test.js.map +0 -1
- package/dist/sync/area-ledger-migration.test.d.ts +0 -2
- package/dist/sync/area-ledger-migration.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-migration.test.js +0 -554
- package/dist/sync/area-ledger-migration.test.js.map +0 -1
- package/dist/sync/area-ledger-recovery.bench.test.d.ts +0 -2
- package/dist/sync/area-ledger-recovery.bench.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-recovery.bench.test.js +0 -60
- package/dist/sync/area-ledger-recovery.bench.test.js.map +0 -1
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts +0 -2
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts.map +0 -1
- package/dist/sync/area-ledger-writer-lock.bench.test.js +0 -57
- package/dist/sync/area-ledger-writer-lock.bench.test.js.map +0 -1
- package/dist/sync/area-ledger.test.d.ts +0 -2
- package/dist/sync/area-ledger.test.d.ts.map +0 -1
- package/dist/sync/area-ledger.test.js +0 -1401
- package/dist/sync/area-ledger.test.js.map +0 -1
- package/dist/sync/area-resolver.test.d.ts +0 -2
- package/dist/sync/area-resolver.test.d.ts.map +0 -1
- package/dist/sync/area-resolver.test.js +0 -234
- package/dist/sync/area-resolver.test.js.map +0 -1
- package/dist/sync/base-version-resolver.test.d.ts +0 -2
- package/dist/sync/base-version-resolver.test.d.ts.map +0 -1
- package/dist/sync/base-version-resolver.test.js +0 -24
- package/dist/sync/base-version-resolver.test.js.map +0 -1
- package/dist/sync/candidate-uploader.test.d.ts +0 -2
- package/dist/sync/candidate-uploader.test.d.ts.map +0 -1
- package/dist/sync/candidate-uploader.test.js +0 -132
- package/dist/sync/candidate-uploader.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker-env.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker-env.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker-env.test.js +0 -38
- package/dist/sync/child-process-sync-worker-env.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker-errors.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker-errors.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker-errors.test.js +0 -121
- package/dist/sync/child-process-sync-worker-errors.test.js.map +0 -1
- package/dist/sync/child-process-sync-worker.test.d.ts +0 -2
- package/dist/sync/child-process-sync-worker.test.d.ts.map +0 -1
- package/dist/sync/child-process-sync-worker.test.js +0 -262
- package/dist/sync/child-process-sync-worker.test.js.map +0 -1
- package/dist/sync/content-hash.test.d.ts +0 -2
- package/dist/sync/content-hash.test.d.ts.map +0 -1
- package/dist/sync/content-hash.test.js +0 -16
- package/dist/sync/content-hash.test.js.map +0 -1
- package/dist/sync/delta-client.test.d.ts +0 -2
- package/dist/sync/delta-client.test.d.ts.map +0 -1
- package/dist/sync/delta-client.test.js +0 -97
- package/dist/sync/delta-client.test.js.map +0 -1
- package/dist/sync/durable-apply.test.d.ts +0 -2
- package/dist/sync/durable-apply.test.d.ts.map +0 -1
- package/dist/sync/durable-apply.test.js +0 -180
- package/dist/sync/durable-apply.test.js.map +0 -1
- package/dist/sync/event-sync.test.d.ts +0 -14
- package/dist/sync/event-sync.test.d.ts.map +0 -1
- package/dist/sync/event-sync.test.js +0 -1714
- package/dist/sync/event-sync.test.js.map +0 -1
- package/dist/sync/feature-flags.test.d.ts +0 -24
- package/dist/sync/feature-flags.test.d.ts.map +0 -1
- package/dist/sync/feature-flags.test.js +0 -594
- package/dist/sync/feature-flags.test.js.map +0 -1
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts +0 -2
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts.map +0 -1
- package/dist/sync/full-pass-cap-governor.bench.test.js +0 -179
- package/dist/sync/full-pass-cap-governor.bench.test.js.map +0 -1
- package/dist/sync/full-pass-caps.test.d.ts +0 -2
- package/dist/sync/full-pass-caps.test.d.ts.map +0 -1
- package/dist/sync/full-pass-caps.test.js +0 -550
- package/dist/sync/full-pass-caps.test.js.map +0 -1
- package/dist/sync/idle-full-reconcile.test.d.ts +0 -2
- package/dist/sync/idle-full-reconcile.test.d.ts.map +0 -1
- package/dist/sync/idle-full-reconcile.test.js +0 -62
- package/dist/sync/idle-full-reconcile.test.js.map +0 -1
- package/dist/sync/inbound-event-admission.test.d.ts +0 -2
- package/dist/sync/inbound-event-admission.test.d.ts.map +0 -1
- package/dist/sync/inbound-event-admission.test.js +0 -125
- package/dist/sync/inbound-event-admission.test.js.map +0 -1
- package/dist/sync/journal-ledger-stream.test.d.ts +0 -12
- package/dist/sync/journal-ledger-stream.test.d.ts.map +0 -1
- package/dist/sync/journal-ledger-stream.test.js +0 -134
- package/dist/sync/journal-ledger-stream.test.js.map +0 -1
- package/dist/sync/lease-client.test.d.ts +0 -2
- package/dist/sync/lease-client.test.d.ts.map +0 -1
- package/dist/sync/lease-client.test.js +0 -119
- package/dist/sync/lease-client.test.js.map +0 -1
- package/dist/sync/logger.test.d.ts +0 -19
- package/dist/sync/logger.test.d.ts.map +0 -1
- package/dist/sync/logger.test.js +0 -204
- package/dist/sync/logger.test.js.map +0 -1
- package/dist/sync/metrics.test.d.ts +0 -19
- package/dist/sync/metrics.test.d.ts.map +0 -1
- package/dist/sync/metrics.test.js +0 -357
- package/dist/sync/metrics.test.js.map +0 -1
- package/dist/sync/multipart-uploader.test.d.ts +0 -2
- package/dist/sync/multipart-uploader.test.d.ts.map +0 -1
- package/dist/sync/multipart-uploader.test.js +0 -135
- package/dist/sync/multipart-uploader.test.js.map +0 -1
- package/dist/sync/mutation-client.test.d.ts +0 -2
- package/dist/sync/mutation-client.test.d.ts.map +0 -1
- package/dist/sync/mutation-client.test.js +0 -100
- package/dist/sync/mutation-client.test.js.map +0 -1
- package/dist/sync/mutation-session.test.d.ts +0 -2
- package/dist/sync/mutation-session.test.d.ts.map +0 -1
- package/dist/sync/mutation-session.test.js +0 -190
- package/dist/sync/mutation-session.test.js.map +0 -1
- package/dist/sync/parallel-sync-coordinator.test.d.ts +0 -2
- package/dist/sync/parallel-sync-coordinator.test.d.ts.map +0 -1
- package/dist/sync/parallel-sync-coordinator.test.js +0 -564
- package/dist/sync/parallel-sync-coordinator.test.js.map +0 -1
- package/dist/sync/path-leases.test.d.ts +0 -2
- package/dist/sync/path-leases.test.d.ts.map +0 -1
- package/dist/sync/path-leases.test.js +0 -51
- package/dist/sync/path-leases.test.js.map +0 -1
- package/dist/sync/per-area-maintenance.test.d.ts +0 -2
- package/dist/sync/per-area-maintenance.test.d.ts.map +0 -1
- package/dist/sync/per-area-maintenance.test.js +0 -100
- package/dist/sync/per-area-maintenance.test.js.map +0 -1
- package/dist/sync/push-event.test.d.ts +0 -15
- package/dist/sync/push-event.test.d.ts.map +0 -1
- package/dist/sync/push-event.test.js +0 -282
- package/dist/sync/push-event.test.js.map +0 -1
- package/dist/sync/push-receiver.test.d.ts +0 -25
- package/dist/sync/push-receiver.test.d.ts.map +0 -1
- package/dist/sync/push-receiver.test.js +0 -2851
- package/dist/sync/push-receiver.test.js.map +0 -1
- package/dist/sync/push-transport.test.d.ts +0 -2
- package/dist/sync/push-transport.test.d.ts.map +0 -1
- package/dist/sync/push-transport.test.js +0 -70
- package/dist/sync/push-transport.test.js.map +0 -1
- package/dist/sync/push-walk-matchers.bench.test.d.ts +0 -2
- package/dist/sync/push-walk-matchers.bench.test.d.ts.map +0 -1
- package/dist/sync/push-walk-matchers.bench.test.js +0 -230
- package/dist/sync/push-walk-matchers.bench.test.js.map +0 -1
- package/dist/sync/realtime-network-integration.test.d.ts +0 -2
- package/dist/sync/realtime-network-integration.test.d.ts.map +0 -1
- package/dist/sync/realtime-network-integration.test.js +0 -83
- package/dist/sync/realtime-network-integration.test.js.map +0 -1
- package/dist/sync/realtime-rollout.test.d.ts +0 -2
- package/dist/sync/realtime-rollout.test.d.ts.map +0 -1
- package/dist/sync/realtime-rollout.test.js +0 -94
- package/dist/sync/realtime-rollout.test.js.map +0 -1
- package/dist/sync/realtime-telemetry.test.d.ts +0 -2
- package/dist/sync/realtime-telemetry.test.d.ts.map +0 -1
- package/dist/sync/realtime-telemetry.test.js +0 -300
- package/dist/sync/realtime-telemetry.test.js.map +0 -1
- package/dist/sync/receiver-origin-config.test.d.ts +0 -2
- package/dist/sync/receiver-origin-config.test.d.ts.map +0 -1
- package/dist/sync/receiver-origin-config.test.js +0 -39
- package/dist/sync/receiver-origin-config.test.js.map +0 -1
- package/dist/sync/reconcile-cursor.test.d.ts +0 -2
- package/dist/sync/reconcile-cursor.test.d.ts.map +0 -1
- package/dist/sync/reconcile-cursor.test.js +0 -139
- package/dist/sync/reconcile-cursor.test.js.map +0 -1
- package/dist/sync/remote-file-spool.test.d.ts +0 -2
- package/dist/sync/remote-file-spool.test.d.ts.map +0 -1
- package/dist/sync/remote-file-spool.test.js +0 -77
- package/dist/sync/remote-file-spool.test.js.map +0 -1
- package/dist/sync/scope-inventory-client.test.d.ts +0 -2
- package/dist/sync/scope-inventory-client.test.d.ts.map +0 -1
- package/dist/sync/scope-inventory-client.test.js +0 -103
- package/dist/sync/scope-inventory-client.test.js.map +0 -1
- package/dist/sync/secret-path-policy.test.d.ts +0 -2
- package/dist/sync/secret-path-policy.test.d.ts.map +0 -1
- package/dist/sync/secret-path-policy.test.js +0 -183
- package/dist/sync/secret-path-policy.test.js.map +0 -1
- package/dist/sync/snapshot-client.test.d.ts +0 -2
- package/dist/sync/snapshot-client.test.d.ts.map +0 -1
- package/dist/sync/snapshot-client.test.js +0 -169
- package/dist/sync/snapshot-client.test.js.map +0 -1
- package/dist/sync/state-store.test.d.ts +0 -2
- package/dist/sync/state-store.test.d.ts.map +0 -1
- package/dist/sync/state-store.test.js +0 -1556
- package/dist/sync/state-store.test.js.map +0 -1
- package/dist/sync/sync-contract.test.d.ts +0 -2
- package/dist/sync/sync-contract.test.d.ts.map +0 -1
- package/dist/sync/sync-contract.test.js +0 -141
- package/dist/sync/sync-contract.test.js.map +0 -1
- package/dist/sync/targeted-pull-prefixes.test.d.ts +0 -2
- package/dist/sync/targeted-pull-prefixes.test.d.ts.map +0 -1
- package/dist/sync/targeted-pull-prefixes.test.js +0 -33
- package/dist/sync/targeted-pull-prefixes.test.js.map +0 -1
- package/dist/sync/targeted-upsert-exact-list.test.d.ts +0 -2
- package/dist/sync/targeted-upsert-exact-list.test.d.ts.map +0 -1
- package/dist/sync/targeted-upsert-exact-list.test.js +0 -247
- package/dist/sync/targeted-upsert-exact-list.test.js.map +0 -1
- package/dist/sync/unchanged-push-events.test.d.ts +0 -2
- package/dist/sync/unchanged-push-events.test.d.ts.map +0 -1
- package/dist/sync/unchanged-push-events.test.js +0 -76
- package/dist/sync/unchanged-push-events.test.js.map +0 -1
- package/dist/sync/uploader-finalization.test.d.ts +0 -2
- package/dist/sync/uploader-finalization.test.d.ts.map +0 -1
- package/dist/sync/uploader-finalization.test.js +0 -107
- package/dist/sync/uploader-finalization.test.js.map +0 -1
- package/dist/sync-core.test.d.ts +0 -2
- package/dist/sync-core.test.d.ts.map +0 -1
- package/dist/sync-core.test.js +0 -189
- package/dist/sync-core.test.js.map +0 -1
- package/dist/sync-progress.test.d.ts +0 -2
- package/dist/sync-progress.test.d.ts.map +0 -1
- package/dist/sync-progress.test.js +0 -277
- package/dist/sync-progress.test.js.map +0 -1
- package/dist/telemetry-events.test.d.ts +0 -2
- package/dist/telemetry-events.test.d.ts.map +0 -1
- package/dist/telemetry-events.test.js +0 -113
- package/dist/telemetry-events.test.js.map +0 -1
- package/dist/telemetry.test.d.ts +0 -11
- package/dist/telemetry.test.d.ts.map +0 -1
- package/dist/telemetry.test.js +0 -1603
- package/dist/telemetry.test.js.map +0 -1
- package/dist/vault-client.test.d.ts +0 -7
- package/dist/vault-client.test.d.ts.map +0 -1
- package/dist/vault-client.test.js +0 -1334
- package/dist/vault-client.test.js.map +0 -1
- package/dist/watch-coverage.test.d.ts +0 -2
- package/dist/watch-coverage.test.d.ts.map +0 -1
- package/dist/watch-coverage.test.js +0 -56
- package/dist/watch-coverage.test.js.map +0 -1
- package/dist/watch-owner-lease.test.d.ts +0 -2
- package/dist/watch-owner-lease.test.d.ts.map +0 -1
- package/dist/watch-owner-lease.test.js +0 -353
- package/dist/watch-owner-lease.test.js.map +0 -1
- package/dist/watch-parent.test.d.ts +0 -2
- package/dist/watch-parent.test.d.ts.map +0 -1
- package/dist/watch-parent.test.js +0 -131
- package/dist/watch-parent.test.js.map +0 -1
- package/dist/watch-roots.test.d.ts +0 -18
- package/dist/watch-roots.test.d.ts.map +0 -1
- package/dist/watch-roots.test.js +0 -395
- package/dist/watch-roots.test.js.map +0 -1
- package/dist/watcher-continuity-hot-path.test.d.ts +0 -2
- package/dist/watcher-continuity-hot-path.test.d.ts.map +0 -1
- package/dist/watcher-continuity-hot-path.test.js +0 -40
- package/dist/watcher-continuity-hot-path.test.js.map +0 -1
- package/dist/watcher-event-gate.test.d.ts +0 -16
- package/dist/watcher-event-gate.test.d.ts.map +0 -1
- package/dist/watcher-event-gate.test.js +0 -191
- package/dist/watcher-event-gate.test.js.map +0 -1
- package/dist/watcher-replan-sweep.test.d.ts +0 -2
- package/dist/watcher-replan-sweep.test.d.ts.map +0 -1
- package/dist/watcher-replan-sweep.test.js +0 -245
- package/dist/watcher-replan-sweep.test.js.map +0 -1
- package/dist/watcher-stdout.test.d.ts +0 -2
- package/dist/watcher-stdout.test.d.ts.map +0 -1
- package/dist/watcher-stdout.test.js +0 -86
- package/dist/watcher-stdout.test.js.map +0 -1
- package/dist/watcher.test.d.ts +0 -2
- package/dist/watcher.test.d.ts.map +0 -1
- package/dist/watcher.test.js +0 -4301
- package/dist/watcher.test.js.map +0 -1
- package/dist/watcher.warmup-cancel.test.d.ts +0 -2
- package/dist/watcher.warmup-cancel.test.d.ts.map +0 -1
- package/dist/watcher.warmup-cancel.test.js +0 -59
- package/dist/watcher.warmup-cancel.test.js.map +0 -1
- package/dist/watcher.warmup-responsive.test.d.ts +0 -2
- package/dist/watcher.warmup-responsive.test.d.ts.map +0 -1
- package/dist/watcher.warmup-responsive.test.js +0 -62
- package/dist/watcher.warmup-responsive.test.js.map +0 -1
|
@@ -1,2439 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as os from "os";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
// Re-export node:fs as a mutable module so the scoped-walk regression can
|
|
6
|
-
// measure the real walker without replacing any filesystem behavior.
|
|
7
|
-
vi.mock("fs", async (importOriginal) => {
|
|
8
|
-
const actual = await importOriginal();
|
|
9
|
-
return { ...actual };
|
|
10
|
-
});
|
|
11
|
-
// Mock the S3 transport so the real share() can run through executeCompanyFanout
|
|
12
|
-
// in the HQ-DESKTOP-64 regression below without touching the network. Inert for
|
|
13
|
-
// every other test here, which injects its own shareFn/syncFn.
|
|
14
|
-
vi.mock("../s3.js", async (importOriginal) => {
|
|
15
|
-
const actual = await importOriginal();
|
|
16
|
-
return {
|
|
17
|
-
...actual,
|
|
18
|
-
uploadFile: vi.fn().mockResolvedValue({ etag: '"upload-etag"' }),
|
|
19
|
-
uploadSymlink: vi.fn().mockResolvedValue({ etag: '"upload-symlink-etag"' }),
|
|
20
|
-
downloadFile: vi.fn().mockResolvedValue(undefined),
|
|
21
|
-
listRemoteFiles: vi.fn().mockResolvedValue([]),
|
|
22
|
-
deleteRemoteFile: vi.fn().mockResolvedValue(undefined),
|
|
23
|
-
headRemoteFile: vi.fn().mockResolvedValue(null),
|
|
24
|
-
readVerifiedRemoteSymlinkTarget: vi.fn().mockResolvedValue(null),
|
|
25
|
-
primeObjectTransport: vi.fn().mockResolvedValue(undefined),
|
|
26
|
-
primeUploads: vi.fn().mockResolvedValue(undefined),
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
import { executeCompanyFanout } from "./sync-runner-company.js";
|
|
30
|
-
import { clearContextCache, resolveEntityContext, setEntityFetchSleepForTest, } from "../context.js";
|
|
31
|
-
import { CognitoAuthError, CognitoRefreshError } from "../cognito-auth.js";
|
|
32
|
-
import { SESSION_LOGS_SYNC_REL } from "../personal-vault.js";
|
|
33
|
-
import { _testing as shareTesting, share, parseRegisteredCompanySkillUid, } from "../cli/share.js";
|
|
34
|
-
import { PERSONAL_VAULT_JOURNAL_SLUG, readJournal } from "../journal.js";
|
|
35
|
-
import { VaultConflictError, vaultErrorFromResponse } from "../vault-client.js";
|
|
36
|
-
import { deleteRemoteFile, headRemoteFile, uploadFile } from "../s3.js";
|
|
37
|
-
import { hashFile } from "../journal.js";
|
|
38
|
-
import { PLAN_LIMIT_UPGRADE_URL, canonicalPlanLimitBody, } from "../plan-limit.fixtures.js";
|
|
39
|
-
import { setPlanLimitPauseClockForTesting } from "../plan-limit-pause.js";
|
|
40
|
-
import { setBandwidthGovernorForTesting } from "../bandwidth.js";
|
|
41
|
-
import { FakeClock, TreeWatcher } from "../watcher.js";
|
|
42
|
-
import { buildScopedPushArgv } from "./sync-runner-watch-routes.js";
|
|
43
|
-
describe("executeCompanyFanout realtime inventory gate", () => {
|
|
44
|
-
it("stops before any legacy push or pull when fresh inventory requires reset", async () => {
|
|
45
|
-
const syncFn = vi.fn();
|
|
46
|
-
const shareFn = vi.fn();
|
|
47
|
-
const client = {
|
|
48
|
-
listMyMemberships: vi.fn(() => {
|
|
49
|
-
throw new Error("membership lookup must not run after reset admission stops network");
|
|
50
|
-
}),
|
|
51
|
-
};
|
|
52
|
-
const emit = vi.fn();
|
|
53
|
-
const result = await executeCompanyFanout({
|
|
54
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
55
|
-
direction: "both",
|
|
56
|
-
hqRoot: "/tmp/realtime-inventory-runner",
|
|
57
|
-
onConflict: "abort",
|
|
58
|
-
client: client,
|
|
59
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
60
|
-
syncFn,
|
|
61
|
-
shareFn,
|
|
62
|
-
resolveDeletePolicy: () => "all",
|
|
63
|
-
emit,
|
|
64
|
-
ensureCompanyDir: vi.fn(),
|
|
65
|
-
scopeInventoryGate: {
|
|
66
|
-
refresh: vi.fn(async () => ({ network: "stop", state: "reset-required", reason: "reset-required" })),
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
expect(syncFn).not.toHaveBeenCalled();
|
|
70
|
-
expect(shareFn).not.toHaveBeenCalled();
|
|
71
|
-
expect(client.listMyMemberships).not.toHaveBeenCalled();
|
|
72
|
-
expect(result.errors).toEqual([{ company: "personal", message: "scope inventory reset-required: reset-required; stopped before legacy network I/O" }]);
|
|
73
|
-
expect(emit).toHaveBeenCalledWith(expect.objectContaining({ type: "error", company: "personal", path: "(scope)" }));
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
describe("executeCompanyFanout cooperative checkpoints", () => {
|
|
77
|
-
it("hands off only after each target leg has settled and retains the remaining plan", async () => {
|
|
78
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-checkpoint-"));
|
|
79
|
-
const order = [];
|
|
80
|
-
const shareResult = {
|
|
81
|
-
filesUploaded: 0,
|
|
82
|
-
bytesUploaded: 0,
|
|
83
|
-
filesSkipped: 0,
|
|
84
|
-
filesDeleted: 0,
|
|
85
|
-
filesTombstoned: 0,
|
|
86
|
-
filesRefusedStale: 0,
|
|
87
|
-
filesRefusedStalePaths: [],
|
|
88
|
-
filesSuppressedByTombstone: 0,
|
|
89
|
-
filesExcludedByPolicy: 0,
|
|
90
|
-
filesExcludedByScope: 0,
|
|
91
|
-
filesExcludedByIgnore: 0,
|
|
92
|
-
unreachablePaths: [],
|
|
93
|
-
linkedSubtreesNotShipped: [],
|
|
94
|
-
conflictPaths: [],
|
|
95
|
-
aborted: false,
|
|
96
|
-
};
|
|
97
|
-
try {
|
|
98
|
-
await executeCompanyFanout({
|
|
99
|
-
plan: [
|
|
100
|
-
{ uid: "prs_1", slug: "personal", personalMode: true },
|
|
101
|
-
{ uid: "prs_2", slug: "personal-next", personalMode: true },
|
|
102
|
-
],
|
|
103
|
-
direction: "push",
|
|
104
|
-
hqRoot,
|
|
105
|
-
onConflict: "abort",
|
|
106
|
-
client: {},
|
|
107
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
108
|
-
syncFn: vi.fn(),
|
|
109
|
-
shareFn: vi.fn(async (options) => {
|
|
110
|
-
order.push(`target:${options.company}`);
|
|
111
|
-
return shareResult;
|
|
112
|
-
}),
|
|
113
|
-
resolveDeletePolicy: () => "all",
|
|
114
|
-
emit: vi.fn(),
|
|
115
|
-
ensureCompanyDir: vi.fn(),
|
|
116
|
-
cooperativeCheckpoint: async () => { order.push("checkpoint"); },
|
|
117
|
-
telemetryClient: null,
|
|
118
|
-
});
|
|
119
|
-
expect(order).toEqual([
|
|
120
|
-
"target:prs_1",
|
|
121
|
-
"checkpoint",
|
|
122
|
-
"target:prs_2",
|
|
123
|
-
"checkpoint",
|
|
124
|
-
]);
|
|
125
|
-
}
|
|
126
|
-
finally {
|
|
127
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
describe("executeCompanyFanout — plan-limit event forwarding", () => {
|
|
132
|
-
it("preserves the server upgrade URL and company label without recording a failure", async () => {
|
|
133
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-plan-limit-"));
|
|
134
|
-
const events = [];
|
|
135
|
-
const shareResult = {
|
|
136
|
-
filesUploaded: 0,
|
|
137
|
-
bytesUploaded: 0,
|
|
138
|
-
filesSkipped: 2,
|
|
139
|
-
filesDeleted: 0,
|
|
140
|
-
filesTombstoned: 0,
|
|
141
|
-
filesRefusedStale: 0,
|
|
142
|
-
filesRefusedStalePaths: [],
|
|
143
|
-
filesSuppressedByTombstone: 0,
|
|
144
|
-
filesExcludedByPolicy: 0,
|
|
145
|
-
filesExcludedByScope: 0,
|
|
146
|
-
filesExcludedByIgnore: 0,
|
|
147
|
-
unreachablePaths: [],
|
|
148
|
-
linkedSubtreesNotShipped: [],
|
|
149
|
-
conflictPaths: [],
|
|
150
|
-
aborted: false,
|
|
151
|
-
};
|
|
152
|
-
fs.mkdirSync(path.join(hqRoot, "companies", "acme"), { recursive: true });
|
|
153
|
-
try {
|
|
154
|
-
const result = await executeCompanyFanout({
|
|
155
|
-
plan: [{ uid: "cmp_1", slug: "acme", name: "Acme" }],
|
|
156
|
-
direction: "push",
|
|
157
|
-
hqRoot,
|
|
158
|
-
onConflict: "abort",
|
|
159
|
-
client: {},
|
|
160
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
161
|
-
syncFn: vi.fn(),
|
|
162
|
-
shareFn: vi.fn(async (options) => {
|
|
163
|
-
// The runner opts every push leg into plan-limit pauses.
|
|
164
|
-
expect(options.planLimitPause).toBe(true);
|
|
165
|
-
options.onEvent?.({
|
|
166
|
-
type: "plan-limit",
|
|
167
|
-
upgradeUrl: "https://billing.example.test/company/acme",
|
|
168
|
-
message: "New files are paused while Acme is over its Starter limits.",
|
|
169
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
170
|
-
error: "plan_limit_reached",
|
|
171
|
-
count: 2,
|
|
172
|
-
paths: ["a.md", "b.md"],
|
|
173
|
-
pausedUntil: "2026-09-28T13:00:00.000Z",
|
|
174
|
-
fromPause: true,
|
|
175
|
-
});
|
|
176
|
-
return { ...shareResult, filesPlanLimited: 2, planLimitedPaths: ["a.md", "b.md"] };
|
|
177
|
-
}),
|
|
178
|
-
resolveDeletePolicy: () => "all",
|
|
179
|
-
emit: (event) => events.push(event),
|
|
180
|
-
ensureCompanyDir: vi.fn(),
|
|
181
|
-
telemetryClient: null,
|
|
182
|
-
});
|
|
183
|
-
expect(events).toContainEqual({
|
|
184
|
-
type: "plan-limit",
|
|
185
|
-
company: "acme",
|
|
186
|
-
upgradeUrl: "https://billing.example.test/company/acme",
|
|
187
|
-
message: "New files are paused while Acme is over its Starter limits.",
|
|
188
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
189
|
-
error: "plan_limit_reached",
|
|
190
|
-
count: 2,
|
|
191
|
-
paths: ["a.md", "b.md"],
|
|
192
|
-
pausedUntil: "2026-09-28T13:00:00.000Z",
|
|
193
|
-
fromPause: true,
|
|
194
|
-
});
|
|
195
|
-
expect(events).toContainEqual(expect.objectContaining({ type: "complete", company: "acme", filesPlanLimited: 2, aborted: false }));
|
|
196
|
-
expect(result.errors).toEqual([]);
|
|
197
|
-
expect(result.stateByCompany.get("acme")?.status).toBe("complete");
|
|
198
|
-
}
|
|
199
|
-
finally {
|
|
200
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
describe("executeCompanyFanout — plan-limit-only pass over the real share() (US-012)", () => {
|
|
205
|
-
const T0 = Date.parse("2026-09-28T12:00:00.000Z");
|
|
206
|
-
let hqRoot;
|
|
207
|
-
let stateDir;
|
|
208
|
-
let previousStateDir;
|
|
209
|
-
const COMPANIES = {
|
|
210
|
-
cmp_01ACME: "acme",
|
|
211
|
-
cmp_02BETA: "beta",
|
|
212
|
-
};
|
|
213
|
-
function entityContextFor(uid) {
|
|
214
|
-
return {
|
|
215
|
-
uid,
|
|
216
|
-
slug: COMPANIES[uid],
|
|
217
|
-
bucketName: `hq-vault-${COMPANIES[uid]}`,
|
|
218
|
-
region: "us-east-1",
|
|
219
|
-
credentials: {
|
|
220
|
-
accessKeyId: "ASIA_PRE_VENDED",
|
|
221
|
-
secretAccessKey: "pre-vended-secret",
|
|
222
|
-
sessionToken: "pre-vended-session",
|
|
223
|
-
},
|
|
224
|
-
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
beforeEach(() => {
|
|
228
|
-
setPlanLimitPauseClockForTesting(() => T0);
|
|
229
|
-
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-plan-limit-real-"));
|
|
230
|
-
stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-plan-limit-state-"));
|
|
231
|
-
previousStateDir = process.env.HQ_STATE_DIR;
|
|
232
|
-
process.env.HQ_STATE_DIR = stateDir;
|
|
233
|
-
vi.mocked(headRemoteFile).mockReset();
|
|
234
|
-
vi.mocked(headRemoteFile).mockResolvedValue(null);
|
|
235
|
-
vi.mocked(deleteRemoteFile).mockClear();
|
|
236
|
-
// Acme is over storage: every PUT is refused with the server's canonical
|
|
237
|
-
// 402 body, mapped exactly as the vault client maps it. Beta is healthy.
|
|
238
|
-
vi.mocked(uploadFile).mockReset();
|
|
239
|
-
vi.mocked(uploadFile).mockImplementation(async (ctx) => {
|
|
240
|
-
if (ctx.uid === "cmp_01ACME") {
|
|
241
|
-
throw vaultErrorFromResponse(402, JSON.stringify(canonicalPlanLimitBody()));
|
|
242
|
-
}
|
|
243
|
-
return { etag: '"upload-etag"' };
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
afterEach(() => {
|
|
247
|
-
setPlanLimitPauseClockForTesting(null);
|
|
248
|
-
vi.mocked(uploadFile).mockReset();
|
|
249
|
-
vi.mocked(uploadFile).mockResolvedValue({ etag: '"upload-etag"' });
|
|
250
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
251
|
-
fs.rmSync(stateDir, { recursive: true, force: true });
|
|
252
|
-
if (previousStateDir === undefined)
|
|
253
|
-
delete process.env.HQ_STATE_DIR;
|
|
254
|
-
else
|
|
255
|
-
process.env.HQ_STATE_DIR = previousStateDir;
|
|
256
|
-
});
|
|
257
|
-
it("settles the company complete, still runs its delete and pull, and still syncs other companies", async () => {
|
|
258
|
-
for (const [name, body] of [
|
|
259
|
-
["acme/docs/new-1.md", "one"],
|
|
260
|
-
["acme/docs/new-2.md", "two"],
|
|
261
|
-
["beta/docs/ok.md", "ok"],
|
|
262
|
-
]) {
|
|
263
|
-
const abs = path.join(hqRoot, "companies", name);
|
|
264
|
-
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
265
|
-
fs.writeFileSync(abs, body);
|
|
266
|
-
}
|
|
267
|
-
// A file acme synced earlier and has since deleted locally: its remote
|
|
268
|
-
// delete must still run even though every upload is refused.
|
|
269
|
-
const gone = path.join(hqRoot, "companies", "acme", "docs", "gone.md");
|
|
270
|
-
fs.writeFileSync(gone, "gone");
|
|
271
|
-
const goneStat = fs.statSync(gone);
|
|
272
|
-
const journal = readJournal("acme");
|
|
273
|
-
journal.files["docs/gone.md"] = {
|
|
274
|
-
hash: hashFile(gone),
|
|
275
|
-
size: goneStat.size,
|
|
276
|
-
syncedAt: "2026-09-27T12:00:00.000Z",
|
|
277
|
-
direction: "up",
|
|
278
|
-
remoteEtag: "gone-etag",
|
|
279
|
-
mtimeMs: goneStat.mtimeMs,
|
|
280
|
-
ctimeMs: goneStat.ctimeMs,
|
|
281
|
-
};
|
|
282
|
-
const { writeJournal } = await import("../journal.js");
|
|
283
|
-
writeJournal("acme", journal);
|
|
284
|
-
fs.rmSync(gone);
|
|
285
|
-
// The remote still holds the journaled version, so the delete is current.
|
|
286
|
-
vi.mocked(headRemoteFile).mockImplementation(async (_ctx, key) => key === "docs/gone.md"
|
|
287
|
-
? { lastModified: new Date("2026-09-27T12:00:00.000Z"), etag: '"gone-etag"', size: goneStat.size }
|
|
288
|
-
: null);
|
|
289
|
-
const pullResult = {
|
|
290
|
-
filesDownloaded: 0,
|
|
291
|
-
bytesDownloaded: 0,
|
|
292
|
-
filesSkipped: 0,
|
|
293
|
-
conflicts: 0,
|
|
294
|
-
conflictPaths: [],
|
|
295
|
-
aborted: false,
|
|
296
|
-
newFiles: [],
|
|
297
|
-
newFilesCount: 0,
|
|
298
|
-
filesExcludedByPolicy: 0,
|
|
299
|
-
filesTombstoned: 0,
|
|
300
|
-
filesOutOfScope: 0,
|
|
301
|
-
scopeOrphansRemoved: 0,
|
|
302
|
-
scopeOrphansBlocked: 0,
|
|
303
|
-
changedPaths: [],
|
|
304
|
-
};
|
|
305
|
-
const syncFn = vi.fn(async (_options) => pullResult);
|
|
306
|
-
const events = [];
|
|
307
|
-
const result = await executeCompanyFanout({
|
|
308
|
-
plan: [
|
|
309
|
-
{ uid: "cmp_01ACME", slug: "acme" },
|
|
310
|
-
{ uid: "cmp_02BETA", slug: "beta" },
|
|
311
|
-
],
|
|
312
|
-
direction: "both",
|
|
313
|
-
hqRoot,
|
|
314
|
-
onConflict: "abort",
|
|
315
|
-
client: {},
|
|
316
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
317
|
-
fetchFileTombstones: vi.fn().mockResolvedValue(new Map()),
|
|
318
|
-
syncFn,
|
|
319
|
-
shareFn: ({ vaultConfig: _vaultConfig, company, ...rest }) => share({
|
|
320
|
-
...rest,
|
|
321
|
-
entityContext: entityContextFor(company),
|
|
322
|
-
}),
|
|
323
|
-
// The runner's default delete policy.
|
|
324
|
-
resolveDeletePolicy: () => "currency-gated",
|
|
325
|
-
emit: (event) => events.push(event),
|
|
326
|
-
ensureCompanyDir: vi.fn(),
|
|
327
|
-
telemetryClient: null,
|
|
328
|
-
});
|
|
329
|
-
// Not a failure: no errors, no company failures, both companies complete.
|
|
330
|
-
expect(result.errors).toEqual([]);
|
|
331
|
-
expect(result.companyFailures).toEqual([]);
|
|
332
|
-
expect(result.transientCompanies).toEqual([]);
|
|
333
|
-
expect(result.stateByCompany.get("acme")?.status).toBe("complete");
|
|
334
|
-
expect(result.stateByCompany.get("beta")?.status).toBe("complete");
|
|
335
|
-
expect(events.filter((e) => e.type === "error" && !("diagnostic" in e && e.diagnostic))).toEqual([]);
|
|
336
|
-
// One plan-limit event for acme, with the refused files and the link.
|
|
337
|
-
const notices = events.filter((e) => e.type === "plan-limit");
|
|
338
|
-
expect(notices).toEqual([
|
|
339
|
-
expect.objectContaining({
|
|
340
|
-
type: "plan-limit",
|
|
341
|
-
company: "acme",
|
|
342
|
-
upgradeUrl: PLAN_LIMIT_UPGRADE_URL,
|
|
343
|
-
count: 2,
|
|
344
|
-
paths: expect.arrayContaining(["docs/new-1.md", "docs/new-2.md"]),
|
|
345
|
-
message: "New files are paused while Acme is over its Starter limits.",
|
|
346
|
-
error: "plan_limit_reached",
|
|
347
|
-
code: "PLAN_LIMIT_EXCEEDED",
|
|
348
|
-
fromPause: false,
|
|
349
|
-
}),
|
|
350
|
-
]);
|
|
351
|
-
expect(events).toContainEqual(expect.objectContaining({
|
|
352
|
-
type: "complete",
|
|
353
|
-
company: "acme",
|
|
354
|
-
filesPlanLimited: 2,
|
|
355
|
-
filesUploaded: 0,
|
|
356
|
-
filesRefusedStale: 0,
|
|
357
|
-
aborted: false,
|
|
358
|
-
}));
|
|
359
|
-
expect(events).toContainEqual(expect.objectContaining({ type: "complete", company: "beta", filesPlanLimited: 0, filesUploaded: 1 }));
|
|
360
|
-
// Deletes and pulls still ran for the plan-limited company.
|
|
361
|
-
expect(vi.mocked(deleteRemoteFile)).toHaveBeenCalledWith(expect.objectContaining({ uid: "cmp_01ACME" }), "docs/gone.md");
|
|
362
|
-
expect(syncFn.mock.calls.map(([o]) => o.company).sort()).toEqual(["cmp_01ACME", "cmp_02BETA"]);
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
describe("executeCompanyFanout — not-shipped event forwarding", () => {
|
|
366
|
-
it("preserves a company skill validation message", async () => {
|
|
367
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-skill-validation-"));
|
|
368
|
-
const events = [];
|
|
369
|
-
const shareResult = {
|
|
370
|
-
filesUploaded: 0,
|
|
371
|
-
bytesUploaded: 0,
|
|
372
|
-
filesSkipped: 1,
|
|
373
|
-
filesDeleted: 0,
|
|
374
|
-
filesTombstoned: 0,
|
|
375
|
-
filesRefusedStale: 0,
|
|
376
|
-
filesRefusedStalePaths: [],
|
|
377
|
-
filesSuppressedByTombstone: 0,
|
|
378
|
-
filesExcludedByPolicy: 0,
|
|
379
|
-
filesExcludedByScope: 0,
|
|
380
|
-
filesExcludedByIgnore: 0,
|
|
381
|
-
unreachablePaths: [],
|
|
382
|
-
linkedSubtreesNotShipped: [],
|
|
383
|
-
conflictPaths: [],
|
|
384
|
-
aborted: false,
|
|
385
|
-
};
|
|
386
|
-
fs.mkdirSync(path.join(hqRoot, "personal"), { recursive: true });
|
|
387
|
-
try {
|
|
388
|
-
await executeCompanyFanout({
|
|
389
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
390
|
-
direction: "push",
|
|
391
|
-
hqRoot,
|
|
392
|
-
onConflict: "abort",
|
|
393
|
-
client: {},
|
|
394
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
395
|
-
syncFn: vi.fn(),
|
|
396
|
-
shareFn: vi.fn(async (options) => {
|
|
397
|
-
options.onEvent?.({
|
|
398
|
-
type: "not-shipped",
|
|
399
|
-
reason: "skill-registration-invalid",
|
|
400
|
-
count: 1,
|
|
401
|
-
samplePaths: ["skills/invalid-frontmatter/SKILL.md"],
|
|
402
|
-
message: "frontmatter.name is required",
|
|
403
|
-
});
|
|
404
|
-
return shareResult;
|
|
405
|
-
}),
|
|
406
|
-
resolveDeletePolicy: () => "all",
|
|
407
|
-
emit: (event) => events.push(event),
|
|
408
|
-
ensureCompanyDir: vi.fn(),
|
|
409
|
-
telemetryClient: null,
|
|
410
|
-
});
|
|
411
|
-
expect(events).toContainEqual({
|
|
412
|
-
type: "not-shipped",
|
|
413
|
-
company: "personal",
|
|
414
|
-
reason: "skill-registration-invalid",
|
|
415
|
-
count: 1,
|
|
416
|
-
samplePaths: ["skills/invalid-frontmatter/SKILL.md"],
|
|
417
|
-
message: "frontmatter.name is required",
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
finally {
|
|
421
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
describe("executeCompanyFanout — personal-vault journal purge forwarding", () => {
|
|
426
|
-
const shareResult = {
|
|
427
|
-
filesUploaded: 0,
|
|
428
|
-
bytesUploaded: 0,
|
|
429
|
-
filesSkipped: 0,
|
|
430
|
-
filesDeleted: 0,
|
|
431
|
-
filesTombstoned: 0,
|
|
432
|
-
filesRefusedStale: 0,
|
|
433
|
-
filesRefusedStalePaths: [],
|
|
434
|
-
filesSuppressedByTombstone: 0,
|
|
435
|
-
filesExcludedByPolicy: 0,
|
|
436
|
-
filesExcludedByScope: 0,
|
|
437
|
-
filesExcludedByIgnore: 0,
|
|
438
|
-
unreachablePaths: [],
|
|
439
|
-
linkedSubtreesNotShipped: [],
|
|
440
|
-
conflictPaths: [],
|
|
441
|
-
aborted: false,
|
|
442
|
-
};
|
|
443
|
-
async function runPersonalPush(emitFromShare) {
|
|
444
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-journal-purge-"));
|
|
445
|
-
fs.mkdirSync(path.join(hqRoot, "personal"), { recursive: true });
|
|
446
|
-
const events = [];
|
|
447
|
-
try {
|
|
448
|
-
const result = await executeCompanyFanout({
|
|
449
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
450
|
-
direction: "push",
|
|
451
|
-
hqRoot,
|
|
452
|
-
onConflict: "abort",
|
|
453
|
-
client: {},
|
|
454
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
455
|
-
syncFn: vi.fn(),
|
|
456
|
-
shareFn: vi.fn(async (options) => {
|
|
457
|
-
emitFromShare(options);
|
|
458
|
-
return shareResult;
|
|
459
|
-
}),
|
|
460
|
-
resolveDeletePolicy: () => "all",
|
|
461
|
-
emit: (event) => events.push(event),
|
|
462
|
-
ensureCompanyDir: vi.fn(),
|
|
463
|
-
telemetryClient: null,
|
|
464
|
-
});
|
|
465
|
-
return { result, events };
|
|
466
|
-
}
|
|
467
|
-
finally {
|
|
468
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
it("forwards a pruned event with the company label, counts by reason and a few sample paths", async () => {
|
|
472
|
-
// The purge's success path was invisible in watch mode: only the vetoed
|
|
473
|
-
// (`purge-skipped`) branch was forwarded, so a 25k-row drain per full pass
|
|
474
|
-
// (hq-cloud 6.16.12, reason `ignore-filtered-present`) left no trace in
|
|
475
|
-
// ~/.hq/logs/hq-sync.log. Forward the pruned event too — count, byReason and
|
|
476
|
-
// a bounded sample — so an operator can see the journal shrinking.
|
|
477
|
-
const samplePaths = Array.from({ length: 10 }, (_, i) => `workspace/.session-logs/claude/s-${i}.jsonl`);
|
|
478
|
-
const { result, events } = await runPersonalPush((options) => {
|
|
479
|
-
options.onEvent?.({
|
|
480
|
-
type: "personal-vault-journal-pruned",
|
|
481
|
-
count: 25_000,
|
|
482
|
-
samplePaths,
|
|
483
|
-
byReason: { "ignore-filtered": 0, "ignore-filtered-present": 25_000, "excluded-top-level": 0 },
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
expect(events).toContainEqual({
|
|
487
|
-
type: "personal-vault-journal-pruned",
|
|
488
|
-
company: "personal",
|
|
489
|
-
count: 25_000,
|
|
490
|
-
samplePaths: samplePaths.slice(0, 5),
|
|
491
|
-
byReason: { "ignore-filtered": 0, "ignore-filtered-present": 25_000, "excluded-top-level": 0 },
|
|
492
|
-
});
|
|
493
|
-
expect(result.errors).toEqual([]);
|
|
494
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
495
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
496
|
-
});
|
|
497
|
-
it("still forwards the vetoed purge with the company label", async () => {
|
|
498
|
-
const { result, events } = await runPersonalPush((options) => {
|
|
499
|
-
options.onEvent?.({
|
|
500
|
-
type: "personal-vault-journal-purge-skipped",
|
|
501
|
-
attempted: 400_000,
|
|
502
|
-
totalRows: 512_560,
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
expect(events).toContainEqual({
|
|
506
|
-
type: "personal-vault-journal-purge-skipped",
|
|
507
|
-
company: "personal",
|
|
508
|
-
attempted: 400_000,
|
|
509
|
-
totalRows: 512_560,
|
|
510
|
-
});
|
|
511
|
-
expect(result.errors).toEqual([]);
|
|
512
|
-
});
|
|
513
|
-
});
|
|
514
|
-
describe("executeCompanyFanout scope fairness", () => {
|
|
515
|
-
it("starts a personal-vault push while a company-vault push is still in flight", async () => {
|
|
516
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-fairness-"));
|
|
517
|
-
fs.mkdirSync(path.join(hqRoot, "personal"), { recursive: true });
|
|
518
|
-
fs.mkdirSync(path.join(hqRoot, "companies", "indigo"), { recursive: true });
|
|
519
|
-
fs.writeFileSync(path.join(hqRoot, "personal", "changed.md"), "personal");
|
|
520
|
-
fs.writeFileSync(path.join(hqRoot, "companies", "indigo", "changed.md"), "company");
|
|
521
|
-
let releaseCompanyPush;
|
|
522
|
-
const companyPush = new Promise((resolve) => {
|
|
523
|
-
releaseCompanyPush = resolve;
|
|
524
|
-
});
|
|
525
|
-
let personalPushStarted = false;
|
|
526
|
-
const shareResult = {
|
|
527
|
-
filesUploaded: 0,
|
|
528
|
-
bytesUploaded: 0,
|
|
529
|
-
filesSkipped: 0,
|
|
530
|
-
filesDeleted: 0,
|
|
531
|
-
filesTombstoned: 0,
|
|
532
|
-
filesRefusedStale: 0,
|
|
533
|
-
filesRefusedStalePaths: [],
|
|
534
|
-
filesSuppressedByTombstone: 0,
|
|
535
|
-
filesExcludedByPolicy: 0,
|
|
536
|
-
filesExcludedByScope: 0,
|
|
537
|
-
filesExcludedByIgnore: 0,
|
|
538
|
-
unreachablePaths: [],
|
|
539
|
-
linkedSubtreesNotShipped: [],
|
|
540
|
-
conflictPaths: [],
|
|
541
|
-
aborted: false,
|
|
542
|
-
};
|
|
543
|
-
const shareFn = vi.fn(async (opts) => {
|
|
544
|
-
if (opts.personalMode === true) {
|
|
545
|
-
personalPushStarted = true;
|
|
546
|
-
return shareResult;
|
|
547
|
-
}
|
|
548
|
-
await companyPush;
|
|
549
|
-
return shareResult;
|
|
550
|
-
});
|
|
551
|
-
try {
|
|
552
|
-
const running = executeCompanyFanout({
|
|
553
|
-
plan: [
|
|
554
|
-
{ uid: "cmp_indigo", slug: "indigo" },
|
|
555
|
-
{
|
|
556
|
-
uid: "prs_me",
|
|
557
|
-
slug: "personal",
|
|
558
|
-
personalMode: true,
|
|
559
|
-
journalSlug: "__hq_personal_vault__",
|
|
560
|
-
},
|
|
561
|
-
],
|
|
562
|
-
direction: "push",
|
|
563
|
-
hqRoot,
|
|
564
|
-
onConflict: "abort",
|
|
565
|
-
client: {},
|
|
566
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
567
|
-
syncFn: vi.fn(),
|
|
568
|
-
shareFn,
|
|
569
|
-
resolveDeletePolicy: () => "all",
|
|
570
|
-
emit: vi.fn(),
|
|
571
|
-
ensureCompanyDir: vi.fn(),
|
|
572
|
-
telemetryClient: null,
|
|
573
|
-
});
|
|
574
|
-
await Promise.resolve();
|
|
575
|
-
await Promise.resolve();
|
|
576
|
-
expect(personalPushStarted).toBe(true);
|
|
577
|
-
releaseCompanyPush?.();
|
|
578
|
-
await running;
|
|
579
|
-
}
|
|
580
|
-
finally {
|
|
581
|
-
releaseCompanyPush?.();
|
|
582
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
});
|
|
586
|
-
describe("executeCompanyFanout transfer ceiling", () => {
|
|
587
|
-
it("keeps concurrent targets at HQ_SYNC_MAX_CONCURRENCY transfers in total", async () => {
|
|
588
|
-
const oldCap = process.env.HQ_SYNC_MAX_CONCURRENCY;
|
|
589
|
-
process.env.HQ_SYNC_MAX_CONCURRENCY = "2";
|
|
590
|
-
setBandwidthGovernorForTesting(null);
|
|
591
|
-
let inFlight = 0;
|
|
592
|
-
let observedMaximum = 0;
|
|
593
|
-
let releaseTransfers;
|
|
594
|
-
const transfersMayFinish = new Promise((resolve) => {
|
|
595
|
-
releaseTransfers = resolve;
|
|
596
|
-
});
|
|
597
|
-
const shareResult = {
|
|
598
|
-
filesUploaded: 0, bytesUploaded: 0, filesSkipped: 0, filesDeleted: 0,
|
|
599
|
-
filesTombstoned: 0, filesRefusedStale: 0, filesRefusedStalePaths: [],
|
|
600
|
-
filesSuppressedByTombstone: 0, filesExcludedByPolicy: 0,
|
|
601
|
-
filesExcludedByScope: 0, filesExcludedByIgnore: 0, unreachablePaths: [],
|
|
602
|
-
linkedSubtreesNotShipped: [], conflictPaths: [], aborted: false,
|
|
603
|
-
};
|
|
604
|
-
const shareFn = vi.fn(async (options) => {
|
|
605
|
-
expect(options.transferSemaphore).toBeDefined();
|
|
606
|
-
await Promise.all(Array.from({ length: 3 }, () => options.transferSemaphore.withPermit(async () => {
|
|
607
|
-
inFlight += 1;
|
|
608
|
-
observedMaximum = Math.max(observedMaximum, inFlight);
|
|
609
|
-
await transfersMayFinish;
|
|
610
|
-
inFlight -= 1;
|
|
611
|
-
})));
|
|
612
|
-
return shareResult;
|
|
613
|
-
});
|
|
614
|
-
try {
|
|
615
|
-
const running = executeCompanyFanout({
|
|
616
|
-
plan: [
|
|
617
|
-
{ uid: "cmp_acme", slug: "acme" },
|
|
618
|
-
{ uid: "cmp_beta", slug: "beta" },
|
|
619
|
-
],
|
|
620
|
-
direction: "push",
|
|
621
|
-
hqRoot: "/tmp/global-transfer-cap",
|
|
622
|
-
onConflict: "abort",
|
|
623
|
-
client: {},
|
|
624
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
625
|
-
syncFn: vi.fn(),
|
|
626
|
-
shareFn,
|
|
627
|
-
resolveDeletePolicy: () => "all",
|
|
628
|
-
emit: vi.fn(),
|
|
629
|
-
ensureCompanyDir: vi.fn(),
|
|
630
|
-
});
|
|
631
|
-
await Promise.resolve();
|
|
632
|
-
await Promise.resolve();
|
|
633
|
-
expect(observedMaximum).toBe(2);
|
|
634
|
-
releaseTransfers?.();
|
|
635
|
-
await running;
|
|
636
|
-
expect(observedMaximum).toBeLessThanOrEqual(2);
|
|
637
|
-
}
|
|
638
|
-
finally {
|
|
639
|
-
releaseTransfers?.();
|
|
640
|
-
if (oldCap === undefined)
|
|
641
|
-
delete process.env.HQ_SYNC_MAX_CONCURRENCY;
|
|
642
|
-
else
|
|
643
|
-
process.env.HQ_SYNC_MAX_CONCURRENCY = oldCap;
|
|
644
|
-
setBandwidthGovernorForTesting(null);
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
});
|
|
648
|
-
describe("executeCompanyFanout tombstone snapshot", () => {
|
|
649
|
-
it("shares one personal deletion set between push and pull in a combined pass", async () => {
|
|
650
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-tombstones-"));
|
|
651
|
-
const deletedAt = "2026-08-22T12:00:00.000Z";
|
|
652
|
-
const fetchMock = vi.fn(async (_url) => ({
|
|
653
|
-
ok: true,
|
|
654
|
-
status: 200,
|
|
655
|
-
json: async () => ({
|
|
656
|
-
tombstones: [{ key: "knowledge/deleted.md", deletedAt }],
|
|
657
|
-
}),
|
|
658
|
-
}));
|
|
659
|
-
vi.stubGlobal("fetch", fetchMock);
|
|
660
|
-
const pushResult = {
|
|
661
|
-
filesUploaded: 0,
|
|
662
|
-
bytesUploaded: 0,
|
|
663
|
-
filesSkipped: 0,
|
|
664
|
-
filesDeleted: 0,
|
|
665
|
-
filesTombstoned: 0,
|
|
666
|
-
filesRefusedStale: 0,
|
|
667
|
-
filesRefusedStalePaths: [],
|
|
668
|
-
filesSuppressedByTombstone: 0,
|
|
669
|
-
filesExcludedByPolicy: 0,
|
|
670
|
-
filesExcludedByScope: 0,
|
|
671
|
-
filesExcludedByIgnore: 0,
|
|
672
|
-
unreachablePaths: [],
|
|
673
|
-
linkedSubtreesNotShipped: [],
|
|
674
|
-
conflictPaths: [],
|
|
675
|
-
aborted: false,
|
|
676
|
-
};
|
|
677
|
-
const pullResult = {
|
|
678
|
-
filesDownloaded: 0,
|
|
679
|
-
bytesDownloaded: 0,
|
|
680
|
-
filesSkipped: 0,
|
|
681
|
-
conflicts: 0,
|
|
682
|
-
conflictPaths: [],
|
|
683
|
-
aborted: false,
|
|
684
|
-
newFiles: [],
|
|
685
|
-
newFilesCount: 0,
|
|
686
|
-
filesExcludedByPolicy: 0,
|
|
687
|
-
filesTombstoned: 0,
|
|
688
|
-
filesOutOfScope: 0,
|
|
689
|
-
scopeOrphansRemoved: 0,
|
|
690
|
-
scopeOrphansBlocked: 0,
|
|
691
|
-
changedPaths: [],
|
|
692
|
-
};
|
|
693
|
-
const shareFn = vi.fn(async (_options) => pushResult);
|
|
694
|
-
const syncFn = vi.fn(async (_options) => pullResult);
|
|
695
|
-
try {
|
|
696
|
-
await executeCompanyFanout({
|
|
697
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
698
|
-
direction: "both",
|
|
699
|
-
hqRoot,
|
|
700
|
-
onConflict: "abort",
|
|
701
|
-
client: {},
|
|
702
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
703
|
-
syncFn,
|
|
704
|
-
shareFn,
|
|
705
|
-
resolveDeletePolicy: () => "all",
|
|
706
|
-
emit: vi.fn(),
|
|
707
|
-
ensureCompanyDir: vi.fn(),
|
|
708
|
-
telemetryClient: null,
|
|
709
|
-
});
|
|
710
|
-
const pushTombstones = shareFn.mock.calls[0][0].fileTombstones;
|
|
711
|
-
const pullTombstones = syncFn.mock.calls[0][0].fileTombstones;
|
|
712
|
-
expect(pushTombstones).toBe(pullTombstones);
|
|
713
|
-
expect(pushTombstones?.get("knowledge/deleted.md")).toEqual({ deletedAt });
|
|
714
|
-
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
715
|
-
expect(String(fetchMock.mock.calls[0][0])).toBe("https://api.example/v1/files/tombstones?personal=1");
|
|
716
|
-
}
|
|
717
|
-
finally {
|
|
718
|
-
vi.unstubAllGlobals();
|
|
719
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
});
|
|
723
|
-
describe("executeCompanyFanout — Windows symlink-privilege skip (HQ-DESKTOP-54)", () => {
|
|
724
|
-
it("re-emits the skip with the company label, never errors the company, and keeps it complete", async () => {
|
|
725
|
-
// A privilege-refused symlink surfaces from the pull leg as the dedicated
|
|
726
|
-
// skip event. The fanout must re-tag it with the company and pass it
|
|
727
|
-
// through WITHOUT recording an error — so `errors[]` stays empty (runner
|
|
728
|
-
// exit 0) and the company settles `complete`. personalMode avoids the
|
|
729
|
-
// network scope resolution so the leg reaches the injected syncFn directly.
|
|
730
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-symlink-"));
|
|
731
|
-
try {
|
|
732
|
-
const events = [];
|
|
733
|
-
const skipResult = {
|
|
734
|
-
filesDownloaded: 0,
|
|
735
|
-
bytesDownloaded: 0,
|
|
736
|
-
filesSkipped: 1,
|
|
737
|
-
conflicts: 0,
|
|
738
|
-
conflictPaths: [],
|
|
739
|
-
aborted: false,
|
|
740
|
-
newFiles: [],
|
|
741
|
-
newFilesCount: 0,
|
|
742
|
-
filesExcludedByPolicy: 0,
|
|
743
|
-
filesTombstoned: 0,
|
|
744
|
-
filesOutOfScope: 0,
|
|
745
|
-
scopeOrphansRemoved: 0,
|
|
746
|
-
scopeOrphansBlocked: 0,
|
|
747
|
-
};
|
|
748
|
-
const syncFn = vi.fn(async (opts) => {
|
|
749
|
-
opts.onEvent?.({
|
|
750
|
-
type: "skip-symlink-privilege",
|
|
751
|
-
path: "docs/skill-link.md",
|
|
752
|
-
target: "../target.md",
|
|
753
|
-
remedy: "enable Developer Mode",
|
|
754
|
-
});
|
|
755
|
-
return skipResult;
|
|
756
|
-
});
|
|
757
|
-
const result = await executeCompanyFanout({
|
|
758
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
759
|
-
direction: "pull",
|
|
760
|
-
hqRoot,
|
|
761
|
-
onConflict: "abort",
|
|
762
|
-
client: {},
|
|
763
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
764
|
-
syncFn,
|
|
765
|
-
shareFn: vi.fn(),
|
|
766
|
-
resolveDeletePolicy: () => "all",
|
|
767
|
-
emit: (e) => events.push(e),
|
|
768
|
-
ensureCompanyDir: vi.fn(),
|
|
769
|
-
telemetryClient: null,
|
|
770
|
-
});
|
|
771
|
-
// Re-emitted with the company label, verbatim payload preserved.
|
|
772
|
-
expect(events).toContainEqual({
|
|
773
|
-
type: "skip-symlink-privilege",
|
|
774
|
-
company: "personal",
|
|
775
|
-
path: "docs/skill-link.md",
|
|
776
|
-
target: "../target.md",
|
|
777
|
-
remedy: "enable Developer Mode",
|
|
778
|
-
});
|
|
779
|
-
// The load-bearing guarantee: no error recorded anywhere.
|
|
780
|
-
expect(result.errors).toEqual([]);
|
|
781
|
-
expect(result.companyFailures).toEqual([]);
|
|
782
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
783
|
-
// The company settled `complete`, not `errored`.
|
|
784
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
785
|
-
}
|
|
786
|
-
finally {
|
|
787
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
});
|
|
791
|
-
describe("executeCompanyFanout — archived session-log skip", () => {
|
|
792
|
-
it("re-emits the skip with the company label and never errors the company", async () => {
|
|
793
|
-
// The push leg refuses to adopt a DEEP_ARCHIVE session transcript (its body
|
|
794
|
-
// cannot be fetched) and reports the deliberate skip. The fanout must pass
|
|
795
|
-
// it through re-tagged with the company, off errors[], so the company still
|
|
796
|
-
// settles `complete` and the runner keeps exit 0.
|
|
797
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-archived-"));
|
|
798
|
-
try {
|
|
799
|
-
const events = [];
|
|
800
|
-
const skipResult = {
|
|
801
|
-
filesDownloaded: 0,
|
|
802
|
-
bytesDownloaded: 0,
|
|
803
|
-
filesSkipped: 1,
|
|
804
|
-
conflicts: 0,
|
|
805
|
-
conflictPaths: [],
|
|
806
|
-
aborted: false,
|
|
807
|
-
newFiles: [],
|
|
808
|
-
newFilesCount: 0,
|
|
809
|
-
filesExcludedByPolicy: 0,
|
|
810
|
-
filesTombstoned: 0,
|
|
811
|
-
filesOutOfScope: 0,
|
|
812
|
-
scopeOrphansRemoved: 0,
|
|
813
|
-
scopeOrphansBlocked: 0,
|
|
814
|
-
};
|
|
815
|
-
const syncFn = vi.fn(async (opts) => {
|
|
816
|
-
opts.onEvent?.({
|
|
817
|
-
type: "skip-archived-session-log",
|
|
818
|
-
path: "workspace/.session-logs/codex/2026/08/20/rollout-r1.jsonl",
|
|
819
|
-
});
|
|
820
|
-
return skipResult;
|
|
821
|
-
});
|
|
822
|
-
const result = await executeCompanyFanout({
|
|
823
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
824
|
-
direction: "pull",
|
|
825
|
-
hqRoot,
|
|
826
|
-
onConflict: "keep",
|
|
827
|
-
client: {},
|
|
828
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
829
|
-
syncFn,
|
|
830
|
-
shareFn: vi.fn(),
|
|
831
|
-
resolveDeletePolicy: () => "all",
|
|
832
|
-
emit: (e) => events.push(e),
|
|
833
|
-
ensureCompanyDir: vi.fn(),
|
|
834
|
-
telemetryClient: null,
|
|
835
|
-
});
|
|
836
|
-
expect(events).toContainEqual({
|
|
837
|
-
type: "skip-archived-session-log",
|
|
838
|
-
company: "personal",
|
|
839
|
-
path: "workspace/.session-logs/codex/2026/08/20/rollout-r1.jsonl",
|
|
840
|
-
});
|
|
841
|
-
expect(result.errors).toEqual([]);
|
|
842
|
-
expect(result.companyFailures).toEqual([]);
|
|
843
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
844
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
845
|
-
}
|
|
846
|
-
finally {
|
|
847
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
|
-
describe("executeCompanyFanout — diagnostic tombstone HEAD deferral", () => {
|
|
852
|
-
it("does not error the company when the only events are diagnostic tombstone deferrals", async () => {
|
|
853
|
-
// A vault 100/hr throttle during planned-deletion HEAD verify is
|
|
854
|
-
// emitted as `{ type: "error", diagnostic: true }`. The fanout must
|
|
855
|
-
// forward that marker and leave errors[] empty so the company
|
|
856
|
-
// settles `complete` and the runner keeps exit 0 (never 2).
|
|
857
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-tombstone-"));
|
|
858
|
-
try {
|
|
859
|
-
const events = [];
|
|
860
|
-
const pullResult = {
|
|
861
|
-
filesDownloaded: 0,
|
|
862
|
-
bytesDownloaded: 0,
|
|
863
|
-
filesSkipped: 0,
|
|
864
|
-
conflicts: 0,
|
|
865
|
-
conflictPaths: [],
|
|
866
|
-
aborted: false,
|
|
867
|
-
newFiles: [],
|
|
868
|
-
newFilesCount: 0,
|
|
869
|
-
filesExcludedByPolicy: 0,
|
|
870
|
-
filesTombstoned: 0,
|
|
871
|
-
filesOutOfScope: 0,
|
|
872
|
-
scopeOrphansRemoved: 0,
|
|
873
|
-
scopeOrphansBlocked: 0,
|
|
874
|
-
};
|
|
875
|
-
const syncFn = vi.fn(async (opts) => {
|
|
876
|
-
opts.onEvent?.({
|
|
877
|
-
type: "error",
|
|
878
|
-
diagnostic: true,
|
|
879
|
-
path: "skills/wbr-finalize/SKILL.md",
|
|
880
|
-
message: "tombstone HEAD verify failed (deferring): RateLimited rate limited (100/hr) — get skills/wbr-finalize/SKILL.md deferred to next sync",
|
|
881
|
-
});
|
|
882
|
-
return pullResult;
|
|
883
|
-
});
|
|
884
|
-
const result = await executeCompanyFanout({
|
|
885
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
886
|
-
direction: "pull",
|
|
887
|
-
hqRoot,
|
|
888
|
-
onConflict: "keep",
|
|
889
|
-
client: {},
|
|
890
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
891
|
-
syncFn,
|
|
892
|
-
shareFn: vi.fn(),
|
|
893
|
-
resolveDeletePolicy: () => "all",
|
|
894
|
-
emit: (e) => events.push(e),
|
|
895
|
-
ensureCompanyDir: vi.fn(),
|
|
896
|
-
telemetryClient: null,
|
|
897
|
-
});
|
|
898
|
-
expect(events).toContainEqual({
|
|
899
|
-
type: "error",
|
|
900
|
-
diagnostic: true,
|
|
901
|
-
company: "personal",
|
|
902
|
-
path: "skills/wbr-finalize/SKILL.md",
|
|
903
|
-
message: "tombstone HEAD verify failed (deferring): RateLimited rate limited (100/hr) — get skills/wbr-finalize/SKILL.md deferred to next sync",
|
|
904
|
-
});
|
|
905
|
-
expect(result.errors).toEqual([]);
|
|
906
|
-
expect(result.companyFailures).toEqual([]);
|
|
907
|
-
expect(result.transientCompanies).toEqual([]);
|
|
908
|
-
expect(events.some((e) => e.type === "error" && e.diagnostic !== true)).toBe(false);
|
|
909
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
910
|
-
}
|
|
911
|
-
finally {
|
|
912
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
|
-
});
|
|
916
|
-
describe("executeCompanyFanout — diagnostic rate-limited transfer deferral", () => {
|
|
917
|
-
it("does not error the company when the only events are diagnostic upload deferrals", async () => {
|
|
918
|
-
// A vault 100/hr throttle during a per-file PUT is emitted as
|
|
919
|
-
// `{ type: "error", diagnostic: true }`. The fanout must forward that
|
|
920
|
-
// marker and leave errors[] empty so the company settles `complete`
|
|
921
|
-
// and the runner keeps exit 0 (never 2).
|
|
922
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-put-defer-"));
|
|
923
|
-
try {
|
|
924
|
-
const events = [];
|
|
925
|
-
const shareResult = {
|
|
926
|
-
filesUploaded: 0,
|
|
927
|
-
bytesUploaded: 0,
|
|
928
|
-
filesSkipped: 1,
|
|
929
|
-
filesDeleted: 0,
|
|
930
|
-
filesTombstoned: 0,
|
|
931
|
-
filesRefusedStale: 0,
|
|
932
|
-
filesRefusedStalePaths: [],
|
|
933
|
-
filesSuppressedByTombstone: 0,
|
|
934
|
-
filesExcludedByPolicy: 0,
|
|
935
|
-
filesExcludedByScope: 0,
|
|
936
|
-
filesExcludedByIgnore: 0,
|
|
937
|
-
unreachablePaths: [],
|
|
938
|
-
linkedSubtreesNotShipped: [],
|
|
939
|
-
conflictPaths: [],
|
|
940
|
-
aborted: false,
|
|
941
|
-
};
|
|
942
|
-
const shareFn = vi.fn(async (opts) => {
|
|
943
|
-
opts.onEvent?.({
|
|
944
|
-
type: "error",
|
|
945
|
-
diagnostic: true,
|
|
946
|
-
path: "workers/concierge/output/mention-sweep-batches/1789110806_212549.json",
|
|
947
|
-
message: "RateLimited rate limited (100/hr) — put workers/concierge/output/mention-sweep-batches/1789110806_212549.json deferred to next sync",
|
|
948
|
-
});
|
|
949
|
-
return shareResult;
|
|
950
|
-
});
|
|
951
|
-
const result = await executeCompanyFanout({
|
|
952
|
-
plan: [{ uid: "prs_1", slug: "mhi-media", personalMode: true }],
|
|
953
|
-
direction: "push",
|
|
954
|
-
hqRoot,
|
|
955
|
-
onConflict: "keep",
|
|
956
|
-
client: {},
|
|
957
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
958
|
-
syncFn: vi.fn(),
|
|
959
|
-
shareFn,
|
|
960
|
-
resolveDeletePolicy: () => "all",
|
|
961
|
-
emit: (e) => events.push(e),
|
|
962
|
-
ensureCompanyDir: vi.fn(),
|
|
963
|
-
telemetryClient: null,
|
|
964
|
-
});
|
|
965
|
-
expect(events).toContainEqual({
|
|
966
|
-
type: "error",
|
|
967
|
-
diagnostic: true,
|
|
968
|
-
company: "mhi-media",
|
|
969
|
-
path: "workers/concierge/output/mention-sweep-batches/1789110806_212549.json",
|
|
970
|
-
message: "RateLimited rate limited (100/hr) — put workers/concierge/output/mention-sweep-batches/1789110806_212549.json deferred to next sync",
|
|
971
|
-
});
|
|
972
|
-
expect(result.errors).toEqual([]);
|
|
973
|
-
expect(result.companyFailures).toEqual([]);
|
|
974
|
-
expect(result.transientCompanies).toEqual([]);
|
|
975
|
-
expect(events.some((e) => e.type === "error" && e.diagnostic !== true)).toBe(false);
|
|
976
|
-
expect(result.stateByCompany.get("mhi-media")?.status).toBe("complete");
|
|
977
|
-
}
|
|
978
|
-
finally {
|
|
979
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
it("does not error the company when the only events are a breaker-tripped upload-batch deferral", async () => {
|
|
983
|
-
// throwUploadWorkerErrors collapses an all-RateLimited worker batch into
|
|
984
|
-
// one `{ type: "error", diagnostic: true, path: "(company)" }`. Same
|
|
985
|
-
// contract as the per-file PUT deferral: errors[] stays empty, the
|
|
986
|
-
// company settles `complete`, the runner keeps exit 0 (never 2).
|
|
987
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-put-batch-defer-"));
|
|
988
|
-
try {
|
|
989
|
-
const events = [];
|
|
990
|
-
const shareResult = {
|
|
991
|
-
filesUploaded: 0,
|
|
992
|
-
bytesUploaded: 0,
|
|
993
|
-
filesSkipped: 0,
|
|
994
|
-
filesDeleted: 0,
|
|
995
|
-
filesTombstoned: 0,
|
|
996
|
-
filesRefusedStale: 0,
|
|
997
|
-
filesRefusedStalePaths: [],
|
|
998
|
-
filesSuppressedByTombstone: 0,
|
|
999
|
-
filesExcludedByPolicy: 0,
|
|
1000
|
-
filesExcludedByScope: 0,
|
|
1001
|
-
filesExcludedByIgnore: 0,
|
|
1002
|
-
unreachablePaths: [],
|
|
1003
|
-
linkedSubtreesNotShipped: [],
|
|
1004
|
-
conflictPaths: [],
|
|
1005
|
-
aborted: false,
|
|
1006
|
-
};
|
|
1007
|
-
const shareFn = vi.fn(async (opts) => {
|
|
1008
|
-
opts.onEvent?.({
|
|
1009
|
-
type: "error",
|
|
1010
|
-
diagnostic: true,
|
|
1011
|
-
path: "(company)",
|
|
1012
|
-
message: "RateLimited rate limited (100/hr) — get workers/concierge/output/mention-sweep-batches/1789110806_212549.json deferred to next sync (and 4915 more upload-worker errors)",
|
|
1013
|
-
});
|
|
1014
|
-
return shareResult;
|
|
1015
|
-
});
|
|
1016
|
-
const result = await executeCompanyFanout({
|
|
1017
|
-
plan: [{ uid: "prs_1", slug: "brickcraft", personalMode: true }],
|
|
1018
|
-
direction: "push",
|
|
1019
|
-
hqRoot,
|
|
1020
|
-
onConflict: "keep",
|
|
1021
|
-
client: {},
|
|
1022
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1023
|
-
syncFn: vi.fn(),
|
|
1024
|
-
shareFn,
|
|
1025
|
-
resolveDeletePolicy: () => "all",
|
|
1026
|
-
emit: (e) => events.push(e),
|
|
1027
|
-
ensureCompanyDir: vi.fn(),
|
|
1028
|
-
telemetryClient: null,
|
|
1029
|
-
});
|
|
1030
|
-
expect(events).toContainEqual({
|
|
1031
|
-
type: "error",
|
|
1032
|
-
diagnostic: true,
|
|
1033
|
-
company: "brickcraft",
|
|
1034
|
-
path: "(company)",
|
|
1035
|
-
message: "RateLimited rate limited (100/hr) — get workers/concierge/output/mention-sweep-batches/1789110806_212549.json deferred to next sync (and 4915 more upload-worker errors)",
|
|
1036
|
-
});
|
|
1037
|
-
expect(result.errors).toEqual([]);
|
|
1038
|
-
expect(result.companyFailures).toEqual([]);
|
|
1039
|
-
expect(result.transientCompanies).toEqual([]);
|
|
1040
|
-
expect(events.some((e) => e.type === "error" && e.diagnostic !== true)).toBe(false);
|
|
1041
|
-
expect(result.stateByCompany.get("brickcraft")?.status).toBe("complete");
|
|
1042
|
-
}
|
|
1043
|
-
finally {
|
|
1044
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
});
|
|
1048
|
-
describe("executeCompanyFanout — Windows rename-blocked skip (HQ-DESKTOP-54, second path)", () => {
|
|
1049
|
-
it("re-emits the skip with the company label, never errors the company, and keeps it complete", async () => {
|
|
1050
|
-
// A transient Windows rename refusal surfaces from the pull leg as the
|
|
1051
|
-
// dedicated skip event. Same contract as the symlink skip: the fanout must
|
|
1052
|
-
// re-tag it with the company and pass it through WITHOUT recording an error,
|
|
1053
|
-
// so `errors[]` stays empty (runner exit 0) and the company settles
|
|
1054
|
-
// `complete`.
|
|
1055
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-rename-"));
|
|
1056
|
-
try {
|
|
1057
|
-
const events = [];
|
|
1058
|
-
const skipResult = {
|
|
1059
|
-
filesDownloaded: 0,
|
|
1060
|
-
bytesDownloaded: 0,
|
|
1061
|
-
filesSkipped: 1,
|
|
1062
|
-
conflicts: 0,
|
|
1063
|
-
conflictPaths: [],
|
|
1064
|
-
aborted: false,
|
|
1065
|
-
newFiles: [],
|
|
1066
|
-
newFilesCount: 0,
|
|
1067
|
-
filesExcludedByPolicy: 0,
|
|
1068
|
-
filesTombstoned: 0,
|
|
1069
|
-
filesOutOfScope: 0,
|
|
1070
|
-
scopeOrphansRemoved: 0,
|
|
1071
|
-
scopeOrphansBlocked: 0,
|
|
1072
|
-
};
|
|
1073
|
-
const syncFn = vi.fn(async (opts) => {
|
|
1074
|
-
opts.onEvent?.({
|
|
1075
|
-
type: "skip-rename-blocked",
|
|
1076
|
-
path: "projects/demo/note.md",
|
|
1077
|
-
remedy: "a program is holding this file open",
|
|
1078
|
-
});
|
|
1079
|
-
return skipResult;
|
|
1080
|
-
});
|
|
1081
|
-
const result = await executeCompanyFanout({
|
|
1082
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1083
|
-
direction: "pull",
|
|
1084
|
-
hqRoot,
|
|
1085
|
-
onConflict: "keep",
|
|
1086
|
-
client: {},
|
|
1087
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1088
|
-
syncFn,
|
|
1089
|
-
shareFn: vi.fn(),
|
|
1090
|
-
resolveDeletePolicy: () => "all",
|
|
1091
|
-
emit: (e) => events.push(e),
|
|
1092
|
-
ensureCompanyDir: vi.fn(),
|
|
1093
|
-
telemetryClient: null,
|
|
1094
|
-
});
|
|
1095
|
-
// Re-emitted with the company label, verbatim payload preserved.
|
|
1096
|
-
expect(events).toContainEqual({
|
|
1097
|
-
type: "skip-rename-blocked",
|
|
1098
|
-
company: "personal",
|
|
1099
|
-
path: "projects/demo/note.md",
|
|
1100
|
-
remedy: "a program is holding this file open",
|
|
1101
|
-
});
|
|
1102
|
-
// The load-bearing guarantee: no error recorded anywhere.
|
|
1103
|
-
expect(result.errors).toEqual([]);
|
|
1104
|
-
expect(result.companyFailures).toEqual([]);
|
|
1105
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1106
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
1107
|
-
}
|
|
1108
|
-
finally {
|
|
1109
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1110
|
-
}
|
|
1111
|
-
});
|
|
1112
|
-
});
|
|
1113
|
-
describe("executeCompanyFanout — vanished-remote skip (LIST→GET race)", () => {
|
|
1114
|
-
it("re-emits the skip with the company label, never errors the company, and keeps it complete", async () => {
|
|
1115
|
-
// A short-lived inbox file that vanished between LIST and GET surfaces
|
|
1116
|
-
// from the pull leg as skip-vanished-remote. The fanout must re-tag it
|
|
1117
|
-
// with the company and pass it through WITHOUT recording an error — so
|
|
1118
|
-
// `errors[]` stays empty (runner exit 0) and the company settles
|
|
1119
|
-
// `complete`.
|
|
1120
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-vanished-"));
|
|
1121
|
-
try {
|
|
1122
|
-
const events = [];
|
|
1123
|
-
const skipResult = {
|
|
1124
|
-
filesDownloaded: 0,
|
|
1125
|
-
bytesDownloaded: 0,
|
|
1126
|
-
filesSkipped: 1,
|
|
1127
|
-
conflicts: 0,
|
|
1128
|
-
conflictPaths: [],
|
|
1129
|
-
aborted: false,
|
|
1130
|
-
newFiles: [],
|
|
1131
|
-
newFilesCount: 0,
|
|
1132
|
-
filesExcludedByPolicy: 0,
|
|
1133
|
-
filesTombstoned: 0,
|
|
1134
|
-
filesOutOfScope: 0,
|
|
1135
|
-
scopeOrphansRemoved: 0,
|
|
1136
|
-
scopeOrphansBlocked: 0,
|
|
1137
|
-
};
|
|
1138
|
-
const vanishedPath = "inbox/pending/jobrun-job-01M0ZP0F8P8BHW4F81X3DR2JKN-1789901775993.json";
|
|
1139
|
-
const syncFn = vi.fn(async (opts) => {
|
|
1140
|
-
opts.onEvent?.({
|
|
1141
|
-
type: "skip-vanished-remote",
|
|
1142
|
-
path: vanishedPath,
|
|
1143
|
-
message: "NoSuchKey http=404 The specified key does not exist.",
|
|
1144
|
-
});
|
|
1145
|
-
return skipResult;
|
|
1146
|
-
});
|
|
1147
|
-
const result = await executeCompanyFanout({
|
|
1148
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1149
|
-
direction: "pull",
|
|
1150
|
-
hqRoot,
|
|
1151
|
-
onConflict: "keep",
|
|
1152
|
-
client: {},
|
|
1153
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1154
|
-
syncFn,
|
|
1155
|
-
shareFn: vi.fn(),
|
|
1156
|
-
resolveDeletePolicy: () => "all",
|
|
1157
|
-
emit: (e) => events.push(e),
|
|
1158
|
-
ensureCompanyDir: vi.fn(),
|
|
1159
|
-
telemetryClient: null,
|
|
1160
|
-
});
|
|
1161
|
-
expect(events).toContainEqual({
|
|
1162
|
-
type: "skip-vanished-remote",
|
|
1163
|
-
company: "personal",
|
|
1164
|
-
path: vanishedPath,
|
|
1165
|
-
message: "NoSuchKey http=404 The specified key does not exist.",
|
|
1166
|
-
});
|
|
1167
|
-
expect(result.errors).toEqual([]);
|
|
1168
|
-
expect(result.companyFailures).toEqual([]);
|
|
1169
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1170
|
-
expect(result.stateByCompany.get("personal")?.status).toBe("complete");
|
|
1171
|
-
}
|
|
1172
|
-
finally {
|
|
1173
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1174
|
-
}
|
|
1175
|
-
});
|
|
1176
|
-
});
|
|
1177
|
-
describe("executeCompanyFanout — targeted pull narrowing (--scope-path)", () => {
|
|
1178
|
-
const emptyResult = {
|
|
1179
|
-
filesDownloaded: 0,
|
|
1180
|
-
bytesDownloaded: 0,
|
|
1181
|
-
filesSkipped: 0,
|
|
1182
|
-
conflicts: 0,
|
|
1183
|
-
conflictPaths: [],
|
|
1184
|
-
aborted: false,
|
|
1185
|
-
newFiles: [],
|
|
1186
|
-
newFilesCount: 0,
|
|
1187
|
-
filesExcludedByPolicy: 0,
|
|
1188
|
-
filesTombstoned: 0,
|
|
1189
|
-
filesOutOfScope: 0,
|
|
1190
|
-
scopeOrphansRemoved: 0,
|
|
1191
|
-
scopeOrphansBlocked: 0,
|
|
1192
|
-
};
|
|
1193
|
-
it("threads scopePaths into the pull leg as pullPrefixes", async () => {
|
|
1194
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-scoped-"));
|
|
1195
|
-
try {
|
|
1196
|
-
const syncFn = vi.fn(async (_opts) => emptyResult);
|
|
1197
|
-
await executeCompanyFanout({
|
|
1198
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1199
|
-
direction: "pull",
|
|
1200
|
-
hqRoot,
|
|
1201
|
-
onConflict: "abort",
|
|
1202
|
-
client: {},
|
|
1203
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1204
|
-
syncFn,
|
|
1205
|
-
shareFn: vi.fn(),
|
|
1206
|
-
resolveDeletePolicy: () => "all",
|
|
1207
|
-
emit: vi.fn(),
|
|
1208
|
-
ensureCompanyDir: vi.fn(),
|
|
1209
|
-
telemetryClient: null,
|
|
1210
|
-
scopePaths: ["knowledge/a.md", "projects/x/"],
|
|
1211
|
-
});
|
|
1212
|
-
expect(syncFn).toHaveBeenCalledTimes(1);
|
|
1213
|
-
expect(syncFn.mock.calls[0][0].pullPrefixes).toEqual([
|
|
1214
|
-
"knowledge/a.md",
|
|
1215
|
-
"projects/x/",
|
|
1216
|
-
]);
|
|
1217
|
-
}
|
|
1218
|
-
finally {
|
|
1219
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1220
|
-
}
|
|
1221
|
-
});
|
|
1222
|
-
it("threads event content hashes into the same scoped pull leg", async () => {
|
|
1223
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-scoped-hash-"));
|
|
1224
|
-
const contentHash = `sha256:${"a".repeat(64)}`;
|
|
1225
|
-
try {
|
|
1226
|
-
const syncFn = vi.fn(async (_opts) => emptyResult);
|
|
1227
|
-
await executeCompanyFanout({
|
|
1228
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1229
|
-
direction: "pull",
|
|
1230
|
-
hqRoot,
|
|
1231
|
-
onConflict: "abort",
|
|
1232
|
-
client: {},
|
|
1233
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1234
|
-
syncFn,
|
|
1235
|
-
shareFn: vi.fn(),
|
|
1236
|
-
resolveDeletePolicy: () => "all",
|
|
1237
|
-
emit: vi.fn(),
|
|
1238
|
-
ensureCompanyDir: vi.fn(),
|
|
1239
|
-
telemetryClient: null,
|
|
1240
|
-
scopePaths: ["knowledge/a.md"],
|
|
1241
|
-
scopeContentHashes: { "knowledge/a.md": contentHash },
|
|
1242
|
-
});
|
|
1243
|
-
expect(syncFn).toHaveBeenCalledTimes(1);
|
|
1244
|
-
expect(syncFn.mock.calls[0][0].pullPrefixes).toEqual(["knowledge/a.md"]);
|
|
1245
|
-
expect(syncFn.mock.calls[0][0].pullContentHashes).toEqual({
|
|
1246
|
-
"knowledge/a.md": contentHash,
|
|
1247
|
-
});
|
|
1248
|
-
}
|
|
1249
|
-
finally {
|
|
1250
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1253
|
-
it("omits pullPrefixes entirely when no scopePaths were passed (full pull preserved)", async () => {
|
|
1254
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-unscoped-"));
|
|
1255
|
-
try {
|
|
1256
|
-
const syncFn = vi.fn(async (_opts) => emptyResult);
|
|
1257
|
-
await executeCompanyFanout({
|
|
1258
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1259
|
-
direction: "pull",
|
|
1260
|
-
hqRoot,
|
|
1261
|
-
onConflict: "abort",
|
|
1262
|
-
client: {},
|
|
1263
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1264
|
-
syncFn,
|
|
1265
|
-
shareFn: vi.fn(),
|
|
1266
|
-
resolveDeletePolicy: () => "all",
|
|
1267
|
-
emit: vi.fn(),
|
|
1268
|
-
ensureCompanyDir: vi.fn(),
|
|
1269
|
-
telemetryClient: null,
|
|
1270
|
-
});
|
|
1271
|
-
expect(syncFn).toHaveBeenCalledTimes(1);
|
|
1272
|
-
expect("pullPrefixes" in syncFn.mock.calls[0][0]).toBe(false);
|
|
1273
|
-
}
|
|
1274
|
-
finally {
|
|
1275
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1276
|
-
}
|
|
1277
|
-
});
|
|
1278
|
-
});
|
|
1279
|
-
describe("executeCompanyFanout — scoped push walk roots", () => {
|
|
1280
|
-
const shareResult = {
|
|
1281
|
-
filesUploaded: 0,
|
|
1282
|
-
bytesUploaded: 0,
|
|
1283
|
-
filesSkipped: 0,
|
|
1284
|
-
filesDeleted: 0,
|
|
1285
|
-
filesTombstoned: 0,
|
|
1286
|
-
filesRefusedStale: 0,
|
|
1287
|
-
filesRefusedStalePaths: [],
|
|
1288
|
-
filesSuppressedByTombstone: 0,
|
|
1289
|
-
filesExcludedByPolicy: 0,
|
|
1290
|
-
filesExcludedByScope: 0,
|
|
1291
|
-
filesExcludedByIgnore: 0,
|
|
1292
|
-
unreachablePaths: [],
|
|
1293
|
-
linkedSubtreesNotShipped: [],
|
|
1294
|
-
conflictPaths: [],
|
|
1295
|
-
aborted: false,
|
|
1296
|
-
};
|
|
1297
|
-
it("walks only three scoped files in a 10k-file personal fixture", async () => {
|
|
1298
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-walk-"));
|
|
1299
|
-
const personalRoot = path.join(hqRoot, "personal");
|
|
1300
|
-
fs.mkdirSync(personalRoot, { recursive: true });
|
|
1301
|
-
const scopePaths = [
|
|
1302
|
-
"personal/selected-a.md",
|
|
1303
|
-
"personal/selected-b.md",
|
|
1304
|
-
"personal/selected-c.md",
|
|
1305
|
-
];
|
|
1306
|
-
for (const scopePath of scopePaths) {
|
|
1307
|
-
fs.writeFileSync(path.join(hqRoot, scopePath), scopePath);
|
|
1308
|
-
}
|
|
1309
|
-
for (let index = 0; index < 10_000; index++) {
|
|
1310
|
-
fs.writeFileSync(path.join(personalRoot, `unscoped-${index}.md`), "x");
|
|
1311
|
-
}
|
|
1312
|
-
let visitedEntries = 0;
|
|
1313
|
-
const realReaddirSync = fs.readdirSync;
|
|
1314
|
-
const readdirSpy = vi.spyOn(fs, "readdirSync").mockImplementation(((...args) => {
|
|
1315
|
-
const entries = Reflect.apply(realReaddirSync, fs, args);
|
|
1316
|
-
if (Array.isArray(entries))
|
|
1317
|
-
visitedEntries += entries.length;
|
|
1318
|
-
return entries;
|
|
1319
|
-
}));
|
|
1320
|
-
const shareFn = vi.fn(async (options) => {
|
|
1321
|
-
await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true);
|
|
1322
|
-
return shareResult;
|
|
1323
|
-
});
|
|
1324
|
-
try {
|
|
1325
|
-
await executeCompanyFanout({
|
|
1326
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1327
|
-
direction: "push",
|
|
1328
|
-
hqRoot,
|
|
1329
|
-
onConflict: "abort",
|
|
1330
|
-
client: {},
|
|
1331
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1332
|
-
syncFn: vi.fn(),
|
|
1333
|
-
shareFn,
|
|
1334
|
-
resolveDeletePolicy: () => "all",
|
|
1335
|
-
emit: vi.fn(),
|
|
1336
|
-
ensureCompanyDir: vi.fn(),
|
|
1337
|
-
telemetryClient: null,
|
|
1338
|
-
scopePaths,
|
|
1339
|
-
});
|
|
1340
|
-
expect(shareFn).toHaveBeenCalledTimes(1);
|
|
1341
|
-
expect(shareFn.mock.calls[0]?.[0].deleteScopeRoots).toEqual(scopePaths);
|
|
1342
|
-
expect(shareFn.mock.calls[0]?.[0].scopedJournal).toBe(true);
|
|
1343
|
-
expect(visitedEntries).toBeLessThanOrEqual(3);
|
|
1344
|
-
}
|
|
1345
|
-
finally {
|
|
1346
|
-
readdirSpy.mockRestore();
|
|
1347
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
it("walks a scoped directory but never a sibling subtree", async () => {
|
|
1351
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-dir-"));
|
|
1352
|
-
const selectedDir = path.join(hqRoot, "personal", "selected");
|
|
1353
|
-
const outsideDir = path.join(hqRoot, "personal", "outside");
|
|
1354
|
-
fs.mkdirSync(selectedDir, { recursive: true });
|
|
1355
|
-
fs.mkdirSync(outsideDir, { recursive: true });
|
|
1356
|
-
fs.writeFileSync(path.join(selectedDir, "inside.md"), "inside");
|
|
1357
|
-
fs.writeFileSync(path.join(outsideDir, "outside.md"), "outside");
|
|
1358
|
-
const readDirs = [];
|
|
1359
|
-
const realReaddirSync = fs.readdirSync;
|
|
1360
|
-
const readdirSpy = vi.spyOn(fs, "readdirSync").mockImplementation(((...args) => {
|
|
1361
|
-
readDirs.push(String(args[0]));
|
|
1362
|
-
return Reflect.apply(realReaddirSync, fs, args);
|
|
1363
|
-
}));
|
|
1364
|
-
try {
|
|
1365
|
-
await executeCompanyFanout({
|
|
1366
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1367
|
-
direction: "push",
|
|
1368
|
-
hqRoot,
|
|
1369
|
-
onConflict: "abort",
|
|
1370
|
-
client: {},
|
|
1371
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1372
|
-
syncFn: vi.fn(),
|
|
1373
|
-
shareFn: async (options) => {
|
|
1374
|
-
await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true);
|
|
1375
|
-
return shareResult;
|
|
1376
|
-
},
|
|
1377
|
-
resolveDeletePolicy: () => "all",
|
|
1378
|
-
emit: vi.fn(),
|
|
1379
|
-
ensureCompanyDir: vi.fn(),
|
|
1380
|
-
telemetryClient: null,
|
|
1381
|
-
scopePaths: ["personal/selected/"],
|
|
1382
|
-
});
|
|
1383
|
-
expect(readDirs).toContain(selectedDir);
|
|
1384
|
-
expect(readDirs).not.toContain(outsideDir);
|
|
1385
|
-
expect(readDirs).not.toContain(path.join(hqRoot, "personal"));
|
|
1386
|
-
}
|
|
1387
|
-
finally {
|
|
1388
|
-
readdirSpy.mockRestore();
|
|
1389
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1390
|
-
}
|
|
1391
|
-
});
|
|
1392
|
-
it("walks a containing thread carve-out scope alongside a vault-root file", async () => {
|
|
1393
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-carveout-"));
|
|
1394
|
-
const rootFile = path.join(hqRoot, "personal", "rtprobe.md");
|
|
1395
|
-
const handoffFile = path.join(hqRoot, "workspace", "threads", "handoff.json");
|
|
1396
|
-
const threadFile = path.join(hqRoot, "workspace", "threads", "x.json");
|
|
1397
|
-
fs.mkdirSync(path.dirname(rootFile), { recursive: true });
|
|
1398
|
-
fs.mkdirSync(path.dirname(threadFile), { recursive: true });
|
|
1399
|
-
fs.writeFileSync(rootFile, "root");
|
|
1400
|
-
fs.writeFileSync(threadFile, "thread");
|
|
1401
|
-
fs.writeFileSync(handoffFile, JSON.stringify({ thread_path: "workspace/threads/x.json" }));
|
|
1402
|
-
try {
|
|
1403
|
-
const uploadedPaths = [];
|
|
1404
|
-
await executeCompanyFanout({
|
|
1405
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1406
|
-
direction: "push",
|
|
1407
|
-
hqRoot,
|
|
1408
|
-
onConflict: "abort",
|
|
1409
|
-
client: {},
|
|
1410
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1411
|
-
syncFn: vi.fn(),
|
|
1412
|
-
shareFn: async (options) => {
|
|
1413
|
-
uploadedPaths.push(...(await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true))
|
|
1414
|
-
.map((entry) => entry.relativePath));
|
|
1415
|
-
return shareResult;
|
|
1416
|
-
},
|
|
1417
|
-
resolveDeletePolicy: () => "all",
|
|
1418
|
-
emit: vi.fn(),
|
|
1419
|
-
ensureCompanyDir: vi.fn(),
|
|
1420
|
-
telemetryClient: null,
|
|
1421
|
-
scopePaths: ["personal/rtprobe.md", "workspace/threads/"],
|
|
1422
|
-
});
|
|
1423
|
-
expect(uploadedPaths).toContain("personal/rtprobe.md");
|
|
1424
|
-
expect(uploadedPaths).toContain("workspace/threads/x.json");
|
|
1425
|
-
}
|
|
1426
|
-
finally {
|
|
1427
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1428
|
-
}
|
|
1429
|
-
});
|
|
1430
|
-
it("routes an active continuity-thread event through the scoped personal push", async () => {
|
|
1431
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-thread-event-"));
|
|
1432
|
-
const threadFile = path.join(hqRoot, "workspace", "threads", "x.json");
|
|
1433
|
-
fs.mkdirSync(path.dirname(threadFile), { recursive: true });
|
|
1434
|
-
fs.writeFileSync(threadFile, "thread");
|
|
1435
|
-
fs.writeFileSync(path.join(hqRoot, "workspace", "threads", "handoff.json"), JSON.stringify({ thread_path: "workspace/threads/x.json" }));
|
|
1436
|
-
try {
|
|
1437
|
-
const clock = new FakeClock();
|
|
1438
|
-
const batches = [];
|
|
1439
|
-
const watcher = new TreeWatcher({
|
|
1440
|
-
hqRoot,
|
|
1441
|
-
personalMode: true,
|
|
1442
|
-
debounceMs: 1,
|
|
1443
|
-
clock,
|
|
1444
|
-
});
|
|
1445
|
-
watcher.onChange((_unused, batch) => {
|
|
1446
|
-
if (batch)
|
|
1447
|
-
batches.push(batch);
|
|
1448
|
-
});
|
|
1449
|
-
watcher.handleEvent(threadFile, "change");
|
|
1450
|
-
clock.advance(1);
|
|
1451
|
-
expect(batches).toHaveLength(1);
|
|
1452
|
-
const scopedArgv = buildScopedPushArgv({ kind: "personal" }, [...batches[0].paths.values()], []);
|
|
1453
|
-
expect(scopedArgv).toContain("workspace/threads/x.json");
|
|
1454
|
-
const uploadedPaths = [];
|
|
1455
|
-
await executeCompanyFanout({
|
|
1456
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1457
|
-
direction: "push",
|
|
1458
|
-
hqRoot,
|
|
1459
|
-
onConflict: "abort",
|
|
1460
|
-
client: {},
|
|
1461
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1462
|
-
syncFn: vi.fn(),
|
|
1463
|
-
shareFn: async (options) => {
|
|
1464
|
-
uploadedPaths.push(...(await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true))
|
|
1465
|
-
.map((entry) => entry.relativePath));
|
|
1466
|
-
return shareResult;
|
|
1467
|
-
},
|
|
1468
|
-
resolveDeletePolicy: () => "all",
|
|
1469
|
-
emit: vi.fn(),
|
|
1470
|
-
ensureCompanyDir: vi.fn(),
|
|
1471
|
-
telemetryClient: null,
|
|
1472
|
-
scopePaths: ["workspace/threads/x.json"],
|
|
1473
|
-
});
|
|
1474
|
-
expect(uploadedPaths).toContain("workspace/threads/x.json");
|
|
1475
|
-
}
|
|
1476
|
-
finally {
|
|
1477
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1478
|
-
}
|
|
1479
|
-
});
|
|
1480
|
-
it("walks a nested session-log carve-out path without walking its sibling", async () => {
|
|
1481
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-session-logs-"));
|
|
1482
|
-
const selected = path.join(hqRoot, "workspace", ".session-logs", "a", "b", "c.txt");
|
|
1483
|
-
const sibling = path.join(hqRoot, "workspace", ".session-logs", "sibling.txt");
|
|
1484
|
-
fs.mkdirSync(path.dirname(selected), { recursive: true });
|
|
1485
|
-
fs.writeFileSync(selected, "selected");
|
|
1486
|
-
fs.writeFileSync(sibling, "sibling");
|
|
1487
|
-
try {
|
|
1488
|
-
const uploadedPaths = [];
|
|
1489
|
-
await executeCompanyFanout({
|
|
1490
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1491
|
-
direction: "push",
|
|
1492
|
-
hqRoot,
|
|
1493
|
-
onConflict: "abort",
|
|
1494
|
-
client: {},
|
|
1495
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1496
|
-
syncFn: vi.fn(),
|
|
1497
|
-
shareFn: async (options) => {
|
|
1498
|
-
uploadedPaths.push(...(await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true))
|
|
1499
|
-
.map((entry) => entry.relativePath));
|
|
1500
|
-
return shareResult;
|
|
1501
|
-
},
|
|
1502
|
-
resolveDeletePolicy: () => "all",
|
|
1503
|
-
emit: vi.fn(),
|
|
1504
|
-
ensureCompanyDir: vi.fn(),
|
|
1505
|
-
telemetryClient: null,
|
|
1506
|
-
scopePaths: ["workspace/.session-logs/a/b/c.txt"],
|
|
1507
|
-
});
|
|
1508
|
-
expect(uploadedPaths).toEqual(["workspace/.session-logs/a/b/c.txt"]);
|
|
1509
|
-
}
|
|
1510
|
-
finally {
|
|
1511
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1512
|
-
}
|
|
1513
|
-
});
|
|
1514
|
-
it("walks a scoped local-company path in the personal vault", async () => {
|
|
1515
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-company-"));
|
|
1516
|
-
const companyFile = path.join(hqRoot, "companies", "acme", "knowledge", "x.md");
|
|
1517
|
-
fs.mkdirSync(path.dirname(companyFile), { recursive: true });
|
|
1518
|
-
fs.writeFileSync(companyFile, "company");
|
|
1519
|
-
try {
|
|
1520
|
-
const uploadedPaths = [];
|
|
1521
|
-
await executeCompanyFanout({
|
|
1522
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1523
|
-
direction: "push",
|
|
1524
|
-
hqRoot,
|
|
1525
|
-
onConflict: "abort",
|
|
1526
|
-
client: {},
|
|
1527
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1528
|
-
syncFn: vi.fn(),
|
|
1529
|
-
shareFn: async (options) => {
|
|
1530
|
-
uploadedPaths.push(...(await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true))
|
|
1531
|
-
.map((entry) => entry.relativePath));
|
|
1532
|
-
return shareResult;
|
|
1533
|
-
},
|
|
1534
|
-
resolveDeletePolicy: () => "all",
|
|
1535
|
-
emit: vi.fn(),
|
|
1536
|
-
ensureCompanyDir: vi.fn(),
|
|
1537
|
-
telemetryClient: null,
|
|
1538
|
-
scopePaths: ["companies/acme/knowledge/x.md"],
|
|
1539
|
-
});
|
|
1540
|
-
expect(uploadedPaths).toEqual(["companies/acme/knowledge/x.md"]);
|
|
1541
|
-
}
|
|
1542
|
-
finally {
|
|
1543
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1544
|
-
}
|
|
1545
|
-
});
|
|
1546
|
-
it("reports an out-of-vault scope instead of silently omitting it", async () => {
|
|
1547
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-outside-"));
|
|
1548
|
-
const emit = vi.fn();
|
|
1549
|
-
try {
|
|
1550
|
-
await executeCompanyFanout({
|
|
1551
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1552
|
-
direction: "push",
|
|
1553
|
-
hqRoot,
|
|
1554
|
-
onConflict: "abort",
|
|
1555
|
-
client: {},
|
|
1556
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1557
|
-
syncFn: vi.fn(),
|
|
1558
|
-
shareFn: vi.fn(async () => shareResult),
|
|
1559
|
-
resolveDeletePolicy: () => "all",
|
|
1560
|
-
emit,
|
|
1561
|
-
ensureCompanyDir: vi.fn(),
|
|
1562
|
-
telemetryClient: null,
|
|
1563
|
-
scopePaths: ["workspace/not-a-carve-out/x.json"],
|
|
1564
|
-
});
|
|
1565
|
-
expect(emit).toHaveBeenCalledWith({
|
|
1566
|
-
type: "not-shipped",
|
|
1567
|
-
company: "personal",
|
|
1568
|
-
reason: "outside-vault-scope",
|
|
1569
|
-
count: 1,
|
|
1570
|
-
samplePaths: ["workspace/not-a-carve-out/x.json"],
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
finally {
|
|
1574
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1575
|
-
}
|
|
1576
|
-
});
|
|
1577
|
-
it("retains a deleted thread carve-out path as a tombstone scope", async () => {
|
|
1578
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scoped-push-thread-delete-"));
|
|
1579
|
-
const handoffFile = path.join(hqRoot, "workspace", "threads", "handoff.json");
|
|
1580
|
-
const threadFile = path.join(hqRoot, "workspace", "threads", "x.json");
|
|
1581
|
-
fs.mkdirSync(path.dirname(threadFile), { recursive: true });
|
|
1582
|
-
fs.writeFileSync(handoffFile, JSON.stringify({ thread_path: "workspace/threads/x.json" }));
|
|
1583
|
-
try {
|
|
1584
|
-
const shareFn = vi.fn(async (_options) => shareResult);
|
|
1585
|
-
await executeCompanyFanout({
|
|
1586
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1587
|
-
direction: "push",
|
|
1588
|
-
hqRoot,
|
|
1589
|
-
onConflict: "abort",
|
|
1590
|
-
client: {},
|
|
1591
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1592
|
-
syncFn: vi.fn(),
|
|
1593
|
-
shareFn,
|
|
1594
|
-
resolveDeletePolicy: () => "all",
|
|
1595
|
-
emit: vi.fn(),
|
|
1596
|
-
ensureCompanyDir: vi.fn(),
|
|
1597
|
-
telemetryClient: null,
|
|
1598
|
-
scopePaths: ["workspace/threads/x.json"],
|
|
1599
|
-
deleteScopePaths: ["workspace/threads/x.json"],
|
|
1600
|
-
});
|
|
1601
|
-
expect(shareFn.mock.calls[0]?.[0].deleteScopeRoots).toContain("workspace/threads/x.json");
|
|
1602
|
-
}
|
|
1603
|
-
finally {
|
|
1604
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1605
|
-
}
|
|
1606
|
-
});
|
|
1607
|
-
it("keeps the full personal walk for an unscoped pass", async () => {
|
|
1608
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-full-push-walk-"));
|
|
1609
|
-
const personalRoot = path.join(hqRoot, "personal");
|
|
1610
|
-
fs.mkdirSync(personalRoot, { recursive: true });
|
|
1611
|
-
for (let index = 0; index < 10_000; index++) {
|
|
1612
|
-
fs.writeFileSync(path.join(personalRoot, `full-${index}.md`), "x");
|
|
1613
|
-
}
|
|
1614
|
-
let visitedEntries = 0;
|
|
1615
|
-
const realReaddirSync = fs.readdirSync;
|
|
1616
|
-
const readdirSpy = vi.spyOn(fs, "readdirSync").mockImplementation(((...args) => {
|
|
1617
|
-
const entries = Reflect.apply(realReaddirSync, fs, args);
|
|
1618
|
-
if (Array.isArray(entries))
|
|
1619
|
-
visitedEntries += entries.length;
|
|
1620
|
-
return entries;
|
|
1621
|
-
}));
|
|
1622
|
-
const shareFn = vi.fn(async (options) => {
|
|
1623
|
-
await shareTesting.collectFiles(options.paths, hqRoot, hqRoot, () => true);
|
|
1624
|
-
return shareResult;
|
|
1625
|
-
});
|
|
1626
|
-
try {
|
|
1627
|
-
await executeCompanyFanout({
|
|
1628
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1629
|
-
direction: "push",
|
|
1630
|
-
hqRoot,
|
|
1631
|
-
onConflict: "abort",
|
|
1632
|
-
client: {},
|
|
1633
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1634
|
-
syncFn: vi.fn(),
|
|
1635
|
-
shareFn,
|
|
1636
|
-
resolveDeletePolicy: () => "all",
|
|
1637
|
-
emit: vi.fn(),
|
|
1638
|
-
ensureCompanyDir: vi.fn(),
|
|
1639
|
-
telemetryClient: null,
|
|
1640
|
-
});
|
|
1641
|
-
expect(visitedEntries).toBeGreaterThanOrEqual(10_000);
|
|
1642
|
-
expect(shareFn.mock.calls[0]?.[0].scopedJournal).toBeUndefined();
|
|
1643
|
-
}
|
|
1644
|
-
finally {
|
|
1645
|
-
readdirSpy.mockRestore();
|
|
1646
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1647
|
-
}
|
|
1648
|
-
});
|
|
1649
|
-
it("passes a combined reconcile checkpoint to the pull leg after the push succeeds", async () => {
|
|
1650
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-combined-reconcile-"));
|
|
1651
|
-
const reconcileApply = { store: {}, cursor: {
|
|
1652
|
-
routerVersion: 1,
|
|
1653
|
-
epoch: "epoch-1",
|
|
1654
|
-
areaId: "root:personal",
|
|
1655
|
-
phase: "apply",
|
|
1656
|
-
} };
|
|
1657
|
-
let pullOptions;
|
|
1658
|
-
const shareResult = {
|
|
1659
|
-
filesUploaded: 0, bytesUploaded: 0, filesSkipped: 0, filesDeleted: 0,
|
|
1660
|
-
filesTombstoned: 0, filesRefusedStale: 0, filesRefusedStalePaths: [],
|
|
1661
|
-
filesSuppressedByTombstone: 0, filesExcludedByPolicy: 0,
|
|
1662
|
-
filesExcludedByScope: 0, filesExcludedByIgnore: 0, unreachablePaths: [],
|
|
1663
|
-
linkedSubtreesNotShipped: [], conflictPaths: [], aborted: false,
|
|
1664
|
-
};
|
|
1665
|
-
const syncResult = {
|
|
1666
|
-
filesDownloaded: 0, bytesDownloaded: 0, filesSkipped: 0, conflicts: 0,
|
|
1667
|
-
conflictPaths: [], aborted: false, newFiles: [], newFilesCount: 0,
|
|
1668
|
-
filesExcludedByPolicy: 0, filesTombstoned: 0, filesOutOfScope: 0,
|
|
1669
|
-
scopeOrphansRemoved: 0, scopeOrphansBlocked: 0, changedPaths: [],
|
|
1670
|
-
};
|
|
1671
|
-
try {
|
|
1672
|
-
await executeCompanyFanout({
|
|
1673
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1674
|
-
direction: "both",
|
|
1675
|
-
hqRoot,
|
|
1676
|
-
onConflict: "abort",
|
|
1677
|
-
client: {},
|
|
1678
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1679
|
-
fetchFileTombstones: vi.fn(async () => new Map()),
|
|
1680
|
-
shareFn: vi.fn(async () => shareResult),
|
|
1681
|
-
syncFn: vi.fn(async (options) => {
|
|
1682
|
-
pullOptions = options;
|
|
1683
|
-
return syncResult;
|
|
1684
|
-
}),
|
|
1685
|
-
resolveDeletePolicy: () => "all",
|
|
1686
|
-
emit: vi.fn(),
|
|
1687
|
-
ensureCompanyDir: vi.fn(),
|
|
1688
|
-
reconcileApplyForTarget: () => reconcileApply,
|
|
1689
|
-
});
|
|
1690
|
-
expect(pullOptions?.reconcileApply).toBe(reconcileApply);
|
|
1691
|
-
}
|
|
1692
|
-
finally {
|
|
1693
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1694
|
-
}
|
|
1695
|
-
});
|
|
1696
|
-
});
|
|
1697
|
-
describe("executeCompanyFanout — entity-fetch 429 (2026-09-18 Odin)", () => {
|
|
1698
|
-
const vaultConfig = {
|
|
1699
|
-
apiUrl: "https://vault-api.test",
|
|
1700
|
-
authToken: "access-token",
|
|
1701
|
-
};
|
|
1702
|
-
const entity = {
|
|
1703
|
-
uid: "cmp_01KQ2RYAHXHDPCTY9GPQPTH3DG",
|
|
1704
|
-
slug: "indigo",
|
|
1705
|
-
bucketName: "hq-vault-indigo",
|
|
1706
|
-
status: "active",
|
|
1707
|
-
};
|
|
1708
|
-
const vend = {
|
|
1709
|
-
credentials: {
|
|
1710
|
-
accessKeyId: "ASIA_TEST",
|
|
1711
|
-
secretAccessKey: "secret",
|
|
1712
|
-
sessionToken: "session",
|
|
1713
|
-
expiration: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
|
|
1714
|
-
},
|
|
1715
|
-
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
|
|
1716
|
-
};
|
|
1717
|
-
const runIndigoPull = async (syncFn) => {
|
|
1718
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-429-"));
|
|
1719
|
-
const events = [];
|
|
1720
|
-
try {
|
|
1721
|
-
const result = await executeCompanyFanout({
|
|
1722
|
-
plan: [{ uid: entity.uid, slug: "indigo" }],
|
|
1723
|
-
direction: "pull",
|
|
1724
|
-
hqRoot,
|
|
1725
|
-
onConflict: "keep",
|
|
1726
|
-
client: {},
|
|
1727
|
-
vaultConfig,
|
|
1728
|
-
syncFn,
|
|
1729
|
-
shareFn: vi.fn(),
|
|
1730
|
-
resolveDeletePolicy: () => "all",
|
|
1731
|
-
emit: (e) => events.push(e),
|
|
1732
|
-
ensureCompanyDir: vi.fn(),
|
|
1733
|
-
telemetryClient: null,
|
|
1734
|
-
});
|
|
1735
|
-
return { result, events };
|
|
1736
|
-
}
|
|
1737
|
-
finally {
|
|
1738
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1739
|
-
}
|
|
1740
|
-
};
|
|
1741
|
-
beforeEach(() => {
|
|
1742
|
-
clearContextCache();
|
|
1743
|
-
setEntityFetchSleepForTest(async () => undefined);
|
|
1744
|
-
});
|
|
1745
|
-
afterEach(() => {
|
|
1746
|
-
setEntityFetchSleepForTest(undefined);
|
|
1747
|
-
vi.unstubAllGlobals();
|
|
1748
|
-
});
|
|
1749
|
-
it("a 429 then success on retry yields a complete company sync", async () => {
|
|
1750
|
-
let entityCalls = 0;
|
|
1751
|
-
vi.stubGlobal("fetch", vi.fn(async (url) => {
|
|
1752
|
-
const u = String(url);
|
|
1753
|
-
if (u.includes(`/entity/${entity.uid}`)) {
|
|
1754
|
-
entityCalls += 1;
|
|
1755
|
-
if (entityCalls === 1) {
|
|
1756
|
-
return new Response(JSON.stringify({ message: "Too Many Requests" }), {
|
|
1757
|
-
status: 429,
|
|
1758
|
-
});
|
|
1759
|
-
}
|
|
1760
|
-
return new Response(JSON.stringify({ entity }), { status: 200 });
|
|
1761
|
-
}
|
|
1762
|
-
if (u.includes("/sts/vend")) {
|
|
1763
|
-
return new Response(JSON.stringify(vend), { status: 200 });
|
|
1764
|
-
}
|
|
1765
|
-
return new Response("Not found", { status: 404 });
|
|
1766
|
-
}));
|
|
1767
|
-
const emptyPull = {
|
|
1768
|
-
filesDownloaded: 0,
|
|
1769
|
-
bytesDownloaded: 0,
|
|
1770
|
-
filesSkipped: 0,
|
|
1771
|
-
conflicts: 0,
|
|
1772
|
-
conflictPaths: [],
|
|
1773
|
-
aborted: false,
|
|
1774
|
-
newFiles: [],
|
|
1775
|
-
newFilesCount: 0,
|
|
1776
|
-
filesExcludedByPolicy: 0,
|
|
1777
|
-
filesTombstoned: 0,
|
|
1778
|
-
filesOutOfScope: 0,
|
|
1779
|
-
scopeOrphansRemoved: 0,
|
|
1780
|
-
scopeOrphansBlocked: 0,
|
|
1781
|
-
changedPaths: [],
|
|
1782
|
-
};
|
|
1783
|
-
const { result, events } = await runIndigoPull(async (opts) => {
|
|
1784
|
-
await resolveEntityContext(opts.company ?? entity.uid, opts.vaultConfig);
|
|
1785
|
-
return emptyPull;
|
|
1786
|
-
});
|
|
1787
|
-
expect(entityCalls).toBe(2);
|
|
1788
|
-
expect(result.errors).toEqual([]);
|
|
1789
|
-
expect(result.transientCompanies).toEqual([]);
|
|
1790
|
-
expect(result.stateByCompany.get("indigo")?.status).toBe("complete");
|
|
1791
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1792
|
-
expect(events.some((e) => e.type === "transient-network")).toBe(false);
|
|
1793
|
-
});
|
|
1794
|
-
});
|
|
1795
|
-
describe("executeCompanyFanout — mid-pass identity refusal (HQ-DESKTOP-5S)", () => {
|
|
1796
|
-
// A mid-pass Cognito refusal surfaces from the leg (share.ts/sync.ts now
|
|
1797
|
-
// rethrow it instead of recording a per-file error). personalMode avoids the
|
|
1798
|
-
// network scope resolution so the leg reaches the injected syncFn directly.
|
|
1799
|
-
const runWithRejectingPull = async (refusal) => {
|
|
1800
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-refusal-"));
|
|
1801
|
-
const events = [];
|
|
1802
|
-
try {
|
|
1803
|
-
const result = await executeCompanyFanout({
|
|
1804
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
1805
|
-
direction: "pull",
|
|
1806
|
-
hqRoot,
|
|
1807
|
-
onConflict: "abort",
|
|
1808
|
-
client: {},
|
|
1809
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1810
|
-
syncFn: vi.fn(async () => {
|
|
1811
|
-
throw refusal;
|
|
1812
|
-
}),
|
|
1813
|
-
shareFn: vi.fn(),
|
|
1814
|
-
resolveDeletePolicy: () => "all",
|
|
1815
|
-
emit: (e) => events.push(e),
|
|
1816
|
-
ensureCompanyDir: vi.fn(),
|
|
1817
|
-
telemetryClient: null,
|
|
1818
|
-
});
|
|
1819
|
-
return { result, events };
|
|
1820
|
-
}
|
|
1821
|
-
catch (thrown) {
|
|
1822
|
-
return { thrown, events };
|
|
1823
|
-
}
|
|
1824
|
-
finally {
|
|
1825
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1826
|
-
}
|
|
1827
|
-
};
|
|
1828
|
-
it("propagates a terminal identity refusal out of the fanout, never as an error", async () => {
|
|
1829
|
-
const refusal = new CognitoRefreshError("Your HQ session needs a quick refresh. Sign in again to keep sync moving.", true, 401, "fp-terminal");
|
|
1830
|
-
const { result, thrown, events } = await runWithRejectingPull(refusal);
|
|
1831
|
-
// Rethrown like VaultAuthError — the caller (sync-runner) clears the session
|
|
1832
|
-
// and emits one auth-error. It must NEVER be recorded as a company error.
|
|
1833
|
-
expect(result).toBeUndefined();
|
|
1834
|
-
expect(thrown).toBe(refusal);
|
|
1835
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1836
|
-
expect(events.some((e) => e.type === "complete")).toBe(false);
|
|
1837
|
-
});
|
|
1838
|
-
it("terminal also covers a bare CognitoAuthError (not a refresh failure)", async () => {
|
|
1839
|
-
const refusal = new CognitoAuthError("interactive login required");
|
|
1840
|
-
const { result, thrown, events } = await runWithRejectingPull(refusal);
|
|
1841
|
-
expect(result).toBeUndefined();
|
|
1842
|
-
expect(thrown).toBe(refusal);
|
|
1843
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1844
|
-
});
|
|
1845
|
-
it("routes a retryable identity refusal to transientCompanies, leaving errors empty", async () => {
|
|
1846
|
-
const refusal = new CognitoRefreshError("Cognito refresh failed (503): service unavailable", false, 503, "fp-retryable");
|
|
1847
|
-
const { result, thrown, events } = await runWithRejectingPull(refusal);
|
|
1848
|
-
expect(thrown).toBeUndefined();
|
|
1849
|
-
expect(result?.errors).toEqual([]);
|
|
1850
|
-
expect(result?.companyFailures).toEqual([]);
|
|
1851
|
-
expect(result?.transientCompanies).toHaveLength(1);
|
|
1852
|
-
expect(result?.transientCompanies[0].company).toBe("personal");
|
|
1853
|
-
expect(result?.stateByCompany.get("personal")?.status).toBe("transient-network");
|
|
1854
|
-
// Emitted as a transient-network signal, never as an error record.
|
|
1855
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
1856
|
-
expect(events.some((e) => e.type === "transient-network" && e.company === "personal")).toBe(true);
|
|
1857
|
-
});
|
|
1858
|
-
it("still records a non-identity leg failure as a deterministic company error", async () => {
|
|
1859
|
-
const boom = new Error("disk exploded");
|
|
1860
|
-
const { result, thrown, events } = await runWithRejectingPull(boom);
|
|
1861
|
-
expect(thrown).toBeUndefined();
|
|
1862
|
-
expect(result?.errors).toHaveLength(1);
|
|
1863
|
-
expect(result?.companyFailures).toHaveLength(1);
|
|
1864
|
-
expect(result?.transientCompanies).toEqual([]);
|
|
1865
|
-
expect(events.some((e) => e.type === "error" && e.company === "personal")).toBe(true);
|
|
1866
|
-
});
|
|
1867
|
-
it("names the vault file on a company-leg abort instead of path (company)", async () => {
|
|
1868
|
-
// The undrdog 2026-09-11 event was
|
|
1869
|
-
// {type:"error", path:"(company)", message:"VaultConflictError The landed skill…"}.
|
|
1870
|
-
// A vault refusal that already named the file must keep that path on the
|
|
1871
|
-
// runner event. A Node filesystem error's `.path` must NOT leak here.
|
|
1872
|
-
const refusal = new VaultConflictError("The landed skill does not carry the registered identity for this path", {
|
|
1873
|
-
code: "SKILL_REGISTER_LANDED_IDENTITY_MISMATCH",
|
|
1874
|
-
path: "skills/workflow-preflight/SKILL.md",
|
|
1875
|
-
});
|
|
1876
|
-
const { result, thrown, events } = await runWithRejectingPull(refusal);
|
|
1877
|
-
expect(thrown).toBeUndefined();
|
|
1878
|
-
expect(events.some((e) => e.type === "error" &&
|
|
1879
|
-
e.company === "personal" &&
|
|
1880
|
-
e.path === "skills/workflow-preflight/SKILL.md")).toBe(true);
|
|
1881
|
-
expect(result?.errors).toHaveLength(1);
|
|
1882
|
-
const fsBoom = Object.assign(new Error("ENOENT"), {
|
|
1883
|
-
path: "/Users/don/hq/companies/undrdog/skills/secret.md",
|
|
1884
|
-
});
|
|
1885
|
-
const fsRun = await runWithRejectingPull(fsBoom);
|
|
1886
|
-
const fsError = fsRun.events.find((e) => e.type === "error");
|
|
1887
|
-
expect(fsError).toMatchObject({ path: "(company)" });
|
|
1888
|
-
});
|
|
1889
|
-
});
|
|
1890
|
-
describe("executeCompanyFanout — a company-skill 409 never aborts the leg (HQ-DESKTOP-64)", () => {
|
|
1891
|
-
let hqRoot;
|
|
1892
|
-
let stateDir;
|
|
1893
|
-
function makeEntityContext() {
|
|
1894
|
-
return {
|
|
1895
|
-
uid: "cmp_01ABCDEF",
|
|
1896
|
-
slug: "acme",
|
|
1897
|
-
bucketName: "hq-vault-acme-123",
|
|
1898
|
-
region: "us-east-1",
|
|
1899
|
-
credentials: {
|
|
1900
|
-
accessKeyId: "ASIA_PRE_VENDED",
|
|
1901
|
-
secretAccessKey: "pre-vended-secret",
|
|
1902
|
-
sessionToken: "pre-vended-session",
|
|
1903
|
-
},
|
|
1904
|
-
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(),
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
beforeEach(() => {
|
|
1908
|
-
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-skill-conflict-"));
|
|
1909
|
-
stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-skill-state-"));
|
|
1910
|
-
process.env.HQ_STATE_DIR = stateDir;
|
|
1911
|
-
vi.mocked(uploadFile).mockClear();
|
|
1912
|
-
vi.mocked(uploadFile).mockResolvedValue({ etag: '"upload-etag"' });
|
|
1913
|
-
vi.mocked(headRemoteFile).mockReset();
|
|
1914
|
-
vi.mocked(headRemoteFile).mockResolvedValue(null);
|
|
1915
|
-
fs.mkdirSync(path.join(hqRoot, "companies", "acme"), { recursive: true });
|
|
1916
|
-
});
|
|
1917
|
-
afterEach(() => {
|
|
1918
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
1919
|
-
fs.rmSync(stateDir, { recursive: true, force: true });
|
|
1920
|
-
delete process.env.HQ_STATE_DIR;
|
|
1921
|
-
});
|
|
1922
|
-
it("runs the real share() with a 409-ing registrar and keeps the company complete unaborted", async () => {
|
|
1923
|
-
const skillFile = path.join(hqRoot, "companies", "acme", "skills", "copied", "SKILL.md");
|
|
1924
|
-
fs.mkdirSync(path.dirname(skillFile), { recursive: true });
|
|
1925
|
-
fs.writeFileSync(skillFile, "---\nname: Copied\ndescription: Copied skill\nskill_uid: skl_SOURCE1\n---\n");
|
|
1926
|
-
// Seed a stuck pending marker via one direct push whose metadata reconcile
|
|
1927
|
-
// fails transiently — the unchanged base behaviour that stranded the marker.
|
|
1928
|
-
await share({
|
|
1929
|
-
paths: [skillFile],
|
|
1930
|
-
hqRoot,
|
|
1931
|
-
entityContext: makeEntityContext(),
|
|
1932
|
-
registerCompanySkill: vi.fn(async () => {
|
|
1933
|
-
throw new Error("registry temporarily unavailable");
|
|
1934
|
-
}),
|
|
1935
|
-
});
|
|
1936
|
-
expect(readJournal("acme").files["skills/copied/SKILL.md"]).toMatchObject({ skillMetadataPending: true });
|
|
1937
|
-
// Pass 2 runs the real share() THROUGH the fanout. The remote now exists and
|
|
1938
|
-
// the registrar 409s on every call (landed reconcile and non-landed
|
|
1939
|
-
// fallback): the field signature of a copied skill the server will not
|
|
1940
|
-
// re-identify from this machine. On the base runner this rejected out of the
|
|
1941
|
-
// pending loop, and the company-leg catch turned it into a (company) error +
|
|
1942
|
-
// PARTIAL_SYNC_EXIT.
|
|
1943
|
-
vi.mocked(uploadFile).mockClear();
|
|
1944
|
-
vi.mocked(headRemoteFile).mockResolvedValue({
|
|
1945
|
-
lastModified: new Date(),
|
|
1946
|
-
etag: '"upload-etag"',
|
|
1947
|
-
size: fs.statSync(skillFile).size,
|
|
1948
|
-
});
|
|
1949
|
-
const conflictRegistrar = vi.fn(async () => {
|
|
1950
|
-
throw new VaultConflictError("landed identity mismatch");
|
|
1951
|
-
});
|
|
1952
|
-
const events = [];
|
|
1953
|
-
const result = await executeCompanyFanout({
|
|
1954
|
-
plan: [{ uid: "cmp_01ABCDEF", slug: "acme" }],
|
|
1955
|
-
direction: "push",
|
|
1956
|
-
hqRoot,
|
|
1957
|
-
onConflict: "abort",
|
|
1958
|
-
client: {},
|
|
1959
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
1960
|
-
syncFn: vi.fn(),
|
|
1961
|
-
shareFn: ({ vaultConfig: _vaultConfig, company: _company, ...rest }) => share({
|
|
1962
|
-
...rest,
|
|
1963
|
-
entityContext: makeEntityContext(),
|
|
1964
|
-
registerCompanySkill: conflictRegistrar,
|
|
1965
|
-
}),
|
|
1966
|
-
resolveDeletePolicy: () => "all",
|
|
1967
|
-
emit: (event) => events.push(event),
|
|
1968
|
-
ensureCompanyDir: vi.fn(),
|
|
1969
|
-
telemetryClient: null,
|
|
1970
|
-
});
|
|
1971
|
-
// A skill 409 is no longer a deterministic company failure.
|
|
1972
|
-
expect(result.errors).toEqual([]);
|
|
1973
|
-
expect(result.companyFailures).toEqual([]);
|
|
1974
|
-
expect(events.some((e) => e.type === "error" &&
|
|
1975
|
-
e.path === "(company)")).toBe(false);
|
|
1976
|
-
const complete = events.find((e) => e.type === "complete");
|
|
1977
|
-
expect(complete).toBeDefined();
|
|
1978
|
-
expect(complete).toMatchObject({ aborted: false });
|
|
1979
|
-
// The deliberate skip is surfaced once, tagged with the company.
|
|
1980
|
-
expect(events).toContainEqual(expect.objectContaining({
|
|
1981
|
-
type: "not-shipped",
|
|
1982
|
-
company: "acme",
|
|
1983
|
-
reason: "skill-registration-conflict",
|
|
1984
|
-
samplePaths: ["skills/copied/SKILL.md"],
|
|
1985
|
-
}));
|
|
1986
|
-
// The marker is cleared so a later pass cannot loop.
|
|
1987
|
-
expect(readJournal("acme").files["skills/copied/SKILL.md"]?.skillMetadataPending).toBeUndefined();
|
|
1988
|
-
// A copied skill's stamped identity is unchanged: the fallback was refused,
|
|
1989
|
-
// so no local re-stamp happened this pass.
|
|
1990
|
-
expect(parseRegisteredCompanySkillUid(fs.readFileSync(skillFile, "utf8"))).toBe("skl_SOURCE1");
|
|
1991
|
-
});
|
|
1992
|
-
});
|
|
1993
|
-
describe("executeCompanyFanout — personal vault skips journaled company dirs", () => {
|
|
1994
|
-
const shareResult = {
|
|
1995
|
-
filesUploaded: 0,
|
|
1996
|
-
bytesUploaded: 0,
|
|
1997
|
-
filesSkipped: 0,
|
|
1998
|
-
filesDeleted: 0,
|
|
1999
|
-
filesTombstoned: 0,
|
|
2000
|
-
filesRefusedStale: 0,
|
|
2001
|
-
filesRefusedStalePaths: [],
|
|
2002
|
-
filesSuppressedByTombstone: 0,
|
|
2003
|
-
filesExcludedByPolicy: 0,
|
|
2004
|
-
filesExcludedByScope: 0,
|
|
2005
|
-
filesExcludedByIgnore: 0,
|
|
2006
|
-
unreachablePaths: [],
|
|
2007
|
-
linkedSubtreesNotShipped: [],
|
|
2008
|
-
conflictPaths: [],
|
|
2009
|
-
aborted: false,
|
|
2010
|
-
};
|
|
2011
|
-
const syncResult = {
|
|
2012
|
-
filesDownloaded: 0,
|
|
2013
|
-
bytesDownloaded: 0,
|
|
2014
|
-
filesSkipped: 0,
|
|
2015
|
-
conflicts: 0,
|
|
2016
|
-
conflictPaths: [],
|
|
2017
|
-
aborted: false,
|
|
2018
|
-
newFiles: [],
|
|
2019
|
-
newFilesCount: 0,
|
|
2020
|
-
filesExcludedByPolicy: 0,
|
|
2021
|
-
filesTombstoned: 0,
|
|
2022
|
-
filesOutOfScope: 0,
|
|
2023
|
-
scopeOrphansRemoved: 0,
|
|
2024
|
-
scopeOrphansBlocked: 0,
|
|
2025
|
-
changedPaths: [],
|
|
2026
|
-
};
|
|
2027
|
-
let hqRoot;
|
|
2028
|
-
let stateDir;
|
|
2029
|
-
let previousStateDir;
|
|
2030
|
-
beforeEach(() => {
|
|
2031
|
-
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-journal-slugs-"));
|
|
2032
|
-
stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-journal-state-"));
|
|
2033
|
-
previousStateDir = process.env.HQ_STATE_DIR;
|
|
2034
|
-
process.env.HQ_STATE_DIR = stateDir;
|
|
2035
|
-
fs.mkdirSync(path.join(hqRoot, "personal"), { recursive: true });
|
|
2036
|
-
});
|
|
2037
|
-
afterEach(() => {
|
|
2038
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
2039
|
-
fs.rmSync(stateDir, { recursive: true, force: true });
|
|
2040
|
-
if (previousStateDir === undefined)
|
|
2041
|
-
delete process.env.HQ_STATE_DIR;
|
|
2042
|
-
else
|
|
2043
|
-
process.env.HQ_STATE_DIR = previousStateDir;
|
|
2044
|
-
});
|
|
2045
|
-
function writeCompanyDir(slug) {
|
|
2046
|
-
fs.mkdirSync(path.join(hqRoot, "companies", slug), { recursive: true });
|
|
2047
|
-
}
|
|
2048
|
-
function writeJournalLocator(slug) {
|
|
2049
|
-
fs.writeFileSync(path.join(stateDir, `sync-journal.${slug}.json`), JSON.stringify({ schema: "hq-sync-journal-locator@1" }));
|
|
2050
|
-
}
|
|
2051
|
-
function relSharePaths(shareFn) {
|
|
2052
|
-
const call = shareFn.mock.calls[0];
|
|
2053
|
-
expect(call).toBeDefined();
|
|
2054
|
-
return call[0].paths.map((p) => path.relative(hqRoot, p)).sort();
|
|
2055
|
-
}
|
|
2056
|
-
async function runPersonalBoth(shareFn = vi.fn(async (_options) => shareResult), syncFn = vi.fn(async (_options) => syncResult)) {
|
|
2057
|
-
const events = [];
|
|
2058
|
-
await executeCompanyFanout({
|
|
2059
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
2060
|
-
direction: "both",
|
|
2061
|
-
hqRoot,
|
|
2062
|
-
onConflict: "abort",
|
|
2063
|
-
client: {},
|
|
2064
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2065
|
-
fetchFileTombstones: async () => new Map(),
|
|
2066
|
-
syncFn,
|
|
2067
|
-
shareFn,
|
|
2068
|
-
resolveDeletePolicy: () => "all",
|
|
2069
|
-
emit: (event) => events.push(event),
|
|
2070
|
-
ensureCompanyDir: vi.fn(),
|
|
2071
|
-
telemetryClient: null,
|
|
2072
|
-
});
|
|
2073
|
-
return { events, shareFn, syncFn };
|
|
2074
|
-
}
|
|
2075
|
-
it("excludes companies/dandy from the personal push when its sync journal exists and there is no manifest", async () => {
|
|
2076
|
-
writeCompanyDir("dandy");
|
|
2077
|
-
writeJournalLocator("dandy");
|
|
2078
|
-
const { events, shareFn, syncFn } = await runPersonalBoth();
|
|
2079
|
-
const rel = relSharePaths(shareFn);
|
|
2080
|
-
expect(rel).not.toContain(path.join("companies", "dandy"));
|
|
2081
|
-
expect(rel).toContain("personal");
|
|
2082
|
-
const shareArgs = shareFn.mock.calls[0][0];
|
|
2083
|
-
expect(shareArgs.decommissionPrefixes).toEqual(["companies/dandy"]);
|
|
2084
|
-
const pullArgs = syncFn.mock.calls[0][0];
|
|
2085
|
-
expect(Array.from(pullArgs.teamSyncedSlugs ?? [])).toEqual(["dandy"]);
|
|
2086
|
-
expect(events).toContainEqual({
|
|
2087
|
-
type: "error",
|
|
2088
|
-
diagnostic: true,
|
|
2089
|
-
company: "personal",
|
|
2090
|
-
path: "(personal-vault)",
|
|
2091
|
-
message: "excluding journaled companies from personal vault: dandy",
|
|
2092
|
-
});
|
|
2093
|
-
expect(events.some((e) => e.type === "error" && e.diagnostic !== true)).toBe(false);
|
|
2094
|
-
});
|
|
2095
|
-
it("still includes a local-only company that has no journal when there is no manifest", async () => {
|
|
2096
|
-
writeCompanyDir("local-only");
|
|
2097
|
-
const { events, shareFn, syncFn } = await runPersonalBoth();
|
|
2098
|
-
const rel = relSharePaths(shareFn);
|
|
2099
|
-
expect(rel).toContain(path.join("companies", "local-only"));
|
|
2100
|
-
expect(shareFn.mock.calls[0][0]).not.toHaveProperty("decommissionPrefixes");
|
|
2101
|
-
expect(Array.from(syncFn.mock.calls[0][0].teamSyncedSlugs ?? [])).toEqual([]);
|
|
2102
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
2103
|
-
});
|
|
2104
|
-
it("does not treat the personal-vault sentinel journal as a company slug", async () => {
|
|
2105
|
-
writeCompanyDir("local-only");
|
|
2106
|
-
writeJournalLocator(PERSONAL_VAULT_JOURNAL_SLUG);
|
|
2107
|
-
const { events, shareFn, syncFn } = await runPersonalBoth();
|
|
2108
|
-
const rel = relSharePaths(shareFn);
|
|
2109
|
-
expect(rel).toContain(path.join("companies", "local-only"));
|
|
2110
|
-
expect(shareFn.mock.calls[0][0]).not.toHaveProperty("decommissionPrefixes");
|
|
2111
|
-
expect(Array.from(syncFn.mock.calls[0][0].teamSyncedSlugs ?? [])).toEqual([]);
|
|
2112
|
-
expect(events.some((e) => e.type === "error")).toBe(false);
|
|
2113
|
-
});
|
|
2114
|
-
it("does not pass journal-derived teamSyncedSlugs to a company target", async () => {
|
|
2115
|
-
writeCompanyDir("dandy");
|
|
2116
|
-
writeJournalLocator("dandy");
|
|
2117
|
-
const shareFn = vi.fn(async (_options) => shareResult);
|
|
2118
|
-
const syncFn = vi.fn(async (_options) => syncResult);
|
|
2119
|
-
await executeCompanyFanout({
|
|
2120
|
-
plan: [{ uid: "cmp_dandy", slug: "dandy" }],
|
|
2121
|
-
direction: "both",
|
|
2122
|
-
hqRoot,
|
|
2123
|
-
onConflict: "abort",
|
|
2124
|
-
client: {},
|
|
2125
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2126
|
-
fetchFileTombstones: async () => new Map(),
|
|
2127
|
-
syncFn,
|
|
2128
|
-
shareFn,
|
|
2129
|
-
resolveDeletePolicy: () => "all",
|
|
2130
|
-
emit: vi.fn(),
|
|
2131
|
-
ensureCompanyDir: vi.fn(),
|
|
2132
|
-
telemetryClient: null,
|
|
2133
|
-
});
|
|
2134
|
-
expect(shareFn.mock.calls[0][0].paths).toEqual([
|
|
2135
|
-
path.join(hqRoot, "companies", "dandy"),
|
|
2136
|
-
]);
|
|
2137
|
-
expect(shareFn.mock.calls[0][0]).not.toHaveProperty("decommissionPrefixes");
|
|
2138
|
-
expect(Object.keys(syncFn.mock.calls[0][0])).not.toContain("teamSyncedSlugs");
|
|
2139
|
-
});
|
|
2140
|
-
});
|
|
2141
|
-
describe("executeCompanyFanout work-bearing sync count telemetry", () => {
|
|
2142
|
-
function emptyShare(overrides = {}) {
|
|
2143
|
-
return {
|
|
2144
|
-
filesUploaded: 0,
|
|
2145
|
-
bytesUploaded: 0,
|
|
2146
|
-
filesSkipped: 0,
|
|
2147
|
-
filesDeleted: 0,
|
|
2148
|
-
filesTombstoned: 0,
|
|
2149
|
-
filesRefusedStale: 0,
|
|
2150
|
-
filesRefusedStalePaths: [],
|
|
2151
|
-
filesSuppressedByTombstone: 0,
|
|
2152
|
-
filesExcludedByPolicy: 0,
|
|
2153
|
-
filesExcludedByScope: 0,
|
|
2154
|
-
filesExcludedByIgnore: 0,
|
|
2155
|
-
unreachablePaths: [],
|
|
2156
|
-
linkedSubtreesNotShipped: [],
|
|
2157
|
-
conflictPaths: [],
|
|
2158
|
-
aborted: false,
|
|
2159
|
-
...overrides,
|
|
2160
|
-
};
|
|
2161
|
-
}
|
|
2162
|
-
function emptySync(overrides = {}) {
|
|
2163
|
-
return {
|
|
2164
|
-
filesDownloaded: 0,
|
|
2165
|
-
bytesDownloaded: 0,
|
|
2166
|
-
filesSkipped: 0,
|
|
2167
|
-
conflicts: 0,
|
|
2168
|
-
conflictPaths: [],
|
|
2169
|
-
aborted: false,
|
|
2170
|
-
newFiles: [],
|
|
2171
|
-
newFilesCount: 0,
|
|
2172
|
-
filesExcludedByPolicy: 0,
|
|
2173
|
-
filesTombstoned: 0,
|
|
2174
|
-
filesOutOfScope: 0,
|
|
2175
|
-
scopeOrphansRemoved: 0,
|
|
2176
|
-
scopeOrphansBlocked: 0,
|
|
2177
|
-
changedPaths: [],
|
|
2178
|
-
...overrides,
|
|
2179
|
-
};
|
|
2180
|
-
}
|
|
2181
|
-
async function runPersonalFanout(args) {
|
|
2182
|
-
const posts = [];
|
|
2183
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-sync-counts-"));
|
|
2184
|
-
fs.mkdirSync(path.join(hqRoot, "personal"), { recursive: true });
|
|
2185
|
-
try {
|
|
2186
|
-
await executeCompanyFanout({
|
|
2187
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
2188
|
-
direction: args.direction ?? "both",
|
|
2189
|
-
hqRoot,
|
|
2190
|
-
onConflict: "abort",
|
|
2191
|
-
client: {},
|
|
2192
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2193
|
-
fetchFileTombstones: async () => new Map(),
|
|
2194
|
-
syncFn: args.syncFn ?? (async () => emptySync()),
|
|
2195
|
-
shareFn: args.shareFn,
|
|
2196
|
-
resolveDeletePolicy: () => "all",
|
|
2197
|
-
emit: vi.fn(),
|
|
2198
|
-
ensureCompanyDir: vi.fn(),
|
|
2199
|
-
telemetryClient: {
|
|
2200
|
-
postTelemetryEvents: async (batch) => {
|
|
2201
|
-
posts.push(batch);
|
|
2202
|
-
return { ok: true, written: batch.events.length, skipped: [] };
|
|
2203
|
-
},
|
|
2204
|
-
},
|
|
2205
|
-
});
|
|
2206
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
2207
|
-
return posts.flatMap((post) => post.events);
|
|
2208
|
-
}
|
|
2209
|
-
finally {
|
|
2210
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
it("emits uploadedCount, downloadedCount, and sessionLogUploadedCount on a work-bearing leg", async () => {
|
|
2214
|
-
const events = await runPersonalFanout({
|
|
2215
|
-
shareFn: async () => emptyShare({
|
|
2216
|
-
filesUploaded: 4,
|
|
2217
|
-
bytesUploaded: 400,
|
|
2218
|
-
skillRegistrationFallbacks: 3,
|
|
2219
|
-
}),
|
|
2220
|
-
syncFn: async () => emptySync({ filesDownloaded: 2, bytesDownloaded: 200 }),
|
|
2221
|
-
});
|
|
2222
|
-
const leg = events.find((event) => event.eventName === "company_sync_leg_completed");
|
|
2223
|
-
expect(leg).toMatchObject({
|
|
2224
|
-
app: "hq-cloud",
|
|
2225
|
-
source: "sync-runner",
|
|
2226
|
-
properties: {
|
|
2227
|
-
status: "complete",
|
|
2228
|
-
filesUploaded: 4,
|
|
2229
|
-
filesDownloaded: 2,
|
|
2230
|
-
uploadedCount: 4,
|
|
2231
|
-
downloadedCount: 2,
|
|
2232
|
-
skillRegistrationFallbacks: 3,
|
|
2233
|
-
sessionLogUploadedCount: 0,
|
|
2234
|
-
},
|
|
2235
|
-
});
|
|
2236
|
-
});
|
|
2237
|
-
it("puts the skill fallback count on the existing end-of-pass event", async () => {
|
|
2238
|
-
const events = [];
|
|
2239
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-skill-fallback-count-"));
|
|
2240
|
-
try {
|
|
2241
|
-
await executeCompanyFanout({
|
|
2242
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
2243
|
-
direction: "push",
|
|
2244
|
-
hqRoot,
|
|
2245
|
-
onConflict: "abort",
|
|
2246
|
-
client: {},
|
|
2247
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2248
|
-
fetchFileTombstones: async () => new Map(),
|
|
2249
|
-
syncFn: async () => emptySync(),
|
|
2250
|
-
shareFn: async () => emptyShare({ skillRegistrationFallbacks: 2 }),
|
|
2251
|
-
resolveDeletePolicy: () => "all",
|
|
2252
|
-
emit: (event) => events.push(event),
|
|
2253
|
-
ensureCompanyDir: vi.fn(),
|
|
2254
|
-
telemetryClient: null,
|
|
2255
|
-
});
|
|
2256
|
-
expect(events.find((event) => event.type === "complete")).toMatchObject({
|
|
2257
|
-
type: "complete",
|
|
2258
|
-
skillRegistrationFallbacks: 2,
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
finally {
|
|
2262
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
2263
|
-
}
|
|
2264
|
-
});
|
|
2265
|
-
it("preserves ignore counts in completion when the push leg throws after reporting them", async () => {
|
|
2266
|
-
const events = [];
|
|
2267
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-ignore-count-error-"));
|
|
2268
|
-
try {
|
|
2269
|
-
await executeCompanyFanout({
|
|
2270
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
2271
|
-
direction: "push",
|
|
2272
|
-
hqRoot,
|
|
2273
|
-
onConflict: "abort",
|
|
2274
|
-
client: {},
|
|
2275
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2276
|
-
fetchFileTombstones: async () => new Map(),
|
|
2277
|
-
syncFn: async () => emptySync(),
|
|
2278
|
-
shareFn: async (options) => {
|
|
2279
|
-
options.onEvent?.({
|
|
2280
|
-
type: "ignore-excluded",
|
|
2281
|
-
count: 2,
|
|
2282
|
-
totalExcluded: 2,
|
|
2283
|
-
samplePaths: ["docs/generated"],
|
|
2284
|
-
});
|
|
2285
|
-
options.onEvent?.({ type: "secret-excluded", count: 3 });
|
|
2286
|
-
throw new Error("push failed after finalizing its ignore report");
|
|
2287
|
-
},
|
|
2288
|
-
resolveDeletePolicy: () => "all",
|
|
2289
|
-
emit: (event) => events.push(event),
|
|
2290
|
-
ensureCompanyDir: vi.fn(),
|
|
2291
|
-
telemetryClient: null,
|
|
2292
|
-
});
|
|
2293
|
-
expect(events.find((event) => event.type === "complete")).toMatchObject({
|
|
2294
|
-
type: "complete",
|
|
2295
|
-
aborted: true,
|
|
2296
|
-
filesExcludedByIgnore: 5,
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
finally {
|
|
2300
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
2301
|
-
}
|
|
2302
|
-
});
|
|
2303
|
-
it("forwards noteworthy and by-design ignore counts in events and completion", async () => {
|
|
2304
|
-
const events = [];
|
|
2305
|
-
const hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-fanout-ignore-count-"));
|
|
2306
|
-
try {
|
|
2307
|
-
await executeCompanyFanout({
|
|
2308
|
-
plan: [{ uid: "prs_1", slug: "personal", personalMode: true }],
|
|
2309
|
-
direction: "push",
|
|
2310
|
-
hqRoot,
|
|
2311
|
-
onConflict: "abort",
|
|
2312
|
-
client: {},
|
|
2313
|
-
vaultConfig: { apiUrl: "https://api.example", authToken: "access-token" },
|
|
2314
|
-
fetchFileTombstones: async () => new Map(),
|
|
2315
|
-
syncFn: async () => emptySync(),
|
|
2316
|
-
shareFn: async (options) => {
|
|
2317
|
-
options.onEvent?.({
|
|
2318
|
-
type: "ignore-excluded",
|
|
2319
|
-
count: 1,
|
|
2320
|
-
totalExcluded: 3,
|
|
2321
|
-
samplePaths: ["companies/acme/knowledge/repos"],
|
|
2322
|
-
});
|
|
2323
|
-
options.onEvent?.({ type: "secret-excluded", count: 1 });
|
|
2324
|
-
return emptyShare({ filesExcludedByIgnore: 2 });
|
|
2325
|
-
},
|
|
2326
|
-
resolveDeletePolicy: () => "all",
|
|
2327
|
-
emit: (event) => events.push(event),
|
|
2328
|
-
ensureCompanyDir: vi.fn(),
|
|
2329
|
-
telemetryClient: null,
|
|
2330
|
-
});
|
|
2331
|
-
expect(events.find((event) => event.type === "ignore-excluded")).toMatchObject({
|
|
2332
|
-
type: "ignore-excluded",
|
|
2333
|
-
count: 1,
|
|
2334
|
-
samplePaths: ["companies/acme/knowledge/repos"],
|
|
2335
|
-
});
|
|
2336
|
-
expect(events.find((event) => event.type === "secret-excluded")).toMatchObject({
|
|
2337
|
-
type: "secret-excluded",
|
|
2338
|
-
count: 1,
|
|
2339
|
-
company: "personal",
|
|
2340
|
-
});
|
|
2341
|
-
expect(events.find((event) => event.type === "secret-excluded")).not.toHaveProperty("samplePaths");
|
|
2342
|
-
expect(events.find((event) => event.type === "complete")).toMatchObject({
|
|
2343
|
-
type: "complete",
|
|
2344
|
-
filesExcludedByIgnore: 2,
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
|
-
finally {
|
|
2348
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
2349
|
-
}
|
|
2350
|
-
});
|
|
2351
|
-
it("emits the fallback count when it is the only work on a pass", async () => {
|
|
2352
|
-
const events = await runPersonalFanout({
|
|
2353
|
-
direction: "push",
|
|
2354
|
-
shareFn: async () => emptyShare({ skillRegistrationFallbacks: 2 }),
|
|
2355
|
-
});
|
|
2356
|
-
const leg = events.find((event) => event.eventName === "company_sync_leg_completed");
|
|
2357
|
-
expect(leg?.properties).toMatchObject({
|
|
2358
|
-
status: "complete",
|
|
2359
|
-
skillRegistrationFallbacks: 2,
|
|
2360
|
-
});
|
|
2361
|
-
});
|
|
2362
|
-
it("counts only SESSION_LOGS_SYNC_REL uploads and never emits a path", async () => {
|
|
2363
|
-
const events = await runPersonalFanout({
|
|
2364
|
-
direction: "push",
|
|
2365
|
-
shareFn: async (options) => {
|
|
2366
|
-
options.onEvent?.({
|
|
2367
|
-
type: "progress",
|
|
2368
|
-
path: `${SESSION_LOGS_SYNC_REL}/claude/a.jsonl`,
|
|
2369
|
-
bytes: 11,
|
|
2370
|
-
});
|
|
2371
|
-
options.onEvent?.({
|
|
2372
|
-
type: "progress",
|
|
2373
|
-
path: `${SESSION_LOGS_SYNC_REL}/codex/b.jsonl`,
|
|
2374
|
-
bytes: 22,
|
|
2375
|
-
});
|
|
2376
|
-
options.onEvent?.({
|
|
2377
|
-
type: "progress",
|
|
2378
|
-
path: "personal/notes.md",
|
|
2379
|
-
bytes: 33,
|
|
2380
|
-
});
|
|
2381
|
-
options.onEvent?.({
|
|
2382
|
-
type: "progress",
|
|
2383
|
-
path: "workspace/.session-logs-old/x.jsonl",
|
|
2384
|
-
bytes: 44,
|
|
2385
|
-
});
|
|
2386
|
-
options.onEvent?.({
|
|
2387
|
-
type: "progress",
|
|
2388
|
-
path: `${SESSION_LOGS_SYNC_REL}/claude/deleted.jsonl`,
|
|
2389
|
-
bytes: 0,
|
|
2390
|
-
deleted: true,
|
|
2391
|
-
});
|
|
2392
|
-
return emptyShare({ filesUploaded: 4, bytesUploaded: 110 });
|
|
2393
|
-
},
|
|
2394
|
-
});
|
|
2395
|
-
const leg = events.find((event) => event.eventName === "company_sync_leg_completed");
|
|
2396
|
-
expect(leg?.properties).toMatchObject({
|
|
2397
|
-
uploadedCount: 4,
|
|
2398
|
-
downloadedCount: 0,
|
|
2399
|
-
sessionLogUploadedCount: 2,
|
|
2400
|
-
filesUploaded: 4,
|
|
2401
|
-
});
|
|
2402
|
-
const serialized = JSON.stringify(leg);
|
|
2403
|
-
expect(serialized).not.toContain(`${SESSION_LOGS_SYNC_REL}/`);
|
|
2404
|
-
expect(serialized).not.toContain("personal/notes.md");
|
|
2405
|
-
expect(serialized).not.toContain("session-logs-old");
|
|
2406
|
-
expect(serialized.toLowerCase()).not.toContain("filename");
|
|
2407
|
-
});
|
|
2408
|
-
it("emits no company_sync_leg_completed on an empty cycle", async () => {
|
|
2409
|
-
const events = await runPersonalFanout({
|
|
2410
|
-
shareFn: async () => emptyShare(),
|
|
2411
|
-
syncFn: async () => emptySync(),
|
|
2412
|
-
});
|
|
2413
|
-
expect(events.map((event) => event.eventName)).not.toContain("company_sync_leg_completed");
|
|
2414
|
-
});
|
|
2415
|
-
it("keeps the three count keys after emitCloudTelemetry redaction", async () => {
|
|
2416
|
-
const events = await runPersonalFanout({
|
|
2417
|
-
direction: "push",
|
|
2418
|
-
shareFn: async (options) => {
|
|
2419
|
-
options.onEvent?.({
|
|
2420
|
-
type: "progress",
|
|
2421
|
-
path: `${SESSION_LOGS_SYNC_REL}/grok/c.jsonl`,
|
|
2422
|
-
bytes: 9,
|
|
2423
|
-
});
|
|
2424
|
-
return emptyShare({ filesUploaded: 1, bytesUploaded: 9 });
|
|
2425
|
-
},
|
|
2426
|
-
});
|
|
2427
|
-
const leg = events.find((event) => event.eventName === "company_sync_leg_completed");
|
|
2428
|
-
expect(leg?.properties).toEqual(expect.objectContaining({
|
|
2429
|
-
uploadedCount: 1,
|
|
2430
|
-
downloadedCount: 0,
|
|
2431
|
-
sessionLogUploadedCount: 1,
|
|
2432
|
-
filesUploaded: 1,
|
|
2433
|
-
}));
|
|
2434
|
-
expect(leg?.properties).not.toHaveProperty("path");
|
|
2435
|
-
expect(leg?.properties).not.toHaveProperty("canonicalPath");
|
|
2436
|
-
expect(JSON.stringify(leg?.properties)).not.toContain(SESSION_LOGS_SYNC_REL);
|
|
2437
|
-
});
|
|
2438
|
-
});
|
|
2439
|
-
//# sourceMappingURL=sync-runner-company.test.js.map
|