fix(artifacts): retain source identity failures after relocation

This commit is contained in:
morluto committed 2026-10-26 15:15:00 +08:00
1 parent 0c147a4a70
commit 2012efe5fd
2 files changed
+72 -3

No files matched your search

+15 -1
View File
@@ -135,7 +135,21 @@ export class ArtifactFileSource {
const source = await this.#opening;
const [observed, selected] = await Promise.all([
source.handle.stat(),
lstat(this.path),
lstat(this.path).catch((cause: unknown) => {
// Admission already established this selected name. Its disappearance
// or a replaced ancestor is a source change, not an unrelated I/O fault.
if (
cause instanceof Error &&
"code" in cause &&
(cause.code === "ENOENT" || cause.code === "ENOTDIR")
)
throw new ArtifactReaderFailure(
"integrity",
`${this.diagnosticLabel} source identity changed: ${this.path}`,
{ cause },
);
throw cause;
}),
]);
if (
!sameRegularFileState(source.initial, observed) ||