Skip to content

fix(cloud): status reads the balance as cents, not micro-dollars (BE-16748) - #926

Merged
vqt123 merged 1 commit into
mainfrom
vinh/be-16748-balance-cents
Sep 23, 2026
Merged

vqt123 merged 1 commit into
mainfrom
vinh/be-16748-balance-cents

Conversation

@vqt123

@vqt123 vqt123 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

comfy cloud status showed every balance 10,000 times too small. The balance endpoint sends cents in fields named *_micros; the CLI divided them by 1,000,000. It now divides by 100. The field names stay, since they are the wire contract, and the JSON schema description says the unit is cents.

Tests: the status fixtures are restated in cents, and a new test checks a realistic balance (347,867 -> $3,478.67).

BE-16748

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 806661ae-2b79-45db-97ec-43c9d4b7baf7

📥 Commits

Reviewing files that changed from the base of the PR and between 54addba and b3af4fa.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • comfy_cli/cloud/billing.py
 _________________________
< Will debug for carrots. >
 -------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e93b33a6-cf0e-429b-8568-0a07d4b710b5

📥 Commits

Reviewing files that changed from the base of the PR and between 64026d2 and 54addba.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • comfy_cli/cloud/billing.py
  • comfy_cli/cloud/command.py
  • comfy_cli/schemas/cloud_status.json
  • tests/comfy_cli/cloud/test_billing.py
  • tests/comfy_cli/cloud/test_status_command.py

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The cloud billing path now treats *_micros balance fields as cents. Dollar conversion divides by 100, and status output, schema text, changelog text, and tests reflect the corrected unit.

Changes

Billing unit correction

Layer / File(s) Summary
Cent conversion contract and status flow
comfy_cli/cloud/billing.py, comfy_cli/cloud/command.py, comfy_cli/schemas/cloud_status.json, CHANGELOG.md
Billing documentation identifies the wire-named fields as cents. cents_to_usd replaces micros_to_usd and divides by 100. status_cmd uses the new conversion.
Cent conversion regression coverage
tests/comfy_cli/cloud/test_billing.py, tests/comfy_cli/cloud/test_status_command.py
Tests use cent-valued fixtures and verify dollar, credit, fallback, negative-balance, validation, and sanitization behavior.

Suggested reviewers: mattmillerai

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 54add

Cloud status now displays cent-valued balances at the correct dollar amount, with matching documentation and regression coverage. The change is ready to merge.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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 unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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

@comfy-greenlight-bot

comfy-greenlight-bot commented Sep 22, 2026

Copy link
Copy Markdown

Swarmhost agentic review

The detailed evaluation is available to employees in the internal Slack review thread.

Updated by Swarmhost's agentic review process.

@james00012 james00012 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. Reads as: reads the balance fields as cents, which the server sends under the micros names. Head 54addba, judged as comfy-cli's owner.

Optional

  • Correctness: credits can land 1 to 3 below the platform page comfy_cli/cloud/billing.py:127. The server sends fractional cents; the CLI truncates them, while the platform rounds.
  • Tests: the new test derives expected credits from the code's own formula tests/comfy_cli/cloud/test_status_command.py:174. The literal 733999 would pin it.
  • Scope: three comments still call the balance micro-dollars comfy_cli/cloud/billing.py:100. They contradict the new comment, the confusion behind this bug.
  • Modularity: the balance variable and helper still say micros while holding cents comfy_cli/cloud/command.py:452. The next reader will take it for a unit bug.

Clean: Verbosity, Resilience, Access, Reachability, Contract, Rollout.
Native review: 8 findings, folded into the list above.
Checked: Ingest and billing-api on cloud main send cents in all four fields. Main's code fails 8 of the new status tests. The red GPU job fails on main too.
Bots: CodeRabbit and Swarmhost raised nothing; cursor-review did not run.

…16748)

The balance endpoint sends cents in fields named *_micros. Dividing them by
1,000,000 showed every balance and credit figure 10,000 times too small.
The field names stay as the wire contract; only the unit changes.
@vqt123
vqt123 force-pushed the vinh/be-16748-balance-cents branch from 54addba to b3af4fa Compare September 23, 2026 15:35
@vqt123
vqt123 merged commit 5cd4b77 into main Sep 23, 2026
13 of 15 checks passed
@vqt123
vqt123 deleted the vinh/be-16748-balance-cents branch September 23, 2026 15:35
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants