Skip to content

Fix yarn.lock v1 parser for compound package alias headers#259640

Merged
tylersmalley merged 3 commits intoelastic:mainfrom
nickofthyme:fix/yarn-lock-v1-compound-header-aliases
Mar 25, 2026
Merged

Fix yarn.lock v1 parser for compound package alias headers#259640
tylersmalley merged 3 commits intoelastic:mainfrom
nickofthyme:fix/yarn-lock-v1-compound-header-aliases

Conversation

@nickofthyme
Copy link
Copy Markdown
Contributor

@nickofthyme nickofthyme commented Mar 25, 2026

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.

Cause

yarn.lock can merge several descriptors into one block when they resolve to the same package, for example:

"@elastic/kibana-d3-color@npm:@elastic/kibana-d3-color@2.0.1", "d3-color@1 - 2", "d3-color@npm:@elastic/kibana-d3-color@2.0.1":
  version "2.0.1"
  resolved "https://registry.yarnpkg.com/@elastic/kibana-d3-color/-/kibana-d3-color-2.0.1.tgz#..."

d3-interpolate@1.2.0 - 2 depends on d3-color "1 - 2", so extract_version_dependencies looks up d3-color@1 - 2 in the index.

The parser in yarn_lock_v1.ts only took the first header entry’s name (@elastic/kibana-d3-color) and then did entry.substring(name.length + 1) on every header entry. For d3-color@1 - 2 that substring is invalid, so d3-color@1 - 2 was never indexed → “Unable to resolve d3-color@1 - 2”.

Fix

In src/dev/yarn/yarn_lock_v1.ts:

  1. splitYarnLockDescriptor – split each header descriptor into [packageName, requestedRange] (scoped packages: split on the @ after the scope).
  2. Per block – parse version / resolved / deps once, then for each header entry register/update a PackageInfo for that alias name and merge requestedVersions when the same name@resolvedVersion appears again.
  3. focus mode – 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.ts for compound headers.

Verification: node_modules/.bin/moon run @kbn/ui-shared-deps-npm:extract-version-dependencies completes successfully, node scripts/jest src/dev/yarn/yarn_lock_v1.test.ts passes, and node scripts/check_changes.ts passes.

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

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
@nickofthyme nickofthyme requested a review from a team as a code owner March 25, 2026 18:30
@tylersmalley tylersmalley added release_note:skip Skip the PR/issue when compiling release notes backport:all-open Backport to all branches that could still receive a release labels Mar 25, 2026
@tylersmalley
Copy link
Copy Markdown
Member

Merging ahead and E2E tests completing to unblock folks

@tylersmalley tylersmalley merged commit c82b6d4 into elastic:main Mar 25, 2026
19 of 20 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/23560208448

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- Fix Moon webpack dependency cache invalidation (#258940)
9.2 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.2:
- Fix Moon webpack dependency cache invalidation (#258940)
9.3 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.3:
- Fix Moon webpack dependency cache invalidation (#258940)

Manual backport

To create the backport manually run:

node scripts/backport --pr 259640

Questions ?

Please refer to the Backport tool documentation

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [7db2b3e]

jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…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>
markov00 pushed a commit to markov00/kibana that referenced this pull request Mar 26, 2026
…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>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 26, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 259640 locally
cc: @nickofthyme

@nickofthyme
Copy link
Copy Markdown
Contributor Author

@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 nickofthyme deleted the fix/yarn-lock-v1-compound-header-aliases branch March 26, 2026 20:49
@tylersmalley
Copy link
Copy Markdown
Member

@nickofthyme, yeah - I am working on clearing out some things blocking the backports. I will own getting this in.

@tylersmalley tylersmalley self-assigned this Mar 27, 2026
tylersmalley pushed a commit to tylersmalley/kibana that referenced this pull request Mar 27, 2026
…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)
@tylersmalley
Copy link
Copy Markdown
Member

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

tylersmalley pushed a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
…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>
tylersmalley pushed a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
…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>
tylersmalley pushed a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
…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>
tylersmalley pushed a commit to tylersmalley/kibana that referenced this pull request Mar 27, 2026
…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)
@tylersmalley
Copy link
Copy Markdown
Member

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@tylersmalley tylersmalley added v9.2.8 v8.19.14 backport:skip This PR does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. backport:all-open Backport to all branches that could still receive a release labels Mar 27, 2026
kibanamachine added a commit that referenced this pull request Mar 27, 2026
# 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>
tylersmalley added a commit that referenced this pull request Mar 27, 2026
…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>
kibanamachine added a commit that referenced this pull request Mar 27, 2026
)

# 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>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…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>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.19.14 v9.2.8 v9.3.3 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants