@indigoai-us/hq-cloud 5.22.0 → 5.23.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/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +76 -1
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +148 -1
- package/dist/journal.js.map +1 -1
- package/dist/journal.test.js +251 -5
- package/dist/journal.test.js.map +1 -1
- package/dist/prefix-coalesce.d.ts +38 -0
- package/dist/prefix-coalesce.d.ts.map +1 -0
- package/dist/prefix-coalesce.js +69 -0
- package/dist/prefix-coalesce.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 +77 -0
- package/dist/prefix-coalesce.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 +105 -0
- package/dist/public-surface.test.js.map +1 -0
- package/dist/remote-pull.d.ts +145 -1
- package/dist/remote-pull.d.ts.map +1 -1
- package/dist/remote-pull.js +258 -1
- package/dist/remote-pull.js.map +1 -1
- package/dist/remote-pull.test.js +470 -2
- package/dist/remote-pull.test.js.map +1 -1
- package/dist/scope-shrink.d.ts +109 -0
- package/dist/scope-shrink.d.ts.map +1 -0
- package/dist/scope-shrink.js +196 -0
- package/dist/scope-shrink.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 +342 -0
- package/dist/scope-shrink.test.js.map +1 -0
- package/dist/types.d.ts +48 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/vault-client.d.ts +178 -0
- package/dist/vault-client.d.ts.map +1 -1
- package/dist/vault-client.js +73 -0
- package/dist/vault-client.js.map +1 -1
- package/dist/vault-client.test.js +226 -0
- package/dist/vault-client.test.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +67 -0
- package/src/journal.test.ts +284 -5
- package/src/journal.ts +167 -2
- package/src/prefix-coalesce.test.ts +95 -0
- package/src/prefix-coalesce.ts +72 -0
- package/src/public-surface.test.ts +112 -0
- package/src/remote-pull.test.ts +540 -3
- package/src/remote-pull.ts +419 -2
- package/src/scope-shrink.test.ts +402 -0
- package/src/scope-shrink.ts +264 -0
- package/src/types.ts +49 -1
- package/src/vault-client.test.ts +335 -0
- package/src/vault-client.ts +223 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope-shrink detection + classification + clean removal (US-005).
|
|
3
|
+
*
|
|
4
|
+
* Implements the "hybrid scope-change contract" decided in US-000 Task 3
|
|
5
|
+
* (see companies/indigo/projects/hq-sync-browse-vs-sync/references.md):
|
|
6
|
+
*
|
|
7
|
+
* - Compare the current pull's `prefixSet` against the last `PullRecord`'s
|
|
8
|
+
* `prefixSet` for the same company. Files in the journal covered by the
|
|
9
|
+
* previous scope but NOT covered by the new scope are **orphans**.
|
|
10
|
+
* - Classify each orphan **clean** (safe to silently delete) or **dirty**
|
|
11
|
+
* (locally modified — sacred, never silently delete).
|
|
12
|
+
* - The remote-pull caller drives:
|
|
13
|
+
* * default mode: abort the leg if any dirty orphan exists;
|
|
14
|
+
* * `--force-scope-shrink`: continue, leave dirty files on disk,
|
|
15
|
+
* tombstone their journal entries.
|
|
16
|
+
*
|
|
17
|
+
* The pure-detection layer here intentionally does NOT touch disk for the
|
|
18
|
+
* tombstone write — that lives in `journal.ts`. It DOES touch disk for the
|
|
19
|
+
* orphan classification (hash + stat) because cleanliness is a function of
|
|
20
|
+
* the file's current on-disk state vs the journal.
|
|
21
|
+
*/
|
|
22
|
+
import * as fs from "fs";
|
|
23
|
+
import * as path from "path";
|
|
24
|
+
import { hashFile, tombstoneEntry } from "./journal.js";
|
|
25
|
+
import { isCoveredByAny } from "./prefix-coalesce.js";
|
|
26
|
+
/**
|
|
27
|
+
* Build a scope-shrink plan: find orphans, classify each clean/dirty.
|
|
28
|
+
* Pure given the journal + filesystem state — no network, no journal
|
|
29
|
+
* mutation.
|
|
30
|
+
*
|
|
31
|
+
* **Tombstone-aware:** journal entries that already carry a `removedAt`
|
|
32
|
+
* marker are skipped — they represent a prior scope-shrink prune and must
|
|
33
|
+
* not be re-flagged as orphans on each subsequent pull (that's the whole
|
|
34
|
+
* point of the tombstone retention window).
|
|
35
|
+
*
|
|
36
|
+
* **Direction-aware:** only `direction: "down"` entries (and pre-ETag
|
|
37
|
+
* legacy entries without an explicit direction marker) participate in
|
|
38
|
+
* shrink detection. Push-only files (`direction: "up"`) represent local
|
|
39
|
+
* authorship — they aren't in scope-as-pulled, so a scope change doesn't
|
|
40
|
+
* orphan them.
|
|
41
|
+
*/
|
|
42
|
+
export function buildScopeShrinkPlan(input) {
|
|
43
|
+
const { journal, hqRoot, lastPrefixSet, currentPrefixSet } = input;
|
|
44
|
+
const orphans = [];
|
|
45
|
+
for (const [relPath, entry] of Object.entries(journal.files)) {
|
|
46
|
+
if (entry.removedAt)
|
|
47
|
+
continue; // tombstone — already pruned
|
|
48
|
+
if (entry.direction !== "down")
|
|
49
|
+
continue;
|
|
50
|
+
if (!isCoveredByAny(relPath, lastPrefixSet))
|
|
51
|
+
continue;
|
|
52
|
+
if (isCoveredByAny(relPath, currentPrefixSet))
|
|
53
|
+
continue;
|
|
54
|
+
orphans.push(classifyOrphan(relPath, entry, hqRoot));
|
|
55
|
+
}
|
|
56
|
+
const clean = orphans.filter((o) => o.clean);
|
|
57
|
+
const dirty = orphans.filter((o) => !o.clean);
|
|
58
|
+
return {
|
|
59
|
+
orphans,
|
|
60
|
+
clean,
|
|
61
|
+
dirty,
|
|
62
|
+
scopeChangeDetected: orphans.length > 0,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Classify a single orphan:
|
|
67
|
+
*
|
|
68
|
+
* - **Clean** when:
|
|
69
|
+
* * the local file is missing (already removed by the user — harmless), OR
|
|
70
|
+
* * `sha256(localFile) === entry.hash` AND `stat.mtime ≤ entry.syncedAt`.
|
|
71
|
+
* - **Dirty** otherwise.
|
|
72
|
+
*
|
|
73
|
+
* Symlinks: we don't re-hash with the symlink-target convention here —
|
|
74
|
+
* the safer default is to treat any symlink whose lstat exists but whose
|
|
75
|
+
* target hash doesn't match `entry.hash` (via `hashFile` reading the
|
|
76
|
+
* target) as dirty. In practice symlinks materialize through the same
|
|
77
|
+
* code path as files; a stale-target symlink is correctly flagged dirty
|
|
78
|
+
* and the operator-facing message points at the path either way.
|
|
79
|
+
*/
|
|
80
|
+
function classifyOrphan(relPath, entry, hqRoot) {
|
|
81
|
+
const absPath = path.join(hqRoot, relPath);
|
|
82
|
+
let stat;
|
|
83
|
+
try {
|
|
84
|
+
stat = fs.lstatSync(absPath);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
const code = err.code;
|
|
88
|
+
if (code === "ENOENT") {
|
|
89
|
+
return { path: relPath, entry, clean: true };
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
path: relPath,
|
|
93
|
+
entry,
|
|
94
|
+
clean: false,
|
|
95
|
+
dirtyReason: "stat-error",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// mtime guard: a local edit moves mtime past syncedAt. We use ≤ because
|
|
99
|
+
// a download stamps syncedAt at the close of the write; mtime is set by
|
|
100
|
+
// the OS before that, so an unmodified pulled file has mtime ≤ syncedAt.
|
|
101
|
+
const mtimeMs = stat.mtimeMs;
|
|
102
|
+
const syncedAtMs = Date.parse(entry.syncedAt);
|
|
103
|
+
if (!Number.isNaN(syncedAtMs) && mtimeMs > syncedAtMs + 1000) {
|
|
104
|
+
// 1s grace for filesystem clock jitter.
|
|
105
|
+
return {
|
|
106
|
+
path: relPath,
|
|
107
|
+
entry,
|
|
108
|
+
clean: false,
|
|
109
|
+
dirtyReason: "modified-after-sync",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// Hash check — final word. If the content matches the journaled hash,
|
|
113
|
+
// the file is provably what the last pull left there.
|
|
114
|
+
let actualHash;
|
|
115
|
+
try {
|
|
116
|
+
actualHash = hashFile(absPath);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return {
|
|
120
|
+
path: relPath,
|
|
121
|
+
entry,
|
|
122
|
+
clean: false,
|
|
123
|
+
dirtyReason: "stat-error",
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (actualHash !== entry.hash) {
|
|
127
|
+
return {
|
|
128
|
+
path: relPath,
|
|
129
|
+
entry,
|
|
130
|
+
clean: false,
|
|
131
|
+
dirtyReason: "hash-mismatch",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return { path: relPath, entry, clean: true };
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Structured error thrown when the engine refuses to proceed because a scope
|
|
138
|
+
* shrink would orphan dirty files. The CLI catches this and renders the
|
|
139
|
+
* operator-facing message; the engine never prints directly.
|
|
140
|
+
*/
|
|
141
|
+
export class ScopeShrinkBlockedError extends Error {
|
|
142
|
+
companyUid;
|
|
143
|
+
fromMode;
|
|
144
|
+
toMode;
|
|
145
|
+
dirty;
|
|
146
|
+
clean;
|
|
147
|
+
code = "SCOPE_SHRINK_BLOCKED";
|
|
148
|
+
constructor(companyUid, fromMode, toMode, dirty, clean) {
|
|
149
|
+
super(`Sync scope shrank for ${companyUid} (${fromMode} → ${toMode}); ` +
|
|
150
|
+
`${dirty.length} dirty file(s) outside the new scope would be ` +
|
|
151
|
+
`pruned from the journal. Resolve or pass --force-scope-shrink.`);
|
|
152
|
+
this.companyUid = companyUid;
|
|
153
|
+
this.fromMode = fromMode;
|
|
154
|
+
this.toMode = toMode;
|
|
155
|
+
this.dirty = dirty;
|
|
156
|
+
this.clean = clean;
|
|
157
|
+
this.name = "ScopeShrinkBlockedError";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Apply a scope-shrink plan: delete clean orphans on disk + tombstone their
|
|
162
|
+
* journal entries. With `forceScopeShrink: true`, dirty orphans are
|
|
163
|
+
* preserved on disk but their journal entries are also tombstoned.
|
|
164
|
+
*
|
|
165
|
+
* Returns counts for the audit log row (`scope_shrink_blocked` /
|
|
166
|
+
* `scope_shrink_forced`).
|
|
167
|
+
*/
|
|
168
|
+
export function applyScopeShrink(input) {
|
|
169
|
+
const { journal, plan, hqRoot, forceScopeShrink } = input;
|
|
170
|
+
const reason = input.reason ?? "scope_shrink";
|
|
171
|
+
let cleanRemoved = 0;
|
|
172
|
+
let dirtyTombstoned = 0;
|
|
173
|
+
for (const orphan of plan.clean) {
|
|
174
|
+
const absPath = path.join(hqRoot, orphan.path);
|
|
175
|
+
try {
|
|
176
|
+
fs.unlinkSync(absPath);
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
const code = err.code;
|
|
180
|
+
if (code !== "ENOENT")
|
|
181
|
+
throw err; // missing-on-disk is fine; anything else escalates
|
|
182
|
+
}
|
|
183
|
+
tombstoneEntry(journal, orphan.path, reason);
|
|
184
|
+
cleanRemoved++;
|
|
185
|
+
}
|
|
186
|
+
if (forceScopeShrink) {
|
|
187
|
+
for (const orphan of plan.dirty) {
|
|
188
|
+
// Do NOT delete the file — that's the entire point of the `--force`
|
|
189
|
+
// contract: keep dirty content on disk, prune only the journal entry.
|
|
190
|
+
tombstoneEntry(journal, orphan.path, reason);
|
|
191
|
+
dirtyTombstoned++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return { cleanRemoved, dirtyTombstoned };
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=scope-shrink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-shrink.js","sourceRoot":"","sources":["../src/scope-shrink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;A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CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC;YACH,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;YACjD,IAAI,IAAI,KAAK,QAAQ;gBAAE,MAAM,GAAG,CAAC,CAAC,mDAAmD;QACvF,CAAC;QACD,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,oEAAoE;YACpE,sEAAsE;YACtE,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC7C,eAAe,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope-shrink detection + classification + clean removal (US-005).
|
|
3
|
+
*
|
|
4
|
+
* Pins the hybrid-contract semantics decided in US-000 Task 3:
|
|
5
|
+
* - orphans = (covered by last scope) ∧ ¬(covered by current scope)
|
|
6
|
+
* - tombstones are NOT re-flagged on subsequent pulls
|
|
7
|
+
* - clean orphan: local missing OR hash matches + mtime ≤ syncedAt
|
|
8
|
+
* - dirty orphan: anything else
|
|
9
|
+
* - applyScopeShrink deletes clean orphans, leaves dirty files alone
|
|
10
|
+
* when `forceScopeShrink: true` but tombstones the journal entry
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=scope-shrink.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-shrink.test.d.ts","sourceRoot":"","sources":["../src/scope-shrink.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope-shrink detection + classification + clean removal (US-005).
|
|
3
|
+
*
|
|
4
|
+
* Pins the hybrid-contract semantics decided in US-000 Task 3:
|
|
5
|
+
* - orphans = (covered by last scope) ∧ ¬(covered by current scope)
|
|
6
|
+
* - tombstones are NOT re-flagged on subsequent pulls
|
|
7
|
+
* - clean orphan: local missing OR hash matches + mtime ≤ syncedAt
|
|
8
|
+
* - dirty orphan: anything else
|
|
9
|
+
* - applyScopeShrink deletes clean orphans, leaves dirty files alone
|
|
10
|
+
* when `forceScopeShrink: true` but tombstones the journal entry
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
13
|
+
import * as fs from "fs";
|
|
14
|
+
import * as os from "os";
|
|
15
|
+
import * as path from "path";
|
|
16
|
+
import * as crypto from "crypto";
|
|
17
|
+
import { buildScopeShrinkPlan, applyScopeShrink, ScopeShrinkBlockedError, } from "./scope-shrink.js";
|
|
18
|
+
function sha256(content) {
|
|
19
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
20
|
+
}
|
|
21
|
+
function emptyJournal() {
|
|
22
|
+
return { version: "2", lastSync: "", files: {}, pulls: [] };
|
|
23
|
+
}
|
|
24
|
+
describe("buildScopeShrinkPlan", () => {
|
|
25
|
+
let hqRoot;
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scope-shrink-"));
|
|
28
|
+
});
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
31
|
+
});
|
|
32
|
+
it("returns empty plan when no orphans exist", () => {
|
|
33
|
+
const journal = {
|
|
34
|
+
...emptyJournal(),
|
|
35
|
+
files: {
|
|
36
|
+
"companies/indigo/meetings/a.md": {
|
|
37
|
+
hash: "h",
|
|
38
|
+
size: 1,
|
|
39
|
+
syncedAt: "2026-05-01T00:00:00.000Z",
|
|
40
|
+
direction: "down",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const plan = buildScopeShrinkPlan({
|
|
45
|
+
journal,
|
|
46
|
+
hqRoot,
|
|
47
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
48
|
+
currentPrefixSet: ["companies/indigo/"],
|
|
49
|
+
});
|
|
50
|
+
expect(plan.orphans).toEqual([]);
|
|
51
|
+
expect(plan.scopeChangeDetected).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
it("flags files covered by lastPrefixSet but not currentPrefixSet as orphans", () => {
|
|
54
|
+
const meetingsAbs = path.join(hqRoot, "companies/indigo/meetings/a.md");
|
|
55
|
+
const scratchAbs = path.join(hqRoot, "companies/indigo/scratch/jacob/draft.md");
|
|
56
|
+
fs.mkdirSync(path.dirname(meetingsAbs), { recursive: true });
|
|
57
|
+
fs.mkdirSync(path.dirname(scratchAbs), { recursive: true });
|
|
58
|
+
fs.writeFileSync(meetingsAbs, "meetings");
|
|
59
|
+
fs.writeFileSync(scratchAbs, "draft");
|
|
60
|
+
const now = new Date().toISOString();
|
|
61
|
+
const journal = {
|
|
62
|
+
...emptyJournal(),
|
|
63
|
+
files: {
|
|
64
|
+
"companies/indigo/meetings/a.md": {
|
|
65
|
+
hash: sha256("meetings"),
|
|
66
|
+
size: 8,
|
|
67
|
+
syncedAt: now,
|
|
68
|
+
direction: "down",
|
|
69
|
+
},
|
|
70
|
+
"companies/indigo/scratch/jacob/draft.md": {
|
|
71
|
+
hash: sha256("draft"),
|
|
72
|
+
size: 5,
|
|
73
|
+
syncedAt: now,
|
|
74
|
+
direction: "down",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
// Backdate the scratch file so mtime ≤ syncedAt.
|
|
79
|
+
const past = Date.now() - 60_000;
|
|
80
|
+
fs.utimesSync(scratchAbs, past / 1000, past / 1000);
|
|
81
|
+
fs.utimesSync(meetingsAbs, past / 1000, past / 1000);
|
|
82
|
+
const plan = buildScopeShrinkPlan({
|
|
83
|
+
journal,
|
|
84
|
+
hqRoot,
|
|
85
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
86
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
87
|
+
});
|
|
88
|
+
expect(plan.orphans.map((o) => o.path)).toEqual([
|
|
89
|
+
"companies/indigo/scratch/jacob/draft.md",
|
|
90
|
+
]);
|
|
91
|
+
expect(plan.clean).toHaveLength(1);
|
|
92
|
+
expect(plan.dirty).toHaveLength(0);
|
|
93
|
+
expect(plan.scopeChangeDetected).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it("classifies a locally modified orphan as dirty (hash mismatch)", () => {
|
|
96
|
+
const abs = path.join(hqRoot, "companies/indigo/scratch/notes.md");
|
|
97
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
98
|
+
fs.writeFileSync(abs, "ORIGINAL");
|
|
99
|
+
const journal = {
|
|
100
|
+
...emptyJournal(),
|
|
101
|
+
files: {
|
|
102
|
+
"companies/indigo/scratch/notes.md": {
|
|
103
|
+
hash: sha256("DIFFERENT"), // doesn't match what's on disk
|
|
104
|
+
size: 8,
|
|
105
|
+
syncedAt: new Date().toISOString(),
|
|
106
|
+
direction: "down",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
const plan = buildScopeShrinkPlan({
|
|
111
|
+
journal,
|
|
112
|
+
hqRoot,
|
|
113
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
114
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
115
|
+
});
|
|
116
|
+
expect(plan.dirty).toHaveLength(1);
|
|
117
|
+
expect(plan.dirty[0]?.dirtyReason).toBe("hash-mismatch");
|
|
118
|
+
});
|
|
119
|
+
it("classifies a recently mtime-touched file as dirty", () => {
|
|
120
|
+
const abs = path.join(hqRoot, "companies/indigo/scratch/notes.md");
|
|
121
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
122
|
+
fs.writeFileSync(abs, "ORIGINAL");
|
|
123
|
+
const syncedAt = new Date(Date.now() - 60_000).toISOString();
|
|
124
|
+
// Touch mtime forward, well past syncedAt + 1s grace.
|
|
125
|
+
const future = Date.now() + 10_000;
|
|
126
|
+
fs.utimesSync(abs, future / 1000, future / 1000);
|
|
127
|
+
const journal = {
|
|
128
|
+
...emptyJournal(),
|
|
129
|
+
files: {
|
|
130
|
+
"companies/indigo/scratch/notes.md": {
|
|
131
|
+
hash: sha256("ORIGINAL"), // hash matches, but mtime is forward
|
|
132
|
+
size: 8,
|
|
133
|
+
syncedAt,
|
|
134
|
+
direction: "down",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
const plan = buildScopeShrinkPlan({
|
|
139
|
+
journal,
|
|
140
|
+
hqRoot,
|
|
141
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
142
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
143
|
+
});
|
|
144
|
+
expect(plan.dirty).toHaveLength(1);
|
|
145
|
+
expect(plan.dirty[0]?.dirtyReason).toBe("modified-after-sync");
|
|
146
|
+
});
|
|
147
|
+
it("treats a locally-missing orphan as clean (already removed by user)", () => {
|
|
148
|
+
const journal = {
|
|
149
|
+
...emptyJournal(),
|
|
150
|
+
files: {
|
|
151
|
+
"companies/indigo/scratch/gone.md": {
|
|
152
|
+
hash: sha256("gone"),
|
|
153
|
+
size: 4,
|
|
154
|
+
syncedAt: new Date().toISOString(),
|
|
155
|
+
direction: "down",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
const plan = buildScopeShrinkPlan({
|
|
160
|
+
journal,
|
|
161
|
+
hqRoot,
|
|
162
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
163
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
164
|
+
});
|
|
165
|
+
expect(plan.clean).toHaveLength(1);
|
|
166
|
+
expect(plan.clean[0]?.path).toBe("companies/indigo/scratch/gone.md");
|
|
167
|
+
});
|
|
168
|
+
it("skips tombstoned entries (do not re-flag on subsequent pulls)", () => {
|
|
169
|
+
const journal = {
|
|
170
|
+
...emptyJournal(),
|
|
171
|
+
files: {
|
|
172
|
+
"companies/indigo/scratch/already.md": {
|
|
173
|
+
hash: "h",
|
|
174
|
+
size: 1,
|
|
175
|
+
syncedAt: "2026-05-01T00:00:00.000Z",
|
|
176
|
+
direction: "down",
|
|
177
|
+
removedAt: "2026-05-02T00:00:00.000Z",
|
|
178
|
+
removedReason: "scope_shrink",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
const plan = buildScopeShrinkPlan({
|
|
183
|
+
journal,
|
|
184
|
+
hqRoot,
|
|
185
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
186
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
187
|
+
});
|
|
188
|
+
expect(plan.orphans).toEqual([]);
|
|
189
|
+
});
|
|
190
|
+
it("skips push-only entries (direction: 'up')", () => {
|
|
191
|
+
const journal = {
|
|
192
|
+
...emptyJournal(),
|
|
193
|
+
files: {
|
|
194
|
+
"companies/indigo/scratch/local-only.md": {
|
|
195
|
+
hash: "h",
|
|
196
|
+
size: 1,
|
|
197
|
+
syncedAt: "2026-05-01T00:00:00.000Z",
|
|
198
|
+
direction: "up",
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
const plan = buildScopeShrinkPlan({
|
|
203
|
+
journal,
|
|
204
|
+
hqRoot,
|
|
205
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
206
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
207
|
+
});
|
|
208
|
+
expect(plan.orphans).toEqual([]);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
describe("applyScopeShrink", () => {
|
|
212
|
+
let hqRoot;
|
|
213
|
+
beforeEach(() => {
|
|
214
|
+
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-scope-shrink-apply-"));
|
|
215
|
+
});
|
|
216
|
+
afterEach(() => {
|
|
217
|
+
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
218
|
+
});
|
|
219
|
+
it("deletes clean orphans on disk + tombstones their journal entries", () => {
|
|
220
|
+
const abs = path.join(hqRoot, "companies/indigo/scratch/clean.md");
|
|
221
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
222
|
+
fs.writeFileSync(abs, "clean");
|
|
223
|
+
const syncedAt = new Date().toISOString();
|
|
224
|
+
const past = Date.now() - 60_000;
|
|
225
|
+
fs.utimesSync(abs, past / 1000, past / 1000);
|
|
226
|
+
const journal = {
|
|
227
|
+
...emptyJournal(),
|
|
228
|
+
files: {
|
|
229
|
+
"companies/indigo/scratch/clean.md": {
|
|
230
|
+
hash: sha256("clean"),
|
|
231
|
+
size: 5,
|
|
232
|
+
syncedAt,
|
|
233
|
+
direction: "down",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
const plan = buildScopeShrinkPlan({
|
|
238
|
+
journal,
|
|
239
|
+
hqRoot,
|
|
240
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
241
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
242
|
+
});
|
|
243
|
+
const result = applyScopeShrink({
|
|
244
|
+
journal,
|
|
245
|
+
plan,
|
|
246
|
+
hqRoot,
|
|
247
|
+
forceScopeShrink: false,
|
|
248
|
+
});
|
|
249
|
+
expect(result.cleanRemoved).toBe(1);
|
|
250
|
+
expect(result.dirtyTombstoned).toBe(0);
|
|
251
|
+
expect(fs.existsSync(abs)).toBe(false);
|
|
252
|
+
expect(journal.files["companies/indigo/scratch/clean.md"]?.removedAt).toBeTruthy();
|
|
253
|
+
expect(journal.files["companies/indigo/scratch/clean.md"]?.removedReason).toBe("scope_shrink");
|
|
254
|
+
});
|
|
255
|
+
it("leaves dirty files on disk when forceScopeShrink: true, but tombstones the entry", () => {
|
|
256
|
+
const abs = path.join(hqRoot, "companies/indigo/scratch/dirty.md");
|
|
257
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
258
|
+
fs.writeFileSync(abs, "MODIFIED");
|
|
259
|
+
const journal = {
|
|
260
|
+
...emptyJournal(),
|
|
261
|
+
files: {
|
|
262
|
+
"companies/indigo/scratch/dirty.md": {
|
|
263
|
+
hash: sha256("ORIGINAL"), // mismatch — dirty
|
|
264
|
+
size: 8,
|
|
265
|
+
syncedAt: new Date().toISOString(),
|
|
266
|
+
direction: "down",
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
const plan = buildScopeShrinkPlan({
|
|
271
|
+
journal,
|
|
272
|
+
hqRoot,
|
|
273
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
274
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
275
|
+
});
|
|
276
|
+
const result = applyScopeShrink({
|
|
277
|
+
journal,
|
|
278
|
+
plan,
|
|
279
|
+
hqRoot,
|
|
280
|
+
forceScopeShrink: true,
|
|
281
|
+
});
|
|
282
|
+
expect(result.dirtyTombstoned).toBe(1);
|
|
283
|
+
expect(fs.existsSync(abs)).toBe(true); // PRESERVED
|
|
284
|
+
expect(fs.readFileSync(abs, "utf-8")).toBe("MODIFIED");
|
|
285
|
+
expect(journal.files["companies/indigo/scratch/dirty.md"]?.removedAt).toBeTruthy();
|
|
286
|
+
});
|
|
287
|
+
it("accepts a custom reason for the tombstone (e.g. narrow_apply)", () => {
|
|
288
|
+
const abs = path.join(hqRoot, "companies/indigo/scratch/clean.md");
|
|
289
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
290
|
+
fs.writeFileSync(abs, "x");
|
|
291
|
+
const past = Date.now() - 60_000;
|
|
292
|
+
fs.utimesSync(abs, past / 1000, past / 1000);
|
|
293
|
+
const journal = {
|
|
294
|
+
...emptyJournal(),
|
|
295
|
+
files: {
|
|
296
|
+
"companies/indigo/scratch/clean.md": {
|
|
297
|
+
hash: sha256("x"),
|
|
298
|
+
size: 1,
|
|
299
|
+
syncedAt: new Date().toISOString(),
|
|
300
|
+
direction: "down",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
const plan = buildScopeShrinkPlan({
|
|
305
|
+
journal,
|
|
306
|
+
hqRoot,
|
|
307
|
+
lastPrefixSet: ["companies/indigo/"],
|
|
308
|
+
currentPrefixSet: ["companies/indigo/meetings/"],
|
|
309
|
+
});
|
|
310
|
+
applyScopeShrink({
|
|
311
|
+
journal,
|
|
312
|
+
plan,
|
|
313
|
+
hqRoot,
|
|
314
|
+
forceScopeShrink: false,
|
|
315
|
+
reason: "narrow_apply",
|
|
316
|
+
});
|
|
317
|
+
expect(journal.files["companies/indigo/scratch/clean.md"]?.removedReason).toBe("narrow_apply");
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
describe("ScopeShrinkBlockedError", () => {
|
|
321
|
+
it("carries from/to syncMode + dirty/clean orphan lists for the CLI", () => {
|
|
322
|
+
const err = new ScopeShrinkBlockedError("cmp_indigo", "all", "shared", [
|
|
323
|
+
{
|
|
324
|
+
path: "companies/indigo/scratch/notes.md",
|
|
325
|
+
entry: {
|
|
326
|
+
hash: "h",
|
|
327
|
+
size: 1,
|
|
328
|
+
syncedAt: "",
|
|
329
|
+
direction: "down",
|
|
330
|
+
},
|
|
331
|
+
clean: false,
|
|
332
|
+
dirtyReason: "hash-mismatch",
|
|
333
|
+
},
|
|
334
|
+
], []);
|
|
335
|
+
expect(err.code).toBe("SCOPE_SHRINK_BLOCKED");
|
|
336
|
+
expect(err.fromMode).toBe("all");
|
|
337
|
+
expect(err.toMode).toBe("shared");
|
|
338
|
+
expect(err.dirty).toHaveLength(1);
|
|
339
|
+
expect(err.name).toBe("ScopeShrinkBlockedError");
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
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AAW,EAAE,eAAe;aAC7B;SACF,EACD,EAAE,CACH,CAAC;QACF,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC9C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -31,11 +31,58 @@ export interface JournalEntry {
|
|
|
31
31
|
* against `syncedAt`.
|
|
32
32
|
*/
|
|
33
33
|
remoteEtag?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Tombstone marker (Journal v2, US-005). When set, this entry represents
|
|
36
|
+
* a file that was pruned by a scope shrink — either implicitly (next pull
|
|
37
|
+
* after the membership's effective scope narrowed) or explicitly (via
|
|
38
|
+
* `hq sync narrow --apply`). Tombstones are kept for `TOMBSTONE_TTL_MS`
|
|
39
|
+
* (30d) so subsequent pulls under the same shrunk scope don't re-flag
|
|
40
|
+
* the same paths as orphans, then garbage-collected.
|
|
41
|
+
*/
|
|
42
|
+
removedAt?: string;
|
|
43
|
+
removedReason?: "scope_shrink" | "narrow_apply" | "manual";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Per-pull boundary record (Journal v2, US-005).
|
|
47
|
+
*
|
|
48
|
+
* Recorded at the end of every per-company sync leg so the next pull can
|
|
49
|
+
* detect "scope changed" against `prefixSet` and compute orphans
|
|
50
|
+
* deterministically. `pulls[]` is append-only; old records are not pruned
|
|
51
|
+
* (cheap, useful for incident forensics — one row per pull per company).
|
|
52
|
+
*/
|
|
53
|
+
export interface PullRecord {
|
|
54
|
+
/** ULID-shaped id (crockford base32, lexically sortable). */
|
|
55
|
+
pullId: string;
|
|
56
|
+
companyUid: string;
|
|
57
|
+
startedAt: string;
|
|
58
|
+
completedAt: string;
|
|
59
|
+
/** Effective sync-mode at pull start. */
|
|
60
|
+
syncMode: "all" | "shared" | "custom";
|
|
61
|
+
/**
|
|
62
|
+
* Coalesced prefixes used to drive ListObjectsV2 for this pull. Empty for
|
|
63
|
+
* v1-migrated records (no recorded scope; treated as full-bucket "all").
|
|
64
|
+
*/
|
|
65
|
+
prefixSet: string[];
|
|
66
|
+
scopeChangeDetected: boolean;
|
|
67
|
+
orphansRemoved: number;
|
|
68
|
+
orphansBlocked: number;
|
|
34
69
|
}
|
|
35
70
|
export interface SyncJournal {
|
|
36
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Schema version. `"1"` is the pre-US-005 shape (no `pulls`, no
|
|
73
|
+
* tombstone fields on entries). `"2"` adds per-pull records and
|
|
74
|
+
* tombstone markers; readers MUST tolerate either and migrate v1 → v2
|
|
75
|
+
* in place on the first v2 write.
|
|
76
|
+
*/
|
|
77
|
+
version: "1" | "2";
|
|
37
78
|
lastSync: string;
|
|
38
79
|
files: Record<string, JournalEntry>;
|
|
80
|
+
/**
|
|
81
|
+
* Per-pull boundary records (v2 only). Always present on v2 journals.
|
|
82
|
+
* v1 journals do not carry this field — readers should treat absence as
|
|
83
|
+
* "no recorded history; treat last scope as 'all'/empty".
|
|
84
|
+
*/
|
|
85
|
+
pulls?: PullRecord[];
|
|
39
86
|
}
|
|
40
87
|
export interface SyncStatus {
|
|
41
88
|
running: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,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