Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(sqlite): classify a missing database path as an invalid value (#2775)
yasshmittal4c79127fcb31
diff --git a/src/sqlite/SqliteDatabaseSnapshot.ts b/src/sqlite/SqliteDatabaseSnapshot.tsindex 4acf89611..1384fbdb6 100644--- a/src/sqlite/SqliteDatabaseSnapshot.ts+++ b/src/sqlite/SqliteDatabaseSnapshot.ts@@ -3,6 +3,7 @@ import { constants, type BigIntStats } from "node:fs";import { join } from "node:path";import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";import type { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";+import { AnalysisInputError } from "../domain/analysisErrorCore.js";import { OwnedFileHandle } from "../filesystem/OwnedFileHandle.js";import {readStableArtifact,@@ -166,6 +167,16 @@ const verifyInactiveJournal = async (}};+// Absence is a caller value to correct, not malformed path or content.+const missingDatabase = (path: string): AnalysisInputError =>+ new AnalysisInputError("inspect_sqlite_database", undefined, [+ {+ path: ["path"],+ reason: "invalid_value",+ message: `Selected SQLite database does not exist: ${path}`,+ },+ ]);+/** Freeze a stable offline file set without ever opening the source through SQLite. */export const captureSqliteDatabaseSnapshot = async (path: string,@@ -183,11 +194,7 @@ export const captureSqliteDatabaseSnapshot = async (const wal = before[1];if (database === undefined || wal === undefined || before[2] === undefined)throw new Error("Incomplete database file-set observation");- if (database === null)- throw new ArtifactReaderFailure(- "path",- `Selected SQLite database does not exist: ${path}`,- );+ if (database === null) throw missingDatabase(path);if (before[2] !== null)await verifyInactiveJournal(`${path}-journal`,diff --git a/tests/boundary/sqlite/sqliteDatabaseProvider.test.ts b/tests/boundary/sqlite/sqliteDatabaseProvider.test.tsindex b5adf8297..7805552c9 100644--- a/tests/boundary/sqlite/sqliteDatabaseProvider.test.ts+++ b/tests/boundary/sqlite/sqliteDatabaseProvider.test.ts@@ -357,6 +357,30 @@ it("does not execute views when selecting rows", async () => {});});+nativeTest.each(["absent.db", "absent-parent/absent.db"])(+ "classifies a missing %s as an invalid value",+ async (name) => {+ const workspace = await createTestWorkspace("rea-sqlite-missing-");+ onTestFinished(() => removeTestWorkspace(workspace.root));+ const path = workspace.path(name);+ const provider = createProvider();+ onTestFinished(() => provider.close());+ const result = await provider.inspect({ path });+ if (result.ok) throw new Error("Expected a missing database rejection");+ expect(projectAnalysisError(result.error)).toMatchObject({+ details: {+ issues: [+ {+ path: ["path"],+ reason: "invalid_value",+ message: `Selected SQLite database does not exist: ${path}`,+ },+ ],+ },+ });+ },+);+it("attributes table and column selection failures to their own arguments", async () => {const { database } = await createFixture();const provider = createProvider();