@indigoai-us/hq-cloud 6.18.44-alpha.48 → 6.18.44-alpha.49
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/active-company.test.d.ts +2 -0
- package/dist/active-company.test.d.ts.map +1 -0
- package/dist/active-company.test.js +149 -0
- package/dist/active-company.test.js.map +1 -0
- package/dist/agent-codex-instructions.test.d.ts +2 -0
- package/dist/agent-codex-instructions.test.d.ts.map +1 -0
- package/dist/agent-codex-instructions.test.js +276 -0
- package/dist/agent-codex-instructions.test.js.map +1 -0
- package/dist/backup-prune.test.d.ts +2 -0
- package/dist/backup-prune.test.d.ts.map +1 -0
- package/dist/backup-prune.test.js +154 -0
- package/dist/backup-prune.test.js.map +1 -0
- package/dist/bandwidth.test.d.ts +2 -0
- package/dist/bandwidth.test.d.ts.map +1 -0
- package/dist/bandwidth.test.js +342 -0
- package/dist/bandwidth.test.js.map +1 -0
- package/dist/best-effort-error.test.d.ts +2 -0
- package/dist/best-effort-error.test.d.ts.map +1 -0
- package/dist/best-effort-error.test.js +54 -0
- package/dist/best-effort-error.test.js.map +1 -0
- package/dist/bin/area-ledger-migration.test.d.ts +2 -0
- package/dist/bin/area-ledger-migration.test.d.ts.map +1 -0
- package/dist/bin/area-ledger-migration.test.js +410 -0
- package/dist/bin/area-ledger-migration.test.js.map +1 -0
- package/dist/bin/backup-prune-runner.test.d.ts +2 -0
- package/dist/bin/backup-prune-runner.test.d.ts.map +1 -0
- package/dist/bin/backup-prune-runner.test.js +22 -0
- package/dist/bin/backup-prune-runner.test.js.map +1 -0
- package/dist/bin/journal-repair.test.d.ts +2 -0
- package/dist/bin/journal-repair.test.d.ts.map +1 -0
- package/dist/bin/journal-repair.test.js +53 -0
- package/dist/bin/journal-repair.test.js.map +1 -0
- package/dist/bin/layout-compatibility.test.d.ts +2 -0
- package/dist/bin/layout-compatibility.test.d.ts.map +1 -0
- package/dist/bin/layout-compatibility.test.js +87 -0
- package/dist/bin/layout-compatibility.test.js.map +1 -0
- package/dist/bin/outpost-heartbeat.test.d.ts +7 -0
- package/dist/bin/outpost-heartbeat.test.d.ts.map +1 -0
- package/dist/bin/outpost-heartbeat.test.js +84 -0
- package/dist/bin/outpost-heartbeat.test.js.map +1 -0
- package/dist/bin/outpost-session-host.test.d.ts +7 -0
- package/dist/bin/outpost-session-host.test.d.ts.map +1 -0
- package/dist/bin/outpost-session-host.test.js +52 -0
- package/dist/bin/outpost-session-host.test.js.map +1 -0
- package/dist/bin/sync-mutation.test.d.ts +2 -0
- package/dist/bin/sync-mutation.test.d.ts.map +1 -0
- package/dist/bin/sync-mutation.test.js +64 -0
- package/dist/bin/sync-mutation.test.js.map +1 -0
- package/dist/bin/sync-runner-args.test.d.ts +2 -0
- package/dist/bin/sync-runner-args.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-args.test.js +82 -0
- package/dist/bin/sync-runner-args.test.js.map +1 -0
- package/dist/bin/sync-runner-auth-wait.test.d.ts +2 -0
- package/dist/bin/sync-runner-auth-wait.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-auth-wait.test.js +406 -0
- package/dist/bin/sync-runner-auth-wait.test.js.map +1 -0
- package/dist/bin/sync-runner-backoff.regression.test.d.ts +29 -0
- package/dist/bin/sync-runner-backoff.regression.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-backoff.regression.test.js +224 -0
- package/dist/bin/sync-runner-backoff.regression.test.js.map +1 -0
- package/dist/bin/sync-runner-company.test.d.ts +2 -0
- package/dist/bin/sync-runner-company.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-company.test.js +2439 -0
- package/dist/bin/sync-runner-company.test.js.map +1 -0
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts +2 -0
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js +648 -0
- package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js.map +1 -0
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts +2 -0
- package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js +329 -0
- package/dist/bin/sync-runner-delete-snapshot.bench.test.js.map +1 -0
- package/dist/bin/sync-runner-events.test.d.ts +2 -0
- package/dist/bin/sync-runner-events.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-events.test.js +364 -0
- package/dist/bin/sync-runner-events.test.js.map +1 -0
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts +2 -0
- package/dist/bin/sync-runner-heap-telemetry.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-heap-telemetry.test.js +1966 -0
- package/dist/bin/sync-runner-heap-telemetry.test.js.map +1 -0
- package/dist/bin/sync-runner-manifest.test.d.ts +12 -0
- package/dist/bin/sync-runner-manifest.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-manifest.test.js +921 -0
- package/dist/bin/sync-runner-manifest.test.js.map +1 -0
- package/dist/bin/sync-runner-planning.test.d.ts +2 -0
- package/dist/bin/sync-runner-planning.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-planning.test.js +448 -0
- package/dist/bin/sync-runner-planning.test.js.map +1 -0
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts +2 -0
- package/dist/bin/sync-runner-post-sync-flags.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-post-sync-flags.test.js +64 -0
- package/dist/bin/sync-runner-post-sync-flags.test.js.map +1 -0
- package/dist/bin/sync-runner-publish-expansion.test.d.ts +2 -0
- package/dist/bin/sync-runner-publish-expansion.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-publish-expansion.test.js +54 -0
- package/dist/bin/sync-runner-publish-expansion.test.js.map +1 -0
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts +2 -0
- package/dist/bin/sync-runner-receiver-unresolved-company.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js +379 -0
- package/dist/bin/sync-runner-receiver-unresolved-company.test.js.map +1 -0
- package/dist/bin/sync-runner-rollup.test.d.ts +2 -0
- package/dist/bin/sync-runner-rollup.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-rollup.test.js +24 -0
- package/dist/bin/sync-runner-rollup.test.js.map +1 -0
- package/dist/bin/sync-runner-watch-loop.test.d.ts +2 -0
- package/dist/bin/sync-runner-watch-loop.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-watch-loop.test.js +735 -0
- package/dist/bin/sync-runner-watch-loop.test.js.map +1 -0
- package/dist/bin/sync-runner-watch-routes.test.d.ts +2 -0
- package/dist/bin/sync-runner-watch-routes.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-watch-routes.test.js +181 -0
- package/dist/bin/sync-runner-watch-routes.test.js.map +1 -0
- package/dist/bin/sync-runner.test.d.ts +10 -0
- package/dist/bin/sync-runner.test.d.ts.map +1 -0
- package/dist/bin/sync-runner.test.js +19084 -0
- package/dist/bin/sync-runner.test.js.map +1 -0
- package/dist/cli/case-alias.test.d.ts +2 -0
- package/dist/cli/case-alias.test.d.ts.map +1 -0
- package/dist/cli/case-alias.test.js +96 -0
- package/dist/cli/case-alias.test.js.map +1 -0
- package/dist/cli/conflict-recovery.test.d.ts +2 -0
- package/dist/cli/conflict-recovery.test.d.ts.map +1 -0
- package/dist/cli/conflict-recovery.test.js +207 -0
- package/dist/cli/conflict-recovery.test.js.map +1 -0
- package/dist/cli/conflict-winner.test.d.ts +7 -0
- package/dist/cli/conflict-winner.test.d.ts.map +1 -0
- package/dist/cli/conflict-winner.test.js +98 -0
- package/dist/cli/conflict-winner.test.js.map +1 -0
- package/dist/cli/doctor.test.d.ts +13 -0
- package/dist/cli/doctor.test.d.ts.map +1 -0
- package/dist/cli/doctor.test.js +607 -0
- package/dist/cli/doctor.test.js.map +1 -0
- package/dist/cli/invite.test.d.ts +5 -0
- package/dist/cli/invite.test.d.ts.map +1 -0
- package/dist/cli/invite.test.js +178 -0
- package/dist/cli/invite.test.js.map +1 -0
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +2 -0
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +1 -0
- package/dist/cli/onepass-pull-planner-regressions.test.js +300 -0
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +1 -0
- package/dist/cli/onepass-pull-planner.test.d.ts +2 -0
- package/dist/cli/onepass-pull-planner.test.d.ts.map +1 -0
- package/dist/cli/onepass-pull-planner.test.js +266 -0
- package/dist/cli/onepass-pull-planner.test.js.map +1 -0
- package/dist/cli/push-scan-exclusions.test.d.ts +2 -0
- package/dist/cli/push-scan-exclusions.test.d.ts.map +1 -0
- package/dist/cli/push-scan-exclusions.test.js +99 -0
- package/dist/cli/push-scan-exclusions.test.js.map +1 -0
- package/dist/cli/reindex-knowledge.test.d.ts +12 -0
- package/dist/cli/reindex-knowledge.test.d.ts.map +1 -0
- package/dist/cli/reindex-knowledge.test.js +318 -0
- package/dist/cli/reindex-knowledge.test.js.map +1 -0
- package/dist/cli/reindex.test.d.ts +11 -0
- package/dist/cli/reindex.test.d.ts.map +1 -0
- package/dist/cli/reindex.test.js +860 -0
- package/dist/cli/reindex.test.js.map +1 -0
- package/dist/cli/rescue-breaker.test.d.ts +2 -0
- package/dist/cli/rescue-breaker.test.d.ts.map +1 -0
- package/dist/cli/rescue-breaker.test.js +812 -0
- package/dist/cli/rescue-breaker.test.js.map +1 -0
- package/dist/cli/rescue-classify-ordering.test.d.ts +2 -0
- package/dist/cli/rescue-classify-ordering.test.d.ts.map +1 -0
- package/dist/cli/rescue-classify-ordering.test.js +500 -0
- package/dist/cli/rescue-classify-ordering.test.js.map +1 -0
- package/dist/cli/rescue-clone-diagnostics.test.d.ts +2 -0
- package/dist/cli/rescue-clone-diagnostics.test.d.ts.map +1 -0
- package/dist/cli/rescue-clone-diagnostics.test.js +101 -0
- package/dist/cli/rescue-clone-diagnostics.test.js.map +1 -0
- package/dist/cli/rescue-clone-network-retry.test.d.ts +2 -0
- package/dist/cli/rescue-clone-network-retry.test.d.ts.map +1 -0
- package/dist/cli/rescue-clone-network-retry.test.js +415 -0
- package/dist/cli/rescue-clone-network-retry.test.js.map +1 -0
- package/dist/cli/rescue-core-stamp.test.d.ts +2 -0
- package/dist/cli/rescue-core-stamp.test.d.ts.map +1 -0
- package/dist/cli/rescue-core-stamp.test.js +364 -0
- package/dist/cli/rescue-core-stamp.test.js.map +1 -0
- package/dist/cli/rescue-drift-reconcile.test.d.ts +2 -0
- package/dist/cli/rescue-drift-reconcile.test.d.ts.map +1 -0
- package/dist/cli/rescue-drift-reconcile.test.js +162 -0
- package/dist/cli/rescue-drift-reconcile.test.js.map +1 -0
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts +2 -0
- package/dist/cli/rescue-drop-dir-symlink.test.d.ts.map +1 -0
- package/dist/cli/rescue-drop-dir-symlink.test.js +255 -0
- package/dist/cli/rescue-drop-dir-symlink.test.js.map +1 -0
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts +2 -0
- package/dist/cli/rescue-exec-bit-preserve.test.d.ts.map +1 -0
- package/dist/cli/rescue-exec-bit-preserve.test.js +177 -0
- package/dist/cli/rescue-exec-bit-preserve.test.js.map +1 -0
- package/dist/cli/rescue-hq-root-guard.test.d.ts +2 -0
- package/dist/cli/rescue-hq-root-guard.test.d.ts.map +1 -0
- package/dist/cli/rescue-hq-root-guard.test.js +210 -0
- package/dist/cli/rescue-hq-root-guard.test.js.map +1 -0
- package/dist/cli/rescue-journal-reconcile.test.d.ts +2 -0
- package/dist/cli/rescue-journal-reconcile.test.d.ts.map +1 -0
- package/dist/cli/rescue-journal-reconcile.test.js +186 -0
- package/dist/cli/rescue-journal-reconcile.test.js.map +1 -0
- package/dist/cli/rescue-keep-local-ignore.test.d.ts +2 -0
- package/dist/cli/rescue-keep-local-ignore.test.d.ts.map +1 -0
- package/dist/cli/rescue-keep-local-ignore.test.js +315 -0
- package/dist/cli/rescue-keep-local-ignore.test.js.map +1 -0
- package/dist/cli/rescue-move.test.d.ts +2 -0
- package/dist/cli/rescue-move.test.d.ts.map +1 -0
- package/dist/cli/rescue-move.test.js +166 -0
- package/dist/cli/rescue-move.test.js.map +1 -0
- package/dist/cli/rescue-mtime-preserve.test.d.ts +2 -0
- package/dist/cli/rescue-mtime-preserve.test.d.ts.map +1 -0
- package/dist/cli/rescue-mtime-preserve.test.js +186 -0
- package/dist/cli/rescue-mtime-preserve.test.js.map +1 -0
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts +2 -0
- package/dist/cli/rescue-preserve-copy-symlink.test.d.ts.map +1 -0
- package/dist/cli/rescue-preserve-copy-symlink.test.js +483 -0
- package/dist/cli/rescue-preserve-copy-symlink.test.js.map +1 -0
- package/dist/cli/rescue-realpath.test.d.ts +2 -0
- package/dist/cli/rescue-realpath.test.d.ts.map +1 -0
- package/dist/cli/rescue-realpath.test.js +109 -0
- package/dist/cli/rescue-realpath.test.js.map +1 -0
- package/dist/cli/rescue-restore-flag.test.d.ts +2 -0
- package/dist/cli/rescue-restore-flag.test.d.ts.map +1 -0
- package/dist/cli/rescue-restore-flag.test.js +82 -0
- package/dist/cli/rescue-restore-flag.test.js.map +1 -0
- package/dist/cli/rescue-rsync-preflight.test.d.ts +2 -0
- package/dist/cli/rescue-rsync-preflight.test.d.ts.map +1 -0
- package/dist/cli/rescue-rsync-preflight.test.js +579 -0
- package/dist/cli/rescue-rsync-preflight.test.js.map +1 -0
- package/dist/cli/rescue-rsync-status.test.d.ts +2 -0
- package/dist/cli/rescue-rsync-status.test.d.ts.map +1 -0
- package/dist/cli/rescue-rsync-status.test.js +406 -0
- package/dist/cli/rescue-rsync-status.test.js.map +1 -0
- package/dist/cli/rescue-settings-reconcile.test.d.ts +2 -0
- package/dist/cli/rescue-settings-reconcile.test.d.ts.map +1 -0
- package/dist/cli/rescue-settings-reconcile.test.js +610 -0
- package/dist/cli/rescue-settings-reconcile.test.js.map +1 -0
- package/dist/cli/rescue-snapshot-copy.test.d.ts +2 -0
- package/dist/cli/rescue-snapshot-copy.test.d.ts.map +1 -0
- package/dist/cli/rescue-snapshot-copy.test.js +790 -0
- package/dist/cli/rescue-snapshot-copy.test.js.map +1 -0
- package/dist/cli/rescue-snapshot-recovery.test.d.ts +2 -0
- package/dist/cli/rescue-snapshot-recovery.test.d.ts.map +1 -0
- package/dist/cli/rescue-snapshot-recovery.test.js +265 -0
- package/dist/cli/rescue-snapshot-recovery.test.js.map +1 -0
- package/dist/cli/rescue-snapshot.test.d.ts +2 -0
- package/dist/cli/rescue-snapshot.test.d.ts.map +1 -0
- package/dist/cli/rescue-snapshot.test.js +46 -0
- package/dist/cli/rescue-snapshot.test.js.map +1 -0
- package/dist/cli/rescue-source-switch-floor.test.d.ts +2 -0
- package/dist/cli/rescue-source-switch-floor.test.d.ts.map +1 -0
- package/dist/cli/rescue-source-switch-floor.test.js +247 -0
- package/dist/cli/rescue-source-switch-floor.test.js.map +1 -0
- package/dist/cli/rescue-unchanged-delete.test.d.ts +2 -0
- package/dist/cli/rescue-unchanged-delete.test.d.ts.map +1 -0
- package/dist/cli/rescue-unchanged-delete.test.js +305 -0
- package/dist/cli/rescue-unchanged-delete.test.js.map +1 -0
- package/dist/cli/rescue.reindex.test.d.ts +2 -0
- package/dist/cli/rescue.reindex.test.d.ts.map +1 -0
- package/dist/cli/rescue.reindex.test.js +72 -0
- package/dist/cli/rescue.reindex.test.js.map +1 -0
- package/dist/cli/rescue.test.d.ts +2 -0
- package/dist/cli/rescue.test.d.ts.map +1 -0
- package/dist/cli/rescue.test.js +127 -0
- package/dist/cli/rescue.test.js.map +1 -0
- package/dist/cli/share-plan-limit-presign.test.d.ts +2 -0
- package/dist/cli/share-plan-limit-presign.test.d.ts.map +1 -0
- package/dist/cli/share-plan-limit-presign.test.js +271 -0
- package/dist/cli/share-plan-limit-presign.test.js.map +1 -0
- package/dist/cli/share-presign-transport.test.d.ts +22 -0
- package/dist/cli/share-presign-transport.test.d.ts.map +1 -0
- package/dist/cli/share-presign-transport.test.js +388 -0
- package/dist/cli/share-presign-transport.test.js.map +1 -0
- package/dist/cli/share.test.d.ts +5 -0
- package/dist/cli/share.test.d.ts.map +1 -0
- package/dist/cli/share.test.js +12336 -0
- package/dist/cli/share.test.js.map +1 -0
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +15 -0
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +1 -0
- package/dist/cli/streaming-pull-planner.bench.test.js +273 -0
- package/dist/cli/streaming-pull-planner.bench.test.js.map +1 -0
- package/dist/cli/sync-scope.test.d.ts +22 -0
- package/dist/cli/sync-scope.test.d.ts.map +1 -0
- package/dist/cli/sync-scope.test.js +903 -0
- package/dist/cli/sync-scope.test.js.map +1 -0
- package/dist/cli/sync.test.d.ts +5 -0
- package/dist/cli/sync.test.d.ts.map +1 -0
- package/dist/cli/sync.test.js +9028 -0
- package/dist/cli/sync.test.js.map +1 -0
- package/dist/cli/tombstones.test.d.ts +2 -0
- package/dist/cli/tombstones.test.d.ts.map +1 -0
- package/dist/cli/tombstones.test.js +120 -0
- package/dist/cli/tombstones.test.js.map +1 -0
- package/dist/cli/watch-event-push-conflict.test.d.ts +25 -0
- package/dist/cli/watch-event-push-conflict.test.d.ts.map +1 -0
- package/dist/cli/watch-event-push-conflict.test.js +230 -0
- package/dist/cli/watch-event-push-conflict.test.js.map +1 -0
- package/dist/client-info.test.d.ts +11 -0
- package/dist/client-info.test.d.ts.map +1 -0
- package/dist/client-info.test.js +168 -0
- package/dist/client-info.test.js.map +1 -0
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts +11 -0
- package/dist/cognito-auth-lock-no-hard-links.test.d.ts.map +1 -0
- package/dist/cognito-auth-lock-no-hard-links.test.js +76 -0
- package/dist/cognito-auth-lock-no-hard-links.test.js.map +1 -0
- package/dist/cognito-auth.test.d.ts +9 -0
- package/dist/cognito-auth.test.d.ts.map +1 -0
- package/dist/cognito-auth.test.js +745 -0
- package/dist/cognito-auth.test.js.map +1 -0
- package/dist/company-resolver.test.d.ts +7 -0
- package/dist/company-resolver.test.d.ts.map +1 -0
- package/dist/company-resolver.test.js +535 -0
- package/dist/company-resolver.test.js.map +1 -0
- package/dist/company-slug.test.d.ts +7 -0
- package/dist/company-slug.test.d.ts.map +1 -0
- package/dist/company-slug.test.js +43 -0
- package/dist/company-slug.test.js.map +1 -0
- package/dist/company-vault-transport.test.d.ts +12 -0
- package/dist/company-vault-transport.test.d.ts.map +1 -0
- package/dist/company-vault-transport.test.js +97 -0
- package/dist/company-vault-transport.test.js.map +1 -0
- package/dist/context.test.d.ts +7 -0
- package/dist/context.test.d.ts.map +1 -0
- package/dist/context.test.js +646 -0
- package/dist/context.test.js.map +1 -0
- package/dist/entity-resolver.test.d.ts +10 -0
- package/dist/entity-resolver.test.d.ts.map +1 -0
- package/dist/entity-resolver.test.js +244 -0
- package/dist/entity-resolver.test.js.map +1 -0
- package/dist/getindigo-dead-refs-contract.test.d.ts +2 -0
- package/dist/getindigo-dead-refs-contract.test.d.ts.map +1 -0
- package/dist/getindigo-dead-refs-contract.test.js +58 -0
- package/dist/getindigo-dead-refs-contract.test.js.map +1 -0
- package/dist/hermetic-test-env.test.d.ts +2 -0
- package/dist/hermetic-test-env.test.d.ts.map +1 -0
- package/dist/hermetic-test-env.test.js +61 -0
- package/dist/hermetic-test-env.test.js.map +1 -0
- package/dist/hq-root-recovery.test.d.ts +2 -0
- package/dist/hq-root-recovery.test.d.ts.map +1 -0
- package/dist/hq-root-recovery.test.js +65 -0
- package/dist/hq-root-recovery.test.js.map +1 -0
- package/dist/ignore.test.d.ts +10 -0
- package/dist/ignore.test.d.ts.map +1 -0
- package/dist/ignore.test.js +958 -0
- package/dist/ignore.test.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +26 -0
- package/dist/index.test.js.map +1 -0
- package/dist/journal-area-ledger-read-boundary.test.d.ts +2 -0
- package/dist/journal-area-ledger-read-boundary.test.d.ts.map +1 -0
- package/dist/journal-area-ledger-read-boundary.test.js +425 -0
- package/dist/journal-area-ledger-read-boundary.test.js.map +1 -0
- package/dist/journal-baseline.test.d.ts +2 -0
- package/dist/journal-baseline.test.d.ts.map +1 -0
- package/dist/journal-baseline.test.js +218 -0
- package/dist/journal-baseline.test.js.map +1 -0
- package/dist/journal-decode-window.test.d.ts +2 -0
- package/dist/journal-decode-window.test.d.ts.map +1 -0
- package/dist/journal-decode-window.test.js +99 -0
- package/dist/journal-decode-window.test.js.map +1 -0
- package/dist/journal-delta-writes.test.d.ts +2 -0
- package/dist/journal-delta-writes.test.d.ts.map +1 -0
- package/dist/journal-delta-writes.test.js +159 -0
- package/dist/journal-delta-writes.test.js.map +1 -0
- package/dist/journal-ledger-index.test.d.ts +15 -0
- package/dist/journal-ledger-index.test.d.ts.map +1 -0
- package/dist/journal-ledger-index.test.js +269 -0
- package/dist/journal-ledger-index.test.js.map +1 -0
- package/dist/journal-public-boundary.test.d.ts +2 -0
- package/dist/journal-public-boundary.test.d.ts.map +1 -0
- package/dist/journal-public-boundary.test.js +216 -0
- package/dist/journal-public-boundary.test.js.map +1 -0
- package/dist/journal-row-store.test.d.ts +2 -0
- package/dist/journal-row-store.test.d.ts.map +1 -0
- package/dist/journal-row-store.test.js +729 -0
- package/dist/journal-row-store.test.js.map +1 -0
- package/dist/journal-snapshot-memory-helpers.d.ts +35 -0
- package/dist/journal-snapshot-memory-helpers.d.ts.map +1 -0
- package/dist/journal-snapshot-memory-helpers.js +298 -0
- package/dist/journal-snapshot-memory-helpers.js.map +1 -0
- package/dist/journal-snapshot-memory.test.d.ts +2 -0
- package/dist/journal-snapshot-memory.test.d.ts.map +1 -0
- package/dist/journal-snapshot-memory.test.js +55 -0
- package/dist/journal-snapshot-memory.test.js.map +1 -0
- package/dist/journal-snapshot-v4-memory.test.d.ts +2 -0
- package/dist/journal-snapshot-v4-memory.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4-memory.test.js +24 -0
- package/dist/journal-snapshot-v4-memory.test.js.map +1 -0
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts +2 -0
- package/dist/journal-snapshot-v4-writer-memory.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4-writer-memory.test.js +76 -0
- package/dist/journal-snapshot-v4-writer-memory.test.js.map +1 -0
- package/dist/journal-snapshot-v4-writer.test.d.ts +2 -0
- package/dist/journal-snapshot-v4-writer.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4-writer.test.js +282 -0
- package/dist/journal-snapshot-v4-writer.test.js.map +1 -0
- package/dist/journal-snapshot-v4.test.d.ts +2 -0
- package/dist/journal-snapshot-v4.test.d.ts.map +1 -0
- package/dist/journal-snapshot-v4.test.js +281 -0
- package/dist/journal-snapshot-v4.test.js.map +1 -0
- package/dist/journal-store.test.d.ts +2 -0
- package/dist/journal-store.test.d.ts.map +1 -0
- package/dist/journal-store.test.js +1227 -0
- package/dist/journal-store.test.js.map +1 -0
- package/dist/journal-streaming.heap.test.d.ts +2 -0
- package/dist/journal-streaming.heap.test.d.ts.map +1 -0
- package/dist/journal-streaming.heap.test.js +190 -0
- package/dist/journal-streaming.heap.test.js.map +1 -0
- package/dist/journal.test.d.ts +9 -0
- package/dist/journal.test.d.ts.map +1 -0
- package/dist/journal.test.js +1074 -0
- package/dist/journal.test.js.map +1 -0
- package/dist/kms10-etag-safe-pull.test.d.ts +2 -0
- package/dist/kms10-etag-safe-pull.test.d.ts.map +1 -0
- package/dist/kms10-etag-safe-pull.test.js +53 -0
- package/dist/kms10-etag-safe-pull.test.js.map +1 -0
- package/dist/lib/cloud-authoritative.test.d.ts +2 -0
- package/dist/lib/cloud-authoritative.test.d.ts.map +1 -0
- package/dist/lib/cloud-authoritative.test.js +42 -0
- package/dist/lib/cloud-authoritative.test.js.map +1 -0
- package/dist/lib/conflict-reconcile.test.d.ts +7 -0
- package/dist/lib/conflict-reconcile.test.d.ts.map +1 -0
- package/dist/lib/conflict-reconcile.test.js +246 -0
- package/dist/lib/conflict-reconcile.test.js.map +1 -0
- package/dist/lib/conflict.test.d.ts +9 -0
- package/dist/lib/conflict.test.d.ts.map +1 -0
- package/dist/lib/conflict.test.js +340 -0
- package/dist/lib/conflict.test.js.map +1 -0
- package/dist/lib/describe-error.test.d.ts +2 -0
- package/dist/lib/describe-error.test.d.ts.map +1 -0
- package/dist/lib/describe-error.test.js +148 -0
- package/dist/lib/describe-error.test.js.map +1 -0
- package/dist/lib/machine-id.test.d.ts +8 -0
- package/dist/lib/machine-id.test.d.ts.map +1 -0
- package/dist/lib/machine-id.test.js +228 -0
- package/dist/lib/machine-id.test.js.map +1 -0
- package/dist/lib/net-errors.test.d.ts +2 -0
- package/dist/lib/net-errors.test.d.ts.map +1 -0
- package/dist/lib/net-errors.test.js +111 -0
- package/dist/lib/net-errors.test.js.map +1 -0
- package/dist/lib/ontology-entity-meta.test.d.ts +2 -0
- package/dist/lib/ontology-entity-meta.test.d.ts.map +1 -0
- package/dist/lib/ontology-entity-meta.test.js +79 -0
- package/dist/lib/ontology-entity-meta.test.js.map +1 -0
- package/dist/lib/ontology-entity-push.test.d.ts +2 -0
- package/dist/lib/ontology-entity-push.test.d.ts.map +1 -0
- package/dist/lib/ontology-entity-push.test.js +156 -0
- package/dist/lib/ontology-entity-push.test.js.map +1 -0
- package/dist/lib/personal-connector-settings-sync.test.d.ts +2 -0
- package/dist/lib/personal-connector-settings-sync.test.d.ts.map +1 -0
- package/dist/lib/personal-connector-settings-sync.test.js +34 -0
- package/dist/lib/personal-connector-settings-sync.test.js.map +1 -0
- package/dist/lib/readlink-safe.test.d.ts +2 -0
- package/dist/lib/readlink-safe.test.d.ts.map +1 -0
- package/dist/lib/readlink-safe.test.js +34 -0
- package/dist/lib/readlink-safe.test.js.map +1 -0
- package/dist/lib/s3-content-checksum.test.d.ts +2 -0
- package/dist/lib/s3-content-checksum.test.d.ts.map +1 -0
- package/dist/lib/s3-content-checksum.test.js +26 -0
- package/dist/lib/s3-content-checksum.test.js.map +1 -0
- package/dist/lib/skill-register-landed-bytes.test.d.ts +2 -0
- package/dist/lib/skill-register-landed-bytes.test.d.ts.map +1 -0
- package/dist/lib/skill-register-landed-bytes.test.js +83 -0
- package/dist/lib/skill-register-landed-bytes.test.js.map +1 -0
- package/dist/local-path-codec.test.d.ts +14 -0
- package/dist/local-path-codec.test.d.ts.map +1 -0
- package/dist/local-path-codec.test.js +122 -0
- package/dist/local-path-codec.test.js.map +1 -0
- package/dist/machine-auth.test.d.ts +14 -0
- package/dist/machine-auth.test.d.ts.map +1 -0
- package/dist/machine-auth.test.js +1492 -0
- package/dist/machine-auth.test.js.map +1 -0
- package/dist/machine-token-cache-isolation.test.d.ts +24 -0
- package/dist/machine-token-cache-isolation.test.d.ts.map +1 -0
- package/dist/machine-token-cache-isolation.test.js +284 -0
- package/dist/machine-token-cache-isolation.test.js.map +1 -0
- package/dist/manifest/US-002.acceptance.test.d.ts +11 -0
- package/dist/manifest/US-002.acceptance.test.d.ts.map +1 -0
- package/dist/manifest/US-002.acceptance.test.js +160 -0
- package/dist/manifest/US-002.acceptance.test.js.map +1 -0
- package/dist/manifest/US-004.acceptance.test.d.ts +12 -0
- package/dist/manifest/US-004.acceptance.test.d.ts.map +1 -0
- package/dist/manifest/US-004.acceptance.test.js +173 -0
- package/dist/manifest/US-004.acceptance.test.js.map +1 -0
- package/dist/manifest/bench-gate.d.ts +30 -0
- package/dist/manifest/bench-gate.d.ts.map +1 -0
- package/dist/manifest/bench-gate.js +47 -0
- package/dist/manifest/bench-gate.js.map +1 -0
- package/dist/manifest/bench-gate.test.d.ts +2 -0
- package/dist/manifest/bench-gate.test.d.ts.map +1 -0
- package/dist/manifest/bench-gate.test.js +67 -0
- package/dist/manifest/bench-gate.test.js.map +1 -0
- package/dist/manifest/build-manifest-resident-parity.test.d.ts +2 -0
- package/dist/manifest/build-manifest-resident-parity.test.d.ts.map +1 -0
- package/dist/manifest/build-manifest-resident-parity.test.js +69 -0
- package/dist/manifest/build-manifest-resident-parity.test.js.map +1 -0
- package/dist/manifest/build-manifest.bench.test.d.ts +22 -0
- package/dist/manifest/build-manifest.bench.test.d.ts.map +1 -0
- package/dist/manifest/build-manifest.bench.test.js +931 -0
- package/dist/manifest/build-manifest.bench.test.js.map +1 -0
- package/dist/manifest/build-manifest.test.d.ts +10 -0
- package/dist/manifest/build-manifest.test.d.ts.map +1 -0
- package/dist/manifest/build-manifest.test.js +1220 -0
- package/dist/manifest/build-manifest.test.js.map +1 -0
- package/dist/manifest/contract.test.d.ts +17 -0
- package/dist/manifest/contract.test.d.ts.map +1 -0
- package/dist/manifest/contract.test.js +346 -0
- package/dist/manifest/contract.test.js.map +1 -0
- package/dist/manifest/import-graph.test.d.ts +25 -0
- package/dist/manifest/import-graph.test.d.ts.map +1 -0
- package/dist/manifest/import-graph.test.js +120 -0
- package/dist/manifest/import-graph.test.js.map +1 -0
- package/dist/manifest/ledger-shard-isolation.test.d.ts +18 -0
- package/dist/manifest/ledger-shard-isolation.test.d.ts.map +1 -0
- package/dist/manifest/ledger-shard-isolation.test.js +153 -0
- package/dist/manifest/ledger-shard-isolation.test.js.map +1 -0
- package/dist/manifest/snapshot-store.test.d.ts +11 -0
- package/dist/manifest/snapshot-store.test.d.ts.map +1 -0
- package/dist/manifest/snapshot-store.test.js +206 -0
- package/dist/manifest/snapshot-store.test.js.map +1 -0
- package/dist/manifest/upload-manifest.test.d.ts +10 -0
- package/dist/manifest/upload-manifest.test.d.ts.map +1 -0
- package/dist/manifest/upload-manifest.test.js +1335 -0
- package/dist/manifest/upload-manifest.test.js.map +1 -0
- package/dist/manifest-reconcile.test.d.ts +2 -0
- package/dist/manifest-reconcile.test.d.ts.map +1 -0
- package/dist/manifest-reconcile.test.js +1032 -0
- package/dist/manifest-reconcile.test.js.map +1 -0
- package/dist/object-io.test.d.ts +11 -0
- package/dist/object-io.test.d.ts.map +1 -0
- package/dist/object-io.test.js +2376 -0
- package/dist/object-io.test.js.map +1 -0
- package/dist/operation-lock.test.d.ts +5 -0
- package/dist/operation-lock.test.d.ts.map +1 -0
- package/dist/operation-lock.test.js +796 -0
- package/dist/operation-lock.test.js.map +1 -0
- package/dist/outcome-telemetry.test.d.ts +9 -0
- package/dist/outcome-telemetry.test.d.ts.map +1 -0
- package/dist/outcome-telemetry.test.js +663 -0
- package/dist/outcome-telemetry.test.js.map +1 -0
- package/dist/outposts/client.test.d.ts +9 -0
- package/dist/outposts/client.test.d.ts.map +1 -0
- package/dist/outposts/client.test.js +415 -0
- package/dist/outposts/client.test.js.map +1 -0
- package/dist/outposts/command.test.d.ts +18 -0
- package/dist/outposts/command.test.d.ts.map +1 -0
- package/dist/outposts/command.test.js +1230 -0
- package/dist/outposts/command.test.js.map +1 -0
- package/dist/outposts/replica-sync.test.d.ts +2 -0
- package/dist/outposts/replica-sync.test.d.ts.map +1 -0
- package/dist/outposts/replica-sync.test.js +225 -0
- package/dist/outposts/replica-sync.test.js.map +1 -0
- package/dist/outposts/self-deploy.test.d.ts +2 -0
- package/dist/outposts/self-deploy.test.d.ts.map +1 -0
- package/dist/outposts/self-deploy.test.js +218 -0
- package/dist/outposts/self-deploy.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-bounds.test.d.ts +25 -0
- package/dist/outposts/session-heartbeat-bounds.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-bounds.test.js +159 -0
- package/dist/outposts/session-heartbeat-bounds.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-guard.test.d.ts +16 -0
- package/dist/outposts/session-heartbeat-guard.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-guard.test.js +88 -0
- package/dist/outposts/session-heartbeat-guard.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.test.d.ts +10 -0
- package/dist/outposts/session-heartbeat-publisher.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.test.js +153 -0
- package/dist/outposts/session-heartbeat-publisher.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts +18 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.js +106 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-scan.test.d.ts +20 -0
- package/dist/outposts/session-heartbeat-scan.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-scan.test.js +242 -0
- package/dist/outposts/session-heartbeat-scan.test.js.map +1 -0
- package/dist/outposts/session-heartbeat.test.d.ts +11 -0
- package/dist/outposts/session-heartbeat.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat.test.js +387 -0
- package/dist/outposts/session-heartbeat.test.js.map +1 -0
- package/dist/outposts/session-host-auth.test.d.ts +16 -0
- package/dist/outposts/session-host-auth.test.d.ts.map +1 -0
- package/dist/outposts/session-host-auth.test.js +284 -0
- package/dist/outposts/session-host-auth.test.js.map +1 -0
- package/dist/outposts/session-host-command.test.d.ts +10 -0
- package/dist/outposts/session-host-command.test.d.ts.map +1 -0
- package/dist/outposts/session-host-command.test.js +182 -0
- package/dist/outposts/session-host-command.test.js.map +1 -0
- package/dist/outposts/session-host-connection.test.d.ts +18 -0
- package/dist/outposts/session-host-connection.test.d.ts.map +1 -0
- package/dist/outposts/session-host-connection.test.js +392 -0
- package/dist/outposts/session-host-connection.test.js.map +1 -0
- package/dist/outposts/session-host-fakes.d.ts +61 -0
- package/dist/outposts/session-host-fakes.d.ts.map +1 -0
- package/dist/outposts/session-host-fakes.js +115 -0
- package/dist/outposts/session-host-fakes.js.map +1 -0
- package/dist/outposts/session-host-ndjson.test.d.ts +11 -0
- package/dist/outposts/session-host-ndjson.test.d.ts.map +1 -0
- package/dist/outposts/session-host-ndjson.test.js +73 -0
- package/dist/outposts/session-host-ndjson.test.js.map +1 -0
- package/dist/outposts/session-host-protocol.test.d.ts +15 -0
- package/dist/outposts/session-host-protocol.test.d.ts.map +1 -0
- package/dist/outposts/session-host-protocol.test.js +0 -0
- package/dist/outposts/session-host-protocol.test.js.map +1 -0
- package/dist/outposts/session-host-server.test.d.ts +10 -0
- package/dist/outposts/session-host-server.test.d.ts.map +1 -0
- package/dist/outposts/session-host-server.test.js +118 -0
- package/dist/outposts/session-host-server.test.js.map +1 -0
- package/dist/outposts/session-host-sessions.test.d.ts +18 -0
- package/dist/outposts/session-host-sessions.test.d.ts.map +1 -0
- package/dist/outposts/session-host-sessions.test.js +439 -0
- package/dist/outposts/session-host-sessions.test.js.map +1 -0
- package/dist/outposts/terminal.test.d.ts +2 -0
- package/dist/outposts/terminal.test.d.ts.map +1 -0
- package/dist/outposts/terminal.test.js +146 -0
- package/dist/outposts/terminal.test.js.map +1 -0
- package/dist/outposts/transport.test.d.ts +10 -0
- package/dist/outposts/transport.test.d.ts.map +1 -0
- package/dist/outposts/transport.test.js +205 -0
- package/dist/outposts/transport.test.js.map +1 -0
- package/dist/packed-journal-phase2.test.d.ts +2 -0
- package/dist/packed-journal-phase2.test.d.ts.map +1 -0
- package/dist/packed-journal-phase2.test.js +273 -0
- package/dist/packed-journal-phase2.test.js.map +1 -0
- package/dist/path-ancestors.test.d.ts +2 -0
- package/dist/path-ancestors.test.d.ts.map +1 -0
- package/dist/path-ancestors.test.js +21 -0
- package/dist/path-ancestors.test.js.map +1 -0
- package/dist/personal-vault-exclusions.test.d.ts +22 -0
- package/dist/personal-vault-exclusions.test.d.ts.map +1 -0
- package/dist/personal-vault-exclusions.test.js +294 -0
- package/dist/personal-vault-exclusions.test.js.map +1 -0
- package/dist/personal-vault.test.d.ts +18 -0
- package/dist/personal-vault.test.d.ts.map +1 -0
- package/dist/personal-vault.test.js +1106 -0
- package/dist/personal-vault.test.js.map +1 -0
- package/dist/plan-limit-pause.test.d.ts +2 -0
- package/dist/plan-limit-pause.test.d.ts.map +1 -0
- package/dist/plan-limit-pause.test.js +150 -0
- package/dist/plan-limit-pause.test.js.map +1 -0
- package/dist/plan-limit.fixtures.d.ts +34 -0
- package/dist/plan-limit.fixtures.d.ts.map +1 -0
- package/dist/plan-limit.fixtures.js +96 -0
- package/dist/plan-limit.fixtures.js.map +1 -0
- package/dist/plan-limit.test.d.ts +2 -0
- package/dist/plan-limit.test.d.ts.map +1 -0
- package/dist/plan-limit.test.js +132 -0
- package/dist/plan-limit.test.js.map +1 -0
- package/dist/prefix-coalesce.test.d.ts +2 -0
- package/dist/prefix-coalesce.test.d.ts.map +1 -0
- package/dist/prefix-coalesce.test.js +260 -0
- package/dist/prefix-coalesce.test.js.map +1 -0
- package/dist/private-folder-transport.test.d.ts +2 -0
- package/dist/private-folder-transport.test.d.ts.map +1 -0
- package/dist/private-folder-transport.test.js +33 -0
- package/dist/private-folder-transport.test.js.map +1 -0
- package/dist/public-surface.test.d.ts +15 -0
- package/dist/public-surface.test.d.ts.map +1 -0
- package/dist/public-surface.test.js +110 -0
- package/dist/public-surface.test.js.map +1 -0
- package/dist/qmd-reindex.test.d.ts +14 -0
- package/dist/qmd-reindex.test.d.ts.map +1 -0
- package/dist/qmd-reindex.test.js +904 -0
- package/dist/qmd-reindex.test.js.map +1 -0
- package/dist/read-only-state-dir.test.d.ts +27 -0
- package/dist/read-only-state-dir.test.d.ts.map +1 -0
- package/dist/read-only-state-dir.test.js +210 -0
- package/dist/read-only-state-dir.test.js.map +1 -0
- package/dist/remote-pull.test.d.ts +2 -0
- package/dist/remote-pull.test.d.ts.map +1 -0
- package/dist/remote-pull.test.js +1147 -0
- package/dist/remote-pull.test.js.map +1 -0
- package/dist/s3-download-stream-hash.test.d.ts +2 -0
- package/dist/s3-download-stream-hash.test.d.ts.map +1 -0
- package/dist/s3-download-stream-hash.test.js +70 -0
- package/dist/s3-download-stream-hash.test.js.map +1 -0
- package/dist/s3.list-cost.test.d.ts +2 -0
- package/dist/s3.list-cost.test.d.ts.map +1 -0
- package/dist/s3.list-cost.test.js +51 -0
- package/dist/s3.list-cost.test.js.map +1 -0
- package/dist/s3.rename-retry.test.d.ts +2 -0
- package/dist/s3.rename-retry.test.d.ts.map +1 -0
- package/dist/s3.rename-retry.test.js +217 -0
- package/dist/s3.rename-retry.test.js.map +1 -0
- package/dist/s3.symlink-materialize.test.d.ts +18 -0
- package/dist/s3.symlink-materialize.test.d.ts.map +1 -0
- package/dist/s3.symlink-materialize.test.js +591 -0
- package/dist/s3.symlink-materialize.test.js.map +1 -0
- package/dist/s3.test.d.ts +9 -0
- package/dist/s3.test.d.ts.map +1 -0
- package/dist/s3.test.js +2091 -0
- package/dist/s3.test.js.map +1 -0
- package/dist/s3.windows-portability.test.d.ts +12 -0
- package/dist/s3.windows-portability.test.d.ts.map +1 -0
- package/dist/s3.windows-portability.test.js +228 -0
- package/dist/s3.windows-portability.test.js.map +1 -0
- package/dist/schemas/signal-types.test.d.ts +2 -0
- package/dist/schemas/signal-types.test.d.ts.map +1 -0
- package/dist/schemas/signal-types.test.js +65 -0
- package/dist/schemas/signal-types.test.js.map +1 -0
- package/dist/schemas/source-channels.test.d.ts +2 -0
- package/dist/schemas/source-channels.test.d.ts.map +1 -0
- package/dist/schemas/source-channels.test.js +65 -0
- package/dist/schemas/source-channels.test.js.map +1 -0
- package/dist/scope-shrink.test.d.ts +13 -0
- package/dist/scope-shrink.test.d.ts.map +1 -0
- package/dist/scope-shrink.test.js +558 -0
- package/dist/scope-shrink.test.js.map +1 -0
- package/dist/session-log-capture.test.d.ts +2 -0
- package/dist/session-log-capture.test.d.ts.map +1 -0
- package/dist/session-log-capture.test.js +533 -0
- package/dist/session-log-capture.test.js.map +1 -0
- package/dist/session-log-retention.test.d.ts +2 -0
- package/dist/session-log-retention.test.d.ts.map +1 -0
- package/dist/session-log-retention.test.js +383 -0
- package/dist/session-log-retention.test.js.map +1 -0
- package/dist/signals/get.test.d.ts +5 -0
- package/dist/signals/get.test.d.ts.map +1 -0
- package/dist/signals/get.test.js +254 -0
- package/dist/signals/get.test.js.map +1 -0
- package/dist/signals/list.test.d.ts +9 -0
- package/dist/signals/list.test.d.ts.map +1 -0
- package/dist/signals/list.test.js +330 -0
- package/dist/signals/list.test.js.map +1 -0
- package/dist/skill-telemetry.test.d.ts +2 -0
- package/dist/skill-telemetry.test.d.ts.map +1 -0
- package/dist/skill-telemetry.test.js +1484 -0
- package/dist/skill-telemetry.test.js.map +1 -0
- package/dist/sources/get.test.d.ts +5 -0
- package/dist/sources/get.test.d.ts.map +1 -0
- package/dist/sources/get.test.js +236 -0
- package/dist/sources/get.test.js.map +1 -0
- package/dist/sources/list.test.d.ts +8 -0
- package/dist/sources/list.test.d.ts.map +1 -0
- package/dist/sources/list.test.js +318 -0
- package/dist/sources/list.test.js.map +1 -0
- package/dist/sts-credential-refresh.test.d.ts +2 -0
- package/dist/sts-credential-refresh.test.d.ts.map +1 -0
- package/dist/sts-credential-refresh.test.js +181 -0
- package/dist/sts-credential-refresh.test.js.map +1 -0
- package/dist/swallowed-error-sites.test.d.ts +2 -0
- package/dist/swallowed-error-sites.test.d.ts.map +1 -0
- package/dist/swallowed-error-sites.test.js +209 -0
- package/dist/swallowed-error-sites.test.js.map +1 -0
- package/dist/swallowed-error-w32.test.d.ts +2 -0
- package/dist/swallowed-error-w32.test.d.ts.map +1 -0
- package/dist/swallowed-error-w32.test.js +186 -0
- package/dist/swallowed-error-w32.test.js.map +1 -0
- package/dist/swallowed-error-w33.test.d.ts +2 -0
- package/dist/swallowed-error-w33.test.d.ts.map +1 -0
- package/dist/swallowed-error-w33.test.js +136 -0
- package/dist/swallowed-error-w33.test.js.map +1 -0
- package/dist/swallowed-error-w34.test.d.ts +2 -0
- package/dist/swallowed-error-w34.test.d.ts.map +1 -0
- package/dist/swallowed-error-w34.test.js +110 -0
- package/dist/swallowed-error-w34.test.js.map +1 -0
- package/dist/swallowed-error-w35.test.d.ts +2 -0
- package/dist/swallowed-error-w35.test.d.ts.map +1 -0
- package/dist/swallowed-error-w35.test.js +237 -0
- package/dist/swallowed-error-w35.test.js.map +1 -0
- package/dist/sync/area-ledger-auto-migration.test.d.ts +2 -0
- package/dist/sync/area-ledger-auto-migration.test.d.ts.map +1 -0
- package/dist/sync/area-ledger-auto-migration.test.js +291 -0
- package/dist/sync/area-ledger-auto-migration.test.js.map +1 -0
- package/dist/sync/area-ledger-migration.test.d.ts +2 -0
- package/dist/sync/area-ledger-migration.test.d.ts.map +1 -0
- package/dist/sync/area-ledger-migration.test.js +554 -0
- package/dist/sync/area-ledger-migration.test.js.map +1 -0
- package/dist/sync/area-ledger-recovery.bench.test.d.ts +2 -0
- package/dist/sync/area-ledger-recovery.bench.test.d.ts.map +1 -0
- package/dist/sync/area-ledger-recovery.bench.test.js +60 -0
- package/dist/sync/area-ledger-recovery.bench.test.js.map +1 -0
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts +2 -0
- package/dist/sync/area-ledger-writer-lock.bench.test.d.ts.map +1 -0
- package/dist/sync/area-ledger-writer-lock.bench.test.js +57 -0
- package/dist/sync/area-ledger-writer-lock.bench.test.js.map +1 -0
- package/dist/sync/area-ledger.test.d.ts +2 -0
- package/dist/sync/area-ledger.test.d.ts.map +1 -0
- package/dist/sync/area-ledger.test.js +1401 -0
- package/dist/sync/area-ledger.test.js.map +1 -0
- package/dist/sync/area-resolver.test.d.ts +2 -0
- package/dist/sync/area-resolver.test.d.ts.map +1 -0
- package/dist/sync/area-resolver.test.js +234 -0
- package/dist/sync/area-resolver.test.js.map +1 -0
- package/dist/sync/base-version-resolver.test.d.ts +2 -0
- package/dist/sync/base-version-resolver.test.d.ts.map +1 -0
- package/dist/sync/base-version-resolver.test.js +24 -0
- package/dist/sync/base-version-resolver.test.js.map +1 -0
- package/dist/sync/candidate-uploader.test.d.ts +2 -0
- package/dist/sync/candidate-uploader.test.d.ts.map +1 -0
- package/dist/sync/candidate-uploader.test.js +132 -0
- package/dist/sync/candidate-uploader.test.js.map +1 -0
- package/dist/sync/child-process-sync-worker-env.test.d.ts +2 -0
- package/dist/sync/child-process-sync-worker-env.test.d.ts.map +1 -0
- package/dist/sync/child-process-sync-worker-env.test.js +38 -0
- package/dist/sync/child-process-sync-worker-env.test.js.map +1 -0
- package/dist/sync/child-process-sync-worker-errors.test.d.ts +2 -0
- package/dist/sync/child-process-sync-worker-errors.test.d.ts.map +1 -0
- package/dist/sync/child-process-sync-worker-errors.test.js +121 -0
- package/dist/sync/child-process-sync-worker-errors.test.js.map +1 -0
- package/dist/sync/child-process-sync-worker.test.d.ts +2 -0
- package/dist/sync/child-process-sync-worker.test.d.ts.map +1 -0
- package/dist/sync/child-process-sync-worker.test.js +279 -0
- package/dist/sync/child-process-sync-worker.test.js.map +1 -0
- package/dist/sync/content-hash.test.d.ts +2 -0
- package/dist/sync/content-hash.test.d.ts.map +1 -0
- package/dist/sync/content-hash.test.js +16 -0
- package/dist/sync/content-hash.test.js.map +1 -0
- package/dist/sync/delta-client.test.d.ts +2 -0
- package/dist/sync/delta-client.test.d.ts.map +1 -0
- package/dist/sync/delta-client.test.js +97 -0
- package/dist/sync/delta-client.test.js.map +1 -0
- package/dist/sync/durable-apply.test.d.ts +2 -0
- package/dist/sync/durable-apply.test.d.ts.map +1 -0
- package/dist/sync/durable-apply.test.js +187 -0
- package/dist/sync/durable-apply.test.js.map +1 -0
- package/dist/sync/event-sync.test.d.ts +14 -0
- package/dist/sync/event-sync.test.d.ts.map +1 -0
- package/dist/sync/event-sync.test.js +1717 -0
- package/dist/sync/event-sync.test.js.map +1 -0
- package/dist/sync/feature-flags.test.d.ts +24 -0
- package/dist/sync/feature-flags.test.d.ts.map +1 -0
- package/dist/sync/feature-flags.test.js +594 -0
- package/dist/sync/feature-flags.test.js.map +1 -0
- package/dist/sync/fsync-compat.test.d.ts +2 -0
- package/dist/sync/fsync-compat.test.d.ts.map +1 -0
- package/dist/sync/fsync-compat.test.js +52 -0
- package/dist/sync/fsync-compat.test.js.map +1 -0
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts +2 -0
- package/dist/sync/full-pass-cap-governor.bench.test.d.ts.map +1 -0
- package/dist/sync/full-pass-cap-governor.bench.test.js +179 -0
- package/dist/sync/full-pass-cap-governor.bench.test.js.map +1 -0
- package/dist/sync/full-pass-caps.test.d.ts +2 -0
- package/dist/sync/full-pass-caps.test.d.ts.map +1 -0
- package/dist/sync/full-pass-caps.test.js +550 -0
- package/dist/sync/full-pass-caps.test.js.map +1 -0
- package/dist/sync/idle-full-reconcile.test.d.ts +2 -0
- package/dist/sync/idle-full-reconcile.test.d.ts.map +1 -0
- package/dist/sync/idle-full-reconcile.test.js +62 -0
- package/dist/sync/idle-full-reconcile.test.js.map +1 -0
- package/dist/sync/inbound-event-admission.test.d.ts +2 -0
- package/dist/sync/inbound-event-admission.test.d.ts.map +1 -0
- package/dist/sync/inbound-event-admission.test.js +128 -0
- package/dist/sync/inbound-event-admission.test.js.map +1 -0
- package/dist/sync/journal-ledger-stream.test.d.ts +12 -0
- package/dist/sync/journal-ledger-stream.test.d.ts.map +1 -0
- package/dist/sync/journal-ledger-stream.test.js +134 -0
- package/dist/sync/journal-ledger-stream.test.js.map +1 -0
- package/dist/sync/lease-client.test.d.ts +2 -0
- package/dist/sync/lease-client.test.d.ts.map +1 -0
- package/dist/sync/lease-client.test.js +119 -0
- package/dist/sync/lease-client.test.js.map +1 -0
- package/dist/sync/logger.test.d.ts +19 -0
- package/dist/sync/logger.test.d.ts.map +1 -0
- package/dist/sync/logger.test.js +204 -0
- package/dist/sync/logger.test.js.map +1 -0
- package/dist/sync/metrics.test.d.ts +19 -0
- package/dist/sync/metrics.test.d.ts.map +1 -0
- package/dist/sync/metrics.test.js +357 -0
- package/dist/sync/metrics.test.js.map +1 -0
- package/dist/sync/multipart-uploader.test.d.ts +2 -0
- package/dist/sync/multipart-uploader.test.d.ts.map +1 -0
- package/dist/sync/multipart-uploader.test.js +141 -0
- package/dist/sync/multipart-uploader.test.js.map +1 -0
- package/dist/sync/mutation-client.test.d.ts +2 -0
- package/dist/sync/mutation-client.test.d.ts.map +1 -0
- package/dist/sync/mutation-client.test.js +100 -0
- package/dist/sync/mutation-client.test.js.map +1 -0
- package/dist/sync/mutation-session.test.d.ts +2 -0
- package/dist/sync/mutation-session.test.d.ts.map +1 -0
- package/dist/sync/mutation-session.test.js +190 -0
- package/dist/sync/mutation-session.test.js.map +1 -0
- package/dist/sync/parallel-sync-coordinator.test.d.ts +2 -0
- package/dist/sync/parallel-sync-coordinator.test.d.ts.map +1 -0
- package/dist/sync/parallel-sync-coordinator.test.js +564 -0
- package/dist/sync/parallel-sync-coordinator.test.js.map +1 -0
- package/dist/sync/path-leases.test.d.ts +2 -0
- package/dist/sync/path-leases.test.d.ts.map +1 -0
- package/dist/sync/path-leases.test.js +51 -0
- package/dist/sync/path-leases.test.js.map +1 -0
- package/dist/sync/per-area-maintenance.test.d.ts +2 -0
- package/dist/sync/per-area-maintenance.test.d.ts.map +1 -0
- package/dist/sync/per-area-maintenance.test.js +100 -0
- package/dist/sync/per-area-maintenance.test.js.map +1 -0
- package/dist/sync/push-event.test.d.ts +15 -0
- package/dist/sync/push-event.test.d.ts.map +1 -0
- package/dist/sync/push-event.test.js +282 -0
- package/dist/sync/push-event.test.js.map +1 -0
- package/dist/sync/push-receiver.test.d.ts +25 -0
- package/dist/sync/push-receiver.test.d.ts.map +1 -0
- package/dist/sync/push-receiver.test.js +2851 -0
- package/dist/sync/push-receiver.test.js.map +1 -0
- package/dist/sync/push-transport.test.d.ts +2 -0
- package/dist/sync/push-transport.test.d.ts.map +1 -0
- package/dist/sync/push-transport.test.js +70 -0
- package/dist/sync/push-transport.test.js.map +1 -0
- package/dist/sync/push-walk-matchers.bench.test.d.ts +2 -0
- package/dist/sync/push-walk-matchers.bench.test.d.ts.map +1 -0
- package/dist/sync/push-walk-matchers.bench.test.js +230 -0
- package/dist/sync/push-walk-matchers.bench.test.js.map +1 -0
- package/dist/sync/realtime-network-integration.test.d.ts +2 -0
- package/dist/sync/realtime-network-integration.test.d.ts.map +1 -0
- package/dist/sync/realtime-network-integration.test.js +83 -0
- package/dist/sync/realtime-network-integration.test.js.map +1 -0
- package/dist/sync/realtime-rollout.test.d.ts +2 -0
- package/dist/sync/realtime-rollout.test.d.ts.map +1 -0
- package/dist/sync/realtime-rollout.test.js +94 -0
- package/dist/sync/realtime-rollout.test.js.map +1 -0
- package/dist/sync/realtime-telemetry.test.d.ts +2 -0
- package/dist/sync/realtime-telemetry.test.d.ts.map +1 -0
- package/dist/sync/realtime-telemetry.test.js +300 -0
- package/dist/sync/realtime-telemetry.test.js.map +1 -0
- package/dist/sync/receiver-origin-config.test.d.ts +2 -0
- package/dist/sync/receiver-origin-config.test.d.ts.map +1 -0
- package/dist/sync/receiver-origin-config.test.js +39 -0
- package/dist/sync/receiver-origin-config.test.js.map +1 -0
- package/dist/sync/reconcile-cursor.test.d.ts +2 -0
- package/dist/sync/reconcile-cursor.test.d.ts.map +1 -0
- package/dist/sync/reconcile-cursor.test.js +139 -0
- package/dist/sync/reconcile-cursor.test.js.map +1 -0
- package/dist/sync/remote-file-spool.test.d.ts +2 -0
- package/dist/sync/remote-file-spool.test.d.ts.map +1 -0
- package/dist/sync/remote-file-spool.test.js +79 -0
- package/dist/sync/remote-file-spool.test.js.map +1 -0
- package/dist/sync/scope-inventory-client.test.d.ts +2 -0
- package/dist/sync/scope-inventory-client.test.d.ts.map +1 -0
- package/dist/sync/scope-inventory-client.test.js +110 -0
- package/dist/sync/scope-inventory-client.test.js.map +1 -0
- package/dist/sync/secret-path-policy.test.d.ts +2 -0
- package/dist/sync/secret-path-policy.test.d.ts.map +1 -0
- package/dist/sync/secret-path-policy.test.js +183 -0
- package/dist/sync/secret-path-policy.test.js.map +1 -0
- package/dist/sync/snapshot-client.test.d.ts +2 -0
- package/dist/sync/snapshot-client.test.d.ts.map +1 -0
- package/dist/sync/snapshot-client.test.js +169 -0
- package/dist/sync/snapshot-client.test.js.map +1 -0
- package/dist/sync/state-store.test.d.ts +2 -0
- package/dist/sync/state-store.test.d.ts.map +1 -0
- package/dist/sync/state-store.test.js +1556 -0
- package/dist/sync/state-store.test.js.map +1 -0
- package/dist/sync/sync-contract.test.d.ts +2 -0
- package/dist/sync/sync-contract.test.d.ts.map +1 -0
- package/dist/sync/sync-contract.test.js +141 -0
- package/dist/sync/sync-contract.test.js.map +1 -0
- package/dist/sync/targeted-pull-prefixes.test.d.ts +2 -0
- package/dist/sync/targeted-pull-prefixes.test.d.ts.map +1 -0
- package/dist/sync/targeted-pull-prefixes.test.js +33 -0
- package/dist/sync/targeted-pull-prefixes.test.js.map +1 -0
- package/dist/sync/targeted-upsert-exact-list.test.d.ts +2 -0
- package/dist/sync/targeted-upsert-exact-list.test.d.ts.map +1 -0
- package/dist/sync/targeted-upsert-exact-list.test.js +247 -0
- package/dist/sync/targeted-upsert-exact-list.test.js.map +1 -0
- package/dist/sync/unchanged-push-events.test.d.ts +2 -0
- package/dist/sync/unchanged-push-events.test.d.ts.map +1 -0
- package/dist/sync/unchanged-push-events.test.js +76 -0
- package/dist/sync/unchanged-push-events.test.js.map +1 -0
- package/dist/sync/uploader-finalization.test.d.ts +2 -0
- package/dist/sync/uploader-finalization.test.d.ts.map +1 -0
- package/dist/sync/uploader-finalization.test.js +107 -0
- package/dist/sync/uploader-finalization.test.js.map +1 -0
- package/dist/sync-core.test.d.ts +2 -0
- package/dist/sync-core.test.d.ts.map +1 -0
- package/dist/sync-core.test.js +189 -0
- package/dist/sync-core.test.js.map +1 -0
- package/dist/sync-progress.test.d.ts +2 -0
- package/dist/sync-progress.test.d.ts.map +1 -0
- package/dist/sync-progress.test.js +277 -0
- package/dist/sync-progress.test.js.map +1 -0
- package/dist/telemetry-events.test.d.ts +2 -0
- package/dist/telemetry-events.test.d.ts.map +1 -0
- package/dist/telemetry-events.test.js +113 -0
- package/dist/telemetry-events.test.js.map +1 -0
- package/dist/telemetry.test.d.ts +11 -0
- package/dist/telemetry.test.d.ts.map +1 -0
- package/dist/telemetry.test.js +1603 -0
- package/dist/telemetry.test.js.map +1 -0
- package/dist/vault-client.test.d.ts +7 -0
- package/dist/vault-client.test.d.ts.map +1 -0
- package/dist/vault-client.test.js +1334 -0
- package/dist/vault-client.test.js.map +1 -0
- package/dist/watch-coverage.test.d.ts +2 -0
- package/dist/watch-coverage.test.d.ts.map +1 -0
- package/dist/watch-coverage.test.js +56 -0
- package/dist/watch-coverage.test.js.map +1 -0
- package/dist/watch-owner-lease.test.d.ts +2 -0
- package/dist/watch-owner-lease.test.d.ts.map +1 -0
- package/dist/watch-owner-lease.test.js +364 -0
- package/dist/watch-owner-lease.test.js.map +1 -0
- package/dist/watch-parent.test.d.ts +2 -0
- package/dist/watch-parent.test.d.ts.map +1 -0
- package/dist/watch-parent.test.js +131 -0
- package/dist/watch-parent.test.js.map +1 -0
- package/dist/watch-roots.test.d.ts +18 -0
- package/dist/watch-roots.test.d.ts.map +1 -0
- package/dist/watch-roots.test.js +395 -0
- package/dist/watch-roots.test.js.map +1 -0
- package/dist/watcher-continuity-hot-path.test.d.ts +2 -0
- package/dist/watcher-continuity-hot-path.test.d.ts.map +1 -0
- package/dist/watcher-continuity-hot-path.test.js +40 -0
- package/dist/watcher-continuity-hot-path.test.js.map +1 -0
- package/dist/watcher-event-gate.test.d.ts +16 -0
- package/dist/watcher-event-gate.test.d.ts.map +1 -0
- package/dist/watcher-event-gate.test.js +191 -0
- package/dist/watcher-event-gate.test.js.map +1 -0
- package/dist/watcher-replan-sweep.test.d.ts +2 -0
- package/dist/watcher-replan-sweep.test.d.ts.map +1 -0
- package/dist/watcher-replan-sweep.test.js +260 -0
- package/dist/watcher-replan-sweep.test.js.map +1 -0
- package/dist/watcher-stdout.test.d.ts +2 -0
- package/dist/watcher-stdout.test.d.ts.map +1 -0
- package/dist/watcher-stdout.test.js +86 -0
- package/dist/watcher-stdout.test.js.map +1 -0
- package/dist/watcher.test.d.ts +2 -0
- package/dist/watcher.test.d.ts.map +1 -0
- package/dist/watcher.test.js +4329 -0
- package/dist/watcher.test.js.map +1 -0
- package/dist/watcher.warmup-cancel.test.d.ts +2 -0
- package/dist/watcher.warmup-cancel.test.d.ts.map +1 -0
- package/dist/watcher.warmup-cancel.test.js +59 -0
- package/dist/watcher.warmup-cancel.test.js.map +1 -0
- package/dist/watcher.warmup-responsive.test.d.ts +2 -0
- package/dist/watcher.warmup-responsive.test.d.ts.map +1 -0
- package/dist/watcher.warmup-responsive.test.js +62 -0
- package/dist/watcher.warmup-responsive.test.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1227 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as crypto from "node:crypto";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { getJournalPath, journalDeltaForTest, journalRows, listJournals, openJournalStoreSession, openJournalStoreSessionAsync, PERSONAL_VAULT_JOURNAL_SLUG, JournalStore, openJournalStateStoreForMigration, readJournal, readJournalForPass, readJournalScoped, disposeScopedJournalStores, repairJournalState, closeCachedAreaJournalMigration, writeJournal, setJournalSnapshotEncoderForTest, } from "./journal.js";
|
|
7
|
+
import { decodeV3JournalSnapshot } from "./journal-snapshot-decoder.js";
|
|
8
|
+
import { JournalRowStore } from "./journal-row-store.js";
|
|
9
|
+
import { acquireGc, collectGarbage, usedBytes } from "./journal-snapshot-memory-helpers.js";
|
|
10
|
+
import { getStateStoreSnapshotRecoveryCountForTest, resetStateStoreSnapshotRecoveryCountForTest, StateStoreCorruptionError, } from "./sync/state-store.js";
|
|
11
|
+
import { AreaLedgerMigration, areaLayoutManifestPath, readAreaLayoutState, setAreaLedgerMigrationTestHooksForTest } from "./sync/area-ledger-migration.js";
|
|
12
|
+
import { AreaResolver } from "./sync/area-resolver.js";
|
|
13
|
+
let stateDir = "";
|
|
14
|
+
function entry(size = 1) {
|
|
15
|
+
return {
|
|
16
|
+
hash: `${size}`.repeat(64),
|
|
17
|
+
size,
|
|
18
|
+
syncedAt: "2026-08-25T00:00:00.000Z",
|
|
19
|
+
direction: "down",
|
|
20
|
+
remoteEtag: `etag-${size}`,
|
|
21
|
+
kind: "file",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Deterministic PRNG so a failing packed-session sequence can be replayed from its seed. */
|
|
25
|
+
function rng(seed) {
|
|
26
|
+
let state = seed >>> 0;
|
|
27
|
+
return () => {
|
|
28
|
+
state = (state + 0x6d2b79f5) >>> 0;
|
|
29
|
+
let value = state;
|
|
30
|
+
value = Math.imul(value ^ (value >>> 15), value | 1);
|
|
31
|
+
value ^= value + Math.imul(value ^ (value >>> 7), value | 61);
|
|
32
|
+
return ((value ^ (value >>> 14)) >>> 0) / 4_294_967_296;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function packedEntry(index) {
|
|
36
|
+
const entryValue = {
|
|
37
|
+
hash: index.toString(16).padStart(64, "0"),
|
|
38
|
+
size: index * 17.25,
|
|
39
|
+
syncedAt: new Date(1_700_000_000_000 + index).toISOString(),
|
|
40
|
+
direction: index % 2 === 0 ? "up" : "down",
|
|
41
|
+
remoteEtag: index.toString(16).padStart(32, "f"),
|
|
42
|
+
kind: index % 3 === 0 ? "symlink" : "file",
|
|
43
|
+
mtimeMs: 1_700_000_000_000 + index,
|
|
44
|
+
ctimeMs: 1_700_000_100_000 + index,
|
|
45
|
+
};
|
|
46
|
+
if (index % 4 === 0) {
|
|
47
|
+
entryValue.localDeleteIntent = {
|
|
48
|
+
version: 1,
|
|
49
|
+
remoteEtag: "e".repeat(32),
|
|
50
|
+
localHash: (index + 7).toString(16).padStart(64, "0"),
|
|
51
|
+
localKind: "file",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (index % 5 === 0)
|
|
55
|
+
entryValue.localDiverges = true;
|
|
56
|
+
return entryValue;
|
|
57
|
+
}
|
|
58
|
+
function scanReference(rows, prefix) {
|
|
59
|
+
const normalizedPrefix = prefix.replace(/\/+$/, "");
|
|
60
|
+
return [...rows.entries()].filter(([key]) => (normalizedPrefix === "" || key === normalizedPrefix || key.startsWith(`${normalizedPrefix}/`)));
|
|
61
|
+
}
|
|
62
|
+
function journal(files) {
|
|
63
|
+
return { version: "2", lastSync: "initial", files, pulls: [] };
|
|
64
|
+
}
|
|
65
|
+
function generatedSnapshotJournal(seed) {
|
|
66
|
+
const random = rng(seed);
|
|
67
|
+
const files = {};
|
|
68
|
+
for (let index = 0; index < 48; index += 1) {
|
|
69
|
+
const canonicalHash = index % 2 === 0;
|
|
70
|
+
const canonicalEtag = index % 3 !== 0;
|
|
71
|
+
const canonicalSyncedAt = index % 5 !== 0;
|
|
72
|
+
const row = {
|
|
73
|
+
hash: canonicalHash ? `${seed.toString(16)}${index.toString(16)}`.padStart(64, "0") : `short-${seed}-${index}`,
|
|
74
|
+
size: Math.round(random() * 10_000) + index / 10,
|
|
75
|
+
syncedAt: canonicalSyncedAt
|
|
76
|
+
? new Date(1_700_000_000_000 + seed * 1_000 + index).toISOString()
|
|
77
|
+
: `not-an-iso-${seed}-${index}`,
|
|
78
|
+
direction: index % 2 === 0 ? "up" : "down",
|
|
79
|
+
};
|
|
80
|
+
if (index % 2 === 0)
|
|
81
|
+
row.kind = index % 4 === 0 ? "symlink" : "file";
|
|
82
|
+
if (index % 3 === 0)
|
|
83
|
+
row.createdBySub = `author-${seed}-${index}`;
|
|
84
|
+
if (index % 4 === 0)
|
|
85
|
+
row.remoteEtag = canonicalEtag ? `${index}`.padStart(32, "a") : `multipart-${seed}-${index}-7`;
|
|
86
|
+
if (index % 5 === 0)
|
|
87
|
+
row.mtimeMs = 1_700_000_000_000 + index;
|
|
88
|
+
if (index % 6 === 0)
|
|
89
|
+
row.ctimeMs = 1_700_000_100_000 + index;
|
|
90
|
+
if (index % 7 === 0) {
|
|
91
|
+
row.removedAt = new Date(1_700_000_200_000 + index).toISOString();
|
|
92
|
+
row.removedReason = index % 14 === 0 ? "local-delete" : "scope_shrink";
|
|
93
|
+
}
|
|
94
|
+
if (index % 8 === 0) {
|
|
95
|
+
row.localDeleteIntent = {
|
|
96
|
+
version: 1,
|
|
97
|
+
remoteEtag: `${index}`.padStart(32, "b"),
|
|
98
|
+
localHash: `${seed}${index}`.padStart(64, "c"),
|
|
99
|
+
localKind: index % 16 === 0 ? "symlink" : "file",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (index % 9 === 0)
|
|
103
|
+
row.outOfScopeProtected = index % 18 === 0;
|
|
104
|
+
if (index % 10 === 0)
|
|
105
|
+
row.skillMetadataPending = index % 20 === 0;
|
|
106
|
+
if (index % 11 === 0)
|
|
107
|
+
row.localDiverges = index % 22 === 0;
|
|
108
|
+
files[`scope-${seed}/nested-${index % 6}/row-${index}.md`] = row;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
version: "2",
|
|
112
|
+
lastSync: new Date(1_700_001_000_000 + seed).toISOString(),
|
|
113
|
+
files,
|
|
114
|
+
pulls: [{
|
|
115
|
+
pullId: `pull-${seed}`,
|
|
116
|
+
companyUid: `company-${seed}`,
|
|
117
|
+
startedAt: new Date(1_700_001_500_000 + seed).toISOString(),
|
|
118
|
+
completedAt: new Date(1_700_002_000_000 + seed).toISOString(),
|
|
119
|
+
syncMode: "all",
|
|
120
|
+
prefixSet: [`scope-${seed}`],
|
|
121
|
+
scopeChangeDetected: seed % 2 === 0,
|
|
122
|
+
orphansRemoved: seed,
|
|
123
|
+
orphansBlocked: seed + 1,
|
|
124
|
+
}],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function parseSnapshotWithWholePayloadJson(store) {
|
|
128
|
+
const snapshotPath = path.join(store.stateDir, `snapshot-${store.getGeneration()}.bin`);
|
|
129
|
+
const bytes = fs.readFileSync(snapshotPath);
|
|
130
|
+
const payloadLength = bytes.readUInt32BE(16);
|
|
131
|
+
return JSON.parse(bytes.subarray(52, 52 + payloadLength).toString("utf8"));
|
|
132
|
+
}
|
|
133
|
+
function rewriteJournalSnapshotPayload(store, payload) {
|
|
134
|
+
const snapshotPath = path.join(store.stateDir, `snapshot-${store.getGeneration()}.bin`);
|
|
135
|
+
const existing = fs.readFileSync(snapshotPath);
|
|
136
|
+
const header = Buffer.from(existing.subarray(0, 52));
|
|
137
|
+
header.writeUInt32BE(payload.length, 16);
|
|
138
|
+
const checksum = crypto.createHash("sha256").update(header).update(payload).digest();
|
|
139
|
+
fs.writeFileSync(snapshotPath, Buffer.concat([header, payload, checksum]));
|
|
140
|
+
}
|
|
141
|
+
function decodeSnapshotPayload(payload) {
|
|
142
|
+
const bytes = Buffer.from(payload, "utf8");
|
|
143
|
+
return decodeV3JournalSnapshot(Object.assign([bytes], { byteLength: bytes.length }));
|
|
144
|
+
}
|
|
145
|
+
function canonicalJson(value) {
|
|
146
|
+
if (value === null || typeof value === "boolean" || typeof value === "string" || typeof value === "number") {
|
|
147
|
+
return JSON.stringify(value);
|
|
148
|
+
}
|
|
149
|
+
if (Array.isArray(value))
|
|
150
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
151
|
+
const object = value;
|
|
152
|
+
return `{${Object.keys(object).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(object[key])}`).join(",")}}`;
|
|
153
|
+
}
|
|
154
|
+
function writeLayoutState(state, slug) {
|
|
155
|
+
const body = canonicalJson(state);
|
|
156
|
+
const envelope = { checksum: crypto.createHash("sha256").update(body).digest("hex"), state };
|
|
157
|
+
fs.writeFileSync(areaLayoutManifestPath(stateDir, slug), `${canonicalJson(envelope)}\n`);
|
|
158
|
+
}
|
|
159
|
+
function manyAreaLayout(count) {
|
|
160
|
+
return {
|
|
161
|
+
format: 1,
|
|
162
|
+
routerVersion: 1,
|
|
163
|
+
areas: [
|
|
164
|
+
...Array.from({ length: count }, (_, index) => ({ id: `root:area-${index}`, prefixes: [`area-${index}`], paths: [] })),
|
|
165
|
+
{ id: "root:@files", prefixes: [], paths: [], rootFiles: true },
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const areaLayout = {
|
|
170
|
+
format: 1,
|
|
171
|
+
routerVersion: 1,
|
|
172
|
+
areas: [
|
|
173
|
+
{ id: "root:alpha", prefixes: ["alpha"], paths: [] },
|
|
174
|
+
{ id: "root:beta", prefixes: ["beta"], paths: [] },
|
|
175
|
+
{ id: "root:@files", prefixes: [], paths: [], rootFiles: true },
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
beforeEach(() => {
|
|
179
|
+
stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-journal-store-"));
|
|
180
|
+
process.env.HQ_STATE_DIR = stateDir;
|
|
181
|
+
resetStateStoreSnapshotRecoveryCountForTest();
|
|
182
|
+
setAreaLedgerMigrationTestHooksForTest({ now: () => 0 });
|
|
183
|
+
});
|
|
184
|
+
afterEach(() => {
|
|
185
|
+
setAreaLedgerMigrationTestHooksForTest(undefined);
|
|
186
|
+
closeCachedAreaJournalMigration("area-cache");
|
|
187
|
+
disposeScopedJournalStores();
|
|
188
|
+
delete process.env.HQ_STATE_DIR;
|
|
189
|
+
fs.rmSync(stateDir, { recursive: true, force: true });
|
|
190
|
+
});
|
|
191
|
+
describe("JournalStore", () => {
|
|
192
|
+
it.each([
|
|
193
|
+
["a root object trailing comma", '{"lastRecordSequence":0,}'],
|
|
194
|
+
["a nested journal object trailing comma", '{"lastRecordSequence":0,"state":{"journal":{"version":"2",}}}'],
|
|
195
|
+
["a files entry trailing comma", '{"lastRecordSequence":0,"state":{"journal":{"version":"2","files":{"a.md":{"hash":"1111111111111111111111111111111111111111111111111111111111111111","size":1,"syncedAt":"2026-08-25T00:00:00.000Z","direction":"down",}}}}}'],
|
|
196
|
+
["a pulls array trailing comma", '{"lastRecordSequence":0,"state":{"journal":{"version":"2","files":{},"pulls":[{},]}}}'],
|
|
197
|
+
["an uncaptured array trailing comma", '{"lastRecordSequence":0,"metadata":[1,]}'],
|
|
198
|
+
["an empty object comma", "{,}"],
|
|
199
|
+
["an empty array comma", "[,]"],
|
|
200
|
+
])("rejects %s with the same SyntaxError as JSON.parse", (_name, payload) => {
|
|
201
|
+
expect(() => JSON.parse(payload)).toThrow(SyntaxError);
|
|
202
|
+
expect(() => decodeSnapshotPayload(payload)).toThrow(SyntaxError);
|
|
203
|
+
});
|
|
204
|
+
it("accepts empty objects and arrays as property values", () => {
|
|
205
|
+
const emptyObjectPayload = '{"lastRecordSequence":0,"state":{"journal":{"version":"2","files":{},"metadata":{}}}}';
|
|
206
|
+
const emptyArrayPayload = '{"lastRecordSequence":0,"state":{"journal":{"version":"2","files":{},"pulls":[]}}}';
|
|
207
|
+
expect(() => decodeSnapshotPayload(emptyObjectPayload)).not.toThrow();
|
|
208
|
+
expect(JSON.parse(JSON.stringify(decodeSnapshotPayload(emptyArrayPayload)))).toEqual(JSON.parse(emptyArrayPayload));
|
|
209
|
+
});
|
|
210
|
+
it("round-trips a well-formed snapshot through the streaming decoder", () => {
|
|
211
|
+
const expected = {
|
|
212
|
+
lastRecordSequence: 0,
|
|
213
|
+
state: { journal: generatedSnapshotJournal(65) },
|
|
214
|
+
};
|
|
215
|
+
const payload = JSON.stringify(expected);
|
|
216
|
+
expect(JSON.parse(JSON.stringify(decodeSnapshotPayload(payload)))).toEqual(expected);
|
|
217
|
+
});
|
|
218
|
+
it("streams v3 snapshots into packed rows with parity against whole-payload JSON.parse", () => {
|
|
219
|
+
setJournalSnapshotEncoderForTest(null);
|
|
220
|
+
try {
|
|
221
|
+
for (let seed = 1; seed <= 64; seed += 1) {
|
|
222
|
+
const slug = `snapshot-parity-${seed}`;
|
|
223
|
+
writeJournal(slug, generatedSnapshotJournal(seed));
|
|
224
|
+
const writer = openJournalStateStoreForMigration(slug);
|
|
225
|
+
writer.compact();
|
|
226
|
+
const oldPayload = parseSnapshotWithWholePayloadJson(writer);
|
|
227
|
+
const decoded = readJournal(slug);
|
|
228
|
+
expect(JSON.parse(JSON.stringify(decoded)), `seed ${seed}`).toEqual(oldPayload.state.journal);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
setJournalSnapshotEncoderForTest(undefined);
|
|
233
|
+
}
|
|
234
|
+
}, 60_000);
|
|
235
|
+
it.each([
|
|
236
|
+
["invalid JSON", (store) => {
|
|
237
|
+
rewriteJournalSnapshotPayload(store, Buffer.from('{"lastRecordSequence":0,"state":{"journal":{"files":{"a":', "utf8"));
|
|
238
|
+
}],
|
|
239
|
+
["invalid state payload", (store) => {
|
|
240
|
+
rewriteJournalSnapshotPayload(store, Buffer.from('{"lastRecordSequence":0,"state":{"journal":{"files":[]}}}', "utf8"));
|
|
241
|
+
}],
|
|
242
|
+
["torn payload", (store) => {
|
|
243
|
+
fs.truncateSync(path.join(store.stateDir, `snapshot-${store.getGeneration()}.bin`), 53);
|
|
244
|
+
}],
|
|
245
|
+
["bad checksum", (store) => {
|
|
246
|
+
const snapshotPath = path.join(store.stateDir, `snapshot-${store.getGeneration()}.bin`);
|
|
247
|
+
const bytes = fs.readFileSync(snapshotPath);
|
|
248
|
+
bytes[bytes.length - 1] ^= 0xff;
|
|
249
|
+
fs.writeFileSync(snapshotPath, bytes);
|
|
250
|
+
}],
|
|
251
|
+
["scope digest mismatch", (store) => {
|
|
252
|
+
const snapshotPath = path.join(store.stateDir, `snapshot-${store.getGeneration()}.bin`);
|
|
253
|
+
const bytes = fs.readFileSync(snapshotPath);
|
|
254
|
+
bytes[20] ^= 0xff;
|
|
255
|
+
fs.writeFileSync(snapshotPath, bytes);
|
|
256
|
+
}],
|
|
257
|
+
])("keeps streamed v3 %s classified as StateStoreCorruptionError", (_name, corrupt) => {
|
|
258
|
+
const slug = "streamed-snapshot-corruption";
|
|
259
|
+
writeJournal(slug, generatedSnapshotJournal(1));
|
|
260
|
+
const store = openJournalStateStoreForMigration(slug);
|
|
261
|
+
store.compact();
|
|
262
|
+
for (const name of fs.readdirSync(store.stateDir)) {
|
|
263
|
+
if (!/^(snapshot|wal)-\d+\.bin$/.test(name))
|
|
264
|
+
continue;
|
|
265
|
+
if (name === `snapshot-${store.getGeneration()}.bin` || name === `wal-${store.getGeneration()}.bin`)
|
|
266
|
+
continue;
|
|
267
|
+
fs.rmSync(path.join(store.stateDir, name));
|
|
268
|
+
}
|
|
269
|
+
corrupt(store);
|
|
270
|
+
expect(() => readJournal(slug)).toThrow(StateStoreCorruptionError);
|
|
271
|
+
});
|
|
272
|
+
it("routes committed area authority through reverse-shadowed sessions and writers", () => {
|
|
273
|
+
writeJournal("personal-vault", journal({ "alpha/before.md": entry(1) }));
|
|
274
|
+
const migration = new AreaLedgerMigration({
|
|
275
|
+
rootDir: stateDir,
|
|
276
|
+
journalSlug: "personal-vault",
|
|
277
|
+
resolver: new AreaResolver(areaLayout),
|
|
278
|
+
legacyStore: openJournalStateStoreForMigration("personal-vault"),
|
|
279
|
+
});
|
|
280
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
281
|
+
const session = openJournalStoreSession("personal-vault");
|
|
282
|
+
const concurrent = openJournalStoreSession("personal-vault");
|
|
283
|
+
session.applyDelta({ upserts: { "beta/from-session.md": entry(2) } });
|
|
284
|
+
concurrent.applyDelta({ upserts: { "alpha/from-concurrent-session.md": entry(4) } });
|
|
285
|
+
const writer = readJournal("personal-vault");
|
|
286
|
+
writer.files["alpha/from-writer.md"] = entry(3);
|
|
287
|
+
writeJournal("personal-vault", writer);
|
|
288
|
+
expect(readJournal("personal-vault").files).toMatchObject({
|
|
289
|
+
"alpha/before.md": { size: 1 },
|
|
290
|
+
"beta/from-session.md": { size: 2 },
|
|
291
|
+
"alpha/from-writer.md": { size: 3 },
|
|
292
|
+
"alpha/from-concurrent-session.md": { size: 4 },
|
|
293
|
+
});
|
|
294
|
+
// The old shard remains a rollback mirror, not an unobserved divergent copy.
|
|
295
|
+
expect(openJournalStateStoreForMigration("personal-vault").getState().journal.files)
|
|
296
|
+
.toMatchObject({
|
|
297
|
+
"beta/from-session.md": { size: 2 },
|
|
298
|
+
"alpha/from-writer.md": { size: 3 },
|
|
299
|
+
"alpha/from-concurrent-session.md": { size: 4 },
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
it("shares one area bridge across repeated opens and invalidates it on layout, phase, and explicit close", () => {
|
|
303
|
+
const slug = "area-cache";
|
|
304
|
+
const layout = manyAreaLayout(100);
|
|
305
|
+
writeJournal(slug, journal({ "area-0/seed.md": entry(1) }));
|
|
306
|
+
const migration = new AreaLedgerMigration({
|
|
307
|
+
rootDir: stateDir,
|
|
308
|
+
journalSlug: slug,
|
|
309
|
+
resolver: new AreaResolver(layout),
|
|
310
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
311
|
+
});
|
|
312
|
+
expect(migration.cutOver(10_000).phase).toBe("area-authoritative");
|
|
313
|
+
const opened = [];
|
|
314
|
+
setAreaLedgerMigrationTestHooksForTest({ afterOpen: (bridge) => opened.push(bridge) });
|
|
315
|
+
resetStateStoreSnapshotRecoveryCountForTest();
|
|
316
|
+
expect(readJournal(slug).files["area-0/seed.md"]).toMatchObject({ size: 1 });
|
|
317
|
+
expect(openJournalStoreSession(slug).get("area-0/seed.md")).toMatchObject({ size: 1 });
|
|
318
|
+
const recoveriesAfterColdOpen = getStateStoreSnapshotRecoveryCountForTest();
|
|
319
|
+
// The bridge opens the 101 data areas, the always-configured overflow area
|
|
320
|
+
// (UNROUTED_AREA_ID — one per ledger, whether or not anything lands in it),
|
|
321
|
+
// and @meta. It must not also retain a full legacy journal StateStore
|
|
322
|
+
// merely to serve post-cutover reads.
|
|
323
|
+
expect(recoveriesAfterColdOpen).toBe(103);
|
|
324
|
+
expect(readJournal(slug).files["area-0/seed.md"]).toMatchObject({ size: 1 });
|
|
325
|
+
// A warm open does no new snapshot recovery whether the layout is small
|
|
326
|
+
// or contains 100 areas: it reuses the bridge opened above.
|
|
327
|
+
expect(getStateStoreSnapshotRecoveryCountForTest()).toBe(recoveriesAfterColdOpen);
|
|
328
|
+
// One bridge means each of the 101 data areas, the overflow area, and @meta
|
|
329
|
+
// is opened only once, instead of reopening all 103 scopes for every
|
|
330
|
+
// journal call.
|
|
331
|
+
expect(opened).toHaveLength(1);
|
|
332
|
+
expect(opened[0].openedAreaStoresForTest()).toHaveLength(103);
|
|
333
|
+
const first = opened[0];
|
|
334
|
+
const beforeLayoutChange = readAreaLayoutState(stateDir, slug);
|
|
335
|
+
writeLayoutState({ ...beforeLayoutChange, activeLayoutEpoch: "next-layout-epoch" }, slug);
|
|
336
|
+
readJournal(slug);
|
|
337
|
+
expect(opened).toHaveLength(2);
|
|
338
|
+
expect(opened[1]).not.toBe(first);
|
|
339
|
+
closeCachedAreaJournalMigration(slug);
|
|
340
|
+
readJournal(slug);
|
|
341
|
+
expect(opened).toHaveLength(3);
|
|
342
|
+
const beforePhaseChange = readAreaLayoutState(stateDir, slug);
|
|
343
|
+
writeLayoutState({ ...beforePhaseChange, phase: "legacy-authoritative" }, slug);
|
|
344
|
+
expect(readJournal(slug).files["area-0/seed.md"]).toMatchObject({ size: 1 });
|
|
345
|
+
expect(opened).toHaveLength(3);
|
|
346
|
+
writeLayoutState(beforePhaseChange, slug);
|
|
347
|
+
readJournal(slug);
|
|
348
|
+
expect(opened).toHaveLength(4);
|
|
349
|
+
closeCachedAreaJournalMigration(slug);
|
|
350
|
+
}, 60_000);
|
|
351
|
+
it("reads only K detached rows for an area-authoritative scoped pass", () => {
|
|
352
|
+
const slug = "area-scoped-snapshot";
|
|
353
|
+
const files = Object.fromEntries(Array.from({ length: 1_000 }, (_, index) => [`alpha/unselected-${index}.md`, entry(index)]));
|
|
354
|
+
files["alpha/selected.md"] = entry(1_001);
|
|
355
|
+
files["beta/selected.md"] = entry(1_002);
|
|
356
|
+
writeJournal(slug, journal(files));
|
|
357
|
+
const migration = new AreaLedgerMigration({
|
|
358
|
+
rootDir: stateDir,
|
|
359
|
+
journalSlug: slug,
|
|
360
|
+
resolver: new AreaResolver(areaLayout),
|
|
361
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
362
|
+
});
|
|
363
|
+
expect(migration.cutOver(10_000).phase).toBe("area-authoritative");
|
|
364
|
+
const clone = vi.spyOn(globalThis, "structuredClone");
|
|
365
|
+
const scoped = readJournalScoped(slug, ["alpha/selected.md", "beta/selected.md"]);
|
|
366
|
+
// Metadata/recovery bookkeeping has a small fixed cost; cloned row maps
|
|
367
|
+
// and clone calls remain bounded by K, never the 1,000 unrelated rows.
|
|
368
|
+
const selectedKeys = ["alpha/selected.md", "beta/selected.md"];
|
|
369
|
+
expect(clone.mock.calls.length).toBeLessThanOrEqual(4 + 4 * selectedKeys.length);
|
|
370
|
+
for (const [value] of clone.mock.calls) {
|
|
371
|
+
if (typeof value !== "object" || value === null)
|
|
372
|
+
continue;
|
|
373
|
+
const object = value;
|
|
374
|
+
expect(Object.keys(object.files ?? object.journal?.files ?? {}).length)
|
|
375
|
+
.toBeLessThanOrEqual(selectedKeys.length);
|
|
376
|
+
}
|
|
377
|
+
expect(Object.keys(scoped.files).sort()).toEqual([
|
|
378
|
+
"alpha/selected.md",
|
|
379
|
+
"beta/selected.md",
|
|
380
|
+
]);
|
|
381
|
+
scoped.files["alpha/selected.md"] = { ...scoped.files["alpha/selected.md"], size: 99_999 };
|
|
382
|
+
clone.mockRestore();
|
|
383
|
+
// The caller owns the scoped snapshot; mutating it cannot alter ledger
|
|
384
|
+
// state or the next scoped reader.
|
|
385
|
+
expect(readJournalScoped(slug, ["alpha/selected.md"]).files["alpha/selected.md"])
|
|
386
|
+
.toMatchObject({ size: 1_001 });
|
|
387
|
+
closeCachedAreaJournalMigration(slug);
|
|
388
|
+
}, 30_000);
|
|
389
|
+
it("adds descendants of scoped delete roots without opening unrelated areas", () => {
|
|
390
|
+
const slug = "area-scoped-delete-root";
|
|
391
|
+
writeJournal(slug, journal({
|
|
392
|
+
"alpha/deleted/one.md": entry(1),
|
|
393
|
+
"alpha/deleted/nested/two.md": entry(2),
|
|
394
|
+
"alpha/sibling.md": entry(3),
|
|
395
|
+
"beta/untouched.md": entry(4),
|
|
396
|
+
}));
|
|
397
|
+
const migration = new AreaLedgerMigration({
|
|
398
|
+
rootDir: stateDir,
|
|
399
|
+
journalSlug: slug,
|
|
400
|
+
resolver: new AreaResolver(areaLayout),
|
|
401
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
402
|
+
});
|
|
403
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
404
|
+
const opened = [];
|
|
405
|
+
setAreaLedgerMigrationTestHooksForTest({ afterOpen: (bridge) => opened.push(bridge) });
|
|
406
|
+
const scoped = readJournalScoped(slug, [], ["alpha/deleted"]);
|
|
407
|
+
expect(Object.keys(scoped.files).sort()).toEqual([
|
|
408
|
+
"alpha/deleted/nested/two.md",
|
|
409
|
+
"alpha/deleted/one.md",
|
|
410
|
+
]);
|
|
411
|
+
expect(opened).toHaveLength(1);
|
|
412
|
+
expect(opened[0].openedAreaStoresForTest()).toEqual(["@meta", "root:alpha"]);
|
|
413
|
+
closeCachedAreaJournalMigration(slug);
|
|
414
|
+
});
|
|
415
|
+
describe("legacy aggregate store scoped reads", () => {
|
|
416
|
+
// A watch-mode scoped push reads K named rows plus the descendants of its
|
|
417
|
+
// delete roots. On the legacy (pre-area) store this used to walk every
|
|
418
|
+
// aggregate row and test each one against every delete root, and it also
|
|
419
|
+
// re-baselined (deep-cloned) the whole aggregate on the way in. With a
|
|
420
|
+
// 73k-row personal vault and a 10,000-path warm-up catch-up batch that is
|
|
421
|
+
// rows x roots = ~7e8 prefix tests per pass — the runner sat at 60% CPU for
|
|
422
|
+
// an hour after every start on the affected Mac. Both costs must be bounded
|
|
423
|
+
// by K + roots, with a single linear pass over rows only when roots exist.
|
|
424
|
+
it("clones only the named rows and never re-baselines the whole aggregate", () => {
|
|
425
|
+
const slug = "legacy-scoped-keys";
|
|
426
|
+
const files = Object.fromEntries(Array.from({ length: 20_000 }, (_, index) => [`alpha/row-${index}.md`, entry(index)]));
|
|
427
|
+
files["alpha/selected.md"] = entry(20_001);
|
|
428
|
+
files["beta/selected.md"] = entry(20_002);
|
|
429
|
+
writeJournal(slug, journal(files));
|
|
430
|
+
readJournal(slug); // warm, the way a running daemon holds it
|
|
431
|
+
const clone = vi.spyOn(globalThis, "structuredClone");
|
|
432
|
+
const scoped = readJournalScoped(slug, [
|
|
433
|
+
"alpha/selected.md",
|
|
434
|
+
"beta/selected.md",
|
|
435
|
+
"alpha/selected.md",
|
|
436
|
+
"gamma/missing.md",
|
|
437
|
+
]);
|
|
438
|
+
const selectedKeys = ["alpha/selected.md", "beta/selected.md"];
|
|
439
|
+
expect(clone.mock.calls.length).toBeLessThanOrEqual(4 + 2 * selectedKeys.length);
|
|
440
|
+
for (const [value] of clone.mock.calls) {
|
|
441
|
+
if (typeof value !== "object" || value === null)
|
|
442
|
+
continue;
|
|
443
|
+
const object = value;
|
|
444
|
+
expect(Object.keys(object.files ?? object.journal?.files ?? {}).length)
|
|
445
|
+
.toBeLessThanOrEqual(selectedKeys.length);
|
|
446
|
+
}
|
|
447
|
+
clone.mockRestore();
|
|
448
|
+
expect(Object.keys(scoped.files).sort()).toEqual(selectedKeys);
|
|
449
|
+
scoped.files["alpha/selected.md"] = { ...scoped.files["alpha/selected.md"], size: 5 };
|
|
450
|
+
expect(readJournal(slug).files["alpha/selected.md"]).toMatchObject({ size: 20_001 });
|
|
451
|
+
expect(readJournalScoped(slug, ["alpha/selected.md"]).files["alpha/selected.md"])
|
|
452
|
+
.toMatchObject({ size: 20_001 });
|
|
453
|
+
});
|
|
454
|
+
it("isolates the retained scoped projection from uncommitted full-pass rows", () => {
|
|
455
|
+
const slug = "legacy-scoped-full-pass-isolation";
|
|
456
|
+
writeJournal(slug, journal({
|
|
457
|
+
"scope/durable-delete.md": entry(1),
|
|
458
|
+
"scope/scoped-writer.md": entry(2),
|
|
459
|
+
}));
|
|
460
|
+
const fullPass = readJournal(slug);
|
|
461
|
+
fullPass.files["scope/uncommitted-upsert.md"] = entry(3);
|
|
462
|
+
delete fullPass.files["scope/durable-delete.md"];
|
|
463
|
+
const fullPassDelta = journalDeltaForTest(fullPass);
|
|
464
|
+
const scoped = readJournalScoped(slug, [
|
|
465
|
+
"scope/durable-delete.md",
|
|
466
|
+
"scope/uncommitted-upsert.md",
|
|
467
|
+
"scope/scoped-writer.md",
|
|
468
|
+
]);
|
|
469
|
+
// A scoped reader sees only what reached durable storage, never a
|
|
470
|
+
// full-pass writer's private, uncommitted overlay.
|
|
471
|
+
expect(scoped.files["scope/durable-delete.md"]).toMatchObject({ size: 1 });
|
|
472
|
+
expect(scoped.files["scope/uncommitted-upsert.md"]).toBeUndefined();
|
|
473
|
+
scoped.files["scope/scoped-writer.md"] = entry(4);
|
|
474
|
+
writeJournal(slug, scoped);
|
|
475
|
+
// A cached scoped commit must not alter either the live full pass's rows
|
|
476
|
+
// or the dirty log that describes its still-uncommitted mutation.
|
|
477
|
+
expect(fullPass.files["scope/uncommitted-upsert.md"]).toMatchObject({ size: 3 });
|
|
478
|
+
expect(fullPass.files["scope/durable-delete.md"]).toBeUndefined();
|
|
479
|
+
expect(fullPass.files["scope/scoped-writer.md"]).toMatchObject({ size: 2 });
|
|
480
|
+
expect(journalDeltaForTest(fullPass)).toEqual(fullPassDelta);
|
|
481
|
+
});
|
|
482
|
+
it("keeps the personal scoped projection hot across a multi-locator warm-up", () => {
|
|
483
|
+
const personalKey = "personal/warm-target.md";
|
|
484
|
+
const warmupSlugs = [
|
|
485
|
+
PERSONAL_VAULT_JOURNAL_SLUG,
|
|
486
|
+
"personal",
|
|
487
|
+
"indigo",
|
|
488
|
+
"companyx",
|
|
489
|
+
"companyy",
|
|
490
|
+
"companyz",
|
|
491
|
+
];
|
|
492
|
+
for (const slug of warmupSlugs) {
|
|
493
|
+
writeJournal(slug, journal({
|
|
494
|
+
[slug === PERSONAL_VAULT_JOURNAL_SLUG ? personalKey : `${slug}/seed.md`]: entry(1),
|
|
495
|
+
}));
|
|
496
|
+
}
|
|
497
|
+
// The preceding full pass has already paid for the personal projection.
|
|
498
|
+
readJournal(PERSONAL_VAULT_JOURNAL_SLUG);
|
|
499
|
+
listJournals(); // The watcher warm-up enumerates every locator.
|
|
500
|
+
resetStateStoreSnapshotRecoveryCountForTest();
|
|
501
|
+
const scoped = readJournalScoped(PERSONAL_VAULT_JOURNAL_SLUG, [personalKey]);
|
|
502
|
+
scoped.files[personalKey] = entry(2);
|
|
503
|
+
writeJournal(PERSONAL_VAULT_JOURNAL_SLUG, scoped);
|
|
504
|
+
expect(getStateStoreSnapshotRecoveryCountForTest()).toBe(0);
|
|
505
|
+
expect(readJournalScoped(PERSONAL_VAULT_JOURNAL_SLUG, [personalKey]).files[personalKey])
|
|
506
|
+
.toMatchObject({ size: 2 });
|
|
507
|
+
});
|
|
508
|
+
it("releases a retained legacy projection after its slug becomes area-authoritative", () => {
|
|
509
|
+
const slug = "legacy-projection-area-cutover";
|
|
510
|
+
writeJournal(slug, journal({ "alpha/seed.md": entry(1) }));
|
|
511
|
+
readJournal(slug); // Retain the legacy keyed projection.
|
|
512
|
+
const dispose = vi.spyOn(JournalStore.prototype, "dispose");
|
|
513
|
+
try {
|
|
514
|
+
const migration = new AreaLedgerMigration({
|
|
515
|
+
rootDir: stateDir,
|
|
516
|
+
journalSlug: slug,
|
|
517
|
+
resolver: new AreaResolver(areaLayout),
|
|
518
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
519
|
+
});
|
|
520
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
521
|
+
// Entering the authoritative read path releases the now-stale v3
|
|
522
|
+
// projection instead of retaining it alongside area storage.
|
|
523
|
+
expect(readJournal(slug).files["alpha/seed.md"]).toMatchObject({ size: 1 });
|
|
524
|
+
expect(dispose).toHaveBeenCalledTimes(1);
|
|
525
|
+
}
|
|
526
|
+
finally {
|
|
527
|
+
dispose.mockRestore();
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
it("persists lastSync and pulls through a cached scoped write after reopen", () => {
|
|
531
|
+
const slug = "legacy-scoped-metadata";
|
|
532
|
+
const key = "scope/selected.md";
|
|
533
|
+
writeJournal(slug, journal({ [key]: entry(1) }));
|
|
534
|
+
readJournal(slug); // Establish the cached delta writer.
|
|
535
|
+
const scoped = readJournalScoped(slug, [key]);
|
|
536
|
+
const expected = generatedSnapshotJournal(97);
|
|
537
|
+
scoped.files[key] = entry(2);
|
|
538
|
+
scoped.lastSync = expected.lastSync;
|
|
539
|
+
scoped.pulls = expected.pulls;
|
|
540
|
+
writeJournal(slug, scoped);
|
|
541
|
+
disposeScopedJournalStores();
|
|
542
|
+
const reopened = readJournal(slug);
|
|
543
|
+
expect(reopened.files[key]).toMatchObject({ size: 2 });
|
|
544
|
+
expect(reopened.lastSync).toBe(expected.lastSync);
|
|
545
|
+
expect(reopened.pulls).toEqual(expected.pulls);
|
|
546
|
+
});
|
|
547
|
+
it("matches delete roots by ancestor lookup instead of testing every row against every root", () => {
|
|
548
|
+
const slug = "legacy-scoped-roots";
|
|
549
|
+
const files = Object.fromEntries(Array.from({ length: 5_000 }, (_, index) => [`alpha/keep-${index}.md`, entry(index)]));
|
|
550
|
+
files["alpha/deleted"] = entry(1);
|
|
551
|
+
files["alpha/deleted/one.md"] = entry(2);
|
|
552
|
+
files["alpha/deleted/nested/two.md"] = entry(3);
|
|
553
|
+
files["alpha/deleted-sibling.md"] = entry(4); // shares the prefix, not the directory
|
|
554
|
+
files["beta/gone/file.md"] = entry(5); // a file named directly as a delete root
|
|
555
|
+
files["beta/gone/file.md.bak"] = entry(6);
|
|
556
|
+
writeJournal(slug, journal(files));
|
|
557
|
+
readJournal(slug);
|
|
558
|
+
const roots = [
|
|
559
|
+
"alpha/deleted",
|
|
560
|
+
"beta/gone/file.md",
|
|
561
|
+
...Array.from({ length: 1_998 }, (_, index) => `zeta/never-${index}`),
|
|
562
|
+
];
|
|
563
|
+
let rootReads = 0;
|
|
564
|
+
const observedRoots = new Proxy(roots, {
|
|
565
|
+
get(target, property, receiver) {
|
|
566
|
+
rootReads += 1;
|
|
567
|
+
return Reflect.get(target, property, receiver);
|
|
568
|
+
},
|
|
569
|
+
});
|
|
570
|
+
const scoped = readJournalScoped(slug, ["alpha/keep-1.md"], observedRoots);
|
|
571
|
+
expect(Object.keys(scoped.files).sort()).toEqual([
|
|
572
|
+
"alpha/deleted",
|
|
573
|
+
"alpha/deleted/nested/two.md",
|
|
574
|
+
"alpha/deleted/one.md",
|
|
575
|
+
"alpha/keep-1.md",
|
|
576
|
+
"beta/gone/file.md",
|
|
577
|
+
]);
|
|
578
|
+
// Old shape: 5,006 rows x 2,000 roots = ~1e7 reads. Reading the root list
|
|
579
|
+
// a handful of times over is fine; reading it once per row is not.
|
|
580
|
+
expect(rootReads).toBeLessThan(roots.length * 8);
|
|
581
|
+
});
|
|
582
|
+
it("still treats the empty delete root as the whole aggregate", () => {
|
|
583
|
+
const slug = "legacy-scoped-all";
|
|
584
|
+
writeJournal(slug, journal({
|
|
585
|
+
"alpha/one.md": entry(1),
|
|
586
|
+
"beta/two.md": entry(2),
|
|
587
|
+
}));
|
|
588
|
+
const scoped = readJournalScoped(slug, [], ["", "alpha"]);
|
|
589
|
+
expect(Object.keys(scoped.files).sort()).toEqual(["alpha/one.md", "beta/two.md"]);
|
|
590
|
+
scoped.files["beta/two.md"] = { ...scoped.files["beta/two.md"], size: 9 };
|
|
591
|
+
expect(readJournal(slug).files["beta/two.md"]).toMatchObject({ size: 2 });
|
|
592
|
+
});
|
|
593
|
+
it("refreshes a retained scoped store after an external append and preserves rows outside its baseline", () => {
|
|
594
|
+
const slug = "legacy-scoped-external-writer";
|
|
595
|
+
writeJournal(slug, journal({
|
|
596
|
+
"scope/selected.md": entry(1),
|
|
597
|
+
"scope/external-delete.md": entry(2),
|
|
598
|
+
"scope/outside-baseline.md": entry(3),
|
|
599
|
+
}));
|
|
600
|
+
readJournal(slug); // Retain the runner projection before another process writes.
|
|
601
|
+
// This writer owns a separate in-memory projection, as another hq
|
|
602
|
+
// process would. It publishes an upsert and a delete while the retained
|
|
603
|
+
// runner projection is idle.
|
|
604
|
+
const external = openJournalStoreSession(slug);
|
|
605
|
+
external.applyDelta({
|
|
606
|
+
upserts: { "scope/from-external.md": entry(4) },
|
|
607
|
+
deletes: ["scope/external-delete.md"],
|
|
608
|
+
});
|
|
609
|
+
const scoped = readJournalScoped(slug, [
|
|
610
|
+
"scope/selected.md",
|
|
611
|
+
"scope/external-delete.md",
|
|
612
|
+
"scope/from-external.md",
|
|
613
|
+
]);
|
|
614
|
+
expect(scoped.files["scope/from-external.md"]).toMatchObject({ size: 4 });
|
|
615
|
+
expect(scoped.files["scope/external-delete.md"]).toBeUndefined();
|
|
616
|
+
scoped.files["scope/selected.md"] = entry(5);
|
|
617
|
+
// A targeted baseline only owns its named rows. Its delta must never
|
|
618
|
+
// turn the omitted row into a delete merely because the scoped caller
|
|
619
|
+
// did not receive it.
|
|
620
|
+
expect(journalDeltaForTest(scoped).deletes).toEqual([]);
|
|
621
|
+
writeJournal(slug, scoped);
|
|
622
|
+
const reopened = openJournalStoreSession(slug);
|
|
623
|
+
expect(reopened.get("scope/selected.md")).toMatchObject({ size: 5 });
|
|
624
|
+
expect(reopened.get("scope/from-external.md")).toMatchObject({ size: 4 });
|
|
625
|
+
expect(reopened.get("scope/external-delete.md")).toBeUndefined();
|
|
626
|
+
expect(reopened.get("scope/outside-baseline.md")).toMatchObject({ size: 3 });
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
it("keeps a warm area-authoritative observer fresh after an independent writer commits", () => {
|
|
630
|
+
const slug = "area-writer-freshness";
|
|
631
|
+
writeJournal(slug, journal({ "alpha/before.md": entry(1) }));
|
|
632
|
+
const migration = new AreaLedgerMigration({
|
|
633
|
+
rootDir: stateDir,
|
|
634
|
+
journalSlug: slug,
|
|
635
|
+
resolver: new AreaResolver(areaLayout),
|
|
636
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
637
|
+
});
|
|
638
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
639
|
+
const observer = openJournalStoreSession(slug);
|
|
640
|
+
expect(observer.get("alpha/before.md")).toMatchObject({ size: 1 });
|
|
641
|
+
// Constructing the writer directly ensures it owns a separate in-memory
|
|
642
|
+
// AreaLedger from the bridge cached by the observing JournalStore.
|
|
643
|
+
const independentWriter = new AreaLedgerMigration({
|
|
644
|
+
rootDir: stateDir,
|
|
645
|
+
journalSlug: slug,
|
|
646
|
+
resolver: new AreaResolver(areaLayout),
|
|
647
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
648
|
+
});
|
|
649
|
+
independentWriter.reverseShadow({
|
|
650
|
+
upserts: { "beta/from-independent-writer.md": entry(2) },
|
|
651
|
+
deletes: [],
|
|
652
|
+
});
|
|
653
|
+
observer.refresh();
|
|
654
|
+
expect(observer.get("beta/from-independent-writer.md")).toMatchObject({ size: 2 });
|
|
655
|
+
expect(readJournal(slug).files["beta/from-independent-writer.md"]).toMatchObject({ size: 2 });
|
|
656
|
+
closeCachedAreaJournalMigration(slug);
|
|
657
|
+
});
|
|
658
|
+
// openJournalStoreSessionAsync is the open a watcher's filesystem callback
|
|
659
|
+
// may start. The callback returns as soon as the call does, so nothing the
|
|
660
|
+
// open reads — the area layout, the aggregate of every area ledger, a
|
|
661
|
+
// legacy journal to seed from — may happen before the first yield. A write
|
|
662
|
+
// committed right after the call, before the caller yields, proves the
|
|
663
|
+
// order: only an open that has not read anything yet can see it.
|
|
664
|
+
it("openJournalStoreSessionAsync yields before it reads an authoritative area ledger", async () => {
|
|
665
|
+
const slug = "area-async-open-yields";
|
|
666
|
+
writeJournal(slug, journal({ "alpha/before.md": entry(1) }));
|
|
667
|
+
const migration = new AreaLedgerMigration({
|
|
668
|
+
rootDir: stateDir,
|
|
669
|
+
journalSlug: slug,
|
|
670
|
+
resolver: new AreaResolver(areaLayout),
|
|
671
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
672
|
+
});
|
|
673
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
674
|
+
const opening = openJournalStoreSessionAsync(slug);
|
|
675
|
+
const independentWriter = new AreaLedgerMigration({
|
|
676
|
+
rootDir: stateDir,
|
|
677
|
+
journalSlug: slug,
|
|
678
|
+
resolver: new AreaResolver(areaLayout),
|
|
679
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
680
|
+
});
|
|
681
|
+
independentWriter.reverseShadow({
|
|
682
|
+
upserts: { "beta/committed-after-the-call.md": entry(2) },
|
|
683
|
+
deletes: [],
|
|
684
|
+
});
|
|
685
|
+
const session = await opening;
|
|
686
|
+
expect(session.get("alpha/before.md")).toMatchObject({ size: 1 });
|
|
687
|
+
expect(session.get("beta/committed-after-the-call.md")).toMatchObject({ size: 2 });
|
|
688
|
+
session.dispose();
|
|
689
|
+
closeCachedAreaJournalMigration(slug);
|
|
690
|
+
});
|
|
691
|
+
it("openJournalStoreSessionAsync yields before it seeds from a legacy journal file", async () => {
|
|
692
|
+
const slug = "legacy-async-open-yields";
|
|
693
|
+
const legacyPath = getJournalPath(slug);
|
|
694
|
+
fs.mkdirSync(path.dirname(legacyPath), { recursive: true });
|
|
695
|
+
fs.writeFileSync(legacyPath, JSON.stringify(journal({ "alpha/before.md": entry(1) })));
|
|
696
|
+
const opening = openJournalStoreSessionAsync(slug);
|
|
697
|
+
fs.writeFileSync(legacyPath, JSON.stringify(journal({
|
|
698
|
+
"alpha/before.md": entry(1),
|
|
699
|
+
"beta/written-after-the-call.md": entry(2),
|
|
700
|
+
})));
|
|
701
|
+
const session = await opening;
|
|
702
|
+
expect(session.get("beta/written-after-the-call.md")).toMatchObject({ size: 2 });
|
|
703
|
+
session.dispose();
|
|
704
|
+
});
|
|
705
|
+
it("does not rebuild a warm area-authoritative keyed projection when the aggregate is unchanged", () => {
|
|
706
|
+
const slug = "area-warm-refresh";
|
|
707
|
+
const files = Object.fromEntries(Array.from({ length: 1_000 }, (_, index) => [`alpha/${index}.md`, entry(index)]));
|
|
708
|
+
writeJournal(slug, journal(files));
|
|
709
|
+
const migration = new AreaLedgerMigration({
|
|
710
|
+
rootDir: stateDir,
|
|
711
|
+
journalSlug: slug,
|
|
712
|
+
resolver: new AreaResolver(areaLayout),
|
|
713
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
714
|
+
});
|
|
715
|
+
expect(migration.cutOver(10_000).phase).toBe("area-authoritative");
|
|
716
|
+
const session = openJournalStoreSession(slug);
|
|
717
|
+
const replace = vi.spyOn(session, "replaceFromJournal");
|
|
718
|
+
const clone = vi.spyOn(globalThis, "structuredClone");
|
|
719
|
+
session.refresh();
|
|
720
|
+
expect(replace).not.toHaveBeenCalled();
|
|
721
|
+
expect(clone).not.toHaveBeenCalled();
|
|
722
|
+
clone.mockRestore();
|
|
723
|
+
replace.mockRestore();
|
|
724
|
+
}, 30_000);
|
|
725
|
+
it("does not rebuild its keyed projection after its own area-authoritative delta", () => {
|
|
726
|
+
const slug = "area-local-write-refresh";
|
|
727
|
+
writeJournal(slug, journal({ "alpha/seed.md": entry(1) }));
|
|
728
|
+
const migration = new AreaLedgerMigration({
|
|
729
|
+
rootDir: stateDir,
|
|
730
|
+
journalSlug: slug,
|
|
731
|
+
resolver: new AreaResolver(areaLayout),
|
|
732
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
733
|
+
});
|
|
734
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
735
|
+
const session = openJournalStoreSession(slug);
|
|
736
|
+
session.applyDelta({ upserts: { "beta/local.md": entry(2) } });
|
|
737
|
+
const replace = vi.spyOn(session, "replaceFromJournal");
|
|
738
|
+
const clone = vi.spyOn(globalThis, "structuredClone");
|
|
739
|
+
session.refresh();
|
|
740
|
+
expect(replace).not.toHaveBeenCalled();
|
|
741
|
+
expect(clone).not.toHaveBeenCalled();
|
|
742
|
+
clone.mockRestore();
|
|
743
|
+
replace.mockRestore();
|
|
744
|
+
expect(session.get("beta/local.md")).toMatchObject({ size: 2 });
|
|
745
|
+
closeCachedAreaJournalMigration(slug);
|
|
746
|
+
});
|
|
747
|
+
it("refreshes an area-backed session after a local delta and independent append", () => {
|
|
748
|
+
const slug = "area-local-then-independent-refresh";
|
|
749
|
+
writeJournal(slug, journal({ "alpha/seed.md": entry(1) }));
|
|
750
|
+
const migration = new AreaLedgerMigration({
|
|
751
|
+
rootDir: stateDir,
|
|
752
|
+
journalSlug: slug,
|
|
753
|
+
resolver: new AreaResolver(areaLayout),
|
|
754
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
755
|
+
});
|
|
756
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
757
|
+
const session = openJournalStoreSession(slug);
|
|
758
|
+
session.applyDelta({ upserts: { "beta/local.md": entry(2) } });
|
|
759
|
+
const independentWriter = new AreaLedgerMigration({
|
|
760
|
+
rootDir: stateDir,
|
|
761
|
+
journalSlug: slug,
|
|
762
|
+
resolver: new AreaResolver(areaLayout),
|
|
763
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
764
|
+
});
|
|
765
|
+
independentWriter.reverseShadow({ upserts: { "alpha/from-independent-writer.md": entry(3) } });
|
|
766
|
+
session.refresh();
|
|
767
|
+
expect(session.get("beta/local.md")).toMatchObject({ size: 2 });
|
|
768
|
+
expect(session.get("alpha/from-independent-writer.md")).toMatchObject({ size: 3 });
|
|
769
|
+
closeCachedAreaJournalMigration(slug);
|
|
770
|
+
});
|
|
771
|
+
it("uses one cold recovery for a 40-unlink keyed fixture, then only keyed deltas", () => {
|
|
772
|
+
const files = Object.fromEntries(Array.from({ length: 40 }, (_, index) => [`knowledge/${index}.md`, entry(index + 1)]));
|
|
773
|
+
writeJournal("acme", journal(files));
|
|
774
|
+
resetStateStoreSnapshotRecoveryCountForTest();
|
|
775
|
+
const session = openJournalStoreSession("acme");
|
|
776
|
+
expect(getStateStoreSnapshotRecoveryCountForTest()).toBe(1);
|
|
777
|
+
for (let index = 0; index < 40; index++) {
|
|
778
|
+
session.refresh();
|
|
779
|
+
const key = `knowledge/${index}.md`;
|
|
780
|
+
const prior = session.get(key);
|
|
781
|
+
expect(prior).toBeDefined();
|
|
782
|
+
session.applyDelta({ upserts: { [key]: { ...prior, localDeleteIntent: {
|
|
783
|
+
version: 1,
|
|
784
|
+
remoteEtag: prior.remoteEtag,
|
|
785
|
+
localHash: prior.hash,
|
|
786
|
+
localKind: "file",
|
|
787
|
+
} } } });
|
|
788
|
+
}
|
|
789
|
+
expect(getStateStoreSnapshotRecoveryCountForTest()).toBe(1);
|
|
790
|
+
expect(Object.values(readJournal("acme").files).every((row) => row.localDeleteIntent)).toBe(true);
|
|
791
|
+
});
|
|
792
|
+
it("interoperates with the existing writeJournal push/pull writer in both directions", () => {
|
|
793
|
+
writeJournal("acme", journal({ "a.md": entry(1) }));
|
|
794
|
+
const session = openJournalStoreSession("acme");
|
|
795
|
+
const pushWriter = readJournal("acme");
|
|
796
|
+
pushWriter.files["from-push.md"] = entry(2);
|
|
797
|
+
writeJournal("acme", pushWriter);
|
|
798
|
+
session.refresh();
|
|
799
|
+
expect(session.get("from-push.md")).toMatchObject({ size: 2 });
|
|
800
|
+
session.applyDelta({ upserts: { "from-session.md": entry(3) } });
|
|
801
|
+
expect(readJournal("acme").files["from-session.md"]).toMatchObject({ size: 3 });
|
|
802
|
+
});
|
|
803
|
+
it("falls back across a published generation change and heals a durable external append", () => {
|
|
804
|
+
writeJournal("acme", journal({ "a.md": entry(1) }));
|
|
805
|
+
const session = openJournalStoreSession("acme");
|
|
806
|
+
repairJournalState("acme");
|
|
807
|
+
const external = readJournal("acme");
|
|
808
|
+
external.files["after-generation.md"] = entry(4);
|
|
809
|
+
writeJournal("acme", external);
|
|
810
|
+
session.refresh();
|
|
811
|
+
expect(session.get("after-generation.md")).toMatchObject({ size: 4 });
|
|
812
|
+
});
|
|
813
|
+
it("rebuilds its projection before committing after another writer publishes a generation", () => {
|
|
814
|
+
writeJournal("acme", journal({ "before.md": entry(1) }));
|
|
815
|
+
const reader = openJournalStoreSession("acme");
|
|
816
|
+
const writer = openJournalStoreSession("acme");
|
|
817
|
+
writer.applyDelta({ upserts: { "before-compaction.md": entry(2) } });
|
|
818
|
+
repairJournalState("acme");
|
|
819
|
+
writer.applyDelta({ upserts: { "after-compaction.md": entry(3) } });
|
|
820
|
+
reader.applyDelta({ upserts: { "reader-commit.md": entry(4) } });
|
|
821
|
+
expect(reader.get("before-compaction.md")).toMatchObject({ size: 2 });
|
|
822
|
+
expect(reader.get("after-compaction.md")).toMatchObject({ size: 3 });
|
|
823
|
+
expect(reader.get("reader-commit.md")).toMatchObject({ size: 4 });
|
|
824
|
+
});
|
|
825
|
+
it("returns frozen rows and scans exact descendants without leaking its backing store", () => {
|
|
826
|
+
writeJournal("acme", journal({
|
|
827
|
+
"dir/a.md": entry(1),
|
|
828
|
+
"dir/nested/b.md": entry(2),
|
|
829
|
+
"other.md": entry(3),
|
|
830
|
+
}));
|
|
831
|
+
const session = openJournalStoreSession("acme");
|
|
832
|
+
const row = session.get("dir/a.md");
|
|
833
|
+
expect(Object.isFrozen(row)).toBe(true);
|
|
834
|
+
expect(() => { row.size = 99; }).toThrow(TypeError);
|
|
835
|
+
expect(session.get("dir/a.md")).toMatchObject({ size: 1 });
|
|
836
|
+
const scanned = session.scanPrefix("dir");
|
|
837
|
+
const scannedRows = Array.from(scanned);
|
|
838
|
+
expect(scannedRows.map(([key]) => key)).toEqual(["dir/a.md", "dir/nested/b.md"]);
|
|
839
|
+
expect(Object.isFrozen(scannedRows[0][1])).toBe(true);
|
|
840
|
+
expect(() => { scannedRows[0][1].size = 99; }).toThrow(TypeError);
|
|
841
|
+
expect(session.get("dir/a.md")).toMatchObject({ size: 1 });
|
|
842
|
+
session.applyDelta({ upserts: { "dir/a.md": { ...entry(1), localDeleteIntent: {
|
|
843
|
+
version: 1, remoteEtag: "etag-1", localHash: "1".repeat(64), localKind: "file",
|
|
844
|
+
} } } });
|
|
845
|
+
const nested = session.get("dir/a.md");
|
|
846
|
+
expect(() => { nested.localDeleteIntent.remoteEtag = "mutated"; }).toThrow();
|
|
847
|
+
expect(session.get("dir/a.md")?.localDeleteIntent?.remoteEtag).toBe("etag-1");
|
|
848
|
+
});
|
|
849
|
+
it("streams a 59,020-row full-pass scan without eagerly retaining every entry", () => {
|
|
850
|
+
const rowCount = 59_020;
|
|
851
|
+
const files = {};
|
|
852
|
+
for (let index = 0; index < rowCount; index += 1) {
|
|
853
|
+
files[`full-pass/${index % 400}/entry-${index}.md`] = packedEntry(index);
|
|
854
|
+
}
|
|
855
|
+
writeJournal("full-pass-streaming", journal(files));
|
|
856
|
+
const session = openJournalStoreSession("full-pass-streaming");
|
|
857
|
+
const materialize = vi.spyOn(JournalRowStore.prototype, "materialize");
|
|
858
|
+
try {
|
|
859
|
+
const scanned = session.scanPrefix("");
|
|
860
|
+
// A full-pass consumer must be able to begin work before every row has
|
|
861
|
+
// been materialized. The old array-returning API reached 59,020 calls
|
|
862
|
+
// here before returning control to its caller.
|
|
863
|
+
expect(materialize).toHaveBeenCalledTimes(0);
|
|
864
|
+
let count = 0;
|
|
865
|
+
for (const [key, row] of scanned) {
|
|
866
|
+
expect(key).toMatch(/^full-pass\//);
|
|
867
|
+
expect(row.size).toBeGreaterThanOrEqual(0);
|
|
868
|
+
count += 1;
|
|
869
|
+
}
|
|
870
|
+
expect(count).toBe(rowCount);
|
|
871
|
+
expect(session.rowCount()).toBe(rowCount);
|
|
872
|
+
}
|
|
873
|
+
finally {
|
|
874
|
+
materialize.mockRestore();
|
|
875
|
+
session.dispose();
|
|
876
|
+
}
|
|
877
|
+
}, 120_000);
|
|
878
|
+
it("releases full-pass scan entries after churn while preserving every no-op row", () => {
|
|
879
|
+
const rowCount = 59_020;
|
|
880
|
+
const slug = "full-pass-streaming-churn";
|
|
881
|
+
const files = {};
|
|
882
|
+
for (let index = 0; index < rowCount; index += 1) {
|
|
883
|
+
files[`full-pass/${index % 400}/entry-${index}.md`] = packedEntry(index);
|
|
884
|
+
}
|
|
885
|
+
writeJournal(slug, journal(files));
|
|
886
|
+
const collect = acquireGc();
|
|
887
|
+
collectGarbage(collect);
|
|
888
|
+
const baseline = usedBytes();
|
|
889
|
+
for (let pass = 0; pass < 3; pass += 1) {
|
|
890
|
+
const session = openJournalStoreSession(slug);
|
|
891
|
+
let seen = 0;
|
|
892
|
+
for (const _row of session.scanPrefix(""))
|
|
893
|
+
seen += 1;
|
|
894
|
+
expect(seen).toBe(rowCount);
|
|
895
|
+
session.dispose();
|
|
896
|
+
}
|
|
897
|
+
// Keep a pass alive after its first bounded unit of work, then measure
|
|
898
|
+
// again after every reference to that pass has been dropped.
|
|
899
|
+
let activeSession = openJournalStoreSession(slug);
|
|
900
|
+
let activeScan = activeSession.scanPrefix("");
|
|
901
|
+
let activeIterator = activeScan[Symbol.iterator]();
|
|
902
|
+
for (let index = 0; index < 32; index += 1) {
|
|
903
|
+
expect(activeIterator.next().done).toBe(false);
|
|
904
|
+
}
|
|
905
|
+
collectGarbage(collect);
|
|
906
|
+
const aliveBytes = usedBytes();
|
|
907
|
+
const aliveRetainedBytes = aliveBytes - baseline;
|
|
908
|
+
activeIterator = undefined;
|
|
909
|
+
activeScan = undefined;
|
|
910
|
+
activeSession.dispose();
|
|
911
|
+
activeSession = undefined;
|
|
912
|
+
collectGarbage(collect);
|
|
913
|
+
const releasedBytes = usedBytes();
|
|
914
|
+
const releasedRetainedBytes = releasedBytes - baseline;
|
|
915
|
+
console.info(`full-pass-scan-memory rows=${rowCount} churnPasses=3` +
|
|
916
|
+
` baselineBytes=${baseline}` +
|
|
917
|
+
` aliveBytes=${aliveBytes}` +
|
|
918
|
+
` aliveRetainedBytes=${aliveRetainedBytes}` +
|
|
919
|
+
` releasedBytes=${releasedBytes}` +
|
|
920
|
+
` releasedRetainedBytes=${releasedRetainedBytes}`);
|
|
921
|
+
expect(releasedRetainedBytes).toBeLessThan(aliveRetainedBytes);
|
|
922
|
+
const noOpPass = readJournalForPass(slug);
|
|
923
|
+
const expectedKeys = new Set(journalRows(noOpPass).keys());
|
|
924
|
+
expect(expectedKeys.size).toBe(rowCount);
|
|
925
|
+
expect(journalDeltaForTest(noOpPass).deletes).toEqual([]);
|
|
926
|
+
writeJournal(slug, noOpPass);
|
|
927
|
+
const reopenedKeys = new Set(journalRows(readJournal(slug)).keys());
|
|
928
|
+
expect(reopenedKeys).toEqual(expectedKeys);
|
|
929
|
+
expect(reopenedKeys.size).toBe(rowCount);
|
|
930
|
+
}, 120_000);
|
|
931
|
+
it("materializes only rows whose paths match a prefix scan", () => {
|
|
932
|
+
writeJournal("acme", journal({
|
|
933
|
+
"docs/guide.md": entry(1),
|
|
934
|
+
"docs/nested/plan.md": entry(2),
|
|
935
|
+
"docs": entry(3),
|
|
936
|
+
"docsx/guide.md": entry(4),
|
|
937
|
+
"other.md": entry(5),
|
|
938
|
+
"notes/meeting.md": entry(6),
|
|
939
|
+
}));
|
|
940
|
+
const materialize = vi.spyOn(JournalRowStore.prototype, "materialize");
|
|
941
|
+
const pathForRow = vi.spyOn(JournalRowStore.prototype, "pathForRow");
|
|
942
|
+
try {
|
|
943
|
+
const session = openJournalStoreSession("acme");
|
|
944
|
+
expect(Array.from(session.scanPrefix("docs")).map(([key]) => key)).toEqual([
|
|
945
|
+
"docs",
|
|
946
|
+
"docs/guide.md",
|
|
947
|
+
"docs/nested/plan.md",
|
|
948
|
+
]);
|
|
949
|
+
expect(materialize).toHaveBeenCalledTimes(3);
|
|
950
|
+
expect(pathForRow).toHaveBeenCalledTimes(3);
|
|
951
|
+
}
|
|
952
|
+
finally {
|
|
953
|
+
pathForRow.mockRestore();
|
|
954
|
+
materialize.mockRestore();
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
it("keeps watcher filter compatibility lazy until the bulk classifier consumes it", () => {
|
|
958
|
+
writeJournal("acme", journal({
|
|
959
|
+
"docs/guide.md": entry(1),
|
|
960
|
+
"docs/nested/plan.md": entry(2),
|
|
961
|
+
"docs": entry(3),
|
|
962
|
+
"docsx/guide.md": entry(4),
|
|
963
|
+
"other.md": entry(5),
|
|
964
|
+
}));
|
|
965
|
+
const materialize = vi.spyOn(JournalRowStore.prototype, "materialize");
|
|
966
|
+
try {
|
|
967
|
+
const session = openJournalStoreSession("acme");
|
|
968
|
+
const covered = session.scanPrefix("docs");
|
|
969
|
+
expect(materialize).not.toHaveBeenCalled();
|
|
970
|
+
const stampable = covered.filter(([, row]) => row.remoteEtag !== undefined);
|
|
971
|
+
expect(stampable.map(([key]) => key)).toEqual([
|
|
972
|
+
"docs",
|
|
973
|
+
"docs/guide.md",
|
|
974
|
+
"docs/nested/plan.md",
|
|
975
|
+
]);
|
|
976
|
+
expect(materialize).toHaveBeenCalledTimes(3);
|
|
977
|
+
}
|
|
978
|
+
finally {
|
|
979
|
+
materialize.mockRestore();
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
it("reiterates one streamed prefix scan with the complete row set", () => {
|
|
983
|
+
writeJournal("acme", journal({
|
|
984
|
+
"docs/guide.md": entry(1),
|
|
985
|
+
"docs/nested/plan.md": entry(2),
|
|
986
|
+
"other/ignored.md": entry(3),
|
|
987
|
+
}));
|
|
988
|
+
const session = openJournalStoreSession("acme");
|
|
989
|
+
const scan = session.scanPrefix("docs");
|
|
990
|
+
const firstPass = Array.from(scan);
|
|
991
|
+
const secondPass = Array.from(scan);
|
|
992
|
+
expect(firstPass.map(([key]) => key)).toEqual(["docs/guide.md", "docs/nested/plan.md"]);
|
|
993
|
+
expect(secondPass).toEqual(firstPass);
|
|
994
|
+
session.dispose();
|
|
995
|
+
});
|
|
996
|
+
it("preserves prefix-boundary scan behavior and frozen rows", () => {
|
|
997
|
+
writeJournal("acme", journal({
|
|
998
|
+
"docs/guide.md": entry(1),
|
|
999
|
+
"docs/nested/plan.md": entry(2),
|
|
1000
|
+
"docs": entry(3),
|
|
1001
|
+
"docsx/guide.md": entry(4),
|
|
1002
|
+
"other.md": entry(5),
|
|
1003
|
+
}));
|
|
1004
|
+
const session = openJournalStoreSession("acme");
|
|
1005
|
+
const expectations = [
|
|
1006
|
+
["", ["docs", "docs/guide.md", "docs/nested/plan.md", "docsx/guide.md", "other.md"]],
|
|
1007
|
+
["docs/guide.md", ["docs/guide.md"]],
|
|
1008
|
+
["docs/", ["docs", "docs/guide.md", "docs/nested/plan.md"]],
|
|
1009
|
+
["docs", ["docs", "docs/guide.md", "docs/nested/plan.md"]],
|
|
1010
|
+
["missing", []],
|
|
1011
|
+
];
|
|
1012
|
+
for (const [prefix, expectedPaths] of expectations) {
|
|
1013
|
+
const scanned = Array.from(session.scanPrefix(prefix));
|
|
1014
|
+
expect(scanned.map(([key]) => key), prefix).toEqual(expectedPaths);
|
|
1015
|
+
for (const [key, row] of scanned) {
|
|
1016
|
+
expect(Object.isFrozen(row), prefix).toBe(true);
|
|
1017
|
+
expect(row).toEqual(session.get(key));
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
it("matches a Map reference through seeded packed-session delta sequences", () => {
|
|
1022
|
+
const paths = [
|
|
1023
|
+
"root.md",
|
|
1024
|
+
"unicode/\ud800",
|
|
1025
|
+
"unicode/�",
|
|
1026
|
+
"unicode/café.md",
|
|
1027
|
+
"unicode/cafe\u0301.md",
|
|
1028
|
+
"nested/alpha.md",
|
|
1029
|
+
"nested/deeper/beta.md",
|
|
1030
|
+
"very/deep/path/with/many/segments/entry.md",
|
|
1031
|
+
];
|
|
1032
|
+
const prefixes = ["", "unicode", "unicode/", "nested", "very/deep/path/with/many/segments", "missing"];
|
|
1033
|
+
const reference = new Map();
|
|
1034
|
+
writeJournal("packed-session-parity", journal({}));
|
|
1035
|
+
const session = openJournalStoreSession("packed-session-parity");
|
|
1036
|
+
try {
|
|
1037
|
+
for (let seed = 1; seed <= 300; seed++) {
|
|
1038
|
+
const random = rng(seed);
|
|
1039
|
+
const sequenceLength = 1 + Math.floor(random() * 5);
|
|
1040
|
+
for (let step = 0; step < sequenceLength; step++) {
|
|
1041
|
+
const chosenPath = paths[Math.floor(random() * paths.length)];
|
|
1042
|
+
const action = random();
|
|
1043
|
+
if (action < 0.2) {
|
|
1044
|
+
session.applyDelta({ deletes: [chosenPath] });
|
|
1045
|
+
reference.delete(chosenPath);
|
|
1046
|
+
}
|
|
1047
|
+
else if (action < 0.35) {
|
|
1048
|
+
const absentPath = `missing/${seed}/${step}.md`;
|
|
1049
|
+
session.applyDelta({ deletes: [absentPath] });
|
|
1050
|
+
reference.delete(absentPath);
|
|
1051
|
+
}
|
|
1052
|
+
else if (action < 0.5) {
|
|
1053
|
+
session.applyDelta({ metadata: { lastSync: `sync-${seed}-${step}` } });
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
const prior = reference.get(chosenPath);
|
|
1057
|
+
const next = prior !== undefined && action < 0.7
|
|
1058
|
+
? structuredClone(prior)
|
|
1059
|
+
: packedEntry(seed * 1_000 + step);
|
|
1060
|
+
session.applyDelta({ upserts: { [chosenPath]: next } });
|
|
1061
|
+
reference.set(chosenPath, next);
|
|
1062
|
+
}
|
|
1063
|
+
const label = `seed ${seed}, step ${step}`;
|
|
1064
|
+
expect(session.rowCount(), label).toBe(reference.size);
|
|
1065
|
+
for (const samplePath of [...paths, `missing/${seed}/${step}.md`]) {
|
|
1066
|
+
expect(session.get(samplePath), `${label}, get ${JSON.stringify(samplePath)}`)
|
|
1067
|
+
.toEqual(reference.get(samplePath));
|
|
1068
|
+
}
|
|
1069
|
+
for (const prefix of prefixes) {
|
|
1070
|
+
expect(Array.from(session.scanPrefix(prefix)), `${label}, scan ${JSON.stringify(prefix)}`)
|
|
1071
|
+
.toEqual(scanReference(reference, prefix));
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
finally {
|
|
1077
|
+
session.dispose();
|
|
1078
|
+
}
|
|
1079
|
+
}, 60_000);
|
|
1080
|
+
it("releases each completed keyed projection instead of retaining one full journal per watch pass", () => {
|
|
1081
|
+
const files = Object.fromEntries(Array.from({ length: 64 }, (_value, index) => [`docs/${index}.md`, entry(index)]));
|
|
1082
|
+
writeJournal("release-after-pass", journal(files));
|
|
1083
|
+
const completed = [];
|
|
1084
|
+
for (let cycle = 0; cycle < 20; cycle += 1) {
|
|
1085
|
+
const session = openJournalStoreSession("release-after-pass");
|
|
1086
|
+
expect(session.rowCount()).toBe(64);
|
|
1087
|
+
session.dispose();
|
|
1088
|
+
completed.push(session);
|
|
1089
|
+
}
|
|
1090
|
+
expect(completed.map((session) => session.rowCount())).toEqual(Array(20).fill(0));
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
describe("JournalStore packed rows", () => {
|
|
1094
|
+
// Companion to the AreaLedger "one object per row" tests. On a 690k-row
|
|
1095
|
+
// vault the runner keeps up to three sessions open at once (cached targeted
|
|
1096
|
+
// pull, watcher, pass-local); each used to structuredClone every row on
|
|
1097
|
+
// open, which is what pushed the outposts over Node's default heap ceiling.
|
|
1098
|
+
function seedAuthoritative(slug, rows) {
|
|
1099
|
+
const files = {};
|
|
1100
|
+
for (let index = 0; index < rows; index += 1)
|
|
1101
|
+
files[`alpha/file-${index}.md`] = entry(index + 1);
|
|
1102
|
+
writeJournal(slug, journal(files));
|
|
1103
|
+
const migration = new AreaLedgerMigration({
|
|
1104
|
+
rootDir: stateDir,
|
|
1105
|
+
journalSlug: slug,
|
|
1106
|
+
resolver: new AreaResolver(areaLayout),
|
|
1107
|
+
legacyStore: openJournalStateStoreForMigration(slug),
|
|
1108
|
+
});
|
|
1109
|
+
expect(migration.cutOver().phase).toBe("area-authoritative");
|
|
1110
|
+
return migration;
|
|
1111
|
+
}
|
|
1112
|
+
it("opens a session without cloning rows", () => {
|
|
1113
|
+
seedAuthoritative("personal-vault", 2_000);
|
|
1114
|
+
const clone = vi.spyOn(globalThis, "structuredClone");
|
|
1115
|
+
try {
|
|
1116
|
+
const session = openJournalStoreSession("personal-vault");
|
|
1117
|
+
expect(session.rowCount()).toBe(2_000);
|
|
1118
|
+
expect(clone.mock.calls.length).toBeLessThan(20);
|
|
1119
|
+
}
|
|
1120
|
+
finally {
|
|
1121
|
+
clone.mockRestore();
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
it("packs independent row values instead of retaining ledger row objects", () => {
|
|
1125
|
+
seedAuthoritative("personal-vault", 10);
|
|
1126
|
+
const opened = [];
|
|
1127
|
+
setAreaLedgerMigrationTestHooksForTest({ afterOpen: (bridge) => opened.push(bridge) });
|
|
1128
|
+
const session = openJournalStoreSession("personal-vault");
|
|
1129
|
+
expect(opened).toHaveLength(1);
|
|
1130
|
+
const ledgerRow = opened[0].readAreaJournalCached().journal.files["alpha/file-4.md"];
|
|
1131
|
+
expect(ledgerRow).toBeDefined();
|
|
1132
|
+
const sessionRows = session.files;
|
|
1133
|
+
expect(sessionRows.get("alpha/file-4.md")).not.toBe(ledgerRow);
|
|
1134
|
+
});
|
|
1135
|
+
it("still returns detached frozen rows to callers", () => {
|
|
1136
|
+
seedAuthoritative("personal-vault", 3);
|
|
1137
|
+
const session = openJournalStoreSession("personal-vault");
|
|
1138
|
+
const row = session.get("alpha/file-1.md");
|
|
1139
|
+
expect(Object.isFrozen(row)).toBe(true);
|
|
1140
|
+
expect(() => { row.size = 999; }).toThrow(TypeError);
|
|
1141
|
+
expect(session.get("alpha/file-1.md")).toMatchObject({ size: 2 });
|
|
1142
|
+
expect(readJournal("personal-vault").files["alpha/file-1.md"]).toMatchObject({ size: 2 });
|
|
1143
|
+
});
|
|
1144
|
+
it("keeps the long-lived projection free of unwired row-store changes", () => {
|
|
1145
|
+
writeJournal("packed-session-dirty-log", journal({}));
|
|
1146
|
+
const session = openJournalStoreSession("packed-session-dirty-log");
|
|
1147
|
+
try {
|
|
1148
|
+
for (let round = 0; round < 180; round += 1) {
|
|
1149
|
+
const path = `churn/${round % 24}.md`;
|
|
1150
|
+
session.applyDelta({ upserts: { [path]: packedEntry(round) } });
|
|
1151
|
+
if (round % 5 === 0)
|
|
1152
|
+
session.applyDelta({ deletes: [path] });
|
|
1153
|
+
}
|
|
1154
|
+
const dirtyLog = session.files.dirtyLog;
|
|
1155
|
+
expect(dirtyLog).toEqual([]);
|
|
1156
|
+
}
|
|
1157
|
+
finally {
|
|
1158
|
+
session.dispose();
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
});
|
|
1162
|
+
/**
|
|
1163
|
+
* A retained scoped projection is a SNAPSHOT. Its cached metadata goes stale
|
|
1164
|
+
* the moment another writer advances the journal's `lastSync` or appends to
|
|
1165
|
+
* its pull history, and `writeJournal` used to fill whichever metadata field
|
|
1166
|
+
* the delta did not carry from that stale snapshot — republishing it over the
|
|
1167
|
+
* concurrent writer's durable value. The reducer already preserves a field the
|
|
1168
|
+
* delta omits, so the delta must omit it.
|
|
1169
|
+
*/
|
|
1170
|
+
describe("writeJournal metadata through a retained scoped session", () => {
|
|
1171
|
+
function pull(index) {
|
|
1172
|
+
const at = new Date(Date.UTC(2026, 8, 18, 0, 0, index)).toISOString();
|
|
1173
|
+
return {
|
|
1174
|
+
pullId: `pull-${index}`,
|
|
1175
|
+
companyUid: "cmp_indigo",
|
|
1176
|
+
startedAt: at,
|
|
1177
|
+
completedAt: at,
|
|
1178
|
+
syncMode: "all",
|
|
1179
|
+
prefixSet: [],
|
|
1180
|
+
scopeChangeDetected: false,
|
|
1181
|
+
orphansRemoved: 0,
|
|
1182
|
+
orphansBlocked: 0,
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
it("keeps a concurrent writer's pull history when the delta only advances lastSync", () => {
|
|
1186
|
+
const slug = "metadata-race-pulls";
|
|
1187
|
+
writeJournal(slug, { version: "2", lastSync: "t0", files: { "a.md": entry(1) }, pulls: [] });
|
|
1188
|
+
// Retain the projection the way a scoped pass does, capturing its baseline.
|
|
1189
|
+
const scoped = readJournalScoped(slug, ["a.md"]);
|
|
1190
|
+
expect(scoped.pulls).toEqual([]);
|
|
1191
|
+
// Another writer records a completed pull after this session's snapshot.
|
|
1192
|
+
const concurrent = openJournalStoreSession(slug);
|
|
1193
|
+
concurrent.applyDelta({ metadata: { pulls: [pull(1)] } });
|
|
1194
|
+
concurrent.dispose();
|
|
1195
|
+
scoped.lastSync = "t1";
|
|
1196
|
+
writeJournal(slug, scoped);
|
|
1197
|
+
const durable = readJournal(slug);
|
|
1198
|
+
expect(durable.lastSync).toBe("t1");
|
|
1199
|
+
expect(durable.pulls).toEqual([pull(1)]);
|
|
1200
|
+
});
|
|
1201
|
+
it("keeps a concurrent writer's lastSync when the delta only records a pull", () => {
|
|
1202
|
+
const slug = "metadata-race-last-sync";
|
|
1203
|
+
writeJournal(slug, { version: "2", lastSync: "t0", files: { "a.md": entry(1) }, pulls: [] });
|
|
1204
|
+
const scoped = readJournalScoped(slug, ["a.md"]);
|
|
1205
|
+
expect(scoped.lastSync).toBe("t0");
|
|
1206
|
+
const concurrent = openJournalStoreSession(slug);
|
|
1207
|
+
concurrent.applyDelta({ metadata: { lastSync: "t9" } });
|
|
1208
|
+
concurrent.dispose();
|
|
1209
|
+
scoped.pulls = [pull(2)];
|
|
1210
|
+
writeJournal(slug, scoped);
|
|
1211
|
+
const durable = readJournal(slug);
|
|
1212
|
+
expect(durable.pulls).toEqual([pull(2)]);
|
|
1213
|
+
expect(durable.lastSync).toBe("t9");
|
|
1214
|
+
});
|
|
1215
|
+
it("still publishes both fields when the delta carries both", () => {
|
|
1216
|
+
const slug = "metadata-race-both";
|
|
1217
|
+
writeJournal(slug, { version: "2", lastSync: "t0", files: { "a.md": entry(1) }, pulls: [] });
|
|
1218
|
+
const scoped = readJournalScoped(slug, ["a.md"]);
|
|
1219
|
+
scoped.lastSync = "t5";
|
|
1220
|
+
scoped.pulls = [pull(3)];
|
|
1221
|
+
writeJournal(slug, scoped);
|
|
1222
|
+
const durable = readJournal(slug);
|
|
1223
|
+
expect(durable.lastSync).toBe("t5");
|
|
1224
|
+
expect(durable.pulls).toEqual([pull(3)]);
|
|
1225
|
+
});
|
|
1226
|
+
});
|
|
1227
|
+
//# sourceMappingURL=journal-store.test.js.map
|