Repository navigation
fix(sqlite): attribute result-column limit to columns instead of data… - #6388
ahmed-husssain wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryAttributes SQLite result-column limits to
Reviews (3) · Last reviewed commit: "fix(sqlite): attribute result-column lim..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c33514550d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
| } catch (cause: unknown) { | ||
| const message = cause instanceof Error ? cause.message : String(cause); | ||
| if (message.includes("too many columns in result set")) |
There was a problem hiding this comment.
Match the result-column diagnostic exactly
When a VIRTUAL generated column calls an unavailable deterministic function whose quoted name contains this text (for example, "too many columns in result set"(id)), SQLite raises unknown function: too many columns in result set(). This substring check intercepts that ordinary generated-column failure before columnEvaluationFailure, so CLI/MCP now rejects columns as malformed and drops the existing readable-column remediation; only classify the exact native result-limit error, ideally also checking SQLITE_ERROR or the configured column limit.
AGENTS.md reference: AGENTS.md:L31-L31
Useful? React with 👍 / 👎.
…base format When inspecting a SQLite table with more selected columns than SQLite's result-column limit, the engine returns SQLITE_ERROR with message 'too many columns in result set'. The worker previously fell back to format classification on path, reporting healthy databases as invalid. Match the SQLite error code and diagnostic message exactly in readRows to attribute result-column limits to column-selection without misclassifying virtual generated columns calling functions named like the error message. Gate the acceptance test on SQLITE_NATIVE_LIMITS_AVAILABLE for Node.js 22 compatibility where native limits are unsupported. Fixes morluto#6292
1889624 to
6fd3b23
Compare
baron
left a comment
There was a problem hiding this comment.
AI-assisted review confirms that the new exact-match guard fixes the earlier generated-function false positive, but the main failure family remains wrong at SqliteDatabaseInspection.ts:607–613.
A readable one-column database selected 2,000 times succeeds; 2,001 valid repeated selections hit the native result-column limit. This head emits column-selection, which the worker consumer projects as invalid_request/invalid_format on columns. The file and names are not malformed: capacity is exhausted. The new tests pin the wrong format classification and omit the effective limit/selected count.
Carry a typed capacity reason from the actual connection limit through the strict worker protocol, with observed counts and smaller/split-projection recovery. Preserve genuine unknown-column/input failures and caller repetitions. #6327 already implements this structural alternative; coordinate rather than merge both.
Inspector and real-worker probes confirmed the boundary; public error consequences were source-traced, not a local full CLI/MCP run. Unrelated GDB CI failures were retained, not treated as flakes. No blind rerun recommended before correcting semantics.
Summary
Fixes #6292.
When inspecting an SQLite table with more selected columns than SQLite's result-column limit (
SQLITE_MAX_COLUMN), the engine returnsSQLITE_ERRORwith message"too many columns in result set". The worker previously fell back to format classification onpath, reporting healthy databases as invalid.Attribute result-column limits to
column-selectioninreadRowsso the error identifiescolumnsas the failing argument and preserves the SQLite reason.Problem and expected behavior
inspect_sqlite_databasewith >2,000 columns (e.g.columns: Array(2001).fill("email")).columns), preserve the engine's reason, and avoid classifying healthy database files as invalid/malformed.path: ["columns"]withreason: "invalid_format"and message"too many columns in result set". Malformed files continue reporting format error onpath.Change and scope
src/sqlite/SqliteDatabaseInspection.ts: catch"too many columns in result set"inreadRowsand throwSqliteInspectionFailure("column-selection", message)."column-selection"protocol and error mapping inSqliteDatabaseWorkerExecution.ts(rejectedArgument["column-selection"] = "columns").Contract and boundary impact
Semantic owner and earliest changed stage:
SqliteDatabaseInspection.ts(query preparation / execution).Contribution scope fit and linked maintainer decision: not applicable.
CLI and MCP/tool-catalog contract: Unchanged schema. Identifies
columnsrather thanpathas the invalid argument when result-column limits are exceeded.Provider, bridge, target-format, or platform compatibility: Standard SQLite result-column limit behavior.
Evidence, artifact, provenance, or reconstruction contract: Database files remain read-only and unmutated.
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
Tests added or updated:
tests/boundary/sqlite/sqliteDatabaseInspection.test.ts: assertsinspectSqliteDatabaseSnapshotthrowsSqliteInspectionFailurewithreason: "column-selection"when result-column limits are exceeded.tests/acceptance/sqliteDatabaseCli.test.ts: verifies MCP tool response reportspath: ["columns"]on >2000 columns while genuine malformed control files reportpath: ["path"].Base reproduction: Base revision threw raw
ERR_SQLITE_ERRORand returnedSelected SQLite database is invalid (too many columns in result set)targetingpath: ["path"].User-visible CLI/MCP output:
{ "error": { "code": "invalid_request", "category": "invalid_input", "retryable": false, "details": { "issues": [ { "path": ["columns"], "reason": "invalid_format", "message": "too many columns in result set" } ] } } }Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
node node_modules/vitest/vitest.mjs run tests/boundary/sqlite/sqliteDatabaseInspection.test.ts— PASS (25 passed, 1 skipped)node node_modules/vitest/vitest.mjs run tests/acceptance/sqliteDatabaseCli.test.ts -t "attributes SQLite result-column limits"— PASS (1 passed, 14 skipped)npx oxfmt --check src/sqlite/SqliteDatabaseInspection.ts tests/acceptance/sqliteDatabaseCli.test.ts tests/boundary/sqlite/sqliteDatabaseInspection.test.ts— PASS (all matched files formatted)npm run check:fast— PASS (Turbo typecheck and oxlint clean)Compatibility, safety, and release
Author readiness
Human owner: @ahmed-husssain
Before merge
type(scope): outcome.