Skip to content

feat(resources): add --object-storage option for apps#74

Open
ovv wants to merge 3 commits into
upsun:mainfrom
ovv:qd/app-object-storage
Open

feat(resources): add --object-storage option for apps#74
ovv wants to merge 3 commits into
upsun:mainfrom
ovv:qd/app-object-storage

Conversation

@ovv
Copy link
Copy Markdown

@ovv ovv commented May 12, 2026

Expose the new resources.disk.object field recently added on the platform side.

resources:set accepts --object-storage name:value (non-negative integer GB, apps only)
resources:get adds an optional "Object storage (GB)" column.

Values are stored as MiB on the wire (1 GB = 1024 MiB) and converted on the way in and out via a shared ResourcesUtil::formatObjectStorageGB() helper.

Quentin Dawans added 2 commits May 11, 2026 13:34
Expose the new resources.disk.object field recently added on the
platform side. resources:set accepts --object-storage name:value
(non-negative integer GB, apps only); resources:get adds an
"Object storage (GB)" column. Values are stored as MiB on the wire
(1 GB = 1024 MiB) and converted on the way in and out via a shared
ResourcesUtil::formatObjectStorageGB() helper. Range and step
constraints are deferred to the API.
Object storage is opt-in and rarely configured, so the column was
displaying "not set" or "N/A" for every row on most projects. Drop it
from the default column list when no application has it configured.
Users can still request it explicitly via --columns.
Copilot AI review requested due to automatic review settings May 12, 2026 12:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class CLI support for configuring and displaying per-app object storage in the resources commands.

Changes:

  • Add --object-storage to resources:set to set per-app object storage (GB input, stored as MiB in updates).
  • Display object storage in resources:get via a new object_storage table column.
  • Introduce ResourcesUtil::formatObjectStorageGB() plus PHPUnit coverage for formatting/rounding behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
legacy/tests/Service/ResourcesUtilTest.php Adds unit tests for object storage MiB→GB formatting.
legacy/src/Service/ResourcesUtil.php Adds a helper to format object storage values for display.
legacy/src/Command/Resources/ResourcesSetCommand.php Adds --object-storage parsing/validation and applies updates to deployment payload.
legacy/src/Command/Resources/ResourcesGetCommand.php Adds an object_storage column and populates it for apps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +184 to 189
if (!$hasObjectStorage) {
$defaultColumns = array_values(array_diff($defaultColumns, ['object_storage']));
}
$this->table->render($rows, $this->tableHeader, $defaultColumns);

if (!$this->table->formatIsMachineReadable()) {
Comment on lines +601 to +607
$gb = (int) $value;
if ((string) $gb !== $value || $gb < 0) {
throw new InvalidArgumentException(sprintf(
'Invalid object storage size <error>%s</error>: it must be a non-negative integer in GB.',
$value,
));
}
Align the object-storage validator with the disk-size validator by
using loose comparison ($gb != $value) instead of a strict string
cast. Inputs like "01" are now accepted, matching the behavior of
other size options, while non-integers such as "1.5" or "abc" are
still rejected.
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