Simplify and harden investigation workflows

This commit is contained in:
morluto
2026-07-12 21:45:26 +00:00
parent fbe8ec1f13
commit 293cea7723
35 changed files with 531 additions and 1041 deletions
+6 -6
View File
@@ -14,7 +14,7 @@ import {
type ArtifactLimits,
} from "./ArtifactReader.js";
/** One file durably written to a transaction-owned output tree. */
/** One file durably written to an operation-owned output tree. */
export interface SafeOutputFile {
readonly relativePath: string;
readonly sha256: string;
@@ -28,7 +28,7 @@ export interface SafeOutputCleanup {
readonly residualPaths: readonly string[];
}
/** Transactional, symlink-resistant materialization beneath an absent path. */
/** Symlink-resistant materialization in an exclusively owned, initially absent tree. */
export class SafeOutputTree {
readonly #registry = new ArtifactPathRegistry();
readonly #limits: ArtifactLimits;
@@ -52,7 +52,7 @@ export class SafeOutputTree {
this.#limits = limits;
}
/** Exclusively create the absent destination as this transaction's owned tree. */
/** Exclusively create the absent destination as this operation's owned tree. */
static async create(
outputRoot: string,
limits: ArtifactLimits,
@@ -177,7 +177,7 @@ export class SafeOutputTree {
}
}
/** Durably commit the exclusively-created output tree. */
/** Sync the owned output tree and prevent further writes through this instance. */
async commit(): Promise<void> {
this.#assertWritable();
const parent = await open(
@@ -195,7 +195,7 @@ export class SafeOutputTree {
} catch (cause: unknown) {
throw new ArtifactReaderFailure(
"path",
"Could not durably commit extraction output",
"Could not durably sync extraction output",
{ cause },
);
} finally {
@@ -203,7 +203,7 @@ export class SafeOutputTree {
}
}
/** Remove only this transaction's uncommitted tree and verify absence. */
/** Remove only this operation's unsealed tree and verify absence. */
async rollback(): Promise<SafeOutputCleanup> {
if (this.#published) return this.#cleanup;
await rm(this.#stagingRoot, { recursive: true, force: true });