Files
cozystack/pkg/registry/apps
Aleksei Sviridkin 7380828271 fix(api): validate workload memory before storing an application (#5348)
## What this PR does

The application API accepts `memory: 8` and stores an eight-byte
workload request. On main, #5009 catches it later when Helm renders the
chart. This patch returns HTTP 422 to the caller on create, upsert, or
an update that introduces such a value.

The check follows declared workload resource fields in the chart schema.
An unrelated edit to an existing application with a smaller value still
passes admission. Existing chart checks continue to apply at render
time. A tenant's zero memory quota and arbitrary chart configuration
keep their existing meaning.

The regression tests exercise the REST create and update paths and
verify that a rejected edit leaves storage untouched. The same change
passed the application registry package tests on main and on
release-1.7. Related to #5004 and #5009.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(api): reject new workload memory values below 1Mi before storing an application. Updates to unrelated fields on existing applications with smaller values still pass admission.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Application creation and updates reject workload memory settings below
the supported minimum of 1 MiB. Values at or above the minimum are
accepted, and existing below-minimum values may remain unchanged.
* Memory settings in quotas and free-form configuration are not
affected. When concurrent updates occur, memory is rechecked against the
latest stored values, preserving repairs and preventing stale updates
from restoring below-minimum settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 15:51:34 +03:00
..