Skip to content

fix(core)!: serve the runtime config at its original path again - #1655

Merged
VarshithaPamisetty merged 1 commit into
mainfrom
fix/cdk-blocks-sandbox-url-unchanged
Nov 19, 2026
Merged

VarshithaPamisetty merged 1 commit into
mainfrom
fix/cdk-blocks-sandbox-url-unchanged

Conversation

@VarshithaPamisetty

@VarshithaPamisetty VarshithaPamisetty commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#1644 renamed the per-deploy state directory to .cdk-blocks-sandbox/ and moved the public path its config.json is published at along with it. The directory name and the URL were one string behind one constant, so one edit did both. Neither has been released yet, so this lands before any customer sees the moved path.

That cost a customer's already-deployed frontend its API URL until they redeployed, and a browser or CloudFront cache could hold the stale request past the deploy. It was the rename's only real cost, and it turns out to be avoidable: a prototype confirmed that the URL can stay fixed while only the directory moves, on the dev server and in production, SPA and SSR.

Changes

  • The two are now separate names. BLOCKS_SANDBOX_DIR is the developer's private directory and stays .cdk-blocks-sandbox; BLOCKS_SANDBOX_SERVED_DIR is the published directory and goes back to .blocks-sandbox, with BLOCKS_SANDBOX_PREFIX built from it so the served path cannot be spelled twice and drift.
  • Every publishing site reads the served constant: the CloudFront behaviour, the S3 key the resolved config is uploaded to, the invalidation paths, the no-cache path registered for that key, and the liveness probe. Two of those were not in the original scope — the no-cache path and the S3 key prefix also derived from the disk constant.
  • One site is both, and follows the served name: the hosting construct writes a placeholder into the static-asset directory on disk and that path becomes the S3 key. So does the S3 exclude that keeps the placeholder from overwriting the real config, which is a functional miss the original scope did not name. @aws-blocks/hosting does not depend on @aws-blocks/core, so it keeps a literal there and the guard pins it instead.
  • Everything touching the developer's disk keeps the renamed directory: the pidfile, the dev server's own config write, the sandbox id, and the copy-forward.
  • The committed Next.js route directory goes back to the published name, since the directory name under src/app IS the URL, while the literal inside the file still reads the renamed disk directory. The hosting-ssr twin follows.
  • The gitignore negation had to move below both state-directory ignores. Git takes the last matching pattern, so the negation where it already sat was overridden by .blocks-sandbox/ and the template's route directory stopped being committable — silently, because the tracked files keep working while a newly scaffolded app would have had no route at all. Verified with untracked probes in five positions; the ordering is now asserted.
  • A guard carries the invariant that the published path and the disk path are never derived from the same constant, pinned per site. It was written and watched failing on every one of its cases before the change.
  • The refactor!: rename .blocks-sandbox to .cdk-blocks-sandbox, served path included #1644 rename guard is rescoped. Its text scan assumed the old name should vanish; now that both names are legitimately live it cannot tell a missed disk rename from a deliberate published path, so it checks shipped source, where the rule is exact. This drops its scan over test files rather than keeping a regex alive with per-line allowances — a real reduction, and the decoupling guard is what replaces it.
  • Renumbered from D-030 to D-031, which feat(core, blocks, hosting, create-blocks-app, admin-ui, bb-database)!: rename the hidden .blocks folder to .cdk-blocks and consolidate local data under it #1607 holds. The record's reversed clauses are amended with the original text preserved, and D-022's "separate, breaking change" note is corrected, since the rename no longer is one.
  • No new changeset. refactor!: rename .blocks-sandbox to .cdk-blocks-sandbox, served path included #1644's changeset is pending and unreleased, and it covers every package this PR touches at minor, the pre-1.0 breaking tier. Rather than add a second entry narrating a moved URL that no release ever shipped, this PR corrects that entry: it no longer announces a breaking change or a required redeploy, and it carries the route-directory detail. The published changelog then tells one story — the directory moved, the URL did not.

Testing

  • Measured on base 5d32092c0: npm run build clean with 0 TypeScript errors; npm test 13173 tests, 13165 pass, 1 fail, 7 skipped; npm run lint 0 errors; lint:deps clean; check:api up to date with no drift; the five sink-guard files pass individually.
  • The one failure is pre-existing and unrelated. Measured on the stashed base: create-blocks-app 419 tests, 418 pass, 1 fail, the same assertion with the same expected and actual values, failing because a nested install inside a temporary fixture cannot complete in this environment.
  • The new guard failed 3/3 on unchanged main, naming all six conflated sites, before any of them was changed.
  • Gitignore ordering verified empirically rather than by reading: untracked probes in the template route, a second template's route, the SSR test app's route, and both state directories — route committable, state ignored, five for five.
  • Not run: a deployed sandbox. The published path is exercised locally by the dev server's mirror of it and by the CloudFront behaviour and BucketDeployment assertions at synth, and no part of this change crosses into an AWS API call. The prototype this follows was confirmed in production by its author.
  • Disclosed rather than hidden: the first bulk pass over the tests over-reached into disk contexts in eight places, where a fixture would have written one directory and read another. Caught with a filesystem-call audit and reverted; the audit is in the history.

Checklist

@VarshithaPamisetty VarshithaPamisetty self-assigned this Nov 19, 2026
@VarshithaPamisetty
VarshithaPamisetty force-pushed the fix/cdk-blocks-sandbox-url-unchanged branch from e87892f to 79cd901 Compare November 19, 2026 01:26
Comment thread test-apps/hosting-ssr/test/e2e.test.ts Resolved
The previous change renamed the per-deploy state directory to
`.cdk-blocks-sandbox/` and moved the public path its `config.json` is published
at along with it, because the directory name and the URL were one string and one
constant. That cost a customer's already-deployed frontend its API URL until they
redeployed, and a browser or CloudFront cache could hold the stale request past
the deploy.

An on-disk layout study prototyped keeping the URL fixed while moving only the
directory, confirmed on the dev server and in production, SPA and SSR. Since the
breakage was the rename's only real cost and it is avoidable, it is avoided.

The two are now separate names. `BLOCKS_SANDBOX_DIR` is the developer's private
directory and stays `.cdk-blocks-sandbox`. `BLOCKS_SANDBOX_SERVED_DIR` is the
published directory and goes back to `.blocks-sandbox`, with
`BLOCKS_SANDBOX_PREFIX` built from it so the served path cannot be spelled twice
and drift.

Every publishing site reads the served constant: the CloudFront behaviour, the S3
key the resolved config is uploaded to, the invalidation paths, the no-cache path
registered for that key, and the liveness probe. One site is both — the hosting
construct writes a placeholder into the static-asset directory on disk and that
path becomes the S3 key — and it follows the served name, as does the S3 exclude
that keeps the placeholder from overwriting the real config. Everything touching
the developer's disk keeps the renamed directory: the pidfile, the dev server's
own config write, the sandbox id, and the copy-forward.

The committed Next.js route directory goes back to the published name too, since
the directory name under `src/app` IS the URL, while the literal inside the file
still reads the renamed disk directory. The root gitignore's negation follows it,
and had to move BELOW both state-directory ignores: git takes the last matching
pattern, so the negation as placed was overridden and the template's route stopped
being committable — silently, because the tracked files kept working while a
newly scaffolded app would have had no route at all.

A guard carries the invariant that the published path and the disk path are never
derived from the same constant, pinned per site and watched failing on every case
before the change. The earlier rename guard is rescoped: its text scan could not
tell a missed disk rename from a deliberate published path once both names are
live, so it now checks shipped source, where the rule is exact.

Renumbered from D-030 to D-031, which #1607 holds.

Whether this URL needs to exist at all is left open: the browser reads only
`apiUrl` from it, the fetch is the last step of a fallback chain after
`BLOCKS_API_URL`, and the build already bakes that variable into the frontend, so
removing the fetch looks possible but is not decided.

This branch was previously deployed

2 inactive deployments
agent-bench — 4cb972d4 Deployed Nov 19, 2026 by VarshithaPamisetty via bench / summary #6449
e2e — 4cb972d4 Deployed Nov 19, 2026 by VarshithaPamisetty via E2E Teardown Verify #7401
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