Skip to content

Display and accept compute prices in $/node-hr for scale and orders#271

Closed
claude[bot] wants to merge 1 commit into
mainfrom
change-price-unit-to-node-hour
Closed

Display and accept compute prices in $/node-hr for scale and orders#271
claude[bot] wants to merge 1 commit into
mainfrom
change-price-unit-to-node-hour

Conversation

@claude

@claude claude Bot commented Jun 24, 2026

Copy link
Copy Markdown

Before / After

Makes the whole CLI consistent on price units. sf nodes already displayed and accepted prices as $/node-hr; this brings sf scale and sf orders in line.

  • Before: sf scale and sf orders displayed limit/order prices as $2.00/gpu/hr, and sf scale --price was interpreted as dollars-per-GPU-hour.
  • After: they display $16.00/node/hr, and sf scale --price is interpreted as dollars-per-node-hour.

A node is 8 GPUs (GPUS_PER_NODE = 8), so $2.00/gpu-hr = $16.00/node-hr.

⚠️ Breaking UX change — needs a human's eyes

The --price input semantics for sf scale create / sf scale update change. A user who previously ran --price 2 (meaning $2/gpu-hr) must now run --price 16 ($16/node-hr) to express the same limit. Same factor-of-8 shift applies to anyone who had memorized typical values. This is intentional (it matches sf nodes and the rest of the CLI) but is worth calling out explicitly since it silently changes the meaning of an existing flag.

How

  • Display: flipped the per-GPU display conversions to per-node.
    • orders/OrderDisplay.tsx: dropped the * GPUS_PER_NODE in the price math, renamed pricePerGPUHourpricePerNodeHour (and the executed-price field), relabeled /gpu/hr/node/hr.
    • scale/ProcurementDisplay.tsx and scale/ConfirmationMessage.tsx: the API value is per-GPU, so multiply by GPUS_PER_NODE for display and relabel to /node/hr.
  • Input: the backend procurement field is still per-GPU (buy_limit_price_per_gpu_hour), so we keep converting — but now from a node-hr input. In scale/create.tsx and scale/update.tsx the user's --price (cents/node-hr) is divided by GPUS_PER_NODE before being sent to the API. This mirrors the existing sf nodes set pattern (node-hr input → per-GPU for the API).
  • Helpers: added getPricePerNodeHourFromQuote in helpers/quote.ts; kept getPricePerGpuHourFromQuote for the sf nodes create/extend callers, which already convert it to node-hr for display.
  • Strings/help: updated "Price per GPU hour" → "Price per node hour", examples /GPU/hr/node/hr (and example values rescaled, e.g. -p 1.50-p 12.00), and relabeled the sf nodes set confirmation (it was already node-hr but printed /GPU/hr).
  • Tests: updated OrderDisplay.test.ts (node-hr expectations + renamed field) and quote.test.ts (exercises the new node-hr helper).

GPU-count math (e.g. "16 gpus", accelerators → node count) was deliberately left unchanged — only price-per-hour units changed. The unused helpers in helpers/price.ts (no callers in src/) were left as-is.

Validation

  • bun run check (tsc) — passes
  • bun run test (vitest) — 14/14 pass
  • bun run lint (biome) — passes (only pre-existing warnings, none on the changed lines)

Make the `sf scale` and `sf orders` command families consistent with
`sf nodes` by showing and accepting limit prices in dollars-per-node-hour
instead of dollars-per-GPU-hour (a node is 8 GPUs).

- orders/OrderDisplay: compute and label price as $/node/hr (drop the
  per-GPU division); rename pricePerGPUHour -> pricePerNodeHour and the
  executed-price field accordingly.
- scale create/update: --price input is now interpreted as $/node-hr and
  converted to the API's per-GPU field (buy_limit_price_per_gpu_hour);
  display, help text, and examples updated to node-hr.
- scale ProcurementDisplay/ConfirmationMessage: show the limit price as
  $/node/hr (multiply the API's per-GPU value by 8 for display).
- nodes/set: relabel the already-node-hr max price as /node/hr (was /GPU/hr).
- helpers/quote: add getPricePerNodeHourFromQuote; keep the per-GPU helper
  for the nodes callers that still convert per-GPU for display.
- Update OrderDisplay and quote tests to node-hr expectations.

BREAKING UX: scale/orders --price now means $/node-hr, so a value that
previously meant $2/gpu-hr must now be passed as $16/node-hr.
@semanticdiff-com

semanticdiff-com Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/scale/ConfirmationMessage.tsx  68% smaller
  src/lib/scale/create.tsx  41% smaller
  src/helpers/test/quote.test.ts  27% smaller
  src/lib/scale/update.tsx  20% smaller
  src/lib/scale/index.tsx  12% smaller
  src/helpers/quote.ts  0% smaller
  src/lib/nodes/set.ts  0% smaller
  src/lib/orders/OrderDisplay.tsx  0% smaller
  src/lib/orders/__tests__/OrderDisplay.test.ts  0% smaller
  src/lib/scale/ProcurementDisplay.tsx  0% smaller

@masonsfc masonsfc self-requested a review June 24, 2026 17:57
@masonsfc masonsfc marked this pull request as ready for review June 24, 2026 18:03
@masonsfc masonsfc requested a review from joshi4 June 24, 2026 18:04
@sigmachirality

Copy link
Copy Markdown
Member

I'm hesitant to make logical changes with such a high blast radius especially while we're in the process of deprecating this CLI.

Also, this is a breaking change.

@claude claude Bot deleted the change-price-unit-to-node-hour branch June 24, 2026 19:35
@sfcompute sfcompute deleted a comment from claude Bot Jun 24, 2026
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