fix(continuity): ignore AppleDouble lease sidecars

This commit is contained in:
冰朔 2026-08-05 21:08:28 +08:00
commit f48ca13295
3 changed files with 15 additions and 4 deletions

View file

@ -133,6 +133,10 @@ export function safeCacheRelative(worktree, candidate) {
return { absolute, relative };
}
export function isJsonRecordName(name) {
return String(name).endsWith(".json") && !String(name).startsWith("._");
}
function run(file, args, options = {}) {
return execFileSync(file, args, {
cwd: options.cwd,
@ -164,7 +168,7 @@ function listOwnedLeases(storeRoot, developmentId) {
if (!fs.existsSync(directory)) return [];
return fs
.readdirSync(directory)
.filter((name) => name.endsWith(".json"))
.filter(isJsonRecordName)
.map((name) => readJson(path.join(directory, name)))
.filter((lease) => lease.development_id === developmentId);
}

View file

@ -4,6 +4,7 @@ import os from "node:os";
import path from "node:path";
import test from "node:test";
import {
isJsonRecordName,
normalizeBranch,
normalizeCodeChannelRepository,
normalizeReceipt,
@ -76,3 +77,9 @@ test("cache deletion scope accepts only exact allowlisted descendants", () => {
test("embedded finalizer self-test passes", () => {
assert.deepEqual(selfTest(), { result: "PASS_100" });
});
test("macOS AppleDouble sidecars are never parsed as JSON records", () => {
assert.equal(isJsonRecordName("lease.json"), true);
assert.equal(isJsonRecordName("._lease.json"), false);
assert.equal(isJsonRecordName("lease.txt"), false);
});