Skip to content

Fix Moon webpack dependency cache invalidation#258940

Merged
tylersmalley merged 4 commits intoelastic:mainfrom
tylersmalley:moon-deps
Mar 24, 2026
Merged

Fix Moon webpack dependency cache invalidation#258940
tylersmalley merged 4 commits intoelastic:mainfrom
tylersmalley:moon-deps

Conversation

@tylersmalley
Copy link
Copy Markdown
Member

@tylersmalley tylersmalley commented Mar 20, 2026

Moon 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 input 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 node_modules/@elastic/eui was missing from the emitted shared deps bundle.

This 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 transitive 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.

@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 20, 2026
@tkajtoch
Copy link
Copy Markdown
Member

tkajtoch commented Mar 20, 2026

We were just talking about this caching invalidation behavior in Slack!

My idea was to just add this to .moon/tasks/node.yml:

implicitInputs:
  - 'package.json'

Looking at your solution, it's definitely better in that it doesn't invalidate the cache when changes in package.json aren't dependency updates. I wonder if it's worth the added complexity and the risk of forgetting to add a new or updated dependency to the list of arguments. Let me know what you think! I'm really happy that we have a solution to this!

@tylersmalley
Copy link
Copy Markdown
Member Author

@tkajtoch, yeah I had considered that. There are thousands of dependencies and only a dozen or so in the shared deps, so my take was it was going to limit the cache hits enough for local development that it would negatively affect DX.

@tylersmalley tylersmalley marked this pull request as ready for review March 21, 2026 17:57
@tylersmalley tylersmalley requested review from a team as code owners March 21, 2026 17:57
@tkajtoch
Copy link
Copy Markdown
Member

Yeah, that makes sense. I wish this could be handled natively by moonrepo and it's probably the first time I ever thought "huh, bazel made it more convenient" lol. I like the approach you took to minimize cache misses and make it scoped to just the dependencies used in these packages.

Thank you for putting this together!

Moon 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 input 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 node_modules/@elastic/eui was missing from the emitted shared deps bundle.

This 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 transitive 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.
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Mar 23, 2026

⏳ Build in-progress, with failures

Failed CI Steps

History

- '^:build-webpack'
inputs:
- '@group(src)'
- 'package.json'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This refers to this project's package.json - did you mean that, or the root?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, the package one as it contains the scripts.build and buildSourcePaths

args:
- build
deps:
- extract-version-dependencies
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While I think this is correct, this is probably not optimal. I believe this will always want to run before the webpack build. I guess it's ultimately the same, because we run this together with the version dependencies generation in the bootstrap step.

If you, however set up an input file dependency on the version_dependencies.txt the task will be cacheable so long as that file doesn't change. Did you try that variation?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can see the input dependency on version_dependencies.txt is set up transitively through being part of the src file group, maybe then this dep is not required?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The dep is still required to bring version_dependencies.txt up-to-date, so it's technically a dependency here. The PR also changes bootstrap to run a single invocation of Moon, so in the end extract-version-dependencies should run at most once.

@tylersmalley tylersmalley merged commit 41b1f04 into elastic:main Mar 24, 2026
16 checks passed
@tylersmalley tylersmalley deleted the moon-deps branch March 24, 2026 23:56
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.2
9.3

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

Questions ?

Please refer to the Backport tool documentation

tylersmalley added a commit that referenced this pull request Mar 25, 2026
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Mar 25, 2026
tylersmalley added a commit that referenced this pull request Mar 25, 2026
…259487)

This reverts commit 0d3d288.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
tylersmalley added a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
tylersmalley added a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
tylersmalley added a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
Bamieh pushed a commit that referenced this pull request Mar 25, 2026
…259487)

This reverts commit 0d3d288.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
kibanamachine added a commit that referenced this pull request Mar 25, 2026
# Backport

This will backport the following commits from `main` to `9.3`:
- [Fix Moon webpack dependency cache invalidation
(#258940)](#258940)

<!--- 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>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…)" (elastic#259487)

This reverts commit 0d3d288.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
tylersmalley added a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
tylersmalley added a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
Moon 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
input 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
`node_modules/@elastic/eui` was missing from the emitted shared deps bundle.

This 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
transitive 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.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
(cherry picked from commit 41b1f04)
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>
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
…)" (elastic#259487)

This reverts commit 0d3d288.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…)" (elastic#259487)

This reverts commit 0d3d288.

---------

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release 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.

6 participants