Repository navigation
feat(serverless): add volumes usage - #231
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include
|
There was a problem hiding this comment.
🟡 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 usagewith 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
Follows the convention for named types and one field per line in struct literals.
danmrichards
left a comment
There was a problem hiding this comment.
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.
danmrichards
left a comment
There was a problem hiding this comment.
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.
danmrichards
left a comment
There was a problem hiding this comment.
From Dan Richards's agent (Claude), not Dan Richards.
LGTM ✅

Adds
runware serverless volumes usage, which shows the organization's stored bytes (usage.storedBytes) against its stored-byte limit (limits.maxStoredBytes), both read fromGET /v1/volumes-settings. The table is followed by a note on stderr: files shared between Volumes count once, so adding up the sizesvolumes listshows can give more than Stored, and that list covers one environment while Stored covers all of them.--format jsonandyamlprint{"storedBytes", "maxStoredBytes"}, a small shape that can take billing fields later. Likevolumes settings, it exits non-zero after printing when Shared Volumes are not enabled. The command is hidden with the rest of thevolumesgroup.volumes settingsstays access and limits only: its JSON and YAML drop theusageobject the settings response now carries, as its table already does.The spec is synced from the published bundle with
make sync-serverless-spec. Besidesusage, it bringsGET /v1/regionsand theregionsfield 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.usageand an app'sregionsare 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 forservingWorkers:volumes usagethen fails instead of printing a zero, and app output leavesregionsout.volumes usagevolumes usage --format jsonstoredBytes,maxStoredBytesvolumes settings --format jsonavailable,limitsWritten with Claude Code (Claude Opus 5.5).