🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Issue #3484714: Increase route build speed - #11

Open
Decipher wants to merge 2 commits into
8.x-1.xfrom
feature/3484714-route-build-speed
Open

Issue #3484714: Increase route build speed#11
Decipher wants to merge 2 commits into
8.x-1.xfrom
feature/3484714-route-build-speed

Conversation

@Decipher

@Decipher Decipher commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Mirrors Drupal.org issue #3484714.

During database updates, when Drupal's cache backend can't persist writes, route building recomputed JSON:API resource type names for every view instead of reusing them across views sharing an entity type. On one reported site (46 views, 13 content types) this took over 45 minutes.

Caches resource type names per entity type during route building, and adds test coverage for views sharing an entity type (previously untested). Measured at the reported scale: 637 calls to ResourceTypeRepository::get() before, 13 after.

Tests green on D10 and D11.

Summary by CodeRabbit

  • Bug Fixes

    • Improved JSON:API route generation for multiple views using the same entity type.
    • Ensured these views consistently return the correct resource type and entity data.
  • Tests

    • Added coverage for route generation across multiple views sharing an entity type.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Decipher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 817ceda6-1922-4e31-98c1-902282acc57a

📥 Commits

Reviewing files that changed from the base of the PR and between 2124d34 and 6245b5e.

📒 Files selected for processing (2)
  • tests/src/Kernel/CountingResourceTypeRepository.php
  • tests/src/Kernel/JsonapiViewsResourceKernelTest.php
📝 Walkthrough

Walkthrough

Route generation now caches JSON:API resource type names by entity type. A kernel test verifies that multiple node-based Views use the cached resource type and return the expected entity data.

Changes

Resource type cache

Layer / File(s) Summary
Entity-type resource type caching
src/Routing/Routes.php
Route generation caches derived resource type names by entity type and reuses them for later Views.
Shared entity-type route validation
tests/src/Kernel/JsonapiViewsResourceKernelTest.php
A kernel test creates a second node-based View, rebuilds routes, and verifies both Views return the node--room resource type and expected entity identifiers.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: improving route build speed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/3484714-route-build-speed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.28%. Comparing base (3e50d79) to head (6245b5e).

Additional details and impacted files
@@             Coverage Diff             @@
##           8.x-1.x      #11      +/-   ##
===========================================
+ Coverage    94.11%   94.28%   +0.16%     
===========================================
  Files            3        3              
  Lines          136      140       +4     
===========================================
+ Hits           128      132       +4     
  Misses           8        8              

☔ View full report in Codecov by Harness.
📢 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.

@Decipher

Decipher commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/src/Kernel/JsonapiViewsResourceKernelTest.php (1)

249-294: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Make the cache hit observable.

This test validates response correctness only. A route builder that recomputes resource types for each View produces the same responses.

Decorate or replace ResourceTypeRepositoryInterface before the router rebuild. Assert that get() runs once per node bundle across both Views. This protects the route-build performance contract from regression.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/src/Kernel/JsonapiViewsResourceKernelTest.php` around lines 249 - 294,
Update testMultipleViewsShareEntityTypeResourceTypeCache() to decorate or
replace ResourceTypeRepositoryInterface before rebuilding the router, track
get() invocations by node bundle, and assert each bundle is resolved only once
across both Views. Retain the existing response assertions while making the
cache-hit behavior observable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/src/Kernel/JsonapiViewsResourceKernelTest.php`:
- Around line 249-294: Update
testMultipleViewsShareEntityTypeResourceTypeCache() to decorate or replace
ResourceTypeRepositoryInterface before rebuilding the router, track get()
invocations by node bundle, and assert each bundle is resolved only once across
both Views. Retain the existing response assertions while making the cache-hit
behavior observable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ffc01900-2f14-472b-9eff-660fa8224b00

📥 Commits

Reviewing files that changed from the base of the PR and between 3e50d79 and 2124d34.

📒 Files selected for processing (2)
  • src/Routing/Routes.php
  • tests/src/Kernel/JsonapiViewsResourceKernelTest.php

@Decipher
Decipher force-pushed the feature/3484714-route-build-speed branch from 2124d34 to 6245b5e Compare August 4, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant