Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 35527e2f3fd6bc76527bbfccb100148b5f3e9eb0
parent cde547a56a7e9731b6a03b34fde456c7a540f994
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 17:05:05 -0400

common: a delete removes what the plan made under the lock lists, with the first plan's media copies

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/lib/report/delete.ts | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/common/lib/report/delete.ts b/common/lib/report/delete.ts @@ -496,6 +496,8 @@ async function removeEntries( return out; } +const uniqueByPath = (entries: readonly DeleteEntry[]): DeleteEntry[] => [...new Map(entries.map((e) => [e.path, e])).values()]; + const stampOf = (now: Date) => `${now.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z")}-${process.pid}`; // DELETE ARTICLE `id`. Refused (DeleteRefusedError, nothing written) while @@ -530,7 +532,10 @@ export async function deleteArticle(id: string, opts: DeleteOptions, now: Date = return { plan, parked }; }, paths); const projectsRoot = path.resolve(opts.projectsRoot); - const entries = first.remove.map((e) => + // What either plan lists — the one made under the lock is what is there now; + // the first walked every link (a media copy) — the article directory as it + // was parked. + const entries = uniqueByPath([...locked.plan.remove, ...first.remove]).map((e) => locked.parked && e.path === articleDir(paths, id) ? { ...e, path: locked.parked } : e, ); const roots = [paths.articlesDir, projectsRoot, paths.exportIndexDir, ...(opts.media ? [opts.media.mediaRoot] : [])]; @@ -618,14 +623,14 @@ export async function deleteIteration(id: string, n: number, opts: DeleteOptions const first = await planIterationDelete(id, n, opts); if (deleteBlocked(first)) throw new DeleteRefusedError(`"${id}" ${iterationLabel(n)} is not deleted`, first); const stamp = stampOf(now); - const parked = await withArticleStoreLock(async () => { + const locked = await withArticleStoreLock(async () => { const plan = await planIterationDelete(id, n, { ...opts, measure: false }); if (deleteBlocked(plan)) throw new DeleteRefusedError(`"${id}" ${iterationLabel(n)} is not deleted`, plan); - return retireIterationHoldingLock(id, n, paths, stamp); + return { plan, parked: await retireIterationHoldingLock(id, n, paths, stamp) }; }, paths); const projectsRoot = path.resolve(opts.projectsRoot); const own = iterationDir(paths, id, n); - const entries = first.remove.map((e) => (e.path === own ? { ...e, path: parked } : e)); + const entries = uniqueByPath([...locked.plan.remove, ...first.remove]).map((e) => (e.path === own ? { ...e, path: locked.parked } : e)); const roots = [paths.articlesDir, projectsRoot, ...(opts.media ? [opts.media.mediaRoot] : [])]; const done = await removeEntries(entries, roots); const projectsDir = path.join(projectsRoot, id);