Repository navigation
ADFA-7297 SQLite debugger P2-2: rows, change counts, named parameters and column types - #2319
davidschachterADFA wants to merge 9 commits into
Conversation
…column types Phase 2, P2-2 (ADFA-7131 comments 41476, 41477). On P2-1 (#2311, at e16ea45). - get_events: a profile event carries rows, changes (null for a read) and rows_cut; a row event carries row_number, column_count, values, storage_classes and cut_values. get_events turns row recording on (new DebugEngine.setRowCapture, JNI setRowCapture): 10 rows per statement, values cut at 256 bytes, a row at 4 KiB. include_rows false turns it off and leaves row events out; it also goes off with the idle client and when the server stops. - query and explain_query_plan: args as an object binds by name (:name, @name, $name, ?NNN; a key with or without its prefix). Names go to JNI as UTF-8 and are matched against sqlite3_bind_parameter_name: every parameter needs a value and every key a parameter. The array form is unchanged. - query returns column_types (sqlite3_column_decltype, null for an expression) and storage_classes, a letter per cell (i r t b n): JSON writes REAL 2.0 as 2, and big integers as strings. - BLOBs are {hex, bytes, truncated}; they were base64. No client reads the old key (AI-Agent-MCP passes results through). - Tool descriptions say what is capped; README updated. Limit: execute (P2-3, #2312) still binds positional args only; the second of the two PRs to merge wires its names. Tests: test.sh passes (ASan+UBSan, TSan, JNI 279 checks: each name form, the five refusals, declared types, the row-recording switch). DatabaseToolsTest, McpProtocolTest and EventDecoderTest pass (118), compiled with the Kotlin compiler outside Gradle, including an encoding of every event in P2-1's fixture. Revert proofs: no unused-name check fails "named: a misspelt name"; no decltype fails "declared types"; no idle switch-off fails rowRecordingStopsWithTheIdleClient; no row filter fails getEventsTurnsRowRecordingOnUnlessToldNotTo. Not run here: Gradle, spotlessCheck, a device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
spotlessKotlinCheck's two changes to DatabaseTools.kt: the named-args key chain on one call per line, and one blank line dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
The args description said every key could be written without its prefix, but only :name, @name and $name match a bare name (key_matches): {"1": 5} for ?1 fails with "no value was given for parameter ?1". The text now says a ?NNN key keeps its ?, as the README already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
It described bind_args, which bind_positional and bind_value replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
spotlessKotlinCheck failed on DatabaseToolsTest.kt with one max-line-length error, reported at L1. ktlint joins kinds()'s expression body onto its signature line, and the joined line is 142 columns. Its other changes were then not applied either, so the file also needed ktlint's wrapping of the named-args call and of a four-call chain. kinds() now has a block body. Two long assertions are wrapped, and the row-values check reads values.get(c) once, before its when, so each branch stays on one line. Production code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
The cloud session's ffb3f18 drops a stale comment above bind_value in sqlitedbg_jni.c (one line). P2-6 (ADFA-7301) already merges it, so the two branches keep the same ancestry. No conflicts; nothing else changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ite-debugger/ADFA-7301 P2-6 now stacks on #2319: it takes Remington's e450122 (a ?NNN args key keeps its ?), e648501 and the merge of ffb3f18. No conflicts. At the merge: DatabaseToolsTest, ShellToolsTest, McpProtocolTest and EventDecoderTest pass (135); test.sh 0 failures (JNI 333). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
bind_named stopped at the first parameter with no value, before it
looked for keys that matched no parameter. So args {"idx": 1} against
"WHERE id = :id" failed with "no value was given for parameter :id",
and the misspelt key was never named (seen on the J7, ADFA-7297
comment 41611).
It now binds every parameter that has a value, then reports a key that
matched nothing first, together with the parameter left without a
value: "the statement has no parameter named idx, and no value was
given for parameter :id". A parameter left out with no stray key, and a
stray key with every parameter bound, keep their messages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…qlite-debugger/ADFA-7301 Brings in the misspelt named-args key message from #2319. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…eff47b0) The base for ADFA-7304, which needs P2-2 and P2-3/P2-4; neither has landed (David, 2026-11-26). Conflicts, each side kept: - sqlitedbg.c: P2-2's sqlitedbg_set_row_capture beside P2-3's PRAGMA allowlist and writable authorizer. - sqlitedbg_jni.c: P2-3's prepare_bound calls P2-2's bind_named or bind_positional (which checks the count itself, as prepare_bound did); bridge_query passes its names; execute stays positional for now. - DebugEngine.kt: P2-2's setRowCapture beside P2-3's openServerConnection doc. - DatabaseTools.kt: P2-3's withConnection with P2-2's Bind; execute refuses object args (its schema still says array), so an object's values are never bound by position; the Room check passes Bind.NONE. - README: the JNI test list names both PRs' cases. At the merge: test.sh 0 failures (JNI 480); DatabaseToolsTest, McpProtocolTest and EventDecoderTest pass (131). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
The item left for whichever of #2312 and #2319 merged second (41592): execute takes args as an array or an object, through the same prepare_bound, bind_named and argsSchema as query. - JNI execute gains names ([[B); bridge_execute passes them to prepare_bound. ServerConnection.execute gains argNames. - The execute tool's args schema is argsSchema(), and the merge's refusal of an object is gone. README updated. Tests: JNI binds INSERT ... VALUES(:id, @s) by name and refuses a misspelt key with SQLITE_RANGE, writing nothing; executeBindsAnObjectByName. test.sh 0 failures (JNI 488); JVM 132. Revert proof: execute ignoring names fails "each value went to its own parameter", "execute ran with a misspelt name" and "and the row is still there". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
davidschachterADFA
left a comment
There was a problem hiding this comment.
Review of #2319 at f0c931f63f. Stack: #2311 (P2-1) <- #2319 (this) <- #2323 (P2-6); claims checked at the stack tip 323d3d3. Read: the full diff; at the tip DatabaseTools.kt, EventDecoder.kt, the sqlitedbg.c row-capture setters, the JNI named-arg matching (misspelt, duplicate and unused keys) and decltype handling, and the README. Tests were not re-run for this review.
No findings survived verification.
Earlier review comments, re-checked against the code (not the replies)
- claude[bot] - review-bot boilerplate (manual review instructions); no findings: fixed. Review body only says reviews are manual; no inline comments exist on the PR (gh api pulls/2319/comments is empty).
Verdict: COMMENT. This PR is authored by the account posting the review, and GitHub refuses APPROVE and REQUEST_CHANGES on your own PR. Severity rules: CodeOnTheGo REVIEW.md and CLAUDE.md (a ticket moves to QA with no outstanding critical, high or medium findings); addons has no written rule, so the default applied.
Generated by Claude Code
…gger/ADFA-7297 Brings in the #2311 review fix (the fake engine sizes records as the native ones). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…gger/ADFA-7301 Brings in the #2311 review fix through #2319. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
|
@hal-eisen-adfa A new commit since you were asked to review: d354698 merges #2311's test-only fix for the 2026-11-26 review. Both branches had added an |
…gger/ADFA-7297 Brings in the #2311 review fix (EventDecoder refuses a row count its bytes cannot hold). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…gger/ADFA-7301 Brings in the #2311 review fix through #2319. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…gger/ADFA-7302 Brings in the #2311 review fix through #2319 and #2323. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
|
@hal-eisen-adfa A new commit since you were asked to review: b87338e merges #2311's 2d674ec ( |
ADFA-7297
Phase 2, P2-2 of the SQLite debugger (ADFA-7131): the MCP server turns on the row recording that #2311 (P2-1) added to the extension, and returns rows, change counts, named parameters and column types. Stacked on #2311.
What it does (
subprojects/sqlite-debugger)get_events: a profile event gainsrows,changes(null for a read) androws_cut. A newrowevent kind hasrow_number,column_count,values,storage_classesandcut_values. Callingget_eventsturns row recording on: 10 rows per statement, values cut at 256 bytes, rows at 4 KiB.include_rows: falseturns it off and leaves row events out. Recording also goes off when the client goes idle and when the server stops.queryandexplain_query_plan:argscan be an object that binds by name (:name,@name,$name,?NNN). A key is written as in the SQL; a key without a prefix, such asid, matches:id,@idand$id, and a?NNNkey keeps its?. Names are matched in JNI. Every parameter needs a value, and every key must name a parameter.queryreturnscolumn_types(the declared types) andstorage_classes(one letter per cell,irtbn).{hex, bytes, truncated}; they were base64. No client reads the old key.Limit:
execute(#2312) still binds positional args only. Whichever of #2312 and this PR merges second wires named args intoexecute: passargNamesthroughbridge_executeandprepare_bound.Commits
spotlessApplyonDatabaseTools.ktonly (one call chain wrapped, one blank line dropped).argsdescription said every key could drop its prefix, but a bare1doesn't match?1; it now says a?NNNkey keeps its?, as the README already did (from the review below).sqlitedbg_jni.c; ADFA-7301 SQLite debugger P2-6: sqlite3 shell tools (suggest_indexes, lint_foreign_keys, dump, export, .dbinfo) #2323 carries the same commit.kinds()'s expression body onto its signature line, at 142 columns, and that error (reported at L1) stopped its other changes.kinds()now has a block body, and the lines ktlint wanted wrapped are wrapped. Production code is unchanged.{"idx": 1}for:id) failed with only "no value was given for parameter :id".bind_namedstopped at the first parameter with no value, before it looked for keys that matched nothing. It now names the key as well: "the statement has no parameter named idx, and no value was given for parameter :id". A parameter left out with no stray key, and a stray key with every parameter bound, keep their messages. The README says so.addEventoverload toFakeDebugEngine, and both are kept.EventDecoderrefuses a row count its bytes cannot hold), with no conflicts. Its diff is exactly 2d674ec's.Tests
:subprojects:sqlite-debugger:testDebugUnitTest(125 tests) andspotlessCheckpass.:subprojects:sqlite-debugger:testDebugUnitTest(124 tests) andspotlessCheckpass.test.shat 99007a7 passes (ASan+UBSan 20750 checks, TSan 20732, JNI 279, 0 failures). The C and JNI code is unchanged after it. At e648501::subprojects:sqlite-debugger:testDebugUnitTest(123 tests) andspotlessCheckpass.assembleV8Debugpassed at 99007a7, and:subprojects:sqlite-debugger:assembleDebugat e450122.test.shpasses (ASan+UBSan 20748 checks, TSan 20750, JNI 280, 0 failures), and so do:subprojects:sqlite-debugger:testDebugUnitTest(123 tests),spotlessCheckand the module's debug and release AARs. Revert proof: withsqlitedbg_jni.cas at a8fca8c, exactly the two changed expectations fail, each showing the old message.test.sh0 failures, 118 JVM tests, and four revert proofs that fail as named.Review before this PR (a fresh read of 99007a7; no CRITICAL or IMPORTANT findings):
argsdescription (e450122).%.100s), which can split a UTF-8 character and show U+FFFD; a comment inDatabaseTools.ktsays every tool that returns cells carriesstorage_classes, but onlyqueryandget_eventsdo; the named-binding tests don't cover a key over 100 bytes ornamesandargsof different lengths (the code paths were read and found correct).Device check (Galaxy J7, Android 9, 2026-11-26; ADFA-7297 41611):
get_eventsturned row recording on; after a note was added in the app, the INSERT's profile event hadchanges1 and the list's SELECTrows5, followed by 5rowevents, andinclude_rows: falseleft them out. Named args bound asid,:idand?1, and a misspelt key failed with "no value was given for parameter :id" (the key itself is now named too, f0c931f; not rerun on the device). The test app was RoomNotes built with the SQLite debugger from #2323's head (which carries this PR) and #2262's plugin, called overadb forward.No screens added or changed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Code Reviewer: Code Reviewer couldn't review this pull request
The pull request author does not have access to AI for the associated Atlassian organization.