@indigoai-us/hq-cloud 6.16.85-alpha.0 → 6.16.87-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.
Files changed (73) hide show
  1. package/dist/bin/sync-runner-company.js +2 -2
  2. package/dist/bin/sync-runner-company.js.map +1 -1
  3. package/dist/bin/sync-runner-watch-loop.d.ts +21 -0
  4. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  5. package/dist/bin/sync-runner-watch-loop.js +100 -32
  6. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  7. package/dist/bin/sync-runner.d.ts +0 -2
  8. package/dist/bin/sync-runner.d.ts.map +1 -1
  9. package/dist/bin/sync-runner.js.map +1 -1
  10. package/dist/bin/sync-runner.test.js +286 -148
  11. package/dist/bin/sync-runner.test.js.map +1 -1
  12. package/dist/cli/share.d.ts.map +1 -1
  13. package/dist/cli/share.js +7 -14
  14. package/dist/cli/share.js.map +1 -1
  15. package/dist/cli/share.test.js +22 -72
  16. package/dist/cli/share.test.js.map +1 -1
  17. package/dist/cli/sync-scope.test.js +34 -0
  18. package/dist/cli/sync-scope.test.js.map +1 -1
  19. package/dist/cli/sync.d.ts.map +1 -1
  20. package/dist/cli/sync.js +4 -4
  21. package/dist/cli/sync.js.map +1 -1
  22. package/dist/cli/sync.test.js +43 -9
  23. package/dist/cli/sync.test.js.map +1 -1
  24. package/dist/lib/describe-error.d.ts.map +1 -1
  25. package/dist/lib/describe-error.js +2 -0
  26. package/dist/lib/describe-error.js.map +1 -1
  27. package/dist/lib/describe-error.test.js +8 -0
  28. package/dist/lib/describe-error.test.js.map +1 -1
  29. package/dist/prefix-coalesce.d.ts +37 -30
  30. package/dist/prefix-coalesce.d.ts.map +1 -1
  31. package/dist/prefix-coalesce.js +104 -16
  32. package/dist/prefix-coalesce.js.map +1 -1
  33. package/dist/prefix-coalesce.test.js +34 -3
  34. package/dist/prefix-coalesce.test.js.map +1 -1
  35. package/dist/remote-pull.d.ts.map +1 -1
  36. package/dist/remote-pull.js +15 -8
  37. package/dist/remote-pull.js.map +1 -1
  38. package/dist/remote-pull.test.js +44 -4
  39. package/dist/remote-pull.test.js.map +1 -1
  40. package/dist/scope-shrink.d.ts.map +1 -1
  41. package/dist/scope-shrink.js +7 -1
  42. package/dist/scope-shrink.js.map +1 -1
  43. package/dist/sync/event-sync.d.ts +2 -0
  44. package/dist/sync/event-sync.d.ts.map +1 -1
  45. package/dist/sync/event-sync.js +5 -4
  46. package/dist/sync/event-sync.js.map +1 -1
  47. package/dist/sync/event-sync.test.js +67 -2
  48. package/dist/sync/event-sync.test.js.map +1 -1
  49. package/dist/sync/pull-scope.d.ts +2 -0
  50. package/dist/sync/pull-scope.d.ts.map +1 -1
  51. package/dist/sync/pull-scope.js +15 -5
  52. package/dist/sync/pull-scope.js.map +1 -1
  53. package/dist/sync/push-receiver.d.ts +5 -0
  54. package/dist/sync/push-receiver.d.ts.map +1 -1
  55. package/dist/sync/push-receiver.js +36 -15
  56. package/dist/sync/push-receiver.js.map +1 -1
  57. package/dist/sync/push-receiver.test.js +184 -44
  58. package/dist/sync/push-receiver.test.js.map +1 -1
  59. package/dist/watcher.d.ts +4 -0
  60. package/dist/watcher.d.ts.map +1 -1
  61. package/dist/watcher.js +16 -4
  62. package/dist/watcher.js.map +1 -1
  63. package/dist/watcher.test.js +50 -3
  64. package/dist/watcher.test.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/sync/full-pass-interval.d.ts +0 -25
  67. package/dist/sync/full-pass-interval.d.ts.map +0 -1
  68. package/dist/sync/full-pass-interval.js +0 -53
  69. package/dist/sync/full-pass-interval.js.map +0 -1
  70. package/dist/sync/full-pass-interval.test.d.ts +0 -2
  71. package/dist/sync/full-pass-interval.test.d.ts.map +0 -1
  72. package/dist/sync/full-pass-interval.test.js +0 -21
  73. package/dist/sync/full-pass-interval.test.js.map +0 -1
@@ -73,6 +73,7 @@ import { AreaLedgerMigration, closeCachedAreaJournalMigration, hashFile, openJou
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";
76
77
  /**
77
78
  * Read a journal the way production does.
78
79
  *
@@ -4035,12 +4036,6 @@ describe("share", () => {
4035
4036
  vi.mocked(uploadFile)
4036
4037
  .mockRejectedValueOnce(fence412())
4037
4038
  .mockRejectedValueOnce(Object.assign(new Error("retry PUT timed out"), { name: "TimeoutError" }));
4038
- const store = ReconcileCursorStore.open({
4039
- rootDir: stateDir,
4040
- journalSlug: "acme",
4041
- layoutEpoch: 1,
4042
- areaId: "root:notes",
4043
- });
4044
4039
  const events = [];
4045
4040
  const result = await share({
4046
4041
  paths: [testFile],
@@ -4049,16 +4044,6 @@ describe("share", () => {
4049
4044
  hqRoot: tmpDir,
4050
4045
  onConflict: "overwrite",
4051
4046
  onEvent: (event) => events.push(event),
4052
- reconcileApply: {
4053
- store,
4054
- cursor: {
4055
- routerVersion: 1,
4056
- epoch: "epoch-overwrite",
4057
- areaId: "root:notes",
4058
- phase: "apply",
4059
- journalAfterKey: "retry-later.md",
4060
- },
4061
- },
4062
4047
  });
4063
4048
  expect(vi.mocked(uploadFile)).toHaveBeenCalledTimes(2);
4064
4049
  expect(result.filesUploaded).toBe(0);
@@ -4074,62 +4059,6 @@ describe("share", () => {
4074
4059
  message: expect.stringContaining("TimeoutError"),
4075
4060
  }));
4076
4061
  expect(events.some((event) => event.type === "error" && event.diagnostic !== true)).toBe(false);
4077
- expect(store.read().cursor).toBeUndefined();
4078
- });
4079
- it("withholds an apply checkpoint when a version-aware local retry is deferred", async () => {
4080
- const companyRoot = path.join(tmpDir, "companies", "acme");
4081
- fs.mkdirSync(companyRoot, { recursive: true });
4082
- const testFile = path.join(companyRoot, "retry-local-winner.md");
4083
- fs.writeFileSync(testFile, "---\nversion: 10\n---\nlocal body\n");
4084
- vi.mocked(headRemoteFile)
4085
- .mockResolvedValueOnce(null)
4086
- .mockResolvedValueOnce({
4087
- lastModified: new Date(),
4088
- etag: '"peer-etag"',
4089
- size: 31,
4090
- });
4091
- vi.mocked(downloadFile).mockImplementationOnce(async (_ctx, _key, destination) => {
4092
- fs.writeFileSync(destination, "---\nversion: 8\n---\nremote body\n");
4093
- return undefined;
4094
- });
4095
- vi.mocked(uploadFile)
4096
- .mockRejectedValueOnce(fence412())
4097
- .mockRejectedValueOnce(Object.assign(new Error("retry PUT timed out"), { name: "TimeoutError" }));
4098
- const store = ReconcileCursorStore.open({
4099
- rootDir: stateDir,
4100
- journalSlug: "acme",
4101
- layoutEpoch: 1,
4102
- areaId: "root:notes",
4103
- });
4104
- const events = [];
4105
- const result = await share({
4106
- paths: [testFile],
4107
- company: "acme",
4108
- vaultConfig: mockConfig,
4109
- hqRoot: tmpDir,
4110
- onConflict: "keep",
4111
- onEvent: (event) => events.push(event),
4112
- reconcileApply: {
4113
- store,
4114
- cursor: {
4115
- routerVersion: 1,
4116
- epoch: "epoch-local-winner",
4117
- areaId: "root:notes",
4118
- phase: "apply",
4119
- journalAfterKey: "retry-local-winner.md",
4120
- },
4121
- },
4122
- });
4123
- expect(vi.mocked(uploadFile)).toHaveBeenCalledTimes(2);
4124
- expect(result.filesUploaded).toBe(0);
4125
- expect(result.filesSkipped).toBe(1);
4126
- expect(store.read().cursor).toBeUndefined();
4127
- expect(events).toContainEqual(expect.objectContaining({
4128
- type: "error",
4129
- diagnostic: true,
4130
- path: "retry-local-winner.md",
4131
- message: expect.stringContaining("TimeoutError"),
4132
- }));
4133
4062
  });
4134
4063
  it("412 under abort: halts the pass", async () => {
4135
4064
  const companyRoot = path.join(tmpDir, "companies", "acme");
@@ -4884,6 +4813,27 @@ describe("share", () => {
4884
4813
  expect(putKeys).not.toContain("settings/.gitkeep");
4885
4814
  expect(putKeys).not.toContain("projects/.gitkeep");
4886
4815
  });
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
+ });
4887
4837
  it("push surfaces an OVER-BROAD ignore exclusion via ignore-excluded instead of dropping it silently (feedback_b9dfc7ae)", async () => {
4888
4838
  // Regression for the silent-drop failure mode behind DEV-1791: an
4889
4839
  // over-broad ignore rule (here a deliberately un-anchored `repos/` in