Skip to content

feat(serverless): add volumes usage - #231

Merged
emmmile merged 11 commits into
mainfrom
feat/volumes-usage
Dec 1, 2026
Merged

emmmile merged 11 commits into
mainfrom
feat/volumes-usage

Conversation

@emmmile

@emmmile emmmile commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Adds runware serverless volumes usage, which shows the organization's stored bytes (usage.storedBytes) against its stored-byte limit (limits.maxStoredBytes), both read from GET /v1/volumes-settings. The table is followed by a note on stderr: files shared between Volumes count once, so adding up the sizes volumes list shows can give more than Stored, and that list covers one environment while Stored covers all of them. --format json and yaml print {"storedBytes", "maxStoredBytes"}, a small shape that can take billing fields later. Like volumes settings, it exits non-zero after printing when Shared Volumes are not enabled. The command is hidden with the rest of the volumes group.

volumes settings stays access and limits only: its JSON and YAML drop the usage object the settings response now carries, as its table already does.

The spec is synced from the published bundle with make sync-serverless-spec. Besides usage, it brings GET /v1/regions and the regions field on apps, and description updates for private base images and registry secrets, the idle timeout floor, a task's endpoint id and the commitment region.

usage and an app's regions are required in the spec, so the generated types would decode a response without them as zero stored bytes and "regions": null. Two overlay actions make them optional for this client, as for servingWorkers: volumes usage then fails instead of printing a zero, and app output leaves regions out.

Command Output
volumes usage Stored, Max stored, plus the note
volumes usage --format json storedBytes, maxStoredBytes
volumes settings --format json available, limits

Written with Claude Code (Claude Opus 5.5).

Copies the published Serverless API bundle with make
sync-serverless-spec and regenerates the client. No hand edits.

The bundle adds the usage object (storedBytes) to the Shared Volume
settings, GET /v1/regions with the regions field on apps, and
description updates for private base images and registry secrets, the
idle timeout floor, a task's endpoint id and the commitment region.
runware serverless volumes usage shows the organization's stored bytes
against its stored-byte limit, read from the Shared Volume settings, in
a table or with --format json or yaml. The table adds a note on stderr
that files shared between Volumes count once, so the sizes volumes list
shows can add up to more than the stored bytes, and that the list covers
one environment while the stored bytes cover all of them. Like volumes
settings, it exits non-zero when Shared Volumes are not enabled for the
organization, after printing the usage when the API reports it.

The command stays hidden with the rest of the volumes group.

An overlay action makes the settings' usage optional in the generated
client. Required, it would decode as zero from a response without it,
and the command would print that zero as the organization's usage; the
command fails instead.
The settings response now carries the organization's usage, which
volumes usage shows. volumes settings drops it from its JSON and YAML,
so it keeps printing access and limits only, as its table does.
The synced spec makes an app's regions required, so the generated type
decoded a response without them as a nil list and apps commands printed
"regions": null in JSON and YAML. An overlay action makes the field
optional for this client, as for servingWorkers, so it stays omitted.
@emmmile
emmmile requested a balanced review from Copilot November 30, 2026 16:46
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include coderabbit-review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20920038-91f6-4923-b593-5d9b95b0a60d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two guideline violations remain: the sentinel error needs an Err prefix, and the new test table needs a named case type with one literal field per line.

2 open issues
What changed in this PR

Adds organization-wide Shared Volume storage reporting to the existing hidden serverless volumes command group, while keeping settings output focused on access and limits.

Changes:

  • Adds volumes usage with table, JSON, and YAML output, plus handling for missing usage and disabled access.
  • Keeps usage out of settings output and adds regression tests for output and error behavior.
  • Syncs the published API specification and generated client, with compatibility overlays for omitted usage and app regions.
File Description
internal/​cmd/​serverless/​volumes.go Registers the usage command.
internal/​cmd/​serverless/​volumes_manage.go Implements usage reporting and error handling.
internal/​cmd/​serverless/​volumes_manage_test.go Tests usage output, errors, and command registration.
internal/​cmd/​serverless/​volumes_display.go Formats usage and excludes it from settings output.
internal/​cmd/​serverless/​display_test.go Tests preservation of omitted app regions.
internal/​api/​serverless/​volumes.go Updates comments to describe stored-byte usage.
internal/​api/​serverless/​gen/​client.gen.go Adds generated usage and region support.
api/​serverless/​overlay.yaml Makes usage and app regions optional for compatibility.
api/​serverless/​openapi.yaml Syncs usage, regions, and API description updates.

Review effort: Balanced

Comment thread internal/cmd/serverless/display_test.go Resolved
Follows the convention for named types and one field per line in
struct literals.
@emmmile
emmmile marked this pull request as ready for review December 1, 2026 11:13
leszko
leszko previously approved these changes Dec 1, 2026

@leszko leszko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM ✅

danmrichards
danmrichards previously approved these changes Dec 1, 2026

@danmrichards danmrichards 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.

From Dan Richards's agent (Claude), not Dan Richards.

Added a few non-blocking comments. LGTM ✅

volumes usage --format yaml must not print the table note on stderr,
and the volumes settings table must not gain the Stored row that
volumes usage owns.
The usage help now holds volumeUsageNote as its paragraph instead of
restating the rule in other words, so the two cannot drift apart.
Stored and Max stored are each rounded, so near the limit they can read
the same while some space is left, or differ by a rounding step while
none is. A Free row shows the limit minus Stored, and zero once Stored
reaches or passes the limit. JSON and YAML keep their shape: they
already carry the exact bytes.

Free is an upper bound, since content held by upload sessions also
counts at admission, so that caveat moves from the help alone into the
note the table prints on stderr.
@emmmile
emmmile dismissed stale reviews from danmrichards and leszko via ed2d063 December 1, 2026 11:51
leszko
leszko previously approved these changes Dec 1, 2026

@leszko leszko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM ✅

danmrichards
danmrichards previously approved these changes Dec 1, 2026

@danmrichards danmrichards 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.

From Dan Richards's agent (Claude), not Dan Richards.

Added one suggestion. LGTM ✅

The usage help must hold volumeUsageNote, so a help rewrite that stops
using the constant fails instead of letting the two texts drift.
@emmmile
emmmile dismissed stale reviews from danmrichards and leszko via 56a7c90 December 1, 2026 12:28

@danmrichards danmrichards 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.

From Dan Richards's agent (Claude), not Dan Richards.

LGTM ✅

@emmmile
emmmile merged commit 04efa21 into main Dec 1, 2026
5 checks passed
@emmmile
emmmile deleted the feat/volumes-usage branch December 1, 2026 12:43
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.

4 participants