Skip to content

ADFA-3641: Wire per-task tooltips for Gradle tasks#1519

Merged
hal-eisen-adfa merged 4 commits into
stagefrom
ADFA-3641-add-tooltips-to-gradle-tasks
Jul 20, 2026
Merged

ADFA-3641: Wire per-task tooltips for Gradle tasks#1519
hal-eisen-adfa merged 4 commits into
stagefrom
ADFA-3641-add-tooltips-to-gradle-tasks

Conversation

@hal-eisen-adfa

@hal-eisen-adfa hal-eisen-adfa commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

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 of PROJECT_GRADLE_TASKS.
  • ToolTipManager.getTooltip — now honors its IDETooltipItem? contract: returns null on 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 — adds testImplementation(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

  • Unit test GradleTaskTooltipTagTest passes (:idetooltips:testV8DebugUnitTest).
  • End-to-end on emulator (arm64): long-press :buildEnvironment → task-specific tooltip → See more (Tier-2 bullet detail) → Learn more (Tier-3 help page served from the Content table). Uncovered task :artifactTransformsno popup; logcat confirms getTooltip … → 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 idea Gradle 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

  • Spotless can't run inside a git worktree (jgit can't resolve the .git pointer file); pre-commit / CI will apply formatting.

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9fe3e20-2dc8-4be1-8ce8-5dd17e2253e8

📥 Commits

Reviewing files that changed from the base of the PR and between 8ad1c29 and ea1d270.

📒 Files selected for processing (1)
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt

📝 Walkthrough
  • Wired per-Gradle-task tooltips into the Run-Tasks dialog by deriving each tooltip’s tag from the specific task path (replacing the prior single static Gradle-task tag).
  • Added TooltipTag.gradleTaskTooltipTag(taskPath) to translate Gradle task paths into the expected tooltip tag format, with JUnit test coverage.
  • Updated ToolTipManager.getTooltip to return null when no authored tooltip exists (so no popup is shown for uncovered tasks) and to rethrow CancellationException to preserve coroutine cancellation behavior.
  • Included 280 authored Gradle task tooltips sourced from documentation.db.
  • Verification covers task-specific Tier-1/2 tooltips, Tier-3 help pages, and graceful handling for tasks without authored tooltips.
  • Risk: tooltip visibility depends on task-path conventions matching the authored tag format; malformed/unmapped paths will intentionally yield no tooltip/popup.

Walkthrough

Gradle task tooltips now use tags derived from task paths. Tooltip lookup constructs results only for successful database queries and returns null for missing or failed lookups. JUnit coverage validates the new tag mappings.

Changes

Tooltip behavior updates

Layer / File(s) Summary
Gradle tooltip tag contract
idetooltips/src/main/java/.../TooltipTag.kt, idetooltips/src/test/.../GradleTaskTooltipTagTest.kt, idetooltips/build.gradle.kts
Adds Gradle task tag generation, JUnit coverage, and the module test dependency.
Tooltip database lookup
idetooltips/src/main/java/.../ToolTipManager.kt
Refactors database and cursor handling, constructs tooltip items only for single-row results, and returns null for missing or failed lookups.
Task-list tooltip integration
app/src/main/java/.../RunTasksListAdapter.kt
Passes a task-path-derived tooltip tag instead of the static project Gradle tag.

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
Loading

Possibly related PRs

Suggested reviewers: jatezzz, daniel-adfa

Poem

I’m a bunny with tags in my tray,
Guiding each Gradle task on its way.
Lookups now know when to return,
With tidy tests for paths to learn.
Hop, hop—tooltips bloom today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: wiring per-task tooltips for Gradle tasks.
Description check ✅ Passed The description matches the changeset and explains the tooltip wiring, tag mapping, tests, and no-popup behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-3641-add-tooltips-to-gradle-tasks

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt (2)

90-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use 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: Replace catch (e: Exception) with a specific exception such as catch (e: SQLiteException).
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt#L134-L140: Replace catch (e: Exception) with a specific exception such as catch (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 value

Silence 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e33ec6 and 422ed9f.

📒 Files selected for processing (5)
  • app/src/main/java/com/itsaky/androidide/adapters/RunTasksListAdapter.kt
  • idetooltips/build.gradle.kts
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/TooltipTag.kt
  • idetooltips/src/test/java/com/itsaky/androidide/idetooltips/GradleTaskTooltipTagTest.kt

…ps-to-gradle-tasks

# Conflicts:
#	idetooltips/src/main/java/com/itsaky/androidide/idetooltips/TooltipTag.kt
Stage now runs spotlessCheck in CI (ADFA-2522). Spotless' ratchet is
file-level, so the two files this branch touches get reformatted
whole-file (space -> tab). Whitespace-only; no logic change.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt (2)

77-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Address the TODO by restricting debug code to debug builds.

You can use BuildConfig.DEBUG to ensure the debug database switch is only evaluated in debug builds, fulfilling the requirement mentioned in the TODO.

Do you want me to generate a solution that implements this requirement and open a new issue to track it?

🤖 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 77 - 84, Update the debug database logic in ToolTipManager around
debugDatabaseTimestamp so it is evaluated and can switch dbPath only when
BuildConfig.DEBUG is true; preserve the existing timestamp comparison and
production database behavior for non-debug builds.

190-190: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a lifecycle-bound coroutine scope.

Creating an unmanaged CoroutineScope violates the coding guideline to use lifecycle-bound coroutine scopes and avoid retaining screen contexts. This "fire and forget" coroutine can outlive its Context, potentially leading to memory leaks or wasted work if the context is destroyed while the database query is suspended.

Consider extracting the Context.findActivity() helper from canShowPopup to access the activity's lifecycleScope (e.g., (context.findActivity() as? ComponentActivity)?.lifecycleScope?.launch), or pass an appropriate CoroutineScope from the caller. As per coding guidelines, use lifecycle-bound coroutine scopes.

🤖 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`
at line 190, Replace the unmanaged CoroutineScope in the popup/database-query
flow with a lifecycle-bound scope, using the activity obtained through the
existing Context.findActivity helper and its lifecycleScope, or an appropriate
caller-provided scope. Ensure the coroutine is launched only when a valid
lifecycle owner is available and preserve the existing work otherwise.

Source: Coding guidelines

🤖 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.

Inline comments:
In
`@idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt`:
- Around line 134-140: Update both exception handlers in ToolTipManager.kt at
lines 134-140 and 90-93: replace broad Exception catches with the specific
expected exception type where possible, or rethrow CancellationException before
logging and handling other failures. Preserve the existing fallback behavior and
logging for non-cancellation errors at both sites.

---

Nitpick comments:
In
`@idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt`:
- Around line 77-84: Update the debug database logic in ToolTipManager around
debugDatabaseTimestamp so it is evaluated and can switch dbPath only when
BuildConfig.DEBUG is true; preserve the existing timestamp comparison and
production database behavior for non-debug builds.
- Line 190: Replace the unmanaged CoroutineScope in the popup/database-query
flow with a lifecycle-bound scope, using the activity obtained through the
existing Context.findActivity helper and its lifecycleScope, or an appropriate
caller-provided scope. Ensure the coroutine is launched only when a valid
lifecycle owner is available and preserve the existing work otherwise.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 240aedaa-b974-418c-ad98-9707df0b1c8f

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba63f5 and 8ad1c29.

📒 Files selected for processing (2)
  • idetooltips/src/main/java/com/itsaky/androidide/idetooltips/ToolTipManager.kt
  • idetooltips/src/test/java/com/itsaky/androidide/idetooltips/GradleTaskTooltipTagTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • idetooltips/src/test/java/com/itsaky/androidide/idetooltips/GradleTaskTooltipTagTest.kt

A broad catch(Exception) in the getTooltip suspend function swallowed
coroutine CancellationException, silently returning null (a "no tooltip"
result) on cancellation. Rethrow it before the fallback catch to keep
structured concurrency intact.
@hal-eisen-adfa
hal-eisen-adfa merged commit 7629974 into stage Jul 20, 2026
4 checks passed
@hal-eisen-adfa
hal-eisen-adfa deleted the ADFA-3641-add-tooltips-to-gradle-tasks branch July 20, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants