Skip to content

fix(infra): spend alerts count usage before credits - #1221

Merged
allisonmahmood merged 2 commits into
mainfrom
fix/infra-budgets-count-credits
Nov 3, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
fix/infra-budgets-count-credits

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

What changed

The production spend alerts email when the month's forecast passes $300 or $600. Both budgets counted AWS credits, which is the default, so while credits pay the bill they read $0 spent and can never fire. Both now count usage before credits. That way they warn about how fast credits are being spent, and they keep working unchanged once the credits run out.

Look at

  • One property on each budget, no replacement. costTypes: { includeCredit: false } is part of each budget's Budget property, which CloudFormation updates in place ("Update requires: No interruption"). Only a change to NotificationsWithSubscribers replaces a budget, so the deploy keeps both names and their subscribers. The synthesized production base stack shows the only change:

    {"id":"Spend","budget":{"BudgetLimit":{"Amount":300,"Unit":"USD"},"BudgetName":"patchy-monthly","BudgetType":"COST","CostTypes":{"IncludeCredit":false},"TimeUnit":"MONTHLY"}}
    {"id":"SpendHigh","budget":{"BudgetLimit":{"Amount":600,"Unit":"USD"},"BudgetName":"patchy-monthly-600","BudgetType":"COST","CostTypes":{"IncludeCredit":false},"TimeUnit":"MONTHLY"}}
    
  • The other cost types keep their defaults. Budgets treats every omitted CostTypes field as its default, so tax, refunds, support and the rest still count.

  • Right after the deploy the alerts may read $0 for a while. AWS resets a budget's calculated spend when the budget is updated, and recomputes it as fresh usage data arrives (UpdateBudget). So don't count on either alert until the budgets show spend again.

  • docs/adr/ADR-0012-credential-free-execution-service.md named only the $300 budget. It now names both, and says they count usage before credits.

How it was verified

  • vitest run apps/infra/src/stacks.test.ts: 8 passed. The budget case now also pins CostTypes: { IncludeCredit: false } on both budgets.
  • cdk synth of the example production stacks, shown above.
  • Prettier on the changed files.
  • Reviewed by GPT-6.1 Sol (xhigh): no P1 or P2 findings. Its one P3, the stale ADR line, is fixed in 9b21f61.
  • Not checked: the deploy itself. The budgets change on the next release's base stack deploy.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Infrastructure only: one cost-type setting on each of the two production budgets.

  • What does a revert leave behind? Nothing. The next base stack deploy puts both budgets back to counting credits.
  • Does the release before it still work with that? Yes. Releases don't read budgets.

Made by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code.

While AWS credits pay the bill, a budget that counts them reads $0 spent,
so neither the $300 nor the $600 forecast alert could fire. Both now
count usage before credits: they warn about how fast credits are spent,
and keep working unchanged once credits run out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area size:s Under 100 changed lines labels Nov 3, 2026
@allisonmahmood
allisonmahmood merged commit dd0e2ec into main Nov 3, 2026
24 checks passed
@allisonmahmood
allisonmahmood deleted the fix/infra-budgets-count-credits branch November 3, 2026 23:04
allisonmahmood added a commit that referenced this pull request Nov 3, 2026
…tals stay exact (#1222)

## What changed

This adds release 35's What's new entry, written from `dd0e2ec`. It
covers everything merged since release 34's `through` (`e5334ca`), and
sets the `patchy` release to `0.35.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Fixed: keyboard shortcuts in patches do what they say (a
once-per-press shortcut doesn't fire again while held, shortcuts wait
during input-method composition, symbol keys such as `+` work on every
keyboard) | #1152 |
| Improved: agents keep shared totals exact | #1184 |

The rest get no line:
- #1147, #1154, #1189, #1155, #1172 and #1153 are `pnpm dev eval`
tooling.
- #1150 renames a CI check.
- #1203 is an internal docs paragraph.
- #1221 changes the production spend alerts, which nobody using Patchy
sees.
- #1149 is release 34's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `11dc68b` (release 34) to
`dd0e2ec`:**
- None of the 11 PRs is labelled `one-way`, and each one's Release
impact answers say a revert leaves nothing behind.
- #1152 changes `patchy/hotkeys`, which patches bundle when they are
built. Published patches keep the copy they bundled. A patch repo that
writes `"+"` stops typechecking only if it moves back to an older
`patchy` release.
- #1184 is skill text. #1147 adds a dev-only personas option that
production never reads.
- #1221 changes a cost setting on the two budgets in the base stack.
Releases don't read budgets.
  - Nothing else touches code that runs in production.

**Rollback line:** If this release misbehaves, roll back to `11dc68b`
(release 34).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (21 tests), and `bun fmt` passes on the changed
files.
- **Deploy state.** I pinned the live commit from `/healthz/deep`:
`11dc68b` (release 34). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Text and version numbers only. Like every release, the `0.35.0` bump
tells CLIs and patch repos installed before this deploy to upgrade.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Touches the docs area area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant