Skip to content

fix(@angular/build): ensure parent directory exists in SQLite cache store - #34016

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix/sqlite-cache-parent-dir
Sep 3, 2026
Merged

fix(@angular/build): ensure parent directory exists in SQLite cache store#34016
clydin merged 1 commit into
angular:mainfrom
clydin:fix/sqlite-cache-parent-dir

Conversation

@clydin

@clydin clydin commented Sep 3, 2026

Copy link
Copy Markdown
Member

Previously, initializing DatabaseSync directly with a path in a nonexistent directory failed with an unable to open database file error. Unlike other storage backends, node:sqlite does not recursively create parent directory structures.

Parent directories for the cache database are now created recursively before opening the database file, preventing initialization errors when the cache directory does not yet exist.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the SQLite cache store by trying to open the database file first, only creating parent directories if that fails. A test was added to verify this behavior. The reviewer suggested checking for the ':memory:' path upfront to avoid an unnecessary try-catch block and prevent masking other errors.

Comment thread packages/angular/build/src/tools/esbuild/sqlite-cache-store.ts Outdated
@clydin
clydin force-pushed the fix/sqlite-cache-parent-dir branch from 0dfec97 to c7f52fc Compare September 3, 2026 14:17
@clydin clydin added target: patch This PR is targeted for the next patch release target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Sep 3, 2026
…tore

Previously, initializing DatabaseSync directly with a path in a nonexistent directory failed with an unable to open database file error. Unlike other storage backends, node:sqlite does not recursively create parent directory structures.

Parent directories for the cache database are now created recursively before opening the database file, preventing initialization errors when the cache directory does not yet exist.
@clydin
clydin force-pushed the fix/sqlite-cache-parent-dir branch from c7f52fc to 75fbe7f Compare September 3, 2026 14:47
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 3, 2026
@clydin
clydin requested a review from alan-agius4 September 3, 2026 15:19
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 3, 2026
@clydin
clydin merged commit 54d712f into angular:main Sep 3, 2026
41 checks passed
@clydin

clydin commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the fix/sqlite-cache-parent-dir branch September 3, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants