fix(common): avoid tracking directories during file reads by mayankdhingra02 · Pull Request #1691 · dsherret/ts-morph · GitHub
Skip to content

fix(common): avoid tracking directories during file reads - #1691

Open
mayankdhingra02 wants to merge 1 commit into
dsherret:latestfrom
mayankdhingra02:fix-repeated-path-probes
Open

mayankdhingra02 wants to merge 1 commit into
dsherret:latestfrom
mayankdhingra02:fix-repeated-path-probes

Conversation

@mayankdhingra02

Copy link
Copy Markdown

Reading a missing source file records its parent directories in the transactional file system. A later recursive addDirectoryAtPathIfExists treats those directories as present and throws while enumerating them.

Validate reads against the nearest tracked ancestor without creating directory records. This preserves the checks for deleted or moved ancestors and lets repeated *IfExists calls return undefined until the directory is created.

Regression tests cover the reported Project calls, synchronous and asynchronous missing reads, and an untracked descendant of a directory queued for deletion.

Fixes #1554.

Validation: deno task build, deno task --recursive test:ci (5,397 passing), deno task --recursive ensure-no-project-compile-errors, deno task --recursive code-verification, and deno run -A npm:dprint check.

The Deno CI path also passed: deno task build:deno, deno test --allow-read (2 passing), and deno publish --dry-run.

Check tracked ancestors without creating directory records when validating a
file read. Missing source-file probes no longer make recursive directory
probes treat missing paths as present, and reads preserve queued deletions.

Fixes dsherret#1554.

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
@mayankdhingra02

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
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.

Calling addSourceFileAtPathIfExists has a side effect of internally remembering directories that don't exist which causes subsequent operations to fail

1 participant