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

Fix numeric bundle machine name route build failure - #12

Open
Decipher wants to merge 2 commits into
8.x-1.xfrom
feature/3503402-numeric-bundle-id
Open

Fix numeric bundle machine name route build failure#12
Decipher wants to merge 2 commits into
8.x-1.xfrom
feature/3503402-numeric-bundle-id

Conversation

@Decipher

@Decipher Decipher commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Fixes drupal.org/i/3503402. A bundle machine name that's all digits (e.g. 123) breaks route building: array_keys() on the bundle info array turns it into an int, and ResourceTypeRepository::get() asserts its $bundle argument is a string. Route rebuild throws AssertionError: A bundle ID is required.

Casts the bundle ID to a string before the lookup, matching Drupal core's fix for the same class of bug (#3075831). Adds Kernel test coverage that creates a numeric-machine-name content type and confirms route rebuild and the JSON:API response both succeed.

Tests green on D10 and D11.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed access to JSON:API Views resources when a content bundle uses a numeric machine name.
    • Resource lookups now handle bundle identifiers consistently, preventing failed page requests.
  • Tests

    • Added coverage confirming successful requests for numeric bundle names.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 27a9b85e-e2d0-4ec8-8d15-3cea0269ba1d

📥 Commits

Reviewing files that changed from the base of the PR and between 3e50d79 and 4790fca.

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

📝 Walkthrough

Walkthrough

The route builder now converts bundle values to strings before resource type lookup. A kernel test covers numeric node-type machine names and verifies a successful JSON:API Views request.

Changes

Numeric Bundle Route Lookup

Layer / File(s) Summary
String bundle lookup and regression coverage
src/Routing/Routes.php, tests/src/Kernel/JsonapiViewsResourceKernelTest.php
The route builder stringifies bundle values before repository lookup. The kernel test creates a node type with machine name "123" and verifies an HTTP 200 response.

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 fix for route building failures caused by numeric bundle machine names.
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/3503402-numeric-bundle-id

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.11%. Comparing base (3e50d79) to head (4790fca).

Additional details and impacted files
@@           Coverage Diff            @@
##           8.x-1.x      #12   +/-   ##
========================================
  Coverage    94.11%   94.11%           
========================================
  Files            3        3           
  Lines          136      136           
========================================
  Hits           128      128           
  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.

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