fix: run ap-search-remote-uid-guard after ap-search-url-resolve-remote
Deploy Indiekit Server / deploy (push) Successful in 1m20s

The uid-guard patch anchors to markers written by the remote-search patch,
so it must run after it. Moved the uid-guard runner block below the
ap-search-url-resolve-remote block to fix ordering dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-04-15 21:50:57 +02:00
parent 0a131f699c
commit ad1ecce943
+19 -18
View File
@@ -275,24 +275,6 @@ const UID_GUARD_NEW =
` if (!_rData?.uid) throw new Error("remote AP object has no uid"); ${UID_GUARD_MARKER}\n` +
` const _rStored = await addTimelineItem(collections, _rData); ${SEARCH_REMOTE_MARKER}`;
let uidGuardDone = false;
for (const f of SEARCH_CANDIDATES) {
if (!(await fileExists(f))) continue;
const src = await readFile(f, "utf8");
if (src.includes(UID_GUARD_MARKER)) {
console.log(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard already applied in ${f}`);
uidGuardDone = true; break;
}
if (!src.includes(UID_GUARD_OLD)) {
console.warn(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard — anchor not found in ${f}`);
continue;
}
await writeFile(f, src.replace(UID_GUARD_OLD, UID_GUARD_NEW), "utf8");
console.log(`[postinstall] ${SCRIPT}: applied ap-search-remote-uid-guard to ${f}`);
total++; uidGuardDone = true; break;
}
if (!uidGuardDone) console.log(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard — no target file found`);
let searchRemoteDone = false;
for (const f of SEARCH_CANDIDATES) {
if (!(await fileExists(f))) continue;
@@ -311,6 +293,25 @@ for (const f of SEARCH_CANDIDATES) {
}
if (!searchRemoteDone) console.log(`[postinstall] ${SCRIPT}: ap-search-url-resolve-remote — no target file found or no changes`);
// uid-guard must run AFTER ap-search-url-resolve-remote (depends on its markers)
let uidGuardDone = false;
for (const f of SEARCH_CANDIDATES) {
if (!(await fileExists(f))) continue;
const src = await readFile(f, "utf8");
if (src.includes(UID_GUARD_MARKER)) {
console.log(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard already applied in ${f}`);
uidGuardDone = true; break;
}
if (!src.includes(UID_GUARD_OLD)) {
console.warn(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard — anchor not found in ${f}`);
continue;
}
await writeFile(f, src.replace(UID_GUARD_OLD, UID_GUARD_NEW), "utf8");
console.log(`[postinstall] ${SCRIPT}: applied ap-search-remote-uid-guard to ${f}`);
total++; uidGuardDone = true; break;
}
if (!uidGuardDone) console.log(`[postinstall] ${SCRIPT}: ap-search-remote-uid-guard — no target file found`);
// ── patch-ap-resolve-actor-timeout: cap actor lookup at 8 s + log failures ───
// When Mastodon client clicks a @mention handle, /api/v1/accounts/lookup calls
// resolveRemoteAccount → lookupWithSecurity → ctx.lookupObject (no timeout).