Skip to content

test(telemetry): give asserted destroys time to finish throttle retries - #1292

Merged
xyos merged 1 commit into
mainfrom
fix/telemetry-e2e-destroy-budget
Nov 4, 2026
Merged

xyos merged 1 commit into
mainfrom
fix/telemetry-e2e-destroy-budget

Conversation

@xyos

@xyos xyos commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Telemetry E2E fails intermittently in SUCCESS: sandbox:destroy after deploy emits sandbox:destroy/SUCCESS and SUCCESS: destroy with creds emits destroy/SUCCESS with:

AssertionError [ERR_ASSERTION]: telemetry file not written.
exit=null

The stdout tail shows the destroy still retrying, for example ⏳ Stack deletion was throttled by AWS (API rate limit). Retrying in 41s (throttle retry 1; backing off for up to 20 min)... or ⏳ Stack deletion failed. Retrying in 60s (waiting for resource cleanup)..., with Too Many Requests (Service: ApiGateway, Status Code: 429 ...) on stderr. The test gives each destroy 450 s, but a throttled cdk destroy attempt on this app's stack takes about 5 min, so the test stops the command during its first retry, before trackCommand writes the event.

Issue #, if available:

Changes

  • The two destroys whose telemetry is asserted get 20 min (DESTROY_TIMEOUT_MS). With attempts of about 5 min, that covers the first attempt and two throttle retries in core's runDestroyWithRetries (jittered waits of at most 1 and 2 min). In CI's cleanup step, throttled destroys of this stack that recovered took 4.5 to 21 min, most under 12.
  • The suite timeout, after which the test runner cancels any case still running, goes from 40 to 50 min (SUITE_TIMEOUT_MS). The sandbox group is the longer AWS group and takes 10 to 21 min when it passes, so this leaves room for one of its destroys to use the full 20 min. The groups run concurrently, and destroys within a group run in sequence.
  • Unchanged: the e2e-telemetry job's timeout-minutes: 60, core's retry behavior, and the cleanup destroys that only remove a case's stack. Those keep 450 s, and the job's "Cleanup stacks" step retries any stack they leave, best-effort, in whatever job time is left.

Trade-off: this covers realistic throttling, not every retry core may make. Core stops scheduling throttle retries once a wait would end more than 20 min after the first failure, but the last retry can finish after that, and core sets no hard limit on the total time. The job's AWS session from configure-aws-credentials lasts 1 h, and the sandbox group runs three destroys in a row, so the suite has to end well within that session. The comments on the two constants explain both budgets.

Validation

  • npm run build, npm run lint, npm run lint:deps and npx tsc --noEmit -p test-apps/telemetry pass.
  • npm test (every workspace) and npm run test:e2e:local pass with 0 failures.
  • The change is limited to test timeouts; this PR's Telemetry E2E job runs it against AWS.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced): n/a; the budget is documented in the test's comments

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The sandbox:destroy and destroy SUCCESS cases gave the command 450 s.
When API Gateway throttles DeleteRestApi (429), one throttled cdk destroy
attempt on this app's stack takes about 5 min. So the test killed the
command during its first retry, before trackCommand wrote the event, and
the case failed with "telemetry file not written. exit=null" even though
the destroy was healthy.

Give those two destroys 20 min. With ~5-min attempts that covers the
first attempt and two throttle retries in core's runDestroyWithRetries
(waits of at most 1 and 2 min). Raise the suite timeout, the runner's
cancellation threshold, from 40 to 50 min so one destroy in the sandbox
group can use the whole limit. Throttled destroys of this app's stack that
finished in CI's cleanup step took 4.5 to 21 min, most under 12.

This does not cover every retry core may make. Core schedules no further
throttle retry whose wait would end more than 20 min after the first
failure, but the last retry can finish after that, and core sets no hard
limit on the total time. The job's AWS session from
configure-aws-credentials lasts 1 h, and the sandbox group runs three
destroys in a row, so the suite has to end well within that. The job's
timeout-minutes (60) is unchanged. Cleanup destroys that only remove a
case's stack keep 450 s; the job's Cleanup stacks step retries what they
leave, best-effort, in whatever job time is left.
@xyos
xyos requested a review from a team as a code owner November 3, 2026 22:38
@changeset-bot

changeset-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 150911d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@xyos
xyos merged commit 7665686 into main Nov 4, 2026
77 of 80 checks passed
@xyos
xyos deleted the fix/telemetry-e2e-destroy-budget branch November 4, 2026 12:41
harsh62 added a commit that referenced this pull request Nov 4, 2026
Brings in the blocks CLI (#1203), CLI-calling templates (#1207),
AuthBasic sign-in metrics (#1296), docs corrections (#1288), the
native export type-name rule (#1134), the consolidated Data block
bb-database (#774), CI checkout of the PR merge commit (#1291) and
smaller fixes (#960, #1292, #1294).

Conflict resolutions:
- packages/bb-auth-basic, bb-auth-cognito/DESIGN.md, bb-auth-oidc:
  kept deleted. #1288's cookie correction already holds in Auth's
  DESIGN.md; #1203's `cdk-blocks secret` wording has no Auth
  counterpart (Auth's README uses `npm run secret`). #1296's metrics
  are not ported here (see the follow-up and the pending-changes note).
- Changesets naming deleted packages: auth-basic-signin-metrics and
  bb-auth-oidc-cdk-blocks-secret removed and folded into
  auth-replaced-blocks-pending-changes.md; docs-correct-infra-guidance
  drops bb-auth-cognito.
- templates/auth-cognito: not re-added (its e2e test is git rm'd).
  templates/auth/aws-blocks/scripts/*: deleted, as #1207 deleted them
  from every template; auth's package.json, README and gitignore
  auto-merged onto the cdk-blocks scripts.
- templates/default and react e2e tests: kept this branch's Auth
  sign-up-with-code flow and its per-run username, plus main's
  package.json port lookup and graceful server shutdown.
- create-blocks-app cli.test.ts: main's per-template tables name
  `auth`, not `auth-cognito`.
- package.json workspaces: bb-database added, old auth packages stay
  removed, bb-auth kept. packages/blocks/package.json: main's
  cdk-blocks bin, tsx dependency and cli tests, plus this branch's
  test files. package-lock.json regenerated with
  `npm install --package-lock-only`, keeping main's @aws/dsql-lint
  0.2.20.
- docs/DECISIONS.md: both sides kept. main's D-021 (export type
  names) keeps its number; the auth decision becomes D-022, and every
  link to it is updated. D-008's reference keeps the bb-auth path,
  without the PR numbers #1288 removed.
- native fixture 27 dart/client.dart: regenerated with
  regenerate-all.sh; the drift is #1134's APILink plus this branch's
  positional params.
- bb-database README quick start: Auth from @aws-blocks/bb-auth
  instead of AuthBasic.

This branch was previously deployed

1 inactive deployment
e2e — 150911d7 Deployed Nov 4, 2026 by xyos via E2E Supabase #5351
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.

2 participants