Skip to content

chore/deploy-sh-hardening: improved failure handling - #72

Merged
gibbsie merged 1 commit into
mainfrom
chore/deploy-sh-hardening
Aug 14, 2026
Merged

chore/deploy-sh-hardening: improved failure handling#72
gibbsie merged 1 commit into
mainfrom
chore/deploy-sh-hardening

Conversation

@gibbsie

@gibbsie gibbsie commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Mitigates two deploy failure path edge cases: deploy.sh reporting confident states its inputs didn't support.

  • The API-key pepper existence check treated every read failure as absence - expired credentials read as "not found" and entered the generate branch. Only a genuine ParameterNotFound does now; anything else aborts naming the real cause. The absence of --overwrite on the store call is documented as a deliberate safety property (replacing the pepper invalidates every issued API-key hash).
  • Stack deploys classify a failed attempt before retrying: deterministic client-side errors (e.g. spawnSync docker ENOENT) fail fast with the root cause; CloudFormation transients keep the single retry. The container runtime is re-checked before every attempt, so a mid-deploy Docker disappearance is named precisely.
  • cdk diff drops the unsupported --all flag and names its failures instead of swallowing them with || true.

Testing

scripts/test-deploy-sh.sh (tracked via a .gitignore exception): 16/16 assertions using PATH-shimmed fake aws/cdk/docker binaries, including the exact credential-failure and runtime-disappearance shapes from both incidents. The harness is bite-proven - reverting either fix fails it by name. Default execution is byte-equivalent: all changes are function-internal; the test seam is opt-in. bash -n clean; secret value verified never to reach stout or logs.

Notes

No infrastructure delta. Behaviour changes only on failure paths.

cover that the API-key pepper existence check treated every read failure as absence, so expired credentials read as 'not found' and entered the generate branch — only a genuine ParameterNotFound does now, and any other failure aborts naming the real cause, with a comment recording that the absence of overwrite on the store call is a deliberate safety property protecting existing API-key hashes. Stack deploys now classify a failed attempt before retrying: deterministic client-side errors fail fast with the root cause line instead of burning a guaranteed-identical retry, the container runtime is re-checked before every attempt so a mid-run disappearance is named precisely, and the diff step drops an unsupported flag and names its failures instead of swallowing them. A self-contained harness under scripts proves each behaviour with PATH-shimmed fakes, including the exact credential-failure and runtime-disappearance shapes from the two incidents that motivated this.
@gibbsie
gibbsie merged commit 3f048ef into main Aug 14, 2026
14 checks passed
@gibbsie
gibbsie deleted the chore/deploy-sh-hardening branch August 14, 2026 00:59
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.

1 participant