Fix yarn.lock v1 parser for compound package alias headers#259640
Fix yarn.lock v1 parser for compound package alias headers#259640tylersmalley merged 3 commits intoelastic:mainfrom
Conversation
Yarn merges multiple descriptors into one block when they resolve to the same tarball (e.g. d3-color@1 - 2 alongside @elastic/kibana-d3-color@...). The parser previously derived the package name only from the first header entry and applied substring() to every entry, so alias names were never indexed. Transitive dependency extraction then failed with Unable to resolve d3-color@1 - 2. Parse each comma-separated descriptor with correct scoped/unscoped split, register PackageInfo per alias, and merge requestedVersions when the same resolved package appears twice. When using focus mode, include a block if any alias matches. Adds a regression test for compound headers. Refreshes yarn.lock merged descriptor entries and regenerates ui-shared-deps-npm version_dependencies.txt. Made-with: Cursor
|
Merging ahead and E2E tests completing to unblock folks |
|
Starting backport for target branches: 8.19, 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/23560208448 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💔 Build Failed
Failed CI StepsMetrics [docs]
|
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
@tylersmalley could you handle backporting this along with any other fixes? Looks like the original PR #258940 has issues backporting. At this point I'm going to ignore this PR. 😄 |
|
@nickofthyme, yeah - I am working on clearing out some things blocking the backports. I will own getting this in. |
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit c82b6d4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit c82b6d4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `9.2`: - [Fix Moon webpack dependency cache invalidation (#258940)](#258940) - [Fix yarn.lock v1 parser for compound package alias headers (#259640)](#259640) - [[CI] Fix moon cache usage (#259760)](#259760) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tyler Smalley","email":"tyler.smalley@elastic.co"},"sourceCommit":{"committedDate":"2026-03-24T23:56:42Z","message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.4.0"],"title":"Fix Moon webpack dependency cache invalidation","number":258940,"url":"https://github.com/elastic/kibana/pull/258940","mergeCommit":{"message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258940","number":258940,"mergeCommit":{"message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09"}}]}] BACKPORT--> --------- Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co> Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co> Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
…9640) (#260090) # Backport This will backport the following commits from `main` to `9.3`: - [Fix yarn.lock v1 parser for compound package alias headers (#259640)](#259640) - [[CI] Fix moon cache usage (#259760)](#259760) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"nicholas.partridge@elastic.co"},"sourceCommit":{"committedDate":"2026-03-25T19:33:17Z","message":"Fix yarn.lock v1 parser for compound package alias headers (#259640)\n\n## Summary\n\nFixes `extract-version-dependencies` failing with `Unable to resolve\nd3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges\nmultiple lockfile descriptors (aliases) into a single block.\n\n## Changes\n\n- **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor\nwith correct scoped vs unscoped `@` splitting; register `PackageInfo`\nper alias; merge `requestedVersions` for duplicate\n`name@resolvedVersion` keys. In `focus` mode, include a block if any\nalias matches.\n- **`yarn_lock_v1.test.ts`**: Regression test for compound headers.\n- **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` /\n`@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`).\n- **`version_dependencies.txt`**: Regenerated via\n`extract-version-dependencies`.\n\n## Testing\n\n- `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts`\n- `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies`\n- `node scripts/check_changes.ts`\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"c82b6d42eb7fecc5116eaab557ad8a4cf8869076","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:all-open","v9.4.0"],"title":"Fix yarn.lock v1 parser for compound package alias headers","number":259640,"url":"https://github.com/elastic/kibana/pull/259640","mergeCommit":{"message":"Fix yarn.lock v1 parser for compound package alias headers (#259640)\n\n## Summary\n\nFixes `extract-version-dependencies` failing with `Unable to resolve\nd3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges\nmultiple lockfile descriptors (aliases) into a single block.\n\n## Changes\n\n- **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor\nwith correct scoped vs unscoped `@` splitting; register `PackageInfo`\nper alias; merge `requestedVersions` for duplicate\n`name@resolvedVersion` keys. In `focus` mode, include a block if any\nalias matches.\n- **`yarn_lock_v1.test.ts`**: Regression test for compound headers.\n- **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` /\n`@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`).\n- **`version_dependencies.txt`**: Regenerated via\n`extract-version-dependencies`.\n\n## Testing\n\n- `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts`\n- `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies`\n- `node scripts/check_changes.ts`\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"c82b6d42eb7fecc5116eaab557ad8a4cf8869076"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/259640","number":259640,"mergeCommit":{"message":"Fix yarn.lock v1 parser for compound package alias headers (#259640)\n\n## Summary\n\nFixes `extract-version-dependencies` failing with `Unable to resolve\nd3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges\nmultiple lockfile descriptors (aliases) into a single block.\n\n## Changes\n\n- **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor\nwith correct scoped vs unscoped `@` splitting; register `PackageInfo`\nper alias; merge `requestedVersions` for duplicate\n`name@resolvedVersion` keys. In `focus` mode, include a block if any\nalias matches.\n- **`yarn_lock_v1.test.ts`**: Regression test for compound headers.\n- **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` /\n`@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`).\n- **`version_dependencies.txt`**: Regenerated via\n`extract-version-dependencies`.\n\n## Testing\n\n- `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts`\n- `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies`\n- `node scripts/check_changes.ts`\n\nMade with [Cursor](https://cursor.com)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"c82b6d42eb7fecc5116eaab557ad8a4cf8869076"}},{"url":"https://github.com/elastic/kibana/pull/259476","number":259476,"branch":"9.2","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/259475","number":259475,"branch":"8.19","state":"OPEN"}]}] BACKPORT--> --------- Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
) # Backport This will backport the following commits from `main` to `8.19`: - [Fix Moon webpack dependency cache invalidation (#258940)](#258940) - [Fix yarn.lock v1 parser for compound package alias headers (#259640)](#259640) - [[CI] Fix moon cache usage (#259760)](#259760) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tyler Smalley","email":"tyler.smalley@elastic.co"},"sourceCommit":{"committedDate":"2026-03-24T23:56:42Z","message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.4.0"],"title":"Fix Moon webpack dependency cache invalidation","number":258940,"url":"https://github.com/elastic/kibana/pull/258940","mergeCommit":{"message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258940","number":258940,"mergeCommit":{"message":"Fix Moon webpack dependency cache invalidation (#258940)\n\nMoon cached webpack-built shared dependency bundles using only local source files and webpack config as inputs. When a dependency like `@elastic/eui` changed after bootstrap, Moon did not see any relevant\ninput change for `@kbn/ui-shared-deps-npm`, so it could restore a stale cached bundle. That left the installed dependency tree newer than the built artifact, which is why code present under\n`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.\n\nThis change makes Moon invalidate those webpack bundle caches when, and only when, the actual resolved dependency graph for the bundle changes. Instead of keying off the entire workspace yarn.lock, it adds an exact\ntransitive dependency fingerprint for each affected webpack-built package. That gives correct rebuilds for updated dependencies, including transitive ones, without broadly uncaching on unrelated lockfile churn.\n\n---------\n\nSigned-off-by: Tyler Smalley <tyler.smalley@elastic.co>","sha":"41b1f045b52a2e3ab40fdf7d71cfb0f7b36eed09"}}]}] BACKPORT--> --------- Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co> Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co> Co-authored-by: Nick Partridge <nicholas.partridge@elastic.co> Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…59640) ## Summary Fixes `extract-version-dependencies` failing with `Unable to resolve d3-color@1 - 2 from yarn.lock dependency graph` when Yarn merges multiple lockfile descriptors (aliases) into a single block. ## Changes - **`yarn_lock_v1.ts`**: Parse each comma-separated header descriptor with correct scoped vs unscoped `@` splitting; register `PackageInfo` per alias; merge `requestedVersions` for duplicate `name@resolvedVersion` keys. In `focus` mode, include a block if any alias matches. - **`yarn_lock_v1.test.ts`**: Regression test for compound headers. - **`yarn.lock`**: Refreshed merged descriptor lines (e.g. `d3-color` / `@elastic/kibana-d3-color`, `ajv` / `@redocly/ajv`). - **`version_dependencies.txt`**: Regenerated via `extract-version-dependencies`. ## Testing - `node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts` - `moon run @kbn/ui-shared-deps-npm:extract-version-dependencies` - `node scripts/check_changes.ts` Made with [Cursor](https://cursor.com) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fixes
extract-version-dependenciesfailing withUnable to resolve d3-color@1 - 2 from yarn.lock dependency graphwhen Yarn merges multiple lockfile descriptors (aliases) into a single block.Changes
yarn_lock_v1.ts: Parse each comma-separated header descriptor with correct scoped vs unscoped@splitting; registerPackageInfoper alias; mergerequestedVersionsfor duplicatename@resolvedVersionkeys. Infocusmode, include a block if any alias matches.yarn_lock_v1.test.ts: Regression test for compound headers.yarn.lock: Refreshed merged descriptor lines (e.g.d3-color/@elastic/kibana-d3-color,ajv/@redocly/ajv).version_dependencies.txt: Regenerated viaextract-version-dependencies.Cause
yarn.lockcan merge several descriptors into one block when they resolve to the same package, for example:d3-interpolate@1.2.0 - 2depends ond3-color "1 - 2", soextract_version_dependencieslooks upd3-color@1 - 2in the index.The parser in
yarn_lock_v1.tsonly took the first header entry’s name (@elastic/kibana-d3-color) and then didentry.substring(name.length + 1)on every header entry. Ford3-color@1 - 2that substring is invalid, sod3-color@1 - 2was never indexed → “Unable to resolve d3-color@1 - 2”.Fix
In
src/dev/yarn/yarn_lock_v1.ts:splitYarnLockDescriptor– split each header descriptor into[packageName, requestedRange](scoped packages: split on the@after the scope).version/resolved/ deps once, then for each header entry register/update aPackageInfofor that alias name and mergerequestedVersionswhen the samename@resolvedVersionappears again.focusmode – treat a block as included if any alias in the header matches the focus set (not only the first descriptor).A regression test was added in
yarn_lock_v1.test.tsfor compound headers.Verification:
node_modules/.bin/moon run @kbn/ui-shared-deps-npm:extract-version-dependenciescompletes successfully,node scripts/jest src/dev/yarn/yarn_lock_v1.test.tspasses, andnode scripts/check_changes.tspasses.Testing
node scripts/jest src/dev/yarn/yarn_lock_v1.test.tsmoon run @kbn/ui-shared-deps-npm:extract-version-dependenciesnode scripts/check_changes.tsMade with Cursor