Skip to content

fix: allow ps resize before an app's first release#156

Open
dmonroy wants to merge 1 commit into
mainfrom
fix/ps-resize-before-first-deploy
Open

fix: allow ps resize before an app's first release#156
dmonroy wants to merge 1 commit into
mainfrom
fix/ps-resize-before-first-deploy

Conversation

@dmonroy

@dmonroy dmonroy commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ps resize (and ps list) crashed with could not find DDB item ... DEPLOYSTATUS for any app that had never had a successful release, even though ps resize is explicitly designed to support setting a size before the first deploy.
  • Root cause is a regression from Formatting cleanup 🧹 #102 ("Formatting cleanup"), which changed psResizeCmd from silently discarding LoadDeployStatus()'s error to treating it as fatal via checkErr. Before that commit (v4.6.7), a missing DEPLOYSTATUS item never surfaced, so the command fell through to the existing graceful "service does not exist" handling by accident.
  • Fix: add a sentinel ErrDDBItemNotFound, and only treat that specific case as non-fatal in LoadDeployStatus (leaving DeployStatus nil), rather than reverting to silently discarding all errors. Real errors (auth, throttling, etc.) still fail loudly, unlike the old v4.6.7 behavior. GetServices gets a nil-guard it needs now that LoadDeployStatus can return a nil DeployStatus without erroring.
  • No changes needed to cmd/ps.go — both ps resize and ps (list) already handle a nil DeployStatus gracefully via FindProcess's existing nil-receiver check; this also fixes ps list's identical, longer-standing bug (predates Formatting cleanup 🧹 #102).

Test plan

  • go build ./..., go vet ./..., go test ./..., gofmt -l all clean
  • New unit test pinning the sentinel error's wrap/unwrap contract
  • Verified live against a real AWS account on a genuinely fresh app (zero prior builds): crashes on unpatched v4.7.0, works correctly with this fix
  • New behavioral branches (LoadDeployStatus's non-fatal path, GetServices's nil-guard) aren't covered by an automated test — no DynamoDB-mocking infra exists in this repo to exercise them in isolation

LoadDeployStatus treated a missing DEPLOYSTATUS DynamoDB item as a
fatal error, so ps resize (and ps) crashed for any app that had never
had a successful release, instead of falling through to the existing
graceful handling for a not-yet-created service.

Add a sentinel error for the DynamoDB not-found case and only treat
that specific case as non-fatal, leaving DeployStatus nil. Other
errors (auth, throttling, etc.) still fail loudly. GetServices gets a
nil-guard since LoadDeployStatus no longer errors in this case.

Verified against a real app across three AppPack CLI versions: works
correctly with this fix, crashes on v4.7.0+, and worked by accident
on v4.6.7 (errors from LoadDeployStatus were silently discarded there
until a later cleanup made them fatal).
@dmonroy
dmonroy requested a review from ipmb July 19, 2026 05:49
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.

3 participants