feat: clearer earnings-tracking state on the dashboard (#82 follow-up)#88
Conversation
A deployed service can be running and earning while CashPilot still can't
show its balance, because the earnings collector uses SEPARATE credentials
(e.g. Repocket: container = email+API key; collector = email+password).
The dashboard previously rendered a single red "disconnected" badge that
conflated two very different states and misled users into thinking the
container was broken.
Backend:
- _collector_needs_setup(slug, config): True when a deployed service has a
collector whose required config keys are unset. Surface it as
`collector_needs_setup` on /api/services/deployed (Docker + external),
suppressed when the collector has actually errored (disconnected wins).
- Config read is defensively guarded so a DB hiccup degrades to "unknown"
instead of 500ing the dashboard.
- /api/services/{slug} now returns `has_collector`.
Frontend:
- Split the badge into two honest states: muted "tracking not set up →
set up" (creds never entered) vs red "can't read balance → fix"
(collector ran and failed). Replaces the misleading "disconnected".
- Deploy modal shows a note for services with a collector: the deploy
credentials run the service; to see the balance, add earnings-tracking
credentials under Settings → Collectors (optional — it earns either way).
Tests: +6 (needs-setup vs present vs disconnected-precedence, helper unit,
has_collector flag).
|
Warning Review limit reached
More reviews will be available in 34 minutes and 46 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
+ Coverage 91.54% 91.59% +0.05%
==========================================
Files 30 30
Lines 3063 3082 +19
==========================================
+ Hits 2804 2823 +19
Misses 259 259
🚀 New features to boost your workflow:
|
Follow-up to #82 (the "disconnected / 0,00 €" report after the Repocket API-key fix).
Problem
A service can be running and earning while CashPilot still can't show its balance, because the earnings collector authenticates with separate credentials from the container. For Repocket: the container uses email + API key; the collector reads the balance via email + password (the API key can't read earnings — verified against Repocket's live API). The dashboard rendered a single red "disconnected" badge that conflated two different states and made it look like the container was broken — which is exactly what the reporter concluded.
Changes
Backend
_collector_needs_setup(slug, config)—Truewhen a deployed service has a collector whose required config keys are unset. Exposed ascollector_needs_setupon/api/services/deployed(Docker + external rows), suppressed when the collector has actually errored (the error state wins)./api/services/{slug}now returnshas_collector.Frontend
Tests
+6: needs-setup when creds missing, not when present, disconnected-takes-precedence, the helper unit (incl. optional-only
storjand no-collector cases), and thehas_collectorflag. Full suite 955 passed, ruff + format clean, JS validates.Why this over the reporter's suggestion
The reporter proposed asking for email + password + API key together in one form. That's the wrong model: the API key is useless for earnings, the password must stay optional (the container earns without it), and most other collectors need a browser-extracted cookie/token unavailable at deploy time. This change keeps the credential paths separate but makes the state honest and discoverable.