Skip to content

fix(ci): keep E2E stack names within S3's bucket-name limit at 4-digit PR numbers - #1017

Closed
belaboe wants to merge 4 commits into
mainfrom
fix/e2e-prod-stack-prefix-length
Closed

belaboe wants to merge 4 commits into
mainfrom
fix/e2e-prod-stack-prefix-length

Conversation

@belaboe

@belaboe belaboe commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Problem

E2E Production fails at synth on every PR numbered 1000 or above, before any test runs. For example, on #1016:

ValidationFailed: Derived bucket name "bb-test-prod-pr-1016-1-runner-qb3cmv-test-app-preset-balanced-sn" is 64 characters, exceeding S3's 63-character limit

The stack name is the prefix of every derived resource name, and the CI suffix pr-<number>-<attempt> carries the PR number. In the comprehensive app's production mode the stack name is bb-test-prod-<suffix>-<user>-<random>, and <user> is always runner in CI. The longest bucket name (the preset-balanced agent's session bucket) was exactly 63 characters at three-digit PR numbers.

E2E Compute Smoke has the same defect. It just hasn't reached synth on a four-digit PR yet. Its stack bb-compute-smoke-<id>-compute-<n>-<attempt> makes ...-compute-smoke-artifacts 64 characters at PR 1016.

Fix (CI and test app only, no published package changes)

  • test-apps/comprehensive/aws-blocks/index.cdk.ts: the production stack name keeps only the random half of the sandbox id, giving bb-test-prod-pr-1016-1-qb3cmv. That brings the longest bucket from 64 down to 57 characters.
  • pr-checks.yml, E2E Compute Smoke: the suffix is pr-<n>-<attempt> instead of compute-<n>-<attempt>, because the stack name already starts with bb-compute-smoke-. That brings the bucket from 64 down to 59 characters.
  • New guard scripts/ci/stack-name-budget.test.mjs, run in Build, Unit Tests, E2E Local:
    • For each pr-checks.yml job that sets BLOCKS_STACK_SUFFIX, it renders that job's real suffix for PR 99999, attempt 99, then synthesizes the job's app offline and fails on any S3 bucket, S3 Vectors or RDS database name over 63 characters.
    • A job that sets a suffix but is neither checked nor listed in SKIP with a reason fails the test.

Names stay unique per PR, per attempt and per push, because the per-checkout random salt is kept. The stack-name prefixes (bb-test-, bb-compute-smoke-) are unchanged, so the cleanup workflow and the CI role's prefix-scoped grants match the same stacks as before.

Verification

  • Red first: the new test fails on main for production and compute-smoke, at both PR 1016 and PR 99999, with the exact CI message. It passes after the fix, including with --network none.
  • CLI check: cdk synth in production mode with pr-1016-1 passes after the fix and failed before.
  • Local runs (node:22 container): npm run build, lint:deps, npm test, test:e2e:local and lint are green, and so are actionlint and check-actions-pinned.
  • CI: this PR changes test-apps/, so every E2E job runs, E2E Production and E2E Compute Smoke included.

Notes

  • A developer's local test:production stack name changes from bb-test-prod-default-<user>-<random> to bb-test-prod-default-<random>. A stack deployed under the old name before this change won't be found by npm run destroy. The scheduled cleanup still sweeps bb-test-*.
  • Out of scope, and predates this PR:
    • bb-compute-smoke- is in neither the cleanup workflow's prefix lists nor the CI role's prefix list.
    • native-sdk-e2e.yml is not covered by the new guard. Its native-bindings bucket is 59 of 63 characters at a five-digit PR.
  • No changeset: only .github/, scripts/ci/ and the private comprehensive test app change.

Fails on main: the comprehensive production stack and the compute smoke
stack push a FileBucket name past S3's 63-character limit once PR numbers
reach four digits.
…it PRs

The stack name prefixes every derived resource name and the CI suffix
carries the PR number. From PR 1000 the comprehensive app's production
stack (bb-test-prod-pr-<n>-<attempt>-runner-<salt>) made the preset-balanced
agent's session bucket 64 characters, and the compute smoke stack
(bb-compute-smoke-<id>-compute-<n>-<attempt>) did the same to its
artifacts bucket, so both failed at synth before any test ran.

- comprehensive production stack: keep only the random half of the
  sandbox id; the user half is always 'runner' in CI.
- compute smoke job: suffix pr-<n>-<attempt> instead of compute-<n>-...;
  the stack name already says compute-smoke.
- run scripts/ci/stack-name-budget.test.mjs in Build, Unit Tests, E2E Local.

Stack-name prefixes are unchanged (bb-test-, bb-compute-smoke-), so what
the cleanup workflow and the CI role's prefix-scoped grants match is
unchanged too. (bb-compute-smoke- is in neither list today; that predates
this change.)
…udget test

Fail when a pr-checks.yml job sets a stack suffix but is neither checked
nor skipped with a reason; check RDS database names too; parse the suffix
once per job (quotes and trailing comments stripped); bound each synth to
3 minutes.
Run tsx as an in-process loader so the spawn timeout stops the synth
rather than only npx, and say why a synth died (timeout, signal) in the
failure message.
@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 01e92e4

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

# Synthesizes each E2E app with its job's stack suffix at a 5-digit PR
# number, so a name that outgrows its AWS limit fails here, not at deploy.
- name: Test the E2E stack-name budget
run: node --test scripts/ci/stack-name-budget.test.mjs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an overkill? compute -> pr gives us plenty room, same as other changes bellow

@belaboe

belaboe commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #1031, which merged the same fix (production stack name keeps only the random half of the sandbox id; Compute Smoke suffix is pr--). The stack-name budget guard from this PR is not carried over.

@belaboe belaboe closed this Oct 26, 2026

This branch was previously deployed

1 inactive deployment
e2e — 01e92e44 Deployed Oct 23, 2026 by belaboe via E2E Compute Smoke #4003
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