fix(artifacts): preserve iNES source disappearance as integrity failure

This commit is contained in:
64579525
2026-10-12 15:50:02 +08:00
parent 414307c9d5
commit 574f6bb3bd
2 changed files with 56 additions and 2 deletions
+13 -1
View File
@@ -178,7 +178,19 @@ export class InesArtifactReader implements ArtifactReader {
throw new ArtifactReaderFailure("unavailable", "iNES reader is closed");
const [opened, selected] = await Promise.all([
this.source.handle.stat(),
lstat(this.path),
lstat(this.path).catch((cause: unknown) => {
if (
cause instanceof Error &&
"code" in cause &&
["ENOENT", "ENOTDIR", "ELOOP"].includes(String(cause.code))
)
throw new ArtifactReaderFailure(
"integrity",
"iNES source changed during reading",
{ cause },
);
throw cause;
}),
]);
if (
!sameRegularFileState(this.source.initial, opened) ||