@indigoai-us/hq-cloud 6.16.87-alpha.0 → 6.16.89-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/sync-runner-company.d.ts +2 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +8 -2
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +26 -25
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +251 -183
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +22 -2
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +5 -3
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +74 -509
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts +18 -6
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +108 -97
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +4 -177
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync-scope.test.js +0 -34
- package/dist/cli/sync-scope.test.js.map +1 -1
- package/dist/cli/sync.d.ts +17 -4
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +138 -20
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +230 -1
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/lib/machine-id.d.ts +0 -7
- package/dist/lib/machine-id.d.ts.map +1 -1
- package/dist/lib/machine-id.js +7 -54
- package/dist/lib/machine-id.js.map +1 -1
- package/dist/lib/machine-id.test.js +1 -20
- package/dist/lib/machine-id.test.js.map +1 -1
- package/dist/object-io.d.ts +21 -9
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +133 -93
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +140 -108
- package/dist/object-io.test.js.map +1 -1
- package/dist/prefix-coalesce.d.ts +30 -37
- package/dist/prefix-coalesce.d.ts.map +1 -1
- package/dist/prefix-coalesce.js +16 -104
- package/dist/prefix-coalesce.js.map +1 -1
- package/dist/prefix-coalesce.test.js +3 -34
- package/dist/prefix-coalesce.test.js.map +1 -1
- package/dist/remote-pull.d.ts.map +1 -1
- package/dist/remote-pull.js +8 -15
- package/dist/remote-pull.js.map +1 -1
- package/dist/remote-pull.test.js +4 -44
- package/dist/remote-pull.test.js.map +1 -1
- package/dist/s3.d.ts +8 -3
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +30 -7
- package/dist/s3.js.map +1 -1
- package/dist/scope-shrink.d.ts.map +1 -1
- package/dist/scope-shrink.js +1 -7
- package/dist/scope-shrink.js.map +1 -1
- package/dist/sync/event-sync.d.ts +5 -19
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +14 -150
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +2 -386
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/inbound-event-admission.d.ts.map +1 -1
- package/dist/sync/inbound-event-admission.js +3 -0
- package/dist/sync/inbound-event-admission.js.map +1 -1
- package/dist/sync/inbound-event-admission.test.js +6 -0
- package/dist/sync/inbound-event-admission.test.js.map +1 -1
- package/dist/sync/parallel-sync-coordinator.d.ts +0 -1
- package/dist/sync/parallel-sync-coordinator.d.ts.map +1 -1
- package/dist/sync/parallel-sync-coordinator.js +8 -39
- package/dist/sync/parallel-sync-coordinator.js.map +1 -1
- package/dist/sync/parallel-sync-coordinator.test.js +1 -33
- package/dist/sync/parallel-sync-coordinator.test.js.map +1 -1
- package/dist/sync/pull-scope.d.ts +0 -2
- package/dist/sync/pull-scope.d.ts.map +1 -1
- package/dist/sync/pull-scope.js +5 -15
- package/dist/sync/pull-scope.js.map +1 -1
- package/dist/sync/push-receiver.d.ts +1 -22
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js +20 -114
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/push-receiver.test.js +24 -398
- package/dist/sync/push-receiver.test.js.map +1 -1
- package/dist/sync/push-transport.d.ts +0 -15
- package/dist/sync/push-transport.d.ts.map +1 -1
- package/dist/sync/push-transport.js +0 -27
- package/dist/sync/push-transport.js.map +1 -1
- package/dist/sync/push-transport.test.js +1 -14
- package/dist/sync/push-transport.test.js.map +1 -1
- package/dist/sync/sync-work.d.ts +0 -5
- package/dist/sync/sync-work.d.ts.map +1 -1
- package/dist/sync/sync-work.js.map +1 -1
- package/dist/sync-core.d.ts +2 -1
- package/dist/sync-core.d.ts.map +1 -1
- package/dist/sync-core.js +5 -10
- package/dist/sync-core.js.map +1 -1
- package/dist/sync-core.test.js +16 -0
- package/dist/sync-core.test.js.map +1 -1
- package/dist/watcher.d.ts +0 -4
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +4 -16
- package/dist/watcher.js.map +1 -1
- package/dist/watcher.test.js +3 -50
- package/dist/watcher.test.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/share.test.js
CHANGED
|
@@ -68,12 +68,11 @@ import { share, ServerOwnedPushPathsError, UnreachablePushPathsError, Unregister
|
|
|
68
68
|
import { deleteRemoteFile, downloadFile, headRemoteFile, primeObjectTransport, primeUploads, uploadFile, uploadSymlink, WindowsSymlinkPrivilegeError, } from "../s3.js";
|
|
69
69
|
import { VaultAuthError, VaultClientError, VaultConflictError, VaultPermissionDeniedError, } from "../vault-client.js";
|
|
70
70
|
import { CognitoRefreshError } from "../cognito-auth.js";
|
|
71
|
-
import {
|
|
71
|
+
import { RateLimitedError } from "../object-io.js";
|
|
72
72
|
import { AreaLedgerMigration, closeCachedAreaJournalMigration, hashFile, openJournalStateStoreForMigration, readJournal, readJournalScoped, setAreaLedgerMigrationTestHooksForTest, writeJournal, } from "../journal.js";
|
|
73
73
|
import { ReconcileCursorStore } from "../sync/reconcile-cursor.js";
|
|
74
74
|
import { AreaResolver } from "../sync/area-resolver.js";
|
|
75
75
|
import { CooperativePassScheduler } from "../bin/sync-runner-watch-loop.js";
|
|
76
|
-
import { grantPathToPrefix } from "../prefix-coalesce.js";
|
|
77
76
|
/**
|
|
78
77
|
* Read a journal the way production does.
|
|
79
78
|
*
|
|
@@ -1735,10 +1734,10 @@ describe("share", () => {
|
|
|
1735
1734
|
hqRoot: tmpDir,
|
|
1736
1735
|
skipUnchanged: true,
|
|
1737
1736
|
propagateDeletes: true,
|
|
1738
|
-
cooperativeCheckpoint: async () => {
|
|
1737
|
+
cooperativeCheckpoint: Object.assign(async () => {
|
|
1739
1738
|
checkpointCalls++;
|
|
1740
1739
|
return checkpoint();
|
|
1741
|
-
},
|
|
1740
|
+
}, { shouldYieldToRealtime: () => checkpoint.shouldYieldToRealtime?.() === true }),
|
|
1742
1741
|
});
|
|
1743
1742
|
}, "chore");
|
|
1744
1743
|
await realtimePass;
|
|
@@ -1753,7 +1752,7 @@ describe("share", () => {
|
|
|
1753
1752
|
expect(realtimeQueued).toBe(true);
|
|
1754
1753
|
expect(checkpointCalls).toBeGreaterThan(0);
|
|
1755
1754
|
expect(realtimeDispatchedAt).toBeGreaterThan(0);
|
|
1756
|
-
expect(realtimeDispatchedAt).toBeLessThanOrEqual(
|
|
1755
|
+
expect(realtimeDispatchedAt).toBeLessThanOrEqual(maxUploadsInFlight);
|
|
1757
1756
|
// Reopen the durable journal, rather than inspecting the stale first-pass
|
|
1758
1757
|
// object: every pre-handoff key and the realtime key must survive.
|
|
1759
1758
|
const durable = readJournal("acme");
|
|
@@ -2020,109 +2019,6 @@ describe("share", () => {
|
|
|
2020
2019
|
vi.mocked(uploadFile).mockResolvedValue({ etag: '"upload-etag"' });
|
|
2021
2020
|
}
|
|
2022
2021
|
});
|
|
2023
|
-
it.each([
|
|
2024
|
-
[
|
|
2025
|
-
"429 throttle",
|
|
2026
|
-
() => new RateLimitedError("test.md", "put"),
|
|
2027
|
-
"RateLimited",
|
|
2028
|
-
true,
|
|
2029
|
-
],
|
|
2030
|
-
[
|
|
2031
|
-
"503 throttle",
|
|
2032
|
-
() => Object.assign(new Error("presign request failed (503)"), {
|
|
2033
|
-
statusCode: 503,
|
|
2034
|
-
}),
|
|
2035
|
-
"503",
|
|
2036
|
-
true,
|
|
2037
|
-
],
|
|
2038
|
-
[
|
|
2039
|
-
"Object Lock 400 checksum refusal",
|
|
2040
|
-
() => new ObjectLockChecksumRequiredError("test.md", "checksum required"),
|
|
2041
|
-
"ObjectLockChecksumRequired",
|
|
2042
|
-
false,
|
|
2043
|
-
],
|
|
2044
|
-
[
|
|
2045
|
-
"request timeout",
|
|
2046
|
-
() => Object.assign(new Error("request timed out"), { name: "TimeoutError" }),
|
|
2047
|
-
"TimeoutError",
|
|
2048
|
-
true,
|
|
2049
|
-
],
|
|
2050
|
-
[
|
|
2051
|
-
"caller abort",
|
|
2052
|
-
() => Object.assign(new Error("request aborted"), { name: "AbortError" }),
|
|
2053
|
-
"AbortError",
|
|
2054
|
-
true,
|
|
2055
|
-
],
|
|
2056
|
-
[
|
|
2057
|
-
"nested transport failure",
|
|
2058
|
-
() => Object.assign(new TypeError("fetch failed"), {
|
|
2059
|
-
cause: Object.assign(new Error("socket reset"), { code: "ECONNRESET" }),
|
|
2060
|
-
}),
|
|
2061
|
-
"fetch failed",
|
|
2062
|
-
true,
|
|
2063
|
-
],
|
|
2064
|
-
])("remote failure contract classifies %s, preserves its journal row, and emits its reason", async (_description, makeFailure, telemetryReason, deferred) => {
|
|
2065
|
-
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
2066
|
-
fs.mkdirSync(companyRoot, { recursive: true });
|
|
2067
|
-
const testFile = path.join(companyRoot, "test.md");
|
|
2068
|
-
fs.writeFileSync(testFile, "# Hello World");
|
|
2069
|
-
const journalPath = path.join(stateDir, "sync-journal.acme.json");
|
|
2070
|
-
const staleHash = "stale-hash-for-old-content";
|
|
2071
|
-
seedJournalAt(journalPath, {
|
|
2072
|
-
version: "1",
|
|
2073
|
-
lastSync: new Date(Date.now() - 60_000).toISOString(),
|
|
2074
|
-
files: {
|
|
2075
|
-
"test.md": {
|
|
2076
|
-
hash: staleHash,
|
|
2077
|
-
size: 5,
|
|
2078
|
-
syncedAt: new Date(Date.now() - 60_000).toISOString(),
|
|
2079
|
-
direction: "up",
|
|
2080
|
-
remoteEtag: "old-etag",
|
|
2081
|
-
},
|
|
2082
|
-
},
|
|
2083
|
-
});
|
|
2084
|
-
vi.mocked(uploadFile).mockReset();
|
|
2085
|
-
vi.mocked(uploadFile).mockRejectedValueOnce(makeFailure());
|
|
2086
|
-
try {
|
|
2087
|
-
const events = [];
|
|
2088
|
-
const result = await share({
|
|
2089
|
-
paths: [testFile],
|
|
2090
|
-
company: "acme",
|
|
2091
|
-
vaultConfig: mockConfig,
|
|
2092
|
-
hqRoot: tmpDir,
|
|
2093
|
-
onEvent: (event) => events.push(event),
|
|
2094
|
-
});
|
|
2095
|
-
expect(result.filesUploaded).toBe(0);
|
|
2096
|
-
expect(journalAt(journalPath).files["test.md"]).toMatchObject({
|
|
2097
|
-
hash: staleHash,
|
|
2098
|
-
remoteEtag: "old-etag",
|
|
2099
|
-
});
|
|
2100
|
-
expect(events).toContainEqual(expect.objectContaining({
|
|
2101
|
-
type: "error",
|
|
2102
|
-
path: "test.md",
|
|
2103
|
-
message: expect.stringContaining(telemetryReason),
|
|
2104
|
-
}));
|
|
2105
|
-
if (deferred) {
|
|
2106
|
-
expect(result.filesSkipped).toBeGreaterThanOrEqual(1);
|
|
2107
|
-
expect(events).toContainEqual(expect.objectContaining({
|
|
2108
|
-
type: "error",
|
|
2109
|
-
diagnostic: true,
|
|
2110
|
-
path: "test.md",
|
|
2111
|
-
}));
|
|
2112
|
-
expect(events.some((event) => event.type === "error" && event.diagnostic !== true)).toBe(false);
|
|
2113
|
-
}
|
|
2114
|
-
else {
|
|
2115
|
-
expect(result.filesSkipped).toBe(0);
|
|
2116
|
-
const errorEvent = events.find((event) => event.type === "error");
|
|
2117
|
-
expect(errorEvent).toMatchObject({ type: "error", path: "test.md" });
|
|
2118
|
-
expect(errorEvent).not.toHaveProperty("diagnostic");
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
finally {
|
|
2122
|
-
vi.mocked(uploadFile).mockReset();
|
|
2123
|
-
vi.mocked(uploadFile).mockResolvedValue({ etag: '"upload-etag"' });
|
|
2124
|
-
}
|
|
2125
|
-
});
|
|
2126
2022
|
it("still emits a hard error when upload throws a generic Error", async () => {
|
|
2127
2023
|
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
2128
2024
|
fs.mkdirSync(companyRoot, { recursive: true });
|
|
@@ -4012,54 +3908,6 @@ describe("share", () => {
|
|
|
4012
3908
|
expect(calls[0][4]).toEqual({ ifNoneMatch: "*" });
|
|
4013
3909
|
expect(calls[1][4]).toBeUndefined();
|
|
4014
3910
|
});
|
|
4015
|
-
it("defers a retryable upload failure after overwrite conflict resolution", async () => {
|
|
4016
|
-
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
4017
|
-
fs.mkdirSync(companyRoot, { recursive: true });
|
|
4018
|
-
const testFile = path.join(companyRoot, "retry-later.md");
|
|
4019
|
-
fs.writeFileSync(testFile, "keep journaled until the next pass");
|
|
4020
|
-
const journalPath = path.join(stateDir, "sync-journal.acme.json");
|
|
4021
|
-
const staleHash = "old-retry-later-hash";
|
|
4022
|
-
seedJournalAt(journalPath, {
|
|
4023
|
-
version: "1",
|
|
4024
|
-
lastSync: new Date(Date.now() - 60_000).toISOString(),
|
|
4025
|
-
files: {
|
|
4026
|
-
"retry-later.md": {
|
|
4027
|
-
hash: staleHash,
|
|
4028
|
-
size: 5,
|
|
4029
|
-
syncedAt: new Date(Date.now() - 60_000).toISOString(),
|
|
4030
|
-
direction: "up",
|
|
4031
|
-
remoteEtag: "old-etag",
|
|
4032
|
-
},
|
|
4033
|
-
},
|
|
4034
|
-
});
|
|
4035
|
-
vi.mocked(headRemoteFile).mockResolvedValueOnce(null);
|
|
4036
|
-
vi.mocked(uploadFile)
|
|
4037
|
-
.mockRejectedValueOnce(fence412())
|
|
4038
|
-
.mockRejectedValueOnce(Object.assign(new Error("retry PUT timed out"), { name: "TimeoutError" }));
|
|
4039
|
-
const events = [];
|
|
4040
|
-
const result = await share({
|
|
4041
|
-
paths: [testFile],
|
|
4042
|
-
company: "acme",
|
|
4043
|
-
vaultConfig: mockConfig,
|
|
4044
|
-
hqRoot: tmpDir,
|
|
4045
|
-
onConflict: "overwrite",
|
|
4046
|
-
onEvent: (event) => events.push(event),
|
|
4047
|
-
});
|
|
4048
|
-
expect(vi.mocked(uploadFile)).toHaveBeenCalledTimes(2);
|
|
4049
|
-
expect(result.filesUploaded).toBe(0);
|
|
4050
|
-
expect(result.filesSkipped).toBe(1);
|
|
4051
|
-
expect(journalAt(journalPath).files["retry-later.md"]).toMatchObject({
|
|
4052
|
-
hash: staleHash,
|
|
4053
|
-
remoteEtag: "old-etag",
|
|
4054
|
-
});
|
|
4055
|
-
expect(events).toContainEqual(expect.objectContaining({
|
|
4056
|
-
type: "error",
|
|
4057
|
-
diagnostic: true,
|
|
4058
|
-
path: "retry-later.md",
|
|
4059
|
-
message: expect.stringContaining("TimeoutError"),
|
|
4060
|
-
}));
|
|
4061
|
-
expect(events.some((event) => event.type === "error" && event.diagnostic !== true)).toBe(false);
|
|
4062
|
-
});
|
|
4063
3911
|
it("412 under abort: halts the pass", async () => {
|
|
4064
3912
|
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
4065
3913
|
fs.mkdirSync(companyRoot, { recursive: true });
|
|
@@ -4813,27 +4661,6 @@ describe("share", () => {
|
|
|
4813
4661
|
expect(putKeys).not.toContain("settings/.gitkeep");
|
|
4814
4662
|
expect(putKeys).not.toContain("projects/.gitkeep");
|
|
4815
4663
|
});
|
|
4816
|
-
it("a private foo/ creation grant lets a member push their new direct child", async () => {
|
|
4817
|
-
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
4818
|
-
const created = path.join(companyRoot, "foo", "new-folder", "x.md");
|
|
4819
|
-
const outside = path.join(companyRoot, "not-granted.md");
|
|
4820
|
-
fs.mkdirSync(path.dirname(created), { recursive: true });
|
|
4821
|
-
fs.writeFileSync(created, "new private child\n");
|
|
4822
|
-
fs.writeFileSync(outside, "not part of the creation grant\n");
|
|
4823
|
-
vi.mocked(headRemoteFile).mockResolvedValue(null);
|
|
4824
|
-
const result = await share({
|
|
4825
|
-
paths: [companyRoot],
|
|
4826
|
-
company: "acme",
|
|
4827
|
-
vaultConfig: mockConfig,
|
|
4828
|
-
hqRoot: tmpDir,
|
|
4829
|
-
prefixSet: [grantPathToPrefix("foo/", "acme")],
|
|
4830
|
-
});
|
|
4831
|
-
expect(result.aborted).toBe(false);
|
|
4832
|
-
expect(result.filesUploaded).toBe(1);
|
|
4833
|
-
expect(vi.mocked(uploadFile).mock.calls.map((call) => call[2])).toEqual([
|
|
4834
|
-
"foo/new-folder/x.md",
|
|
4835
|
-
]);
|
|
4836
|
-
});
|
|
4837
4664
|
it("push surfaces an OVER-BROAD ignore exclusion via ignore-excluded instead of dropping it silently (feedback_b9dfc7ae)", async () => {
|
|
4838
4665
|
// Regression for the silent-drop failure mode behind DEV-1791: an
|
|
4839
4666
|
// over-broad ignore rule (here a deliberately un-anchored `repos/` in
|