fix(artifacts): own DMG readers before attachment
Make inventory reader construction synchronous and DMG attachment lazy, so the inventory registers its reader before native operations start. Share initialization, reject work after close, wait for an in-flight attach before cleanup, and preserve retryable close state. Cover failed-attach inventory cleanup, concurrent initialization, close-before-use, and close-during-attach alongside existing ownership, cancellation, and integrity cases. Session-level retention after inventory cleanup failure remains a separate concern.
This commit is contained in:
@@ -53,7 +53,7 @@ describe("artifact inventory snapshot", () => {
|
||||
const failure = await scanCanonicalArtifactInventory(
|
||||
root,
|
||||
{},
|
||||
async () => reader,
|
||||
() => reader,
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
|
||||
if (!(failure instanceof ArtifactReaderFailure))
|
||||
|
||||
@@ -176,7 +176,7 @@ describe("ASAR captured-byte identity", () => {
|
||||
const originalSize = (await lstat(fixture.archive)).size;
|
||||
const directory = new DirectoryArtifactReader(fixture.bundle);
|
||||
await expect(
|
||||
scanCanonicalArtifactInventory(fixture.bundle, {}, async () => ({
|
||||
scanCanonicalArtifactInventory(fixture.bundle, {}, () => ({
|
||||
format: directory.format,
|
||||
entries: (signal) => directory.entries(signal),
|
||||
provenance: () => directory.provenance(),
|
||||
@@ -254,7 +254,7 @@ describe("ASAR captured-byte identity", () => {
|
||||
const failure: unknown = await scanCanonicalArtifactInventory(
|
||||
fixture.archive,
|
||||
{},
|
||||
async () => reader,
|
||||
() => reader,
|
||||
).catch((cause: unknown) => cause);
|
||||
expect(failure).toMatchObject({
|
||||
cleanup: { resources: [attempts[0]] },
|
||||
|
||||
Reference in New Issue
Block a user