fix(audit): clarify missing drift artifacts-dir errors

Replace raw ENOENT from drift artifact directory scans with a clear explicit error message containing the resolved path. Architecture/protocol diagrams reviewed; no updates needed.
This commit is contained in:
William Valentin
2026-02-27 13:30:56 -08:00
parent 576b11106f
commit 8818c326b7
2 changed files with 20 additions and 1 deletions
+11
View File
@@ -617,6 +617,17 @@
],
"test_status": "pnpm typecheck + HOME=/tmp path-expansion smoke checks passing"
},
"phase0-live-baseline-drift-missing-dir-error-clarity": {
"status": "completed",
"date": "2026-02-27",
"updated": "2026-02-27",
"summary": "Improved drift CLI operator feedback by translating missing artifacts-directory `ENOENT` failures into a clear explicit error message with the resolved path.",
"files_modified": [
"scripts/check-phase0-baseline-backend-drift.ts",
"docs/plans/state.json"
],
"test_status": "pnpm typecheck + node --import tsx/esm scripts/check-phase0-baseline-backend-drift.ts --artifacts-dir <missing-dir> --backend native --format json passing (clear error)"
},
"phase0-instrumentation-ticket-checklist": {
"status": "completed",
"date": "2026-02-25",
@@ -209,7 +209,15 @@ function buildThresholds(values: Record<string, string | boolean | undefined>):
}
async function readArtifactRecords(artifactsDir: string): Promise<ArtifactRecord[]> {
const files = await readdir(artifactsDir);
let files: string[];
try {
files = await readdir(artifactsDir);
} catch (error) {
if ((error as NodeJS.ErrnoException)?.code === 'ENOENT') {
throw new Error(`Artifacts directory does not exist: ${artifactsDir}`);
}
throw error;
}
const records: ArtifactRecord[] = [];
for (const file of files) {