ADFA-3641: Wire per-task tooltips for Gradle tasks#1519
Conversation
Each task row in the Run-Tasks dialog now shows its own tooltip instead of a
single generic one. The tag is derived from the task path
("gradle." + path.removePrefix(":")), matching the authored content keys
(":app:assembleDebug" -> "gradle.app:assembleDebug", ":clean" -> "gradle.clean").
- TooltipTag.gradleTaskTooltipTag(): pure path->tag mapping (unit-tested).
- RunTasksListAdapter: use the per-task tag instead of PROJECT_GRADLE_TASKS.
- ToolTipManager.getTooltip: honor its nullable contract - return null on a
missing tag so uncovered tasks show no popup instead of an "n/a" tooltip.
No fallback.
Tooltip content lives in the SoT documentation.db (loaded separately).
Verified end-to-end on the emulator: per-task Tier-1/2 tooltip + Tier-3 help
page, and graceful no-popup for tasks without authored content.
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.
📝 Walkthrough
WalkthroughGradle task tooltips now use tags derived from task paths. Tooltip lookup handling constructs results only for successful database queries and returns ChangesTooltip behavior updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RunTasksListAdapter
participant TooltipTag
participant ToolTipManager
participant SQLiteDatabase
RunTasksListAdapter->>TooltipTag: gradleTaskTooltipTag(task.path)
TooltipTag-->>RunTasksListAdapter: path-specific tag
RunTasksListAdapter->>ToolTipManager: request tooltip with tag
ToolTipManager->>SQLiteDatabase: query tooltip and buttons
SQLiteDatabase-->>ToolTipManager: result row or failure
ToolTipManager-->>RunTasksListAdapter: IDETooltipItem or null
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt (2)
90-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse narrow exception handling instead of a generic catch-all.
Based on learnings, in Kotlin files across the AndroidIDE project, prefer narrow exception handling that catches only the specific exception type reported in crashes instead of a broad catch-all, aligning with fail-fast behavior during development.
idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt#L90-L93: Replacecatch (e: Exception)with a specific exception such ascatch (e: SQLiteException).idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt#L134-L140: Replacecatch (e: Exception)with a specific exception such ascatch (e: SQLiteException).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt` around lines 90 - 93, Replace the broad catch-all handlers in ToolTipManager’s version-resolution blocks with narrow SQLiteException handling, preserving the existing logging and "n/a" fallback. Apply this change at ToolTipManager.kt lines 90-93 and 134-140; ensure the required SQLiteException import is available.Source: Learnings
131-133: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSilence the swallowed exception warning.
The static analysis tool warns about a swallowed exception here. Since this is an expected control-flow path, you can rename the exception parameter to
_to suppress the warning and clarify your intent to ignore it.♻️ Proposed refactor
- } catch (e: NoTooltipFoundException) { + } catch (_: NoTooltipFoundException) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt` around lines 131 - 133, Rename the unused exception parameter in the NoTooltipFoundException catch clause within the tooltip lookup flow to “_”, preserving the existing logging and null return behavior.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt`:
- Around line 90-93: Replace the broad catch-all handlers in ToolTipManager’s
version-resolution blocks with narrow SQLiteException handling, preserving the
existing logging and "n/a" fallback. Apply this change at ToolTipManager.kt
lines 90-93 and 134-140; ensure the required SQLiteException import is
available.
- Around line 131-133: Rename the unused exception parameter in the
NoTooltipFoundException catch clause within the tooltip lookup flow to “_”,
preserving the existing logging and null return behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: be0e7ba3-0119-413b-8720-a86c3d9d107d
📒 Files selected for processing (5)
app/src/main/java/com/itsaky/androidide/adapters/RunTasksListAdapter.ktidetooltips/build.gradle.ktsidetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.ktidetooltips/src/main/java/com/itsaky/androidide/idetooltips/TooltipTag.ktidetooltips/src/test/java/com/itsaky/androidide/idetooltips/GradleTaskTooltipTagTest.kt
Summary
Wires per-task tooltips into the Run-Tasks dialog (ADFA-3641). Each Gradle task row now shows its own authored tooltip (Tier-1/2) with a Tier-3 help page, instead of one generic tooltip for every task.
Changes
TooltipTag.gradleTaskTooltipTag(path)— pure mapping:":app:assembleDebug" → "gradle.app:assembleDebug",":clean" → "gradle.clean". Unit-tested.RunTasksListAdapter— long-press uses the per-task tag instead ofPROJECT_GRADLE_TASKS.ToolTipManager.getTooltip— now honors itsIDETooltipItem?contract: returnsnullon a missing tag (its only caller,showTooltip, already null-checks), so tasks without authored content show no popup instead of an "n/a" tooltip. No fallback.idetooltips/build.gradle.kts— addstestImplementation(libs.tests.junit)for the new test.Content
Tooltip content lives in the source-of-truth
documentation.db(loaded separately, not in this repo). 280 Gradle-task tooltips authored + wired.Verification
GradleTaskTooltipTagTestpasses (:idetooltips:testV8DebugUnitTest).:buildEnvironment→ task-specific tooltip → See more (Tier-2 bullet detail) → Learn more (Tier-3 help page served from theContenttable). Uncovered task:artifactTransforms→ no popup; logcat confirmsgetTooltip … → No tooltip found → null, no "n/a".Coverage
Live diff (261 UI tasks vs 282 loaded tags): the 280 covered tasks work; 41 UI tasks are uncovered (the
ideaGradle plugin family, plus Gradle/AGP version drift) — all degrade gracefully to no-popup. None are CoGo-specific. Full breakdown posted to ADFA-3641 for the content team.Notes
.gitpointer file); pre-commit / CI will apply formatting.