Skip to content

fix: make unused resources fatal, and finish the feature that left two behind - #53

Merged
GeiserX merged 1 commit into
mainfrom
fix/unused-resources-are-errors
Aug 6, 2026
Merged

fix: make unused resources fatal, and finish the feature that left two behind#53
GeiserX merged 1 commit into
mainfrom
fix/unused-resources-are-errors

Conversation

@GeiserX

@GeiserX GeiserX commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Closes CashPilot-android-xuc.

Lint already detected an orphaned resource — but only as a warning, and the project's rule is that new lint errors are fatal. So detection worked and nothing acted on it.

The severity change could not be made alone

Two strings were already unused and would have failed the build immediately. The bead asked whether that meant the feature was incomplete rather than the strings being junk. I checked both, and the answers differ:

earnings_no_reading — superseded, deleted.
The rule it was written for is implemented, just differently: FormatUtils.formatPlatformEarnings returns for a null balance, so a per-app figure that was never read already renders as an em dash rather than $0.00. A text label would be a second, competing representation of the same state.

earnings_shared_detail — genuinely missing, now wired in.
The dashboard shows "Shared across your devices" next to a per-app figure but never said what that means for the number directly above it. A user reasonably reads that number as what this phone earned — which is the misreading the label exists to prevent. It now renders the detail underneath, following the earnings_none_yet / _detail pair already established in EarningsCard.

So half of it was an incomplete feature, which is why the bead was right to ask rather than just deleting.

The guard is proven, not assumed

With a deliberately orphaned drawable:

Error: The resource R.drawable.ic_control_orphan appears to be unused [UnusedResources]
BUILD FAILED   (exit 1)

With it removed: exit 0. Before this change, the same file produced a warning and passed.

Verification

Neither Mac has a working JVM, so everything ran on the build host:

  • lintDebug — clean, 0 errors
  • testDebugUnitTest — passing
  • verifyRoborazziDebugthe exact task CI runs — passing, with no golden rewritten

Worth recording: finalizeTestRoborazziDebug is SKIPPED under testDebugUnitTest alone and only runs under verifyRoborazziDebug. The golden gate has to be invoked by name — running the unit tests is not enough to exercise it.

Summary by CodeRabbit

  • New Features

    • Added an explanatory detail line to earnings cards when earnings are shared with other workers.
  • Bug Fixes

    • Improved detection of unused resources during quality checks.
    • Removed an obsolete earnings translation.

…o behind

CashPilot-android-xuc. Lint already DETECTED an orphaned resource but only as a
warning, and the project's rule is that new lint ERRORS are fatal -- so
detection worked and nothing acted on it.

Raising the severity could not be done alone: two strings were already unused
and would have failed the build immediately. The bead asked whether those meant
the FEATURE was incomplete rather than the strings being junk. Checked both,
and the answers differ:

  earnings_no_reading -- SUPERSEDED, deleted. The rule it was written for is
  implemented, just differently: FormatUtils.formatPlatformEarnings returns
  "—" for a null balance, so a per-app figure that was never read already
  renders as an em dash rather than $0.00. A text label would be a second,
  competing representation of the same state.

  earnings_shared_detail -- GENUINELY MISSING, now wired in. The dashboard
  shows "Shared across your devices" next to a per-app figure but never said
  what that means for the number directly above it. A user reasonably reads
  that number as what THIS phone earned, which is the misreading the label
  exists to prevent. It now renders the detail underneath, following the
  earnings_none_yet / _detail pair already established in EarningsCard.

So half of it was an incomplete feature, which is why the bead was right to ask.

THE GUARD IS PROVEN, not assumed. With a deliberately orphaned drawable:
  Error: The resource R.drawable.ic_control_orphan appears to be unused
  BUILD FAILED, exit 1
and with it removed, exit 0. Before this change the same file produced a
warning and passed.

Built and verified on the build host, since neither Mac has a working JVM:
lintDebug clean, testDebugUnitTest passing, and verifyRoborazziDebug -- the
exact task CI runs -- passing with no golden rewritten. Worth noting
finalizeTestRoborazziDebug is SKIPPED under testDebugUnitTest alone and only
runs under verifyRoborazziDebug, so the golden gate has to be invoked by name.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dfdf92ec-a268-45b9-a1c1-8d8de8c2ba6d

📥 Commits

Reviewing files that changed from the base of the PR and between d4e90f2 and d9138c8.

📒 Files selected for processing (3)
  • app/build.gradle.kts
  • app/src/main/java/com/cashpilot/android/ui/screen/DashboardScreen.kt
  • app/src/main/res/values/strings.xml
💤 Files with no reviewable changes (1)
  • app/src/main/res/values/strings.xml

📝 Walkthrough

Walkthrough

The pull request adds explanatory text for shared earnings, removes the obsolete earnings_no_reading resource, and configures Android lint to report UnusedResources findings as errors.

Changes

Earnings display and lint enforcement

Layer / File(s) Summary
Unused-resource lint enforcement
app/build.gradle.kts
The lint configuration now treats UnusedResources findings as errors.
Shared-earnings display clarification
app/src/main/java/com/cashpilot/android/ui/screen/DashboardScreen.kt, app/src/main/res/values/strings.xml
AppCard displays explanatory text below the shared-earnings label. The obsolete earnings_no_reading resource is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the fatal unused-resource lint change and completion of the related earnings feature.
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 fix/unused-resources-are-errors

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.

@GeiserX
GeiserX merged commit 5d4d945 into main Aug 6, 2026
1 of 2 checks passed
@GeiserX
GeiserX deleted the fix/unused-resources-are-errors branch August 6, 2026 21:17
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.

1 participant