Skip to content

perf: cache menu tree lookups#10022

Open
ruibaby wants to merge 1 commit into
halo-dev:mainfrom
ruibaby:codex/menu-finder-cache
Open

perf: cache menu tree lookups#10022
ruibaby wants to merge 1 commit into
halo-dev:mainfrom
ruibaby:codex/menu-finder-cache

Conversation

@ruibaby
Copy link
Copy Markdown
Member

@ruibaby ruibaby commented May 21, 2026

What type of PR is this?

/kind improvement

What this PR does / why we need it:

This PR caches menu tree data used by the theme menu finder, so repeated finder calls can reuse an already-built tree instead of listing all menu and menu item extensions every time.

It extracts the tree-building logic into MenuTreeCache, shares in-flight loads, and invalidates the cache when menu-related extension watch events arrive. It also publishes a MenuItemReconciledEvent after menu item reconciliation so status changes that affect rendered menu labels and links refresh the cached tree.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

This PR was prepared with AI assistance and reviewed before submission.

Validation:

  • ./gradlew :application:test --tests "*MenuFinderImplTest" --tests "*MenuItemReconcilerTest"
  • ./gradlew :application:spotlessCheck :application:test

Does this PR introduce a user-facing change?

NONE

@f2c-ci-robot f2c-ci-robot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/improvement Categorizes issue or PR as related to a improvement. labels May 21, 2026
@sonarqubecloud
Copy link
Copy Markdown

@ruibaby ruibaby marked this pull request as ready for review May 21, 2026 15:15
@f2c-ci-robot f2c-ci-robot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 21, 2026
@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign johnniang for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 88.05970% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.11%. Comparing base (42c374d) to head (f89133e).
⚠️ Report is 588 commits behind head on main.

Files with missing lines Patch % Lines
...run/halo/app/theme/finders/impl/MenuTreeCache.java 87.30% 6 Missing and 10 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10022      +/-   ##
============================================
+ Coverage     59.55%   61.11%   +1.55%     
- Complexity     3812     4122     +310     
============================================
  Files           677      708      +31     
  Lines         23248    23855     +607     
  Branches       1500     1572      +72     
============================================
+ Hits          13846    14579     +733     
+ Misses         8764     8520     -244     
- Partials        638      756     +118     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Categorizes issue or PR as related to a improvement. release-note-none Denotes a PR that doesn't merit a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant