Skip to content

Replace glob dependency with glob from fs/promises - #4601

Merged
josefs merged 1 commit into
mainfrom
josefs/replace-packages-with-node-22-built-ins
Oct 23, 2026
Merged

josefs merged 1 commit into
mainfrom
josefs/replace-packages-with-node-22-built-ins

Conversation

@josefs

@josefs josefs commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Replaces the glob package in extensions/ql-vscode (src/databases/local-databases/database-resolver.ts, src/databases/local-databases/db-contents-heuristics.ts, and src/databases/qlpack.ts) with glob from Node 22's built-in fs/promises, now that the minimum VS Code version has been bumped to 1.101.0 (Node 22) in #4619.

@josefs
josefs marked this pull request as ready for review October 15, 2026 10:44
@josefs
josefs requested a review from a team as a code owner October 15, 2026 10:44
@josefs
josefs requested review from kaspersv and a max review from Copilot October 15, 2026 10:44

Copilot AI 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.

🟡 Changes recommended

Native globbing breaks database and query workflows on supported Node 20 extension hosts.

1 open finding
What changed in this PR

Reduces dependencies in the CodeQL VS Code extension by using Node built-ins and existing libraries.

Changes:

  • Replace build utilities and filesystem globbing with Node APIs.
  • Replace identifier generation and graph click handling.
  • Reuse tmp-promise in tests and remove unused dependencies.
File Description
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​query-history/​store/​query-history-store.test.ts Use UUIDs in fixtures.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​local-queries/​webview.test.ts Import temporary-file helpers from tmp-promise.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​databases/​local-databases-ui.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​no-workspace/​code-tour/​code-tour.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​queries-panel/​query-pack-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​queries-panel/​query-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​qlpack-generator.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​local-queries/​local-databases.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​minimal-workspace/​common/​vscode/​file-path-discovery.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​jest.activated-extension.setup.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​query-server/​query-server-client.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​model-editor/​modeled-method-fs.test.ts Generate temporary paths with UUID prefixes.
extensions/​ql-vscode/​test/​vscode-tests/​cli-integration/​local-queries/​skeleton-query-wizard.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​local-queries/​query-contents.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​databases/​local-databases/​db-contents-heuristics.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​unit-tests/​common/​files.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​test/​jest-config.ts Remove transforms for removed dependencies.
extensions/​ql-vscode/​test/​common/​logging/​output-channel-logger.test.ts Reuse tmp-promise helpers.
extensions/​ql-vscode/​src/​view/​results/​Graph.tsx Use native click listeners.
extensions/​ql-vscode/​src/​variant-analysis/​run-remote-query.ts Use UUIDs for temporary paths.
extensions/​ql-vscode/​src/​stories/​variant-analysis/​VariantAnalysisAnalyzedRepos.stories.tsx Generate repository identifiers with Faker.
extensions/​ql-vscode/​src/​run-queries-shared.ts Use UUID-based query identifiers.
extensions/​ql-vscode/​src/​query-server/​query-runner.ts Use UUID-based run identifiers.
extensions/​ql-vscode/​src/​model-editor/​extensions-workspace-folder.ts Use UUIDs for pack-location probes.
extensions/​ql-vscode/​src/​databases/​qlpack.ts Use native globbing for database schemes.
extensions/​ql-vscode/​src/​databases/​local-databases/​db-contents-heuristics.ts Use native globbing for root detection.
extensions/​ql-vscode/​src/​databases/​local-databases/​database-resolver.ts Use native globbing for database discovery.
extensions/​ql-vscode/​src/​databases/​database-fetcher.ts Use UUIDs for filename collision fallback.
extensions/​ql-vscode/​src/​compare/​compare-view.ts Use UUID-based streaming identifiers.
extensions/​ql-vscode/​package.json Remove redundant dependencies.
extensions/​ql-vscode/​package-lock.json Prune the dependency graph.
extensions/​ql-vscode/​gulpfile.ts/​typescript.ts Use native styling and directory removal.
extensions/​ql-vscode/​gulpfile.ts/​textmate.ts Use Node’s object-mode transform stream.
extensions/​ql-vscode/​gulpfile.ts/​appInsights.ts Inject telemetry keys through filesystem APIs.
Files not reviewed (1)
  • extensions/ql-vscode/package-lock.json: Generated file

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kaspersv kaspersv 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.

Besides the pending issue with glob, this looks good to me. Would you mind creating a new PR with the other commits. Then we can get those merged while we clarify whether we can bump the minimum VS Code version we support.

@josefs

josefs commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@kaspersv #4607

Co-authored-by: Copilot App <[email protected]>
@josefs
josefs force-pushed the josefs/replace-packages-with-node-22-built-ins branch from d076698 to ef13e95 Compare October 22, 2026 19:13
@josefs josefs changed the title Replace redundant dependencies with Node 22 built-ins Replace glob dependency with glob from fs/promises Oct 22, 2026
@josefs
josefs requested a review from kaspersv October 23, 2026 09:27
@kaspersv
kaspersv requested a max review from Copilot October 23, 2026 09:39

Copilot AI 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.

🔵 Needs a closer look

Native glob behavior, including handling of symlinked database directories, needs verification on the minimum supported runtime.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • extensions/ql-vscode/package-lock.json: Generated file

Review effort: Max

@kaspersv

Copy link
Copy Markdown
Contributor

As far as I can tell there are behavioural differences between the external glob and package and the built-in one, including handling of dotfiles and negation patterns among others. Have you done any validation beyond running CI checks?

@josefs

josefs commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Looking at the places where we actually call glob, the differences in dotfiles, negation, directory matching and ordering, don't apply because of the patterns how we use it. The implementations also differ in how they match symlinks, and that could be relevant for the glob("db-*/"). But databases and extracted db archives don't use symlinks afaik.

@josefs
josefs merged commit 05e0d2c into main Oct 23, 2026
22 checks passed
@josefs
josefs deleted the josefs/replace-packages-with-node-22-built-ins branch October 23, 2026 11:21
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