@indigoai-us/hq-cloud 6.18.13 → 6.18.14-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.
@@ -352,6 +352,46 @@ describe("sync", () => {
352
352
  }),
353
353
  }));
354
354
  });
355
+ it("uses a bounded directory listing while planning only the named event paths", async () => {
356
+ vi.mocked(targetedUpsertExactListModule.isTargetedUpsertExactListEnabled)
357
+ .mockResolvedValue(true);
358
+ vi.mocked(remotePullModule.listRemoteForScope).mockResolvedValue([
359
+ {
360
+ key: "docs/burst/0000.md",
361
+ size: 20,
362
+ lastModified: new Date(),
363
+ etag: '"targeted"',
364
+ },
365
+ {
366
+ key: "docs/burst/unannounced.md",
367
+ size: 22,
368
+ lastModified: new Date(),
369
+ etag: '"sibling"',
370
+ },
371
+ ]);
372
+ const pullPrefixes = Array.from({ length: 16 }, (_, index) => `docs/burst/${String(index).padStart(4, "0")}.md`);
373
+ const result = await sync({
374
+ company: "acme",
375
+ vaultConfig: mockConfig,
376
+ hqRoot: tmpDir,
377
+ syncMode: "custom",
378
+ prefixSet: ["docs/"],
379
+ pullPrefixes,
380
+ pullExactPaths: pullPrefixes,
381
+ skipReindex: true,
382
+ });
383
+ expect(result.filesDownloaded).toBe(1);
384
+ expect(fs.existsSync(path.join(tmpDir, "companies", "acme", "docs", "burst", "0000.md")))
385
+ .toBe(true);
386
+ expect(fs.existsSync(path.join(tmpDir, "companies", "acme", "docs", "burst", "unannounced.md")))
387
+ .toBe(false);
388
+ expect(remotePullModule.listRemoteForScope).toHaveBeenCalledWith(expect.objectContaining({
389
+ scope: expect.objectContaining({
390
+ prefixSet: ["docs/burst/"],
391
+ strategy: "vend-fanout",
392
+ }),
393
+ }));
394
+ });
355
395
  it("does not wait for a never-settling flag read and keeps the pull on legacy scope", async () => {
356
396
  let markFlagFetchStarted;
357
397
  const flagFetchStarted = new Promise((resolve) => {
@@ -1652,6 +1692,7 @@ describe("sync", () => {
1652
1692
  changeMessageVisibilityBatch: async () => ({ failedEntries: [] }),
1653
1693
  };
1654
1694
  const results = [];
1695
+ const receiverBatchSizes = [];
1655
1696
  const receiver = new SqsPushReceiver({
1656
1697
  tenantId: "tenant-acme",
1657
1698
  queueUrl: "https://queue.test/targeted-pull",
@@ -1660,6 +1701,7 @@ describe("sync", () => {
1660
1701
  drainMaxMessages: 256,
1661
1702
  publishMetric: async () => undefined,
1662
1703
  syncBatchFn: async ({ events }) => {
1704
+ receiverBatchSizes.push(events.length);
1663
1705
  const argv = buildTargetedPullArgv({ kind: "personal" }, [], events.map((event) => event.relativePath));
1664
1706
  results.push(await sync({
1665
1707
  company: "acme",
@@ -1672,8 +1714,9 @@ describe("sync", () => {
1672
1714
  },
1673
1715
  });
1674
1716
  await receiver.start();
1675
- await vi.waitFor(() => expect(deleted).toHaveLength(512));
1717
+ await vi.waitFor(() => expect(deleted).toHaveLength(512), { timeout: 10_000 });
1676
1718
  await receiver.dispose();
1719
+ expect(receiverBatchSizes).toEqual([256, 256]);
1677
1720
  expect(results.map((result) => result.filesDownloaded)).toEqual([1, 1]);
1678
1721
  expect(fs.existsSync(path.join(tmpDir, personalKey))).toBe(true);
1679
1722
  expect(fs.existsSync(path.join(tmpDir, threadKey))).toBe(true);