Repository navigation
ADFA-7138: Rewrite opted-in apps to requery and add the SQLite debugger to debug builds - #2262
davidschachterADFA wants to merge 67 commits into
Conversation
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.
davidschachterADFA
left a comment
There was a problem hiding this comment.
Stack: this is the tip (layer 3) of #2244 -> #2259 (ADFA-7135, base) -> #2262. #2260 and #2261 sit on #2259 in a separate line; the description says to merge after #2260. Claims were checked at the stack tip, which is this head, 461fd39. No approvals exist on this PR.
Repo rules: REVIEW.md (coaching doc, no written approve/request-changes rule) and CLAUDE.md. The default verdict table applied. The author is the authenticated account, so the verdict is COMMENT.
MINOR
- QuickBuildProjectSupport.kt:104 - the IDE pre-check reads only the root gradle.properties; Gradle's findProperty also sees other sources
- SqliteRewritePlugin.kt:64 - withRuntimeConfiguration silently skips an unrecognised variant type, after the class rewrite is already registered
NITPICK - none
Previous rounds: no earlier review comments. Evidence ledger (REVIEW.md): ticket fit checked against the PR description and design doc; tests exist for the rewrite rules, plugin wiring, the Quick Build opt-in check and the release-APK script (not run, static review); no UI beyond one string, so font scale is untouched; threading: the gradle.properties read happens inside the existing suspend provisioner; security: no untrusted input beyond the project's own gradle.properties and the bundled AARs.
Considered and not posted: the COLLATE UNICODE / hard-failure rules also apply to library classes (already disclosed as an open question in the description); the app's own CancellationSignal listener is replaced by the helper (documented in Known limits and the javadoc); IDE debug builds now run sqlite-debugger's assembleRelease with the NDK (by design, the same shape as logsender). Not verified: AGP's behaviour when two plugins call setAsmFramesComputationMode (this plugin sets the default, COPY_FRAMES), anything at runtime or on a device. Static review only, nothing was built.
Verdict computed: COMMENT (only MINOR findings; and self-authored). Submitted as COMMENT.
… redirects to The build-time rewrite (next commits) moves an app from android.database.sqlite to requery, which lacks a few platform entry points: open flags, CancellationSignal overloads, Context.openOrCreateDatabase and deleteDatabase, and the DatabaseUtils query helpers. The rewritten classes call static helpers for these instead. The helpers are a Java-only module, so one AAR serves every ABI. Code on the Go injects it into apps; it is not shipped in the template's libs/, so it always matches the plugin's rules. The module is registered in settings.gradle.kts and in AndroidModuleConf, which builds it as a release AAR for the apps built with Code on the Go. Tests: the pure helper functions run on the JVM in the gradle-plugin tests (next commit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ugin Apps built in Code on the Go that opt in must run on requery's SQLite (3.49.0) so the debugger can hook it. SqliteRewriter is an ASM class visitor, applied by an AGP transform to the app's and its libraries' classes: - renames android.database.sqlite types to requery's, and String[] descriptors to Object[]; - redirects open flags, CancellationSignal, Context.openOrCreateDatabase and deleteDatabase, and the DatabaseUtils query helpers to sqlite-rewrite-runtime; - fails the build, naming class, method and line, for APIs requery lacks: OpenParams, COLLATE UNICODE (requery has no ICU), casts to Android's cursor classes, method handles, unredirectable Context database calls; - copies frames (COPY_FRAMES), inserting a String[] cast at the start of a method whose parameter is retyped to Object[] so its frames stay valid; memoizes hierarchy lookups; keeps the cursor taint at join points; looks up missing members through every renamed ancestor; adds OPEN_CREATE only to read-write opens. androidx.core is exempt from the build-failure rule: its SQLiteCursorCompat calls setFillWindowForwardOnly, which a real transform run found missing. FrameworkSQLiteOpenHelperFactory is not redirected to requery's factory, which ignores noBackupDirectory and allowDataLossOnRecovery; WorkManager sets both, so its database would be recreated empty on every start. androidx's framework classes are rewritten instead and honour both options. Tests: SqliteRewriterTest and SqliteRewriteResolutionTest rewrite Java samples and the real androidx.sqlite 2.6.2 framework classes and check that every reference resolves in requery 3.49.0 (except execPerConnectionSQL, which throws UnsupportedOperationException when called; Room 2.8.4 and WorkManager 2.10.0 were surveyed with javap and run on a device); BytecodeVerifier runs the JVM verifier over rewritten classes; the runtime helper's pure functions run on the JVM. The tests fail on CI when their jars are missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…he classpath The rewrite is useful only when the helper AAR is on the app's classpath and requery is present. Code on the Go bundles the helper in its assets (release AAR, no v7/v8 flavors), extracts it at startup, and passes its path to Gradle as -Pandroidide.sqliteRewriteRuntime.aar, always, like logsender: the plugin reads it only for an opted-in project and then names the missing file instead of a missing property. SqliteRewritePlugin registers the class transform on every variant and adds the helper to every variant's runtime classpath. checkSqliteRewriteClasspath fails the build with a clear message when requery or androidx.sqlite is missing from the app: requery comes from the project's libs/, as in ADFA-7082, and the build says so. withRuntimeConfiguration moves from LogSenderPlugin to a shared internal function so the rewrite and the debugger plugins use the same one. GradlePluginConfig names the opt-in property cogo.sqliteDebugger. Tests: the plugin and the check task run in a real Gradle build with the sample project, in the commit that applies the plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ed in Code on the Go bundles the sqlite-debugger release AAR (one AAR carries both ABIs), extracts it at startup and passes its path to Gradle as -Pandroidide.sqliteDebugger.aar, like logsender. SqliteDebuggerPlugin adds it and kotlin-stdlib to the runtime classpath of debuggable variants only: it reads Variant.debuggable in onVariants. A release build never carries the debugger. Tests: SqliteDebuggerPluginTest, with the commit that applies the plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
cogo.sqliteDebugger=true in gradle.properties applies both plugins: the rewrite moves the app to requery in every variant, and the debugger, which needs requery, goes into the debuggable variants only. Without the property neither is applied. Tests: a dry run shows the class transform task for a project with the property and none without; the rewrite plugin and the classpath check task run in real Gradle builds with the sample project; a transform run compiles an app and checks the rewritten classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ted into the debugger Quick Build ships edited classes as a separate payload, compiled by its own daemon from the project's source, so it never passes through the SQLite rewrite. Mixed with rewritten baseline classes it would hand android.database.sqlite objects to requery ones. - AndroidIDEGradlePlugin does not apply Quick Build to an opted-in project and logs why. - GradleQuickBuildProvisioner refuses before staging, which writes into the project, and the IDE shows a string saying why, instead of ending in "variant setup missing". - ComponentProxiabilityResolver keeps DebuggerStartup in its by-name list as a guard only. Tests: SqliteDebuggerPluginTest checks which variants get the debugger AAR, with the property absent and set, and that Quick Build is not applied; QuickBuildProjectSupport decides the opt-in from gradle.properties as the Gradle plugin does (root file read, missing file is no opt-in); the provisioner refuses before staging with its own message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
scripts/check-release-apk-no-sqlite-debugger.sh fails when an APK holds libsqlitedbg.so, the DebuggerStartup provider, the <queries> entry for Code on the Go, or the debugger's class prefix in any dex, so a release build can be checked by script (acceptance criteria 2 and 3). INTERNET is only a warning line: the app may declare it for itself. It runs with pipefail and reads the APK with unzip and aapt2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
gradle-plugin/docs/sqlite-rewrite.md explains the rewrite: what it renames and redirects, what it rejects, the Spike 0 survey result, the helper and debugger AAR wiring, the Quick Build exclusion and the APK check. The sqlite-debugger README, CLAUDE.md and ARCHITECTURE.md list the new module and point to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…perty sees The plugin decides the opt-in with findProperty, which sees the Gradle user home and the app module gradle.properties as well as the root one. The IDE read only the root file, so such a project was staged and then refused with the misleading variant-setup message, and a read failure counted as not opted in without a log line. The check now reads user home, app module and root (first defining one wins) and logs a read failure. Tests: opt-in in root, in user home, in the module, false overriding true, and an unreadable file reported and treated as not set. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… reached SqliteRewritePlugin registers the class rewrite before it adds the helper AAR and the classpath check, and withRuntimeConfiguration silently skipped a variant type it did not know, so the app would build and throw NoClassDefFoundError on the device. The two SQLite plugins now use requireRuntimeConfiguration, which throws naming the variant and its class; LogSender keeps the skipping helper. Test: a stand-in variant (TestKit cannot produce an unknown variant type) makes the decision function throw, while withRuntimeConfiguration still skips it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
461fd39 to
4e4718f
Compare
No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Adds a how-to for existing projects to the debugger's README (ADFA-7138, item 5): the gradle.properties line, requery's AAR in libs/, the androidx libraries requery needs, and what to expect in a debug build. It says what the line changes (every variant moves to requery, Quick Build is off), that commenting it out turns it off, and that Room's BundledSQLiteDriver is not covered. The details stay in gradle-plugin/docs/sqlite-rewrite.md, which it links to. The template line itself is in dev-assets, on sqlite-debugger/ADFA-7138, stacked on dev-assets#79. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
The rewrite fails the build on a class that uses something requery lacks, naming class, method and line. For the app's own code that is enough; for a library class the user cannot change, the message gave no way out. It now ends with one: comment out cogo.sqliteDebugger=true in gradle.properties to build without the SQLite debugger. The transform cannot tell an app class from a library class, so the line covers both. The fail rule itself stays (decided 2026-11-16): the rewrite runs in release builds too, so a warning would let a released app ship a call that crashes when it runs. The new test fails without the change (its "in a library" check); the rewrite tests pass with it. The rewrite doc and the debugger README say the message now carries the way out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA
left a comment
There was a problem hiding this comment.
Re-review of #2262 at 810fe1c (medium effort). Verdict computed: COMMENT (MINOR findings only; GitHub also refuses APPROVE/REQUEST_CHANGES on a self-authored PR). Nothing here blocks merge.
MINOR
- GradleQuickBuildProvisioner.kt:350 - the Quick Build opt-in check still misses a module-level
gradle.propertieswhen the tap comes during sync (reply in the existing thread on QuickBuildProjectSupport.kt:104, not a new thread) - CheckSqliteRewriteClasspathTask.kt:61 - the classpath guard does not check androidx.core, which the docs say the rewrite needs
- SqliteRewriteRules.kt:94 -
no()stores{""}where the KDoc anddecide()expect an empty set
NITPICK - none
Stack. Layer 2 of 4, a tip: below #2259 (sqlite-debugger/ADFA-7135, on #2244). Siblings on #2259: #2260 (ADFA-7137) and, on it, #2261 (ADFA-7139), the other tip (2007193). #2260 and #2261 do not touch this layer's files except the debugger README, so claims were checked at this head. Nothing was dropped as fixed higher up.
Rules applied. REVIEW.md and CLAUDE.md at the head. REVIEW.md is "a coaching doc, not a gate" with no approve/request-changes rule, so the skill's default table applied.
Prior threads (judged on the code at this head, not on the replies).
- QuickBuildProjectSupport.kt:104 opt-in read from the root file only: partly fixed.
isSqliteDebuggerEnabled(projectRoot, gradleUserHome, moduleDirs)now reads the user home, the app modules and the root, first definition wins, and logs a read failure. But the module list comes fromgetAndroidAppModules(), which is empty until the Gradle sync has built the workspace, and the provisioner calls it beforeawaitProjectModel. Reply posted in that thread. - SqliteRewritePlugin.kt:64 silent skip for an unrecognized variant: fixed.
requireRuntimeConfigurationthrows a GradleException naming the variant and its class;SqliteRewritePluginandSqliteDebuggerPluginuse it, and LogSender keeps its skip. A stand-in-variant test covers it.
Merges and new commits. 3605133 (#2244 through #2259, no conflicts) and 810fe1c (#2259's README corrections) are clean. 627aa94 (README "Turning it on in an app"): the two links resolve (sqlite-rewrite.md#turning-it-on and #rules are headings there), and its steps agree with the rewrite doc (the one-line opt-in, requery's AAR in libs/, androidx.sqlite and androidx.core, Quick Build off, release builds rewritten but without the debugger). I could not check that the template's app/libs/sqlite-android.aar exists: it is in dev-assets. 2394a80 (failure message and test): the message now ends with a one-line way out, the test asserts that last line, and the README and rewrite doc say so. The way out names gradle.properties, which is right for the documented opt-in.
Static review only: no build, no device. Leads from the built-in review that I discarded: two app modules with different values (the IDE builds one module, and the plugin decides per project), a replaced CancellationSignal listener (stated in the helper's Javadoc, and Android's signal holds one listener), the double lifecycle message and the rule living on both sides (noise, not a defect), the repeated ZipFile opens (performance only), and the reflective Component.getDebuggable lookup: I cannot verify which AGP type declares it without a build, and the fallback path exists, so this is not verified either way.
…akes 2c78e0a made the opt-in check read each app module's projectDirPath, but the shared test double androidModule() did not stub it, so mockk threw, runProxyAppBuild caught it as a build failure, and 21 of the 43 GradleQuickBuildProvisioner* tests failed with the generic failure (FailureArms 9, Signing 7, Baseline 3, BuildDir 2). None of the PR's checks runs :app's unit tests. androidModule() now takes a projectDir (default /fake-project/app), and testProvisioner's default module sits under the test's project root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
The Quick Build opt-in check ran before awaitProjectModel. While the Gradle sync has not published the model, getAndroidAppModules() is empty, so a tap during the sync read only the user home's and the root's gradle.properties. A project with cogo.sqliteDebugger=true in its app module's own file was staged and built, and ended in "variant setup missing". The check still runs first, so a root or user home opt-in is refused at once as before. When the model was not ready then, it runs again after the wait, with the modules. In that case staging (into Code on the Go's own quickbuild directory, not the project) has already run, which a refused build can afford. A model that is ready at the tap sees no change. Test: GradleQuickBuildProvisionerFailureArmsTest, an opt-in in the app module's gradle.properties with the modules published during staging is refused with quick_build_disabled_sqlite_debugger and runs no build. Without the fix it gets quick_build_variant_setup_missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
check<Variant>SqliteRewriteClasspath required requery's and androidx.sqlite's classes but not androidx.core's, which requery 3.49.0 needs too. jdeps and javap over the classes.jar of the template's sqlite-android.aar: 12 requery classes reference androidx.core.os.CancellationSignal; SQLiteSession calls its throwIfCanceled, SQLiteConnection and SQLiteConnectionPool call setOnCancelListener, SQLiteDatabase.query(SupportSQLiteQuery, android.os.CancellationSignal) constructs one, and SQLiteConnectionPool constructs androidx.core.os.OperationCanceledException. The rewrite's own SqliteRewriteRuntime.toCancellationSignal constructs one for every converted signal. An app with androidx.sqlite but without androidx.core passed the check and fails with NoClassDefFoundError on the first query that passes a cancellation signal. The check now also requires androidx/core/os/CancellationSignal.class (present in androidx.core 1.9.0 through 1.16.0), and the message says how to add androidx.core. The rewrite doc lists what requery takes from each library, including androidx.collection's LruCache, which requery's statement cache extends and which androidx.core brings. Tests: SqliteRewritePluginTest, a new case excludes androidx.core and expects its entry and coordinates in the message; the requery and androidx.sqlite cases assert the real androidx.core AAR satisfies the check; the passing case uses a stand-in jar for androidx.core too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
MISSING_MEMBERS' builder no() defaulted desc to "", and its KDoc promised an
empty set for "every descriptor". The two readers disagreed on that
sentinel: SqliteRewriter.decide matched an empty set, fieldProblem and
MISSING_FIELD_NAMES matched "". A method entry written without a descriptor
would have been stored as {""} and matched no call, so the unsupported call
would have passed the rewrite and thrown NoSuchMethodError on the device.
No entry used the default, so nothing misbehaved.
The descriptor is now required, and the "every descriptor" meaning is gone:
decide and fieldProblem match the listed descriptors only, and
SqliteRewriteResolutionTest no longer treats a trailing ":" as a wildcard.
Requiring it is clearer than an empty-set sentinel in a builder that adds to
a set, where a member listed once without and once with a descriptor would
end up narrowed to the one.
Test: SqliteRewriteRulesTest checks that every entry lists at least one
descriptor and that each parses as a JVM descriptor (no blank). It cannot
fail on the old code, whose entries all had descriptors, and a call without
one no longer compiles; with the old default and one such call added, it
fails on that entry's '' descriptor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…e) up the stack Brings 7135's three newer commits: the JNI layer refuses SQL holding more than one statement, and a tool call's time limit starts when the call begins. No conflicts; README.md auto-merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA
left a comment
There was a problem hiding this comment.
Round 2 at 9eb00a2 (round 1 head 810fe1c), reviewed at effort medium, with attention to efc07f7, 1407eae, 7a22763, 1573878 and the merge of #2259's fixes. Stack: #2259 (ADFA-7135) is below this layer, and nothing sits on it, so this head is the tip claims were checked against. Rules read: CLAUDE.md and REVIEW.md at this head, which have no approve/request-changes rule beyond their checks, so the skill's default applied. No new findings in this layer's own diff. The verdict would be APPROVE; the PR is self-authored, so GitHub refuses it and this is a COMMENT. #2259's own round-2 findings (sqlitedbg_jni.c ROLLBACK backstop, get_schema truncated flag) are in the code this layer inherits and are posted on #2259, not repeated here.
Re-check of earlier threads (judged on the code at head, not the replies):
- QuickBuildProjectSupport.kt opt-in read from the root file only: fixed. isSqliteDebuggerEnabled reads the Gradle user home, the app modules, then the root, first definition wins, only "true" opts in, and a read failure is logged.
- QuickBuildProjectSupport.kt module list empty during sync: fixed. GradleQuickBuildProvisioner records whether the workspace was known and, if not, runs the same refusal again after awaitProjectModel.
- SqliteRewritePlugin.kt variant with no runtime configuration: fixed. The rewrite and debugger plugins use the variant of withRuntimeConfiguration that throws a GradleException naming the variant.
- CheckSqliteRewriteClasspathTask.kt androidx.core missing: fixed. REQUIRED now has androidx/core/os/CancellationSignal.class and the message names androidx.core.
- SqliteRewriteRules.kt default descriptor: fixed.
descis required, and decide and fieldProblem match on the descriptor only, so no entry can be stored as an empty-string descriptor.
Earlier findings still open: none.
Not verified: no build or test was run. A lead about a partly resolved superclass chain in SqliteRewriteVisitorFactory.AgpHierarchy depends on how AGP's ClassData reports superClasses, which I could not check here.
… QA only Merges sqlite-debugger/ADFA-7138 (#2262, 9eb00a2) into sqlite-debugger/ADFA-7139 (#2261, 7374a39) so CI builds one Code on the Go with the whole stack, signed with the CI key, for an in-place install on the QA phone. Not for review or merging; the branch is deleted after QA. The only conflict was subprojects/sqlite-debugger/README.md: both sides' new bullets are kept, and each side's "Not done yet" items that the other side completes are dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ncation) up the stack Brings 7135's two newer commits: the query backstop's ROLLBACK gets past the server's authorizer and a failed one is reported, and get_schema says when a CREATE statement was cut. No conflicts; README.md auto-merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ncation) into the integration build Brings #2262's new head (bc4889b). Its only new content is 7135's two commits, which the merge of #2261 already brought, so the tree is unchanged; this records the new head. For the CI-signed device-QA build only. No conflicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…unless CI is set Run outside the sqliteReleaseApkTest task, as from an IDE, the test has no AAR paths and skips with a message (requireEnvironment); with the environment variable CI set it fails instead. The KDoc now says so. Test KDoc only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ith a signal The rewrite gives calls to SQLiteQueryBuilder.query(..., CancellationSignal) requery's descriptor, which ends in androidx.core's signal, but left a subclass's override of that overload with Android's. The calls then resolved to requery's inherited method and skipped the override. Such an override now fails the build, naming the class and method. Retyping the declaration was the alternative: its body is written against Android's signal, so the rewrite would have to turn requery's signal back into Android's on entry and keep the two connected, and patch the frames. The signal-less overloads keep their descriptors in requery and still override as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Code on the Go 26.47 was released on 2026-11-17 without this stack, so the plugin API changelog entry moves to the next unreleased version, 26.48, and plugins floor plugin.min_ide_version at 26.48 (an IDE of 26.47 or older rejects the debugger.endpoints permission). Recheck against the real release number if the stack misses 26.48. No KDoc or Javadoc in #2259 to #2262 names a release version for this stack. Documentation only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…olved renamedAncestors turned a hierarchy lookup that found nothing (AGP's class loader cannot load the owner) into "no renamed ancestors", silently. A call such as isStrict() on an unresolved subclass of SQLiteQueryBuilder then passed the transform and would fail only at run time. Under the full policy, such a call now fails the build when its name and descriptor are those of a member a rule changes or rejects in a renamed class another class can extend: the members requery lacks and the retyped query. That is the policy the rewrite already has for a Context database method on an unresolved owner. Members of the final SQLiteDatabase, SQLiteQuery and SQLiteStatement and constructors are left out, since no other class inherits them, so a call such as rawQuery or delete(String) on an unresolved class does not fail. Field handles and method references go through the same check. The supertype cache now keeps null results too: getOrPut asked the hierarchy again for every call on an unresolved owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…or class
The cast rule caught `(AbstractCursor) c` only where javac writes a
CHECKCAST. An upcast has none: `AbstractCursor up(SQLiteCursor c) { return c; }`
returns the value as is. After the rename the parameter is requery's
SQLiteCursor, which does not extend Android's AbstractCursor, so the class no
longer verified.
A second analysis now follows values whose static type is SQLiteCursor, or a
class that extends it, and fails the build where one is used as
AbstractWindowedCursor, AbstractCursor or CrossProcessCursor without a cast:
returned, passed, called on, stored in a field, or held in a local or stack
slot that a frame declares as one of them. The frames come from a new
non-mutating fullFrames, which expandFrames now uses too. Conversions to
android.database.Cursor and Object stay allowed. Values that pass through
arrays are not followed; storing one into such an array throws
ArrayStoreException at run time.
The test also shows the failure mode: the same class, rewritten in a package
the fail rule exempts, fails ASM's CheckClassAdapter and the JVM verifier.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…, always The second refusal check ran only when the model was missing at the first one (modulesKnown). A sync during the staging or the wait can replace a published model, and a module it adds can carry cogo.sqliteDebugger=true in its own gradle.properties. That project then reached Gradle and ended in "variant setup missing" instead of the refusal. The check after the wait now always runs, and modulesKnown is gone. It reads only small property files and returns early without an opt-in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…odules are known The early refusal check ran before the wait for the model. During a sync it saw no app modules, so it read the Gradle user home and the root only, and a root cogo.sqliteDebugger=true refused at once, even when the app module sets false. The documented rule, that the first file that defines the line decides and a module's file comes before the root's, held only after the sync. The early check now runs only once the model is published. During a sync the check after the wait, which always runs, decides with the modules' files. The cost: a root opt-in tapped during a sync now pays for staging before it is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…s them
ToolsManager.init extracts sqlite-debugger.aar and sqlite-rewrite-runtime.aar
on a background thread, and GradleBuildService passes their paths to a build
without waiting. Each extractor deleted the AAR and then copied straight to its
path, so a build of an opted-in project that started meanwhile could find the
file missing ("not found", with the wrong advice to remove the opt-in) or
read it half-written.
Both now go through replaceAtomically: copy to a .part sibling, then rename
over the final path, as the tooling jar already does. A build sees the previous
complete AAR or the new one. This is smaller than making builds wait for
extraction. The one window left is a fresh install's very first extraction:
a build that early finds no file and says so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… to the cast The guard check was syntactic: an INSTANCEOF of the cast's type on the same local, followed by an IFEQ whose target lies past the cast, counted. In `if (b || c instanceof AbstractCursor) return (AbstractCursor) c;` that holds, yet b alone reaches the cast, which then throws on requery's cursor. The cast analysis now proves the guard itself. A Frame subclass sees `ALOAD n; INSTANCEOF X; IFEQ/IFNE` written back to back (no label, so no path joins in between) and, through Frame.initJumpTarget, gives local n's value the proof on the edge where the test succeeded only. The proof travels with the value through copies and casts, and a merge keeps it only when every path brings it. A store to the local replaces the value, so it drops the proof. The simple, &&, ?: and early-exit guards still pass, and a guard on a copy of the local now counts too. The syntactic check and its helpers are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
toCancellationSignal registered a new listener on Android's signal for each call, and Android's signal holds one listener, so the second registration replaced the first. requery keeps a query's signal for its cursor's later reads, so with two lazy queries on one Android signal, cancelling it left the first cursor's signal uncancelled. Each Android signal now gets one forwarding listener, kept in a WeakHashMap, that cancels every requery signal converted from it. It holds them weakly and drops cleared ones on each call, so a closed and dropped cursor is not kept for a signal the app reuses. Because setOnCancelListener does not call a listener that is already set, a signal cancelled before the call is checked directly. The runtime test replaces android.jar's stub of the signal with a copy of Android's listener rules, to run the conversion on the JVM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…nCanceledException The rewrite converts Android's CancellationSignal to androidx.core's, and requery throws androidx.core.os.OperationCanceledException for a cancelled query, from its Java check and from its native layer (checked with javap and in the 3.49.0 .so). That class does not extend Android's, and catch clauses are not rewritten, so a catch of android.os.OperationCanceledException no longer catches the cancellation. The docs listed this among the unverified review items. It is now a known limit of its own, with the multi-catch an app can use with the SQLite debugger on and off, and the rewriter's comment at the conversion says so. Docs and a comment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… user home TestJars searched ~/.gradle/caches only. With GRADLE_USER_HOME or --gradle-user-home pointing elsewhere, the tests skipped locally, or failed on CI, although the jars were in the active cache. Both test tasks now pass gradle.gradleUserHomeDir as cogo.test.gradleUserHome, as a JVM argument rather than an input, so the per-machine path does not change the task's cache key. gradleUserHome() reads it, then GRADLE_USER_HOME, then falls back to ~/.gradle, as when the tests run from an IDE. Test code and build script only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
ClassIndex.resolve searched superclasses for every member, so a reference to Child.<init>()V resolved to Parent's constructor when Child declares only Child(int). The JVM rejects that invokespecial with NoSuchMethodError, so the resolution tests could accept a constructor reference that does not link. A constructor is now looked up in the named owner only; methods and fields are still inherited. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ading output checkApk read the script's output to its end and only then made the timed wait, so a script, or a child it left behind, that kept stdout open would hang the test past its one-minute limit. runBounded now sends the output to a temp file, waits with the timeout first, destroys the process on timeout and fails with what it printed, and reads the file after the process ends. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…ed one The test looked for a rewritten SqliteRewriteRuntime in every jar of the shared transform cache. The helper's name is fixed, so a rewritten copy from an earlier run passed the check even when this run left the helper alone. The helper AAR now also carries a class with a per-run name, and the test inspects only the transformed jars that hold it. Checked against a build that skips the helper package in isInstrumentable: the new test fails, and the old one still passed on a cached helper from an earlier run. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…al, as the button does While the SQLite debugger is on, the status line reads "Quick Build: off while the SQLite debugger is on - tap for details", but the line was plain text: a tap fell through to the sheet header, and only the Quick Build button showed the refusal again (F221, found on a Galaxy Note 20). The refused-state QuickBuildStatusBarUpdate.Show now carries a tapLabel. ProjectHandlerActivity binds it to the status line after writing the text, and every status write by anyone (doSetStatus) unbinds it first, so the tap lasts only while that line is up. The tap runs the toolbar's Quick Build action through the registry, the button's own path; the dropdown's Quick Build row now shares that function (runQuickBuildAction) instead of repeating it. While tappable the line is clickable and focusable, and TalkBack reads "double- tap to show why Quick Build is off" (new quick_build_status_off_sqlite_debugger_action string). Its size is unchanged, so the 2x font-scale header sizing is untouched; the rest of the header still expands the sheet. Left alone: "setup failed - tap to retry", "stopped - tap to retry" and "built - tap to start app" also say "tap" and are still plain text; they are not part of F221. Test: QuickBuildStatusLineTapTest (Robolectric) inflates the real status line, applies the real mapping the way the activity does, and clicks it. The editor activity itself is too large for a JVM test, so the callback stands in for the toolbar action run. Reverting either the mapping's tapLabel or the binder's click wiring fails it at "value of: performClick() expected to be true". gradle-plugin/docs/sqlite-rewrite.md now mentions the tap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…fore the rename replaceAtomically deleted the .part file only when the rename failed, so a copy that threw (an asset read error, a full disk) left <name>.aar.part beside the AAR. It is now deleted in a finally block, which after a successful rename finds nothing. The copy is also synced (fd.sync()) before the rename, so a power loss after the rename cannot leave the AAR empty on a file system that does not order data before metadata. The temp name stays fixed rather than unique per extractor. ToolsManager.init is the only extractor, called once per process (CredentialProtectedApplicationLoader guards it with _isLoaded.compareAndSet) and the app runs one process, so no second extractor races it. A unique name would leave a new orphan after every process death mid-copy, which no finally block can clean, while a fixed name is overwritten by the next run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…cursor array javac writes no CHECKCAST for `AbstractCursor[] a; a[0] = sqliteCursor;`. After the rename the value is requery's SQLiteCursor, which is not an AbstractCursor, so the store verifies but throws ArrayStoreException at run time, in release builds too: the rewrite runs in every variant of an opted-in app (D10, SqliteRewritePlugin.kt:44). implicitCursorConversions now fails an AASTORE whose value is statically an SQLiteCursor (or a subclass) and whose array is, on every path to the store, an AbstractCursor[], AbstractWindowedCursor[] or CrossProcessCursor[] from a parameter, field, call, cast or ANEWARRAY. The message names the class, method and line, like the other rewrite failures. The analysis value carries the array's element type, and a merge keeps it only when both paths agree. The pre-filter now also looks at a method's parameters and at ANEWARRAY and array casts, since an array parameter is all such a store needs. Not checked, on purpose, and listed in sqlite-rewrite.md's known limits: a store into an array known only as a Cursor[] or Object[] (failing those would fail ordinary apps, though such an array can be an AbstractCursor[] at run time), a store whose array type differs between the paths that merge before it, and values loaded from arrays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…lass as a known miss getWindow()Landroid/database/CursorWindow; is not in the rule table, so on a SQLiteCursor subclass that the build cannot resolve the call passes the rewrite and fails at run time. Failing every unresolved call that returns a CursorWindow would fail ordinary apps: android's kept AbstractWindowedCursor and CrossProcessCursor declare getWindow too. The known limits now say so. Docs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… on the Go starts
App init extracts the SQLite debugger and rewrite runtime AARs in the
background, so on a fresh install an opted-in build that starts before
the first extraction ends finds the AAR missing. The "not found" message
only said to remove cogo.sqliteDebugger, which is the wrong advice for
that transient case. It now ends: "Remove 'cogo.sqliteDebugger' from
gradle.properties to build without it, or retry in a few seconds if Code
on the Go has just started."
The message that ADFA-7138's Steps to QA quote ("Remove
cogo.sqliteDebugger from gradle.properties to build without them") is the
runtime-classpath check's, which this does not change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…fault Gradle user home SqliteTestSupportTest pinned only the order in which the Gradle user home is chosen, not the cache scan that uses it. The requery lookup is now a function of the Gradle user home (requeryAar, over gradleCacheFile), and a new test puts the AAR only in a non-default home's module cache, with the default home's cache present but without it, and checks that the scan finds it there, through the test task's property and through GRADLE_USER_HOME. With the scan hard-coded to ~/.gradle again, the test fails. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…r names an SQLite type Libraries reference optional classes the app does not ship, so a bare name+descriptor match (isStrict()Z, isString(I)Z) on an unresolvable owner failed ordinary app builds with an SQLite message. It now warns; it still fails when the descriptor names an SQLite, requery, Cursor, CursorWindow, CancellationSignal or DatabaseErrorHandler type. Tests: a warn-only case (com.unknown.Row.isString), a still-fails case (SQLite descriptor), and the existing unresolved-owner test now expects isStrict()Z to warn. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ8yszEP4MqbR9PLba
…e unresolved-owner change "a call whose name a rule lists ... still looks the owner up" wrapped the rewrite in a try/catch because getUniqueId()I on the unresolvable p.Mine failed the build. Since 85c3068 that call only warns (its descriptor names no SQLite type), so the catch caught nothing and its comment was wrong. The try/catch is gone, which also makes the test fail if the call fails the build again. "hierarchy lookups are made once per owner ..." keeps its try/catch: its getUniqueId is on SQLiteStatement, a renamed class that resolves, and still fails the build through the missing-member rule. Its comment now says so. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… fail and which warn The known-limits line about getWindow() on an unresolvable SQLiteCursor subclass now also states the split 85c3068 made: on a class the build cannot resolve, a call that matches the rule table fails the build only when its descriptor names an SQLite-related type, and any other match (isString(I)Z, isStrict()Z) logs a warning, is left as it is, and fails at run time if the class does extend the renamed class. Docs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… matches fail 85c3068 fails a rule-table match on an unresolvable owner only when the descriptor holds one of SQLITE_DESCRIPTOR_TOKENS. The test pins the tokens as descriptor forms (a package prefix after L, or a full L...; type), and the split they make of the 34 inheritable table members: 8 fail (setWindow, mWindow, setOpenParams, getCursorFactory, insert, update, delete, and query with a signal) and 26 warn, among them isString(I)Z, isStrict()Z and getUniqueId()I. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
… reaches the log The rewriter's default warn is the Gradle logger, which the unit tests replace. SqliteRewriteTransformTest's library AAR now also holds a call to com.unknown.Row.isString(I)Z, with Row left out of the AAR as an optional class a library references and the app does not ship. The same TestKit build that already runs AGP's transform over the AAR now checks that its output carries the warning, and that the build still succeeds. No extra build. Test code only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…r is not kept SqliteRewriteRuntime.FORWARDERS mapped each Android CancellationSignal weakly to its CancelForwarder, but a WeakHashMap keeps the value of a cleared key until the next call on the map. So each signal the app dropped left its forwarder (72 B) reachable from the static map until the next conversion. LeakCanary and a heap count on the Note 20 (C6h probe) showed both forwarders of two dropped signals retained this way after the activity was destroyed. The value is now a WeakReference<CancelForwarder>. While the signal lives, its own listener field keeps the forwarder alive; a cleared reference means a new forwarder. One accepted change: a caller that sets its own listener after a query lets that forwarder go, so a later conversion starts a new one and the queries from before the caller's listener no longer stop with the signal (they had stopped doing so when the caller replaced the listener). Tests in SqliteRewriteRuntimeTest: a dropped signal's forwarder clears after GC (fails without the fix: the stale entry keeps it), a live signal keeps its forwarder through GC and still cancels, and a signal whose forwarder was collected gets a working new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…rWindow) and mWindow, and say where android.database.CursorWindow is not an SQLite type. It carries every ContentProvider cursor across processes, and Android's kept AbstractWindowedCursor declares both setWindow(CursorWindow) and mWindow, so a library's own windowed cursor on an owner the build cannot resolve matched SQLiteCursor's two members and failed the build. CursorWindow leaves SQLITE_DESCRIPTOR_TOKENS, so those two matches now only warn: of the 34 inheritable rule members, 6 fail on an unresolvable owner and 28 warn. Cursor stays a token; it changes no outcome today. The unresolved-owner warning named only the class, so a user could not find the call. It now starts with class, method and line, formatted by the same site() the string-constant warnings use, and says "field access" instead of "call" for mWindow, the first field that reaches the warning. It is still logged once per message, and the message now holds the method and line: two calls on one line warn once, two lines warn twice. Tests: an unresolvable windowed cursor's setWindow and mWindow only warn; the warning names method and line, once per place; the pinned tokens and the 6/28 split; the TestKit log line. Docs: CursorWindow leaves the list of types that make a match fail, and the known limit on getWindow() says setWindow and mWindow now only warn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
…mporary branch) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
ADFA-7138
Code on the Go's Gradle plugin moves an opted-in app to requery at build time and adds the SQLite debugger to its debug builds. Opt-in:
cogo.sqliteDebugger=truein the project'sgradle.properties. Design, rules and known limits:gradle-plugin/docs/sqlite-rewrite.md.Stack: on
sqlite-debugger/ADFA-7135(#2259). Merge order: #2259, then #2260, then #2261, then this PR. In git it depends only on #2259, but the SQLite debugger AAR it bundles from its own tree sends the endpoint only once #2260 is in, and step 4 of the README's "Turning it on in an app" needs #2260 and #2261. Merged last, the opt-in works end to end as it lands. Stage, with #2244 (ADFA-7082) squash-merged as 5f3d76a, is merged up into this PR (ebe4eda); that merge left this PR's own diff unchanged. The head is b0ceebe. CodeOnTheGo allows only squash merges and deletes the head branch on merge: once #2259 is squashed, this PR's base moves to stage while its branch still carries #2259's original commits. Before this PR merges, merge origin/stage into it, resolve to this PR's side only the conflicts that duplicate the squashed PRs, and prove nothing else changed (CLAUDE.md's squash recipe; no rebase).Expected conflict: #2260, #2261 and this PR each delete a different line of the "Not done yet" list in
subprojects/sqlite-debugger/README.md, so merging this PR last will probably conflict there. Resolve it by dropping all three items and the then-empty## Not done yetheading. Step 4 of "Turning it on in an app" already describes the endpoint (#2260) and AI-Agent-MCP (#2261), so the README is then consistent.What it does
android.database.sqliteto requery: renames,String[]toObject[]descriptors, redirects to a small helper module (subprojects/sqlite-rewrite-runtime) for open flags,CancellationSignal(one forwarding listener per Android signal, held weakly, so every query sharing it is cancelled with it and a dropped signal leaves nothing behind),Context.openOrCreateDatabase/deleteDatabaseandDatabaseUtilsqueries, and a build failure naming class, method and line for anything requery lacks (OpenParams,COLLATE UNICODE, casts to Android's cursor classes, ...) or that the rename would break: aSQLiteCursorconverted without a cast toAbstractCursor,AbstractWindowedCursororCrossProcessCursor(returned, passed, called on or stored, including into an array of one of those classes); aSQLiteQueryBuildersubclass overriding thequeryoverload that takes aCancellationSignal; and, under the FULL policy, a call on an owner the build cannot resolve whose name and descriptor match a member a rule changes or rejects in a renamed class another class can extend, and whose descriptor names an SQLite-related type (CursorWindowdoesn't count: Android's keptAbstractWindowedCursordeclaressetWindow(CursorWindow)andmWindowtoo); other such matches only log a warning naming class, method and line. Aninstanceofguard excuses a cast only when it holds on every path to the cast. androidx's framework classes are rewritten too, so Room and WorkManager keepnoBackupDirectoryandallowDataLossOnRecovery. Strings are not rewritten: under the FULL policy, a string constant naming a renamedandroid.database.sqliteclass logs a warning with class, method and line, as do descriptor forms such as[Landroid.database.sqlite.SQLiteDatabase;; a string that merely contains the name inside a longer one, such ascom.android.database.sqlite.SQLiteDatabase, and kept classes such asSQLiteDatabaseLockedExceptionare not reported.Project.requireSqliteAar. App init extracts each AAR to a temp file, syncs the file and renames it into place (a failed copy deletes the temp file), so a build that starts meanwhile reads the previous complete AAR or the new one, never a half-written file; only a fresh install's very first extraction can still be missing when a build starts that early, and the not-found message then says to retry in a few seconds. Debuggable variants also get kotlin-stdlib, at the version Code on the Go's local Maven repository holds. A check task fails the build clearly when requery (from the project'slibs/), androidx.sqlite or androidx.core (which requery uses forCancellationSignal) is missing.quick_build_status_off_sqlite_debuggerandquick_build_disabled_sqlite_debugger; the unusedsqliteDebuggerMessageis gone). A rebuild refused because the opt-in was turned on during a live session ends in the same refused state, with no retry. The opt-in is read from the Gradle user home, every app module and the root, and the first file that defines it decides for the whole project. The early refusal check runs only once the model is published, so a module'sfalsebeats a roottrueduring a sync too (a root opt-in tapped during a sync then pays for staging before it is refused), and the check after the model wait always runs, so a module that a sync adds with the opt-in is refused instead of reaching Gradle. Quick Build watches every module'sgradle.propertiesup toMODULE_SCAN_MAX_DEPTH(4) levels below the root, plus the Gradle user home's, so turning the opt-in on in one of them ends a live session.scripts/check-release-apk-no-sqlite-debugger.shchecks that an APK carries no SQLite debugger. It now runs on every push:SqliteReleaseApkTest(TestKit, in its own task,:gradle-plugin:sqliteReleaseApkTest) builds the functional tests' sample app with the opt-in, as a release minified with R8 and as debug, using the real SQLite debugger and rewrite-runtime AARs and requery 3.49.0 as a file dependency, and runs the script on both APKs. The release build must pass; the debug APK is the control and must fail on the provider and the.so. With R8, the dex class-prefix check can miss renamed classes, so the manifest and.sochecks are the ones that must fail. A step in debug.yml'sbuild_apkruns it, without the Maven signing key, adding about 2-3.5 minutes; the test needs JitPack at test time. New test-only catalog entry:tests-requery-sqliteAndroid.Tests: rule tests on bytecode compiled from Java samples, run through a verifier and JVM linking against requery 3.49.0, android.jar and androidx; resolution of every member of the 10 renamed classes and of androidx.sqlite's framework classes; a real AGP build that transforms a local AAR and the injected helper; plugin TestKit tests (debuggable-only injection, missing AAR, missing requery, androidx.sqlite or androidx.core, Quick Build off); Quick Build tests of the opt-in rule, the refused start and rebuild, the status line and the watched files (the provisioner tests' shared double now stubs the module directory the opt-in check reads; without it, 21 of them failed); the release-APK script on fake and real APKs, and in
SqliteReleaseApkTeston an R8 release and a debug build (checked once against a broken build that leaves the SQLite debugger in release: it fails with the.soand provider messages); the string-constant warning, and no report for a kept class. Since 9ca47ff, a test for each fix: a string that only contains a renamed name does not warn, while descriptor and array names still do; theSQLiteQueryBuildersignal override; a cast-free cursor conversion (the same class, rewritten where the rule is exempt, fails ASM'sCheckClassAdapterand the JVM verifier); aninstanceofguard that does not cover every path; a call on an unresolved owner; two queries sharing an Android signal; an AAR read while it is replaced; and the two Quick Build refusals during a sync. Since 7572ece: a failed AAR copy leaves the previous AAR and no temp file; an SQLite cursor stored into an array of an Android cursor class fails; an unresolvable owner whose member names no SQLite type only warns, and the warning reaches a real AGP build's log, while one whose member names an SQLite type still fails; the SQLite descriptor tokens and the split of the 34 inheritable members (6 fail, 28 warn) are pinned; an unresolvable windowed cursor'ssetWindow(CursorWindow)andmWindowonly warn; the warning names the method and line, once per place; the rewrite tests find requery in a non-default Gradle user home; a dropped signal's forwarder is not kept, a live signal keeps its forwarder through a GC, and a collected forwarder is replaced. Test fixes: the rewrite tests find their jars in the active Gradle user home, constructor references are no longer resolved through superclasses, the release-APK script check is bounded by its timeout, and the transform test checks this run's helper, not a cached one;SqliteReleaseApkTest's KDoc says it skips without its AAR paths unlessCIis set. At the head b0ceebe::gradle-plugin:test247 tests pass (plus 4 skipped,@Disabledon stage under ADFA-5459),sqliteReleaseApkTest1/1 locally, and:common273. At 7572ece::app1749, andsqliteReleaseApkTestpassed in CI. At ebe4eda::quickbuild:core1249 and:subprojects:sqlite-debugger80 tests pass; neither module has changed since. CI runs only test-sqlite-debugger and the APK build, which now includes the release-APK guard; at 7572ece, test-sqlite-debugger and that guard step passed. Reviewed by Sonnet, twice by Opus, and in a review across all tickets; 9fedd91 to 7572ece answer CodeRabbit's review, and 5a2fd6e to b0ceebe answer a fresh review and the review-thread follow-ups, one commit each.Verified on a device (Galaxy Note 20, Android 13, arm64-v8a and armeabi-v7a; an app built on the host with this plugin through its init script), on earlier heads:
SQLiteOpenHelper, Room with its default factory, WorkManager andContext.openOrCreateDatabaserun on requery's SQLite 3.49.0 with no source change; WorkManager's work survives a force-stop; the SQLite debugger lists and queries all databases; the release build runs on requery and contains no SQLite debugger, and an R8 release build had none either. The current head has not run on a device. Host build cost: about +4 s on a first debug build, nothing measurable cached. At 6e16bdb, a LeakCanary probe: two cursors sharing one Android signal both stop when the signal is cancelled (before or mid-read), and LeakCanary and a heap count find no retained forwarder, signal, cursor or activity (at fbd4451 each dropped signal's forwarder stayed held until the next query; fixed in 6e16bdb).Not verified: a project from the template built inside Code on the Go (needs the template line, dev-assets#80 on #79), build time on a phone, offline resolution of kotlin-stdlib on a device. The Quick Build status line was not checked at 2x font scale on a device (the refusal message was, on an earlier head, and was readable). The build-failure rule also applies to library classes; decided on ADFA-7138 to keep it, and the failure message now says how to build without the SQLite debugger.
Docs: CLAUDE.md and ARCHITECTURE.md list
:subprojects:sqlite-rewrite-runtimeas a module without ABI flavors. The SQLite debugger's README says how to turn it on in an app.gradle-plugin/docs/sqlite-rewrite.mddescribes the release-APK guard and the string-constant warning, and records thatCOPY_FRAMESnever lowers another plugin's frame mode: AGP 7.3.0, 8.8.2 and 9.3.1 replace the mode only with a higher one, and a scratch AGP 9.3.1 build with a second factory needing computed frames verified with no errors. It lists a known limit of its own: a cancelled query throws androidx.core'sOperationCanceledException, which does not extend Android's, so a catch ofandroid.os.OperationCanceledExceptionno longer catches it; it gives the multi-catch an app can use with the SQLite debugger on and off. It also records the array-store check, thegetWindow()limit on an SQLiteCursor subclass the build cannot resolve, and which rule-table matches on an unresolvable class fail and which only warn.🤖 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.