Skip to content

feat: clearer earnings-tracking state on the dashboard (#82 follow-up)#88

Merged
GeiserX merged 1 commit into
mainfrom
feat/collector-setup-ux
Jun 13, 2026
Merged

feat: clearer earnings-tracking state on the dashboard (#82 follow-up)#88
GeiserX merged 1 commit into
mainfrom
feat/collector-setup-ux

Conversation

@GeiserX

@GeiserX GeiserX commented Jun 13, 2026

Copy link
Copy Markdown
Owner

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)True when a deployed service has a collector whose required config keys are unset. Exposed as collector_needs_setup on /api/services/deployed (Docker + external rows), suppressed when the collector has actually errored (the error state wins).
  • The config read is wrapped defensively so a DB hiccup degrades to "unknown" rather than 500-ing the dashboard.
  • /api/services/{slug} now returns has_collector.

Frontend

  • The balance badge now distinguishes two honest states instead of "disconnected":
    • muted "tracking not set up → set up" — credentials never entered (service is fine, just no balance read yet)
    • red "can't read balance → fix" — the collector ran and failed (e.g. wrong credentials)
  • The 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 when creds missing, not when present, disconnected-takes-precedence, the helper unit (incl. optional-only storj and no-collector cases), and the has_collector flag. 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.

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).
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeiserX, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fb97142c-b824-4056-94d5-1bace66dd956

📥 Commits

Reviewing files that changed from the base of the PR and between 01ad721 and 27b1461.

📒 Files selected for processing (3)
  • app/main.py
  • app/static/js/app.js
  • tests/test_main_routes.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/collector-setup-ux

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 and usage tips.

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.59%. Comparing base (01ad721) to head (27b1461).

Additional details and impacted files

Impacted file tree graph

@@            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              
Files with missing lines Coverage Δ
app/main.py 91.67% <100.00%> (+0.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeiserX GeiserX merged commit ed31c64 into main Jun 13, 2026
8 checks passed
@GeiserX GeiserX deleted the feat/collector-setup-ux branch June 13, 2026 19:45
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