Files
PaperClipAI/server/src/services/execution-workspace-source-roots.ts
T
DottaandPaperclip 813e808af4 Remove filesystem history authorization from workspace preparation (#16963)
Remove physical-root source/reader authorization and sticky directory classifications from workspace preparation. Preserve current task/run authority, app-record privacy, credential authorization, containment, and lifecycle/publication integrity.

Validate replacement selections against persisted new inputs and refresh verified checkout ownership so bounded reuse survives earlier workspace relocation. Add real PostgreSQL/Git regressions, a reproducible history-scaling benchmark, and documentation.

Full CI passed all 48 jobs and Greptile scored 5/5 at 3d5da6c259. Five preparation-guard medians improved from 20,512.99 ms to 52.22 ms on the 8,500-workspace fixture; these are not end-to-end startup timings.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-20 09:19:59 -05:00

14 lines
496 B
TypeScript

import fs from "node:fs/promises";
import path from "node:path";
export async function canonicalRepositoryRoot(cwd: string): Promise<string> {
const absolute = path.resolve(cwd);
try { return await fs.realpath(absolute); }
catch (error) {
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
const parent = path.dirname(absolute);
if (parent === absolute) throw error;
return path.join(await canonicalRepositoryRoot(parent), path.basename(absolute));
}
}