Repository navigation
ADFA-7299: SQLite debugger asks before the first write to a Room database - #2313
Open
davidschachterADFA wants to merge 4 commits into
Open
davidschachterADFA wants to merge 4 commits into
davidschachterADFA wants to merge 4 commits into
Conversation
…om database
Phase 2, P2-4 (ADFA-7131 comment 41476, decision D6). On P2-3.
- Room records changes with TEMP triggers on its own connection, which
a write on the server's connection does not fire, so its observers
miss the change and a screen can show stale data. The debugger does
not make Room refresh: it must not change how the app behaves.
- execute looks for room_master_table on the read-only connection. On a
Room database it runs nothing and returns an error naming the risk,
with details {room: true, acknowledge_with: "acknowledge_room"}, until
the call is repeated with acknowledge_room: true.
- The acknowledgement is kept per database path for the life of
DatabaseTools (one per app process), so later writes to that
database run without asking and the check is not run again. A
database without room_master_table never asks.
- acknowledge_room must be a boolean; it is checked before the engine.
- README and execute's description and input schema updated.
Limits: a database without Room's table is checked on every execute
(one indexed read of sqlite_master); an acknowledgement outlives a
database the app deletes and recreates under the same path.
Tests: DatabaseToolsTest, McpProtocolTest and EventDecoderTest pass
(119), compiled with the Kotlin compiler outside Gradle. One P2-3 test
now counts the read-only connection execute opens. Revert proofs:
never refusing fails aRoomDatabaseRefusesTheFirstWrite... and
anAcknowledgementCoversOnlyItsOwnDatabase...; not remembering the
acknowledgement fails anAcknowledgedRoomWriteRunsAndLaterWritesRun...
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
(cherry picked from commit c07fbf3)
…sult c07fbf3 was written on P2-3 before execute returned last_insert_rowid (b73b9f7), so its Room test helper built ExecuteResult(1) and no longer compiled; it now passes lastInsertRowid = null. Its one-line fake answer in the acknowledgement test exceeded ktlint's 140 columns, which spotlessApply cannot fix; it is wrapped. Tests only, no behaviour change. :subprojects:sqlite-debugger:testDebugUnitTest 125 tests pass, assembleDebug passes, spotlessApply leaves nothing to change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…gger/ADFA-7299 Brings P2-3's 8c2f6ac (execute reports rowid 0; INT64_MIN stands for "no row inserted") into this stacked branch. One conflict, in the README's execute paragraph: P2-3 changed its last_insert_rowid sentence, and this PR removed "(the Room warning is ADFA-7299)" from it, as its own bullet now covers the Room warning. The resolution keeps P2-3's paragraph without that parenthesis, followed by this PR's Room bullet. Outside the README this PR's own diff is unchanged (+/- lines of `git diff b73b9f7 1f695c4` and `git diff sqlite-debugger/ADFA-7298 HEAD` identical); in the README its own changes are the same two (the parenthesis removed, the Room bullet added). 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.
…gger/ADFA-7299 Brings P2-3's fix for CodeRabbit's flag-PRAGMA finding into this stacked branch: every PRAGMA that takes a value is refused except schema reads and user_version on execute's connection (d7c5350), and execute's writable connection enforces foreign keys (01413e0). Two conflicts, both resolved to keep both sides: in DatabaseTools.kt, P2-3's new READ_PRAGMAS_NOTE beside this PR's ROOM_DESCRIPTION and ROOM_WARNING, and execute's description with P2-3's new text plus this PR's "$ROOM_DESCRIPTION"; in the README, P2-3's rewritten read-only and execute paragraphs (the latter without "(the Room warning is ADFA-7299)", as this PR's Room bullet covers it), then the Room bullet. Outside those two files this PR's own diff is unchanged (+/- lines of `git diff 8c2f6ac 43d9da5` and `git diff sqlite-debugger/ADFA-7298 HEAD` identical); in them its own changes are the same as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA
added a commit
that referenced
this pull request
Nov 25, 2026
Brings #2313 at 09939db (with #2312 at 01413e0: the PRAGMA allowlist and foreign keys on execute's connection) into the temporary branch for the device checks. No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADFA-7299
Phase 2, P2-4 of the SQLite debugger (ADFA-7131 comment 41476, decision D6): the first
executeon a Room database waits for an acknowledgement. Stacked on #2312 (P2-3, ADFA-7298); merge it after #2312.What it does (
subprojects/sqlite-debugger, Kotlin only)InvalidationTracker) miss the change and a screen can show stale data. The SQLite debugger does not make Room refresh: it must not change how the app behaves.executelooks forroom_master_tableon the read-only connection. On a Room database it runs nothing and returns an error naming the risk, with details{room: true, acknowledge_with: "acknowledge_room"}, until the call is repeated withacknowledge_room: true.DatabaseTools(one per app process), so later writes to that database run without asking and the check is not run again. A database withoutroom_master_tablenever asks.acknowledge_roommust be a boolean; it is checked before the engine is called.execute's description and input schema are updated.Limits: a database without Room's table is checked on every
execute(one indexed read ofsqlite_master); an acknowledgement outlives a database the app deletes and recreates under the same path.Commits: fb55fbc (the cloud session's c07fbf3, cherry-picked onto #2312's branch; conflicts with #2312's
last_insert_rowidinexecute's result and the README'sexecuteparagraph, resolved to keep both), 1f695c4 (its Room test helper builtExecuteResult(1), which no longer compiled afterlast_insert_rowid; a test line over ktlint's 140 columns wrapped), 43d9da5 (merge of #2312 at 8c2f6ac; this PR's own diff unchanged).Tests
:subprojects:sqlite-debugger:testDebugUnitTest(125),:plugin-api:testDebugUnitTest(251) withapiCheck,spotlessCheckandassembleV8Debugpass.test.shwith the system JDK: ASan+UBSan 15919 checks, TSan 15909, JNI 319, 0 failures (no native change in this PR).aRoomDatabaseRefusesTheFirstWriteWithAWarningAndRunsNothingandanAcknowledgementCoversOnlyItsOwnDatabaseAndOnlyThisServerProcess; not remembering the acknowledgement failsanAcknowledgedRoomWriteRunsAndLaterWritesRunWithoutAsking. One P2-3 test now counts the read-only connectionexecuteopens.Not done here: the device checks: by direct MCP calls on the Galaxy J7 (ADFA-7299 comment 41562), and through the Agent on the Note 20 with P2-5 (ADFA-7300).
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.