fix: consolidate boundary ownership and cleanup failure paths (#477)

This commit is contained in:
morluto
2026-09-08 10:59:13 +08:00
committed by GitHub
parent c490d85045
commit 2160d4fae5
138 changed files with 2220 additions and 1781 deletions
@@ -3,7 +3,7 @@ import { lstat, realpath } from "node:fs/promises";
import { err, ok } from "../domain/result.js";
import { cancelled, failure } from "./ReferenceSourceReaderErrors.js";
import { withinRoot } from "./ReferenceSourceReaderPaths.js";
import { isPathWithinRoot } from "../domain/localPath.js";
import {
type BigStats,
type ReferenceSourceFailureCode,
@@ -62,7 +62,7 @@ export const validateDirectory = async (
message: "Directory identity changed",
};
const canonical = await realpath(path);
if (canonical !== path || !withinRoot(root, canonical))
if (canonical !== path || !isPathWithinRoot(root, canonical))
return {
ok: false,
code: "changed",