mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
fix(sqlite): attribute generated-column evaluation failures to the selection (#5879)
* fix(sqlite): attribute generated-column evaluation failures to the selection A selected virtual generated column whose expression needs a function the read-only connection lacks (or raises an SQL error for a sampled row) was classified by the worker's catch-all as a malformed database and projected as an invalid_format issue on `path`. Row reads now attribute SQLITE_ERROR from selected cells by probing each selected virtual generated column over the sampled rows, and report a typed capability_unavailable refusal naming the table, each failing column with SQLite's message, and the remaining columns to select. Other causes, including corruption, TOOBIG and NOMEM, keep their classification. Fixes #5719 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sqlite): recommend only probed-readable columns after evaluation failures Record every per-column probe failure with its own reason, discover stored columns outside an inventory-scope selection without decoding unrelated malformed names, and present recovery as the structured columns selection instead of shell-quoted command text built from database-supplied names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
efab044f30
commit
bcfcd8b6e2
7 files changed
+473
-36
No files matched your search
@@ -4,7 +4,9 @@ import { inspectSqliteDatabaseInputSchema } from "../domain/sqlite/sqliteDatabas
|
||||
import { inspectSqliteDatabaseSnapshot } from "./SqliteDatabaseInspection.js";
|
||||
import {
|
||||
SQLITE_DATABASE_LIMITS,
|
||||
SqliteColumnEvaluationFailure,
|
||||
SqliteInspectionFailure,
|
||||
sqlitePrimaryResultCode,
|
||||
} from "./SqliteDatabaseLimits.js";
|
||||
|
||||
const requestSchema = z.strictObject({
|
||||
@@ -29,20 +31,28 @@ const main = async (): Promise<void> => {
|
||||
),
|
||||
};
|
||||
} catch (cause: unknown) {
|
||||
const code =
|
||||
cause instanceof Error && "errcode" in cause ? cause.errcode : undefined;
|
||||
reply = {
|
||||
ok: false,
|
||||
reason:
|
||||
cause instanceof SqliteInspectionFailure
|
||||
? cause.reason
|
||||
: code === 7
|
||||
? "memory"
|
||||
: code === 18
|
||||
? "output-limit"
|
||||
: "format",
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
};
|
||||
const code = sqlitePrimaryResultCode(cause);
|
||||
const message = cause instanceof Error ? cause.message : String(cause);
|
||||
reply =
|
||||
cause instanceof SqliteColumnEvaluationFailure
|
||||
? {
|
||||
ok: false,
|
||||
reason: cause.reason,
|
||||
message,
|
||||
readable_columns: cause.readableColumns,
|
||||
}
|
||||
: {
|
||||
ok: false,
|
||||
reason:
|
||||
cause instanceof SqliteInspectionFailure
|
||||
? cause.reason
|
||||
: code === 7
|
||||
? "memory"
|
||||
: code === 18
|
||||
? "output-limit"
|
||||
: "format",
|
||||
message,
|
||||
};
|
||||
}
|
||||
let encoded = JSON.stringify(reply);
|
||||
if (Buffer.byteLength(encoded) > SQLITE_DATABASE_LIMITS.outputBytes)
|
||||
|
||||
Reference in new issue
Block a user