feat(resources): add --object-storage option for apps#74
Open
ovv wants to merge 3 commits into
Open
Conversation
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.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class CLI support for configuring and displaying per-app object storage in the resources commands.
Changes:
- Add
--object-storagetoresources:setto set per-app object storage (GB input, stored as MiB in updates). - Display object storage in
resources:getvia a newobject_storagetable 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.