Skip to content

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

Merged
VarshithaPamisetty merged 1 commit into
mainfrom
fix/cdk-blocks-dot-folder
Nov 19, 2026

Conversation

@VarshithaPamisetty

@VarshithaPamisetty VarshithaPamisetty commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Legal will not allow "blocks" on its own, so .blocks becomes .cdk-blocks. That folder holds the committed stackId, the telemetry projectId and opt-out, the installation id, the deploy history and Hosting's generated value types, reached by separate join(...) calls across five packages, three CI steps and the scaffolded templates' tsconfig includes. Nothing links them, so a partial rename still builds, lints and passes its unit tests, then fails at a path that does not exist — or silently reads a different file.

Local Building Block data moves in the same change because it is the other hidden per-project directory. It cannot simply be renamed: .bb-data/ holds the customer's local state, including every AppSetting and Secret value and the local PostgreSQL database.

Issue #, if available: none. Last of the rename series to land: #1602 (CDK_BLOCKS_* environment variables), #1644, #1606 (CDK telemetry opt-out), #1630 (the visible aws-blocks/ → cdk-blocks/ directory) and #1655 have all merged. This one renames the hidden folder only.

Changes

  • The folder is .cdk-blocks in 1014 references on 962 added lines across 370 files, plus the 16 committed test-app config directories moved with git mv as 17 pure renames, so the pinned e2e projectIds survive. An existing app renames its own folder, with one deliberate exception: getStackId still reads a pre-rename .blocks/config.json, because secret-naming.ts answers an unresolved id with the unscoped /blocks/secrets and /blocks/config namespaces instead of failing, so without that fallback npm run secret and npm run config would silently touch another app's namespace. When neither file exists, deploy and destroy still refuse and name the path to create rather than guessing a stackId and creating a second production stack.
  • Mock data is .cdk-blocks/local/data/{fullId}/, recorded as D-032, which supersedes D-001's rejection of that nesting. An existing project keeps its data: the first use of each block's store, and of the shared settings.json, copies that unit across and never overwrites the new location, and .bb-data/ is left in place so an older CLI in the same checkout still reads it. The carry-over is recorded per unit in .cdk-blocks/local/.carried-over and runs once for each, so data deleted after the upgrade stays deleted; the record is written only after a unit's copy finishes, so an interrupted copy is retried.
  • The local database moves with the block's other files, since it now goes through getMockDataDir. A copy that did not finish is refused, naming both paths, where an incomplete data directory would otherwise be replaced with an empty one — an empty database is indistinguishable from a fresh project, so the next write would start a second copy of the customer's rows. npm run db -- status and -- types also read the old directory, being read-only.
  • Three CI gates. check:dot-folder (22 unit tests) fails when any tracked file still names the old folder, in its content or in its path. check:data-ignored asserts the data stays ignored in a scaffolded app fixture, since this monorepo ignores .cdk-blocks/ wholesale and a root rule would answer first and make the check vacuous — local/ hides itself, because getMockDataDir writes a nested .gitignore containing * on first use, so one self-ignoring folder replaces three breakable root rules while the committed config.json stays tracked. check:rename-traps asserts the four mistakes this rename made repeatedly: a multi-segment path compared against single path segments, a LEGACY* constant holding the new name, a comment reflow merging two commands onto one line, and a doc naming a Dart generated-client import that disagrees with builder.dart.
  • Kept on the old name: .blocks-sandbox/ (Hosting serves it as a public URL path; renamed separately in fix(core)!: serve the runtime config at its original path again #1655), the native clients' own ~/.blocks/<applicationId> session storage — Dart's as well as Kotlin's, both on the guard allowlist, since that is a per-user directory rather than the CLI's project folder and renaming it would sign every app out for a rename it is not part of — the published changelogs, .gitignore's legacy .bb-data/ rules, the migrate wrapper snapshots keyed by SHA-256, and the Dart codegen output extension .blocks.dart, which names a generated file, not the folder.

Validation

Build, npm test, test:e2e:local, lint, lint:deps, every check:* and the four changeset guards pass locally. npm test is 13105 pass with 1 failure, create-blocks-app subtest 36, which fails identically on the unchanged base; test:e2e:local is 555 pass, 0 fail.

Two new suites check real contents rather than that a path exists, which would pass against an empty store: core/src/common/mock-data.test.ts for the JSON carry-over, including the shared root file after a per-block call ran first, and bb-database/src/local-data-carry-over.test.ts against a real PGlite, for rows identical after the move and a half-copied directory refused.

Not run: the sandbox, production, native and telemetry e2e legs, which need AWS credentials.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

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

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 263c25c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@aws-blocks/bb-auth Minor
@aws-blocks/auth-common Patch
@aws-blocks/blocks Minor
@aws-blocks/core Minor
@aws-blocks/bb-database Minor
@aws-blocks/create-blocks-app Minor
@aws-blocks/bb-app-setting Patch
@aws-blocks/bb-file-bucket Patch
@aws-blocks/admin-ui Minor
@aws-blocks/hosting Minor
@aws-blocks/bb-async-job Patch
@aws-blocks/bb-dashboard Patch
@aws-blocks/bb-email-client Patch
@aws-blocks/bb-knowledge-base Patch
@aws-blocks/bb-kv-store Minor
@aws-blocks/bb-logger Patch
@aws-blocks/bb-metrics Patch
@aws-blocks/bb-realtime Patch
@aws-blocks/bb-secret Patch
@aws-blocks/bb-tracer Patch
@aws-blocks/create-block Patch
@aws-blocks/bb-cron-job Patch
@aws-blocks/bb-agent Patch
@aws-blocks/bb-lambda-compute Patch
@aws-blocks/bb-container-compute Patch
@aws-blocks/bb-compute Patch
@aws-blocks/pipeline Patch

Not sure what this means? Click here to learn what changesets are.

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

Comment thread packages/core/src/scripts/stack-id.ts Resolved
Comment thread packages/core/src/common/mock-data.ts Resolved
Comment thread packages/core/src/telemetry/consent.ts Resolved
Comment thread scripts/dot-folder-guard.ts Resolved
Comment thread scripts/dot-folder-guard.test.mjs Resolved
Comment thread packages/hosting/src/typegen-cli-bin.ts Resolved
Comment thread packages/core/src/telemetry/consent.ts Resolved
Comment thread packages/core/src/scripts/stack-id.ts Resolved
Comment thread scripts/dot-folder-guard.ts Resolved
Comment thread scripts/dot-folder-guard.ts Resolved
Comment thread .changeset/cdk-blocks-dot-folder.md Resolved
Comment thread packages/core/src/common/constants.ts Resolved
Comment thread packages/core/src/scripts/stack-id.ts Resolved
Comment thread scripts/dot-folder-guard.ts Resolved

@soberm soberm left a comment

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.

Comments on lines outside the diff

native/dart/packages/blocks_runtime/CHANGELOG.md:333-334

[minor] This entry is in ## Unreleased, not published history, so it should name the path this PR ships: ~/.cdk-blocks/<applicationId>/dart/. The guard misses it because CHANGELOG.md is allowlisted by basename as "published release history".

Comment thread packages/core/src/scripts/stack-id.ts Resolved
Comment thread packages/core/src/common/constants.ts Resolved
Comment thread packages/core/src/scripts/stack-id.ts Resolved
Comment thread packages/core/src/cdk/stack-metadata.ts Resolved
Comment thread docs/DECISIONS.md Resolved
Comment thread docs/DECISIONS.md Resolved
Comment thread .gitignore Resolved
Comment thread .github/workflows/pr-checks.yml Resolved

@soberm soberm left a comment

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.

Requesting changes for the open items in the threads above, chiefly the stackId fallback in stack-id.ts.

Comment thread packages/core/src/common/mock-data.ts Resolved
Comment thread packages/core/src/common/mock-data.ts Resolved
…olidate local data

The hidden project folder is renamed from `.blocks/` to `.cdk-blocks/`, and the
local Building Block data moves from `.bb-data/` into `.cdk-blocks/local/data/`,
so an app keeps one hidden folder instead of two.

`local/` hides itself: `getMockDataDir` writes a nested `.gitignore` containing
`*` on first use, so runtime data cannot be staged while the committed
`.cdk-blocks/config.json` stays tracked.

Data is carried over per unit, copied rather than moved, and the renamed
location wins when both exist. A pre-rename `.blocks/config.json` is still read
for `stackId`, because `secret-naming.ts` answers an unresolved id with the
unscoped `/blocks/secrets` namespace rather than failing.

Adds `check:rename-traps`, which asserts the four mistakes this rename made
repeatedly: a multi-segment path compared against single path segments, a
`LEGACY*` constant holding the new name, a comment reflow merging two commands
onto one line, and a doc naming a Dart generated-client import that disagrees
with `builder.dart`.

Decision: D-032. Layout per Bunsho UcDOcEZOfEpsD; see also #1139.

This branch had an error being deployed

1 failed and 1 inactive deployments
e2e — 3c397ed8 Deployed Nov 19, 2026 by VarshithaPamisetty via E2E Teardown Verify #7495
agent-bench — 3c397ed8 Deployed Nov 19, 2026 by VarshithaPamisetty via bench / summary #6533
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.

3 participants