recallnest 2.5.4 → 2.6.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/CHANGELOG.md +37 -0
- package/README.md +34 -9
- package/README_CN.md +37 -12
- package/package.json +4 -4
- package/src/__tests__/access-tracker-novelty.test.ts +66 -0
- package/src/__tests__/api-server-security.test.ts +102 -0
- package/src/__tests__/belief-history.test.ts +220 -0
- package/src/__tests__/capture-engine.test.ts +93 -3
- package/src/__tests__/category-min-scores.test.ts +83 -0
- package/src/__tests__/cluster-consolidation.test.ts +167 -4
- package/src/__tests__/conflict-store.test.ts +46 -2
- package/src/__tests__/consolidation-engine.test.ts +97 -0
- package/src/__tests__/contracts.test.ts +46 -0
- package/src/__tests__/decay-exemption.test.ts +45 -0
- package/src/__tests__/dream-pipeline.test.ts +464 -5
- package/src/__tests__/freshness.test.ts +186 -0
- package/src/__tests__/hotness-blend.test.ts +207 -0
- package/src/__tests__/llm-client-pivot.test.ts +628 -0
- package/src/__tests__/maintenance-locks.test.ts +15 -0
- package/src/__tests__/memory-boundaries.test.ts +32 -0
- package/src/__tests__/noise-prototype-bank.test.ts +280 -0
- package/src/__tests__/pii-redact.test.ts +19 -0
- package/src/__tests__/pivot-apply.test.ts +373 -0
- package/src/__tests__/pivot-distill-supervisor.test.ts +457 -0
- package/src/__tests__/pivot-distill.test.ts +1178 -0
- package/src/__tests__/preference-matcher.test.ts +54 -2
- package/src/__tests__/pull-from-macbook-sync-only.test.ts +679 -0
- package/src/__tests__/recall-gate.test.ts +266 -0
- package/src/__tests__/resolve-db-path.test.ts +130 -0
- package/src/__tests__/resolve-tier.test.ts +64 -0
- package/src/__tests__/retrieval-eval.test.ts +163 -0
- package/src/__tests__/retriever-lazy-init-dispatch.test.ts +123 -0
- package/src/__tests__/skill-promotion.test.ts +53 -0
- package/src/__tests__/stable-context-length-contract.test.ts +62 -0
- package/src/__tests__/store-read-consistency.test.ts +122 -0
- package/src/__tests__/store-schema-migration.test.ts +87 -0
- package/src/__tests__/store-upsert.test.ts +17 -0
- package/src/__tests__/term-registry-terminal-roster.test.ts +127 -0
- package/src/__tests__/ui-server-security.test.ts +93 -0
- package/src/access-tracker.ts +53 -3
- package/src/adaptive-retrieval.ts +11 -0
- package/src/api-server.ts +9 -2
- package/src/auto-recall.ts +61 -1
- package/src/belief-history.ts +164 -0
- package/src/capture-engine.ts +88 -11
- package/src/cli.ts +109 -14
- package/src/conflict-engine.ts +24 -3
- package/src/consolidation-engine.ts +146 -12
- package/src/context-composer-stable-selection.ts +7 -1
- package/src/data-checkup.ts +1 -1
- package/src/decay-engine.ts +59 -7
- package/src/doctor.ts +4 -2
- package/src/dream-pipeline.ts +359 -11
- package/src/env-config.ts +41 -0
- package/src/eval.ts +154 -11
- package/src/freshness.ts +192 -0
- package/src/http-request-policy.ts +148 -0
- package/src/ingest.ts +277 -2
- package/src/kg-extractor.ts +7 -1
- package/src/llm-client.ts +106 -11
- package/src/mcp-server.ts +2 -1
- package/src/mcp-tools-advanced.ts +13 -0
- package/src/mcp-tools-core.ts +5 -1
- package/src/memory-boundaries.ts +23 -2
- package/src/memory-health-rebalance.ts +4 -0
- package/src/memory-output.ts +16 -2
- package/src/memory-store-port.ts +3 -0
- package/src/noise-prototype-bank.ts +408 -0
- package/src/pii-detector.ts +52 -2
- package/src/pivot-apply.ts +399 -0
- package/src/preference-matcher.ts +37 -3
- package/src/recall-gate.ts +305 -0
- package/src/retrieval-profiles.ts +46 -4
- package/src/retriever.ts +95 -18
- package/src/retroactive-boost.ts +6 -2
- package/src/runtime-config.ts +70 -5
- package/src/skill-promotion.ts +58 -2
- package/src/store.ts +54 -19
- package/src/term-registry.ts +35 -0
- package/src/ui-server.ts +7 -0
- package/src/version.ts +19 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
chmodSync,
|
|
4
|
+
existsSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
mkdtempSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
renameSync,
|
|
9
|
+
statSync,
|
|
10
|
+
symlinkSync,
|
|
11
|
+
writeFileSync,
|
|
12
|
+
} from "node:fs";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { dirname, join, resolve } from "node:path";
|
|
15
|
+
import { spawnSync } from "node:child_process";
|
|
16
|
+
|
|
17
|
+
const REPO_ROOT = resolve(import.meta.dir, "../..");
|
|
18
|
+
const SCRIPT = join(REPO_ROOT, "scripts", "pull-from-macbook.sh");
|
|
19
|
+
const TEST_TIMEOUT_MS = 30_000;
|
|
20
|
+
|
|
21
|
+
interface Harness {
|
|
22
|
+
root: string;
|
|
23
|
+
home: string;
|
|
24
|
+
remoteHome: string;
|
|
25
|
+
report: string;
|
|
26
|
+
rsyncLog: string;
|
|
27
|
+
sshLog: string;
|
|
28
|
+
registrarMarker: string;
|
|
29
|
+
ingestMarker: string;
|
|
30
|
+
env: NodeJS.ProcessEnv;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface RsyncCall {
|
|
34
|
+
args: string[];
|
|
35
|
+
sourceArg: string;
|
|
36
|
+
targetArg: string;
|
|
37
|
+
dryRun: boolean;
|
|
38
|
+
ignoreTimes: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function executable(path: string, source: string): void {
|
|
42
|
+
writeFileSync(path, source, { mode: 0o700 });
|
|
43
|
+
chmodSync(path, 0o700);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function fixture(path: string, content: string): void {
|
|
47
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
48
|
+
writeFileSync(path, content);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function fakeRsyncSource(): string {
|
|
52
|
+
return [
|
|
53
|
+
"#!/usr/bin/env bun",
|
|
54
|
+
'import { appendFileSync, copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, renameSync, statSync, symlinkSync, writeFileSync } from "node:fs";',
|
|
55
|
+
'import { basename, dirname, extname, join, relative, sep } from "node:path";',
|
|
56
|
+
'const args = process.argv.slice(2);',
|
|
57
|
+
'const sourceArg = args.at(-2) || "";',
|
|
58
|
+
'const targetArg = args.at(-1) || "";',
|
|
59
|
+
'const dryRun = args.includes("--dry-run");',
|
|
60
|
+
'const ignoreTimes = args.includes("--ignore-times");',
|
|
61
|
+
'const optionValues = new Set(["-e", "--exclude", "--include", "--out-format", "--rsync-path", "--timeout"]);',
|
|
62
|
+
'for (let index = 0; index < args.length - 2; index += 1) {',
|
|
63
|
+
' const arg = args[index];',
|
|
64
|
+
' if (optionValues.has(arg)) { if (index + 1 >= args.length - 2) process.exit(64); index += 1; continue; }',
|
|
65
|
+
' if (!arg.startsWith("-")) process.exit(64);',
|
|
66
|
+
'}',
|
|
67
|
+
'appendFileSync(process.env.FAKE_RSYNC_LOG, JSON.stringify({ args: args.slice(0, -2), sourceArg, targetArg, dryRun, ignoreTimes }) + "\\n");',
|
|
68
|
+
'if (!dryRun && process.env.FAKE_CREATE_REPORT_DURING_SYNC && !existsSync(process.env.FAKE_CREATE_REPORT_DURING_SYNC)) writeFileSync(process.env.FAKE_CREATE_REPORT_DURING_SYNC, "racing-writer");',
|
|
69
|
+
'if (!dryRun && process.env.FAKE_BREAK_MAPPING_TMP) {',
|
|
70
|
+
' const report = process.env.FAKE_BREAK_MAPPING_TMP;',
|
|
71
|
+
' const prefix = basename(report) + ".tmp.";',
|
|
72
|
+
' const temporary = readdirSync(dirname(report))',
|
|
73
|
+
' .filter((name) => name.startsWith(prefix) && !name.endsWith(".saved"))',
|
|
74
|
+
' .map((name) => join(dirname(report), name))',
|
|
75
|
+
' .find((path) => statSync(path).isFile());',
|
|
76
|
+
' if (temporary) { renameSync(temporary, temporary + ".saved"); mkdirSync(temporary); }',
|
|
77
|
+
'}',
|
|
78
|
+
'if (!sourceArg.startsWith("mac:")) process.exit(64);',
|
|
79
|
+
'const remoteHome = process.env.FAKE_REMOTE_HOME;',
|
|
80
|
+
'let remoteRaw = sourceArg.slice(4);',
|
|
81
|
+
'let sourcePath = remoteRaw;',
|
|
82
|
+
'if (remoteRaw === "~") sourcePath = remoteHome;',
|
|
83
|
+
'else if (remoteRaw.startsWith("~/")) sourcePath = join(remoteHome, remoteRaw.slice(2));',
|
|
84
|
+
'else if (!remoteRaw.startsWith("/")) sourcePath = join(remoteHome, remoteRaw);',
|
|
85
|
+
'if (!existsSync(sourcePath)) process.exit(23);',
|
|
86
|
+
'function walk(root) {',
|
|
87
|
+
' const files = [];',
|
|
88
|
+
' for (const entry of readdirSync(root, { withFileTypes: true })) {',
|
|
89
|
+
' const path = join(root, entry.name);',
|
|
90
|
+
' if (entry.isDirectory()) files.push(...walk(path));',
|
|
91
|
+
' else if (entry.isFile() || entry.isSymbolicLink()) files.push(path);',
|
|
92
|
+
' }',
|
|
93
|
+
' return files.sort();',
|
|
94
|
+
'}',
|
|
95
|
+
'function included(path) {',
|
|
96
|
+
' const normalizedSource = sourcePath.split(sep).join("/");',
|
|
97
|
+
' const name = basename(path);',
|
|
98
|
+
' if (statSync(sourcePath).isFile()) return true;',
|
|
99
|
+
' if (normalizedSource.includes("/.gemini/tmp")) return name.startsWith("session-") && extname(name) === ".json";',
|
|
100
|
+
' if (normalizedSource.includes("/local-agent-mode-sessions")) return extname(name) === ".jsonl" && name !== "audit.jsonl";',
|
|
101
|
+
' if (normalizedSource.includes("/antigravity-cli/brain")) return name === "transcript_full.jsonl";',
|
|
102
|
+
' if (normalizedSource.includes("/antigravity-rescue/conversations")) return extname(name) === ".pb";',
|
|
103
|
+
' return extname(name) === ".jsonl";',
|
|
104
|
+
'}',
|
|
105
|
+
'const sourceIsDirectory = statSync(sourcePath).isDirectory();',
|
|
106
|
+
'const files = (sourceIsDirectory ? walk(sourcePath) : [sourcePath]).filter(included);',
|
|
107
|
+
'if (dryRun && !ignoreTimes && process.env.FAKE_RSYNC_MUTATE_ON_VERIFY_SOURCE && sourceArg.includes(process.env.FAKE_RSYNC_MUTATE_ON_VERIFY_SOURCE) && files.length > 0) appendFileSync(files[0], "late-change");',
|
|
108
|
+
'const prefix = args.some((arg) => arg.includes("__RN_MAP__")) ? "__RN_MAP__" : "__RN_CHANGE__";',
|
|
109
|
+
'function copySource(source, destination) {',
|
|
110
|
+
' mkdirSync(dirname(destination), { recursive: true });',
|
|
111
|
+
' if (lstatSync(source).isSymbolicLink()) symlinkSync(readlinkSync(source), destination);',
|
|
112
|
+
' else copyFileSync(source, destination);',
|
|
113
|
+
'}',
|
|
114
|
+
'const forcedFailure = Boolean(process.env.FAKE_RSYNC_FAIL_SOURCE && sourceArg.includes(process.env.FAKE_RSYNC_FAIL_SOURCE));',
|
|
115
|
+
'if (!dryRun && forcedFailure && files.length > 0) {',
|
|
116
|
+
' const source = files[0];',
|
|
117
|
+
' const rel = sourceIsDirectory ? relative(sourcePath, source).split(sep).join("/") : basename(source);',
|
|
118
|
+
' const destination = sourceIsDirectory ? join(targetArg, rel) : targetArg;',
|
|
119
|
+
' copySource(source, destination);',
|
|
120
|
+
' process.exit(23);',
|
|
121
|
+
'}',
|
|
122
|
+
'for (const source of files) {',
|
|
123
|
+
' const rel = sourceIsDirectory ? relative(sourcePath, source).split(sep).join("/") : basename(source);',
|
|
124
|
+
' const destination = sourceIsDirectory ? join(targetArg, rel) : targetArg;',
|
|
125
|
+
' if (dryRun) {',
|
|
126
|
+
' const changed = !existsSync(destination) || !readFileSync(source).equals(readFileSync(destination));',
|
|
127
|
+
' const item = lstatSync(source).isSymbolicLink() ? "cL+++++++++" : ">f+++++++++";',
|
|
128
|
+
' if (ignoreTimes || changed) process.stdout.write(prefix + item + "|" + rel + "\\n");',
|
|
129
|
+
' continue;',
|
|
130
|
+
' }',
|
|
131
|
+
' copySource(source, destination);',
|
|
132
|
+
'}',
|
|
133
|
+
].join("\n") + "\n";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function fakeSshSource(): string {
|
|
137
|
+
return [
|
|
138
|
+
"#!/usr/bin/env bun",
|
|
139
|
+
'import { appendFileSync, existsSync, statSync } from "node:fs";',
|
|
140
|
+
'import { join } from "node:path";',
|
|
141
|
+
'const args = process.argv.slice(2);',
|
|
142
|
+
'const command = args.join(" ");',
|
|
143
|
+
'appendFileSync(process.env.FAKE_SSH_LOG, command + "\\n");',
|
|
144
|
+
'if (process.env.FAKE_SSH_ONLINE !== "1") process.exit(255);',
|
|
145
|
+
'if (command.includes("echo online")) { console.log("online"); process.exit(0); }',
|
|
146
|
+
'if (process.env.FAKE_SSH_FAIL_PROBE && command.includes(process.env.FAKE_SSH_FAIL_PROBE)) process.exit(255);',
|
|
147
|
+
'if (command.includes("$HOME/.codex") && command.includes("session_index.jsonl")) { const path = join(process.env.FAKE_REMOTE_HOME, ".codex/session_index.jsonl"); process.exit(!existsSync(path) ? 2 : statSync(path).isFile() ? 0 : 3); }',
|
|
148
|
+
'if (command.includes("$HOME/.kimi-code") && command.includes("session_index.jsonl")) { const path = join(process.env.FAKE_REMOTE_HOME, ".kimi-code/session_index.jsonl"); process.exit(!existsSync(path) ? 2 : statSync(path).isFile() ? 0 : 3); }',
|
|
149
|
+
'if (command.includes("antigravity-rescue")) { const path = join(process.env.FAKE_REMOTE_HOME, "Downloads/antigravity-rescue/conversations"); process.exit(!existsSync(path) ? 2 : statSync(path).isDirectory() ? 0 : 3); }',
|
|
150
|
+
'process.exit(0);',
|
|
151
|
+
].join("\n") + "\n";
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function makeHarness(): Harness {
|
|
155
|
+
const root = mkdtempSync(join(tmpdir(), "pull-sync-only-"));
|
|
156
|
+
const home = join(root, "home");
|
|
157
|
+
const remoteHome = join(root, "remote-home");
|
|
158
|
+
const fakeBin = join(root, "bin");
|
|
159
|
+
const report = join(root, "mapping.tsv");
|
|
160
|
+
const rsyncLog = join(root, "rsync.jsonl");
|
|
161
|
+
const sshLog = join(root, "ssh.log");
|
|
162
|
+
const registrarMarker = join(root, "registrar-called");
|
|
163
|
+
const ingestMarker = join(root, "ingest-called");
|
|
164
|
+
|
|
165
|
+
mkdirSync(fakeBin, { recursive: true });
|
|
166
|
+
mkdirSync(join(home, "recallnest", "scripts"), { recursive: true });
|
|
167
|
+
executable(join(fakeBin, "rsync"), fakeRsyncSource());
|
|
168
|
+
executable(join(fakeBin, "ssh"), fakeSshSource());
|
|
169
|
+
executable(
|
|
170
|
+
join(home, "recallnest", "scripts", "codex-projectless-register.py"),
|
|
171
|
+
[
|
|
172
|
+
"#!/bin/bash",
|
|
173
|
+
'printf "called\\n" > "$FAKE_REGISTRAR_MARKER"',
|
|
174
|
+
].join("\n") + "\n",
|
|
175
|
+
);
|
|
176
|
+
executable(
|
|
177
|
+
join(home, "recallnest", "scripts", "incremental-ingest.sh"),
|
|
178
|
+
[
|
|
179
|
+
"#!/bin/bash",
|
|
180
|
+
'printf "called\\n" > "$FAKE_INGEST_MARKER"',
|
|
181
|
+
].join("\n") + "\n",
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
fixture(join(remoteHome, ".claude", "projects", "p", "cc.jsonl"), "{\"source\":\"cc\"}\n");
|
|
185
|
+
fixture(join(remoteHome, ".codex", "sessions", "2026", "codex.jsonl"), "{\"source\":\"codex\"}\n");
|
|
186
|
+
fixture(join(remoteHome, ".codex", "archived_sessions", "archived.jsonl"), "{\"source\":\"archive\"}\n");
|
|
187
|
+
fixture(
|
|
188
|
+
join(remoteHome, ".codex", "session_index.jsonl"),
|
|
189
|
+
"{\"id\":\"mac-codex\",\"updated_at\":\"2026-08-03T00:00:00Z\"}\n",
|
|
190
|
+
);
|
|
191
|
+
fixture(join(remoteHome, ".kimi-code", "sessions", "k1", "wire.jsonl"), "{\"source\":\"kimi\"}\n");
|
|
192
|
+
fixture(join(remoteHome, ".kimi-code", "session_index.jsonl"), "{\"sessionId\":\"mac-kimi\"}\n");
|
|
193
|
+
fixture(join(remoteHome, ".gemini", "tmp", "g1", "chats", "session-g.json"), "{\"source\":\"gemini\"}\n");
|
|
194
|
+
fixture(
|
|
195
|
+
join(
|
|
196
|
+
remoteHome,
|
|
197
|
+
"Library",
|
|
198
|
+
"Application Support",
|
|
199
|
+
"Claude",
|
|
200
|
+
"local-agent-mode-sessions",
|
|
201
|
+
"d1",
|
|
202
|
+
".claude",
|
|
203
|
+
"projects",
|
|
204
|
+
"p",
|
|
205
|
+
"desktop-one.jsonl",
|
|
206
|
+
),
|
|
207
|
+
"{\"source\":\"desktop\"}\n",
|
|
208
|
+
);
|
|
209
|
+
fixture(
|
|
210
|
+
join(remoteHome, ".gemini", "antigravity-cli", "brain", "b1", "transcript_full.jsonl"),
|
|
211
|
+
"{\"source\":\"agy-brain\"}\n",
|
|
212
|
+
);
|
|
213
|
+
fixture(
|
|
214
|
+
join(remoteHome, "Downloads", "antigravity-rescue", "conversations", "legacy.pb"),
|
|
215
|
+
"legacy-original",
|
|
216
|
+
);
|
|
217
|
+
fixture(
|
|
218
|
+
join(remoteHome, ".gemini", "antigravity-cli", "conversations", "remote-cli.db"),
|
|
219
|
+
"remote-cli-original",
|
|
220
|
+
);
|
|
221
|
+
fixture(
|
|
222
|
+
join(remoteHome, ".gemini", "antigravity", "conversations", "remote-app.db"),
|
|
223
|
+
"remote-app-original",
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
for (let index = 1; index <= 24; index += 1) {
|
|
227
|
+
fixture(
|
|
228
|
+
join(home, "machine-data", "macbook-agy", "conversations", "existing-" + index + ".db"),
|
|
229
|
+
"mini-existing-" + index,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const env: NodeJS.ProcessEnv = {
|
|
234
|
+
...process.env,
|
|
235
|
+
LC_ALL: "C",
|
|
236
|
+
PULL_FROM_MACBOOK_HOME: home,
|
|
237
|
+
PULL_FROM_MACBOOK_RSYNC: join(fakeBin, "rsync"),
|
|
238
|
+
PULL_FROM_MACBOOK_SSH: join(fakeBin, "ssh"),
|
|
239
|
+
FAKE_REMOTE_HOME: remoteHome,
|
|
240
|
+
FAKE_RSYNC_LOG: rsyncLog,
|
|
241
|
+
FAKE_SSH_LOG: sshLog,
|
|
242
|
+
FAKE_SSH_ONLINE: "1",
|
|
243
|
+
FAKE_REGISTRAR_MARKER: registrarMarker,
|
|
244
|
+
FAKE_INGEST_MARKER: ingestMarker,
|
|
245
|
+
PULL_FROM_MACBOOK_LOG: join(root, "pull.log"),
|
|
246
|
+
PULL_FROM_MACBOOK_LOG_DIR: join(root, "logs"),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
root,
|
|
251
|
+
home,
|
|
252
|
+
remoteHome,
|
|
253
|
+
report,
|
|
254
|
+
rsyncLog,
|
|
255
|
+
sshLog,
|
|
256
|
+
registrarMarker,
|
|
257
|
+
ingestMarker,
|
|
258
|
+
env,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function run(harness: Harness, args: string[], extraEnv: NodeJS.ProcessEnv = {}) {
|
|
263
|
+
return spawnSync("/bin/bash", [SCRIPT, ...args], {
|
|
264
|
+
env: { ...harness.env, ...extraEnv },
|
|
265
|
+
encoding: "utf8",
|
|
266
|
+
timeout: 30_000,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function syncOnly(harness: Harness) {
|
|
271
|
+
return run(harness, ["--sync-only", "--mapping-report", harness.report]);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function rsyncCalls(harness: Harness): RsyncCall[] {
|
|
275
|
+
if (!existsSync(harness.rsyncLog)) return [];
|
|
276
|
+
return readFileSync(harness.rsyncLog, "utf8")
|
|
277
|
+
.trim()
|
|
278
|
+
.split("\n")
|
|
279
|
+
.filter(Boolean)
|
|
280
|
+
.map((line) => JSON.parse(line) as RsyncCall);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function normalizedRsyncArgs(args: string[]): string[] {
|
|
284
|
+
return args.filter(
|
|
285
|
+
(arg) =>
|
|
286
|
+
arg !== "--dry-run"
|
|
287
|
+
&& arg !== "--ignore-times"
|
|
288
|
+
&& arg !== "--itemize-changes"
|
|
289
|
+
&& !arg.startsWith("--out-format="),
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function unexpectedPositionalArgs(args: string[]): string[] {
|
|
294
|
+
const valueOptions = new Set(["-e", "--exclude", "--include", "--out-format", "--rsync-path", "--timeout"]);
|
|
295
|
+
const unexpected: string[] = [];
|
|
296
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
297
|
+
const arg = args[index];
|
|
298
|
+
if (valueOptions.has(arg)) {
|
|
299
|
+
index += 1;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (!arg.startsWith("-")) unexpected.push(arg);
|
|
303
|
+
}
|
|
304
|
+
return unexpected;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function dbContents(directory: string): Record<string, string> {
|
|
308
|
+
const result: Record<string, string> = {};
|
|
309
|
+
for (let index = 1; index <= 24; index += 1) {
|
|
310
|
+
const name = "existing-" + index + ".db";
|
|
311
|
+
result[name] = readFileSync(join(directory, name), "utf8");
|
|
312
|
+
}
|
|
313
|
+
return result;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
describe("pull-from-macbook --sync-only", () => {
|
|
317
|
+
it("syncs allowed sources, verifies identical rsync arguments, and emits per-file mappings without ingest", () => {
|
|
318
|
+
const harness = makeHarness();
|
|
319
|
+
expect(harness.env.HOME).toBe(process.env.HOME);
|
|
320
|
+
const localDbDir = join(harness.home, "machine-data", "macbook-agy", "conversations");
|
|
321
|
+
const localDbBefore = dbContents(localDbDir);
|
|
322
|
+
const remoteCliDb = join(harness.remoteHome, ".gemini", "antigravity-cli", "conversations", "remote-cli.db");
|
|
323
|
+
const remoteAppDb = join(harness.remoteHome, ".gemini", "antigravity", "conversations", "remote-app.db");
|
|
324
|
+
const remoteCliBefore = readFileSync(remoteCliDb, "utf8");
|
|
325
|
+
const remoteAppBefore = readFileSync(remoteAppDb, "utf8");
|
|
326
|
+
|
|
327
|
+
const result = syncOnly(harness);
|
|
328
|
+
|
|
329
|
+
expect(result.status).toBe(0);
|
|
330
|
+
expect(existsSync(harness.ingestMarker)).toBe(false);
|
|
331
|
+
expect(existsSync(harness.registrarMarker)).toBe(false);
|
|
332
|
+
expect(readFileSync(join(harness.home, ".claude", "projects", "p", "cc.jsonl"), "utf8")).toContain("cc");
|
|
333
|
+
expect(
|
|
334
|
+
readFileSync(
|
|
335
|
+
join(harness.home, "recallnest", "data", "desktop-import", "desktop-one.jsonl"),
|
|
336
|
+
"utf8",
|
|
337
|
+
),
|
|
338
|
+
).toContain("desktop");
|
|
339
|
+
expect(readFileSync(join(harness.home, ".codex", "session_index.jsonl"), "utf8")).toContain("mac-codex");
|
|
340
|
+
expect(readFileSync(join(harness.home, ".kimi-code", "session_index.jsonl"), "utf8")).toContain("mac-kimi");
|
|
341
|
+
|
|
342
|
+
const mapping = readFileSync(harness.report, "utf8");
|
|
343
|
+
expect(mapping.split("\n")[0]).toBe(
|
|
344
|
+
"source_kind\tsource_file\tlocal_target\tderived_target\tstatus",
|
|
345
|
+
);
|
|
346
|
+
expect(mapping).toContain("claude-code\tmac:~/.claude/projects/p/cc.jsonl");
|
|
347
|
+
expect(mapping).toContain(
|
|
348
|
+
join(harness.home, "recallnest", "data", "desktop-import", "desktop-one.jsonl"),
|
|
349
|
+
);
|
|
350
|
+
expect(mapping).toContain("desktop-flat\t");
|
|
351
|
+
expect(mapping).toContain("codex-index-merge\t");
|
|
352
|
+
for (const line of mapping.trim().split("\n").slice(1)) {
|
|
353
|
+
expect(line.split("\t")).toHaveLength(5);
|
|
354
|
+
}
|
|
355
|
+
const desktopTransportRows = mapping
|
|
356
|
+
.trim()
|
|
357
|
+
.split("\n")
|
|
358
|
+
.slice(1)
|
|
359
|
+
.map((line) => line.split("\t"))
|
|
360
|
+
.filter(([sourceKind]) => sourceKind === "claude-desktop");
|
|
361
|
+
expect(desktopTransportRows.length).toBeGreaterThan(0);
|
|
362
|
+
expect(
|
|
363
|
+
desktopTransportRows.every((fields) => fields[4] === "local-verified:derived-pending"),
|
|
364
|
+
).toBe(true);
|
|
365
|
+
expect(statSync(harness.report).mode & 0o777).toBe(0o600);
|
|
366
|
+
expect(existsSync(join(harness.home, ".codex", ".codex-global-state.json"))).toBe(false);
|
|
367
|
+
|
|
368
|
+
const calls = rsyncCalls(harness);
|
|
369
|
+
const grouped = new Map<string, RsyncCall[]>();
|
|
370
|
+
for (const call of calls) {
|
|
371
|
+
grouped.set(call.sourceArg, [...(grouped.get(call.sourceArg) || []), call]);
|
|
372
|
+
}
|
|
373
|
+
expect(grouped.size).toBe(10);
|
|
374
|
+
for (const sourceCalls of grouped.values()) {
|
|
375
|
+
expect(sourceCalls).toHaveLength(3);
|
|
376
|
+
const real = sourceCalls.find((call) => !call.dryRun);
|
|
377
|
+
const verify = sourceCalls.find((call) => call.dryRun && !call.ignoreTimes);
|
|
378
|
+
const inventory = sourceCalls.find((call) => call.dryRun && call.ignoreTimes);
|
|
379
|
+
expect(real).toBeDefined();
|
|
380
|
+
expect(verify).toBeDefined();
|
|
381
|
+
expect(inventory).toBeDefined();
|
|
382
|
+
expect(normalizedRsyncArgs(verify!.args)).toEqual(real!.args);
|
|
383
|
+
expect(normalizedRsyncArgs(inventory!.args)).toEqual(real!.args);
|
|
384
|
+
expect(verify!.targetArg).toBe(real!.targetArg);
|
|
385
|
+
expect(inventory!.targetArg).toBe(real!.targetArg);
|
|
386
|
+
expect(unexpectedPositionalArgs(real!.args)).toEqual([]);
|
|
387
|
+
}
|
|
388
|
+
const desktopSource = "mac:Library/Application Support/Claude/local-agent-mode-sessions/";
|
|
389
|
+
const desktopCalls = grouped.get(desktopSource);
|
|
390
|
+
expect(desktopCalls).toHaveLength(3);
|
|
391
|
+
expect(desktopCalls!.every((call) => call.args.includes("-s"))).toBe(true);
|
|
392
|
+
expect(
|
|
393
|
+
calls.some((call) =>
|
|
394
|
+
call.sourceArg.includes("/.gemini/antigravity-cli/conversations/")
|
|
395
|
+
|| call.sourceArg.includes("/.gemini/antigravity/conversations/")
|
|
396
|
+
),
|
|
397
|
+
).toBe(false);
|
|
398
|
+
const wrapperSource = readFileSync(SCRIPT, "utf8");
|
|
399
|
+
expect(wrapperSource).not.toContain("mac:~/.gemini/antigravity-cli/conversations/");
|
|
400
|
+
expect(wrapperSource).not.toContain("mac:~/.gemini/antigravity/conversations/");
|
|
401
|
+
|
|
402
|
+
expect(dbContents(localDbDir)).toEqual(localDbBefore);
|
|
403
|
+
expect(readFileSync(remoteCliDb, "utf8")).toBe(remoteCliBefore);
|
|
404
|
+
expect(readFileSync(remoteAppDb, "utf8")).toBe(remoteAppBefore);
|
|
405
|
+
const sshCalls = readFileSync(harness.sshLog, "utf8");
|
|
406
|
+
expect(sshCalls).toContain("echo online");
|
|
407
|
+
expect(sshCalls).toContain("$HOME/.codex");
|
|
408
|
+
expect(sshCalls).toContain("$HOME/.kimi-code");
|
|
409
|
+
expect(sshCalls).toContain("antigravity-rescue");
|
|
410
|
+
}, TEST_TIMEOUT_MS);
|
|
411
|
+
|
|
412
|
+
it("fails offline in sync-only mode but keeps the routine offline run successful", () => {
|
|
413
|
+
const syncHarness = makeHarness();
|
|
414
|
+
const syncResult = run(
|
|
415
|
+
syncHarness,
|
|
416
|
+
["--sync-only", "--mapping-report", syncHarness.report],
|
|
417
|
+
{ FAKE_SSH_ONLINE: "0" },
|
|
418
|
+
);
|
|
419
|
+
expect(syncResult.status).not.toBe(0);
|
|
420
|
+
expect(readFileSync(syncHarness.report, "utf8")).toContain("transport\tmac\t-\t-\toffline");
|
|
421
|
+
expect(existsSync(syncHarness.registrarMarker)).toBe(false);
|
|
422
|
+
expect(existsSync(syncHarness.ingestMarker)).toBe(false);
|
|
423
|
+
expect(rsyncCalls(syncHarness)).toHaveLength(0);
|
|
424
|
+
|
|
425
|
+
const routineHarness = makeHarness();
|
|
426
|
+
const routineResult = run(routineHarness, [], { FAKE_SSH_ONLINE: "0" });
|
|
427
|
+
expect(routineResult.status).toBe(0);
|
|
428
|
+
expect(existsSync(routineHarness.registrarMarker)).toBe(true);
|
|
429
|
+
expect(existsSync(routineHarness.ingestMarker)).toBe(false);
|
|
430
|
+
|
|
431
|
+
const existingReportHarness = makeHarness();
|
|
432
|
+
fixture(existingReportHarness.report, "keep-existing-report");
|
|
433
|
+
const existingReportResult = syncOnly(existingReportHarness);
|
|
434
|
+
expect(existingReportResult.status).not.toBe(0);
|
|
435
|
+
expect(readFileSync(existingReportHarness.report, "utf8")).toBe("keep-existing-report");
|
|
436
|
+
expect(existsSync(existingReportHarness.sshLog)).toBe(false);
|
|
437
|
+
|
|
438
|
+
const racingReportHarness = makeHarness();
|
|
439
|
+
const racingReportResult = run(
|
|
440
|
+
racingReportHarness,
|
|
441
|
+
["--sync-only", "--mapping-report", racingReportHarness.report],
|
|
442
|
+
{ FAKE_CREATE_REPORT_DURING_SYNC: racingReportHarness.report },
|
|
443
|
+
);
|
|
444
|
+
expect(racingReportResult.status).not.toBe(0);
|
|
445
|
+
expect(readFileSync(racingReportHarness.report, "utf8")).toBe("racing-writer");
|
|
446
|
+
}, TEST_TIMEOUT_MS);
|
|
447
|
+
|
|
448
|
+
it("fails before flattening when Desktop basenames collide", () => {
|
|
449
|
+
const harness = makeHarness();
|
|
450
|
+
fixture(
|
|
451
|
+
join(
|
|
452
|
+
harness.remoteHome,
|
|
453
|
+
"Library",
|
|
454
|
+
"Application Support",
|
|
455
|
+
"Claude",
|
|
456
|
+
"local-agent-mode-sessions",
|
|
457
|
+
"d2",
|
|
458
|
+
".claude",
|
|
459
|
+
"projects",
|
|
460
|
+
"other",
|
|
461
|
+
"Desktop-One.jsonl",
|
|
462
|
+
),
|
|
463
|
+
"{\"source\":\"collision\"}\n",
|
|
464
|
+
);
|
|
465
|
+
|
|
466
|
+
const result = syncOnly(harness);
|
|
467
|
+
|
|
468
|
+
expect(result.status).not.toBe(0);
|
|
469
|
+
expect(readFileSync(harness.report, "utf8")).toContain("basename-collision");
|
|
470
|
+
expect(
|
|
471
|
+
existsSync(join(harness.home, "recallnest", "data", "desktop-import", "desktop-one.jsonl")),
|
|
472
|
+
).toBe(false);
|
|
473
|
+
expect(existsSync(harness.ingestMarker)).toBe(false);
|
|
474
|
+
|
|
475
|
+
const symlinkHarness = makeHarness();
|
|
476
|
+
const linkedContent = join(symlinkHarness.remoteHome, "linked-content.jsonl");
|
|
477
|
+
fixture(linkedContent, "{\"source\":\"must-not-follow\"}\n");
|
|
478
|
+
const linkedSession = join(
|
|
479
|
+
symlinkHarness.remoteHome,
|
|
480
|
+
"Library",
|
|
481
|
+
"Application Support",
|
|
482
|
+
"Claude",
|
|
483
|
+
"local-agent-mode-sessions",
|
|
484
|
+
"d2",
|
|
485
|
+
".claude",
|
|
486
|
+
"projects",
|
|
487
|
+
"other",
|
|
488
|
+
"linked.jsonl",
|
|
489
|
+
);
|
|
490
|
+
mkdirSync(dirname(linkedSession), { recursive: true });
|
|
491
|
+
symlinkSync(linkedContent, linkedSession);
|
|
492
|
+
|
|
493
|
+
const symlinkResult = syncOnly(symlinkHarness);
|
|
494
|
+
|
|
495
|
+
expect(symlinkResult.status).not.toBe(0);
|
|
496
|
+
expect(readFileSync(symlinkHarness.report, "utf8")).toContain("unsafe-symlink");
|
|
497
|
+
expect(
|
|
498
|
+
existsSync(join(symlinkHarness.home, "recallnest", "data", "desktop-import", "linked.jsonl")),
|
|
499
|
+
).toBe(false);
|
|
500
|
+
|
|
501
|
+
const destinationHarness = makeHarness();
|
|
502
|
+
const outsideTarget = join(destinationHarness.root, "outside-target.jsonl");
|
|
503
|
+
fixture(outsideTarget, "outside-must-not-be-ingested");
|
|
504
|
+
const destinationLink = join(
|
|
505
|
+
destinationHarness.home,
|
|
506
|
+
"recallnest",
|
|
507
|
+
"data",
|
|
508
|
+
"desktop-import",
|
|
509
|
+
"desktop-one.jsonl",
|
|
510
|
+
);
|
|
511
|
+
mkdirSync(dirname(destinationLink), { recursive: true });
|
|
512
|
+
symlinkSync(outsideTarget, destinationLink);
|
|
513
|
+
|
|
514
|
+
const destinationResult = syncOnly(destinationHarness);
|
|
515
|
+
|
|
516
|
+
expect(destinationResult.status).not.toBe(0);
|
|
517
|
+
expect(readFileSync(destinationHarness.report, "utf8")).toContain(
|
|
518
|
+
"unsafe-destination-symlink",
|
|
519
|
+
);
|
|
520
|
+
expect(readFileSync(outsideTarget, "utf8")).toBe("outside-must-not-be-ingested");
|
|
521
|
+
}, TEST_TIMEOUT_MS);
|
|
522
|
+
|
|
523
|
+
it("surfaces a Desktop copy failure and does not ingest", () => {
|
|
524
|
+
const harness = makeHarness();
|
|
525
|
+
mkdirSync(
|
|
526
|
+
join(harness.home, "recallnest", "data", "desktop-import", "desktop-one.jsonl"),
|
|
527
|
+
{ recursive: true },
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
const result = syncOnly(harness);
|
|
531
|
+
|
|
532
|
+
expect(result.status).not.toBe(0);
|
|
533
|
+
expect(readFileSync(harness.report, "utf8")).toContain("copy-failed:IsADirectoryError");
|
|
534
|
+
expect(existsSync(harness.ingestMarker)).toBe(false);
|
|
535
|
+
}, TEST_TIMEOUT_MS);
|
|
536
|
+
|
|
537
|
+
it("does not derive from a failed or partial source sync", () => {
|
|
538
|
+
const desktopHarness = makeHarness();
|
|
539
|
+
const desktopImport = join(
|
|
540
|
+
desktopHarness.home,
|
|
541
|
+
"recallnest",
|
|
542
|
+
"data",
|
|
543
|
+
"desktop-import",
|
|
544
|
+
"desktop-one.jsonl",
|
|
545
|
+
);
|
|
546
|
+
fixture(desktopImport, "known-good-desktop");
|
|
547
|
+
|
|
548
|
+
const desktopResult = run(
|
|
549
|
+
desktopHarness,
|
|
550
|
+
["--sync-only", "--mapping-report", desktopHarness.report],
|
|
551
|
+
{ FAKE_RSYNC_FAIL_SOURCE: "local-agent-mode-sessions" },
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
expect(desktopResult.status).not.toBe(0);
|
|
555
|
+
expect(readFileSync(desktopImport, "utf8")).toBe("known-good-desktop");
|
|
556
|
+
expect(readFileSync(desktopHarness.report, "utf8")).toContain(
|
|
557
|
+
"derived-skipped:source-sync-failed",
|
|
558
|
+
);
|
|
559
|
+
|
|
560
|
+
const indexHarness = makeHarness();
|
|
561
|
+
const kimiIndex = join(indexHarness.home, ".kimi-code", "session_index.jsonl");
|
|
562
|
+
fixture(kimiIndex, "{\"sessionId\":\"mini-only\"}\n");
|
|
563
|
+
|
|
564
|
+
const indexResult = run(
|
|
565
|
+
indexHarness,
|
|
566
|
+
["--sync-only", "--mapping-report", indexHarness.report],
|
|
567
|
+
{ FAKE_RSYNC_FAIL_SOURCE: ".kimi-code/session_index.jsonl" },
|
|
568
|
+
);
|
|
569
|
+
|
|
570
|
+
expect(indexResult.status).not.toBe(0);
|
|
571
|
+
expect(readFileSync(kimiIndex, "utf8")).toContain("mini-only");
|
|
572
|
+
expect(readFileSync(kimiIndex, "utf8")).not.toContain("mac-kimi");
|
|
573
|
+
expect(readFileSync(indexHarness.report, "utf8")).toContain(
|
|
574
|
+
"kimi-index-merge\t" + join(indexHarness.home, ".kimi-code", "session_index.macbook.jsonl"),
|
|
575
|
+
);
|
|
576
|
+
expect(readFileSync(indexHarness.report, "utf8")).toContain(
|
|
577
|
+
"derived-skipped:source-sync-failed",
|
|
578
|
+
);
|
|
579
|
+
}, TEST_TIMEOUT_MS);
|
|
580
|
+
|
|
581
|
+
it("distinguishes absent probes from partial, transport, and wrong-type failures", () => {
|
|
582
|
+
const legacyHarness = makeHarness();
|
|
583
|
+
const legacyResult = run(
|
|
584
|
+
legacyHarness,
|
|
585
|
+
["--sync-only", "--mapping-report", legacyHarness.report],
|
|
586
|
+
{ FAKE_RSYNC_FAIL_SOURCE: "antigravity-rescue/conversations" },
|
|
587
|
+
);
|
|
588
|
+
const legacyMapping = readFileSync(legacyHarness.report, "utf8");
|
|
589
|
+
expect(legacyResult.status).not.toBe(0);
|
|
590
|
+
expect(legacyMapping).toContain("agy-legacy-pb\t");
|
|
591
|
+
expect(legacyMapping).toContain("sync-failed:23");
|
|
592
|
+
expect(legacyMapping).not.toContain(
|
|
593
|
+
"agy-legacy-pb\tmac:~/Downloads/antigravity-rescue/conversations/\t"
|
|
594
|
+
+ join(legacyHarness.home, "machine-data", "macbook-agy", "legacy-pb")
|
|
595
|
+
+ "/\t"
|
|
596
|
+
+ join(legacyHarness.home, "machine-data", "macbook-agy", "legacy-pb")
|
|
597
|
+
+ "/\tsource-absent",
|
|
598
|
+
);
|
|
599
|
+
|
|
600
|
+
const probeHarness = makeHarness();
|
|
601
|
+
const probeResult = run(
|
|
602
|
+
probeHarness,
|
|
603
|
+
["--sync-only", "--mapping-report", probeHarness.report],
|
|
604
|
+
{ FAKE_SSH_FAIL_PROBE: "$HOME/.codex" },
|
|
605
|
+
);
|
|
606
|
+
expect(probeResult.status).not.toBe(0);
|
|
607
|
+
expect(readFileSync(probeHarness.report, "utf8")).toContain("probe-failed:255");
|
|
608
|
+
expect(
|
|
609
|
+
rsyncCalls(probeHarness).some((call) =>
|
|
610
|
+
call.sourceArg === "mac:~/.codex/session_index.jsonl"
|
|
611
|
+
),
|
|
612
|
+
).toBe(false);
|
|
613
|
+
|
|
614
|
+
const wrongTypeHarness = makeHarness();
|
|
615
|
+
const wrongTypeIndex = join(
|
|
616
|
+
wrongTypeHarness.remoteHome,
|
|
617
|
+
".codex",
|
|
618
|
+
"session_index.jsonl",
|
|
619
|
+
);
|
|
620
|
+
renameSync(wrongTypeIndex, wrongTypeIndex + ".saved");
|
|
621
|
+
mkdirSync(wrongTypeIndex);
|
|
622
|
+
const wrongTypeResult = syncOnly(wrongTypeHarness);
|
|
623
|
+
const wrongTypeMapping = readFileSync(wrongTypeHarness.report, "utf8");
|
|
624
|
+
expect(wrongTypeResult.status).not.toBe(0);
|
|
625
|
+
expect(wrongTypeMapping).toContain("probe-failed:3");
|
|
626
|
+
expect(wrongTypeMapping).not.toContain(
|
|
627
|
+
"codex-session-index\tmac:~/.codex/session_index.jsonl\t"
|
|
628
|
+
+ join(wrongTypeHarness.home, ".codex", "session_index.macbook.jsonl")
|
|
629
|
+
+ "\t"
|
|
630
|
+
+ join(wrongTypeHarness.home, ".codex", "session_index.jsonl")
|
|
631
|
+
+ "\tsource-absent",
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
const absentHarness = makeHarness();
|
|
635
|
+
const absentIndex = join(absentHarness.remoteHome, ".codex", "session_index.jsonl");
|
|
636
|
+
renameSync(absentIndex, absentIndex + ".saved");
|
|
637
|
+
const absentResult = syncOnly(absentHarness);
|
|
638
|
+
expect(absentResult.status).toBe(0);
|
|
639
|
+
expect(readFileSync(absentHarness.report, "utf8")).toContain(
|
|
640
|
+
"codex-session-index\tmac:~/.codex/session_index.jsonl\t"
|
|
641
|
+
+ join(absentHarness.home, ".codex", "session_index.macbook.jsonl")
|
|
642
|
+
+ "\t"
|
|
643
|
+
+ join(absentHarness.home, ".codex", "session_index.jsonl")
|
|
644
|
+
+ "\tsource-absent",
|
|
645
|
+
);
|
|
646
|
+
}, TEST_TIMEOUT_MS);
|
|
647
|
+
|
|
648
|
+
it("surfaces mapping append failures without installing a report or ingesting", () => {
|
|
649
|
+
const harness = makeHarness();
|
|
650
|
+
const result = run(
|
|
651
|
+
harness,
|
|
652
|
+
["--sync-only", "--mapping-report", harness.report],
|
|
653
|
+
{ FAKE_BREAK_MAPPING_TMP: harness.report },
|
|
654
|
+
);
|
|
655
|
+
|
|
656
|
+
expect(result.status).not.toBe(0);
|
|
657
|
+
expect(result.stdout + result.stderr).toContain("sync-only 映射报告追加失败");
|
|
658
|
+
expect(existsSync(harness.report)).toBe(false);
|
|
659
|
+
expect(existsSync(harness.ingestMarker)).toBe(false);
|
|
660
|
+
}, TEST_TIMEOUT_MS);
|
|
661
|
+
|
|
662
|
+
it("marks files pending when a live source changes after inventory", () => {
|
|
663
|
+
const liveSourceHarness = makeHarness();
|
|
664
|
+
const liveSourceResult = run(
|
|
665
|
+
liveSourceHarness,
|
|
666
|
+
["--sync-only", "--mapping-report", liveSourceHarness.report],
|
|
667
|
+
{ FAKE_RSYNC_MUTATE_ON_VERIFY_SOURCE: ".claude/projects/" },
|
|
668
|
+
);
|
|
669
|
+
const liveSourceRows = readFileSync(liveSourceHarness.report, "utf8")
|
|
670
|
+
.trim()
|
|
671
|
+
.split("\n")
|
|
672
|
+
.slice(1)
|
|
673
|
+
.map((line) => line.split("\t"))
|
|
674
|
+
.filter(([sourceKind]) => sourceKind === "claude-code");
|
|
675
|
+
expect(liveSourceResult.status).not.toBe(0);
|
|
676
|
+
expect(liveSourceRows.some((fields) => fields[4] === "pending:1")).toBe(true);
|
|
677
|
+
expect(liveSourceRows.some((fields) => fields[4] === "verified")).toBe(false);
|
|
678
|
+
}, TEST_TIMEOUT_MS);
|
|
679
|
+
});
|