fix: reject negative process counts when scaling

A process count below zero was accepted and stored verbatim, leaving the scheduler to reject the value long after the command reported success. Counts below zero are now rejected, as are process tuples that omit a process type, across `ps:scale`, the `ps-set-scale` trigger and the `formation` key of `app.json`. A negative count persisted by an earlier version stays readable so it can be corrected with `ps:scale`.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-09-18 02:50:34 -04:00
1 parent 4fc19fe1bc
commit ffa2991abf
8 files changed
+292 -3

No files matched your search

+4
View File
@@ -431,6 +431,10 @@ func setScale(appName string) error {
args := []string{appName, strconv.FormatBool(skipDeploy), strconv.FormatBool(clearExisting)}
for processType, formation := range appJSON.Formation {
if formation.Quantity != nil {
if *formation.Quantity < 0 {
return fmt.Errorf("Invalid quantity for process type %s in app.json: value must be zero or greater", processType)
}
args = append(args, fmt.Sprintf("%s=%d", processType, *formation.Quantity))
}
}