-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⬆️ Laravel 12 compatibility #152
Conversation
WalkthroughThe pull request updates the CI/CD pipeline configuration and dependency constraints to support newer PHP and Laravel versions. It enhances search functionality with more flexible limit handling by modifying query builder classes and methods, refines how responses for model relations are generated, and adds new tests to verify the behavior of search operations and relationship limits. Additionally, a new method is introduced to provide predefined limit values for resource responses. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant DispatchAction
participant QueryBuilder
participant Database
Client->>API: POST request with search parameters & limit
API->>DispatchAction: Invoke handleClassic(searchQuery)
DispatchAction->>QueryBuilder: Call disableDefaultLimit()
QueryBuilder->>QueryBuilder: Apply limit (from parameters or default)
QueryBuilder->>Database: Execute query with applied limit
Database-->>QueryBuilder: Return result count or limited records
QueryBuilder-->>DispatchAction: Return determined result count
DispatchAction-->>API: Send final response
API-->>Client: Return JSON with impacted record count
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (5)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Docstrings generation was requested by @GautierDele. * #152 (comment) The following files were modified: * `src/Actions/DispatchAction.php` * `src/Http/Response.php` * `src/Query/Builder.php` * `src/Query/ScoutBuilder.php` * `src/Query/Traits/PerformSearch.php` * `tests/Support/Rest/Resources/BelongsToManyResource.php`
Note Generated docstrings for this pull request at #153 |
📝 Add docstrings to `feature/laravel-12`
…l-rest-api into feature/laravel-12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
README.md (1)
9-9
: Consider explicitly mentioning Laravel 12.You've updated the system requirements to “PHP 8.2+ and Laravel 11+.” Given the PR objective of Laravel 12 compatibility, it may be clearer to say “Laravel 11+ (including 12)” or “Laravel 11|12” to avoid confusion and align with the updated pipeline matrix.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
README.md
(1 hunks)composer.json
(1 hunks)src/Actions/DispatchAction.php
(3 hunks)tests/Feature/Controllers/ActionsOperationsTest.php
(1 hunks)tests/Support/Rest/Resources/ModelResource.php
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- composer.json
🧰 Additional context used
🪛 GitHub Actions: tests
tests/Feature/Controllers/ActionsOperationsTest.php
[error] 33-33: Failed asserting that 0 matches expected 2.
[error] 123-123: Failed asserting that 0 matches expected 150.
[error] 190-190: Failed asserting that 0 matches expected 2.
[error] 217-217: Failed asserting that 0 matches expected 150.
[error] 240-240: Failed asserting that 0 matches expected 2.
[error] 260-260: The expected [Lomkit\Rest\Actions\CallRestApiAction] job was not pushed. Failed asserting that false is true.
[error] 292-292: Failed asserting that 0 matches expected 1.
[error] 349-349: The expected batch was not dispatched. Failed asserting that false is true.
🔇 Additional comments (3)
tests/Support/Rest/Resources/ModelResource.php (1)
118-118
: Nice addition of the 150-limit option.This addition broadens supported limit values, which is especially helpful when working with large datasets. Be sure other related resource files or queries also account for an expanded limit if relevant.
tests/Feature/Controllers/ActionsOperationsTest.php (1)
298-333
:❓ Verification inconclusive
Test logic appears valid, but pipeline failures suggest the search or chunk logic may not be engaging properly.
The pipeline fails with discrepancies like “0 matches expected 150.” Possible reasons:
- The “string = match” filter might not be recognized or is being skipped by the chunk logic.
- The chunk callback might be terminating early if
$page
indexing is off.Re-check the chunking and the “disableDefaultLimit” logic to ensure the 300 matching models are targeted and that the test environment is seeding data as expected.
To investigate, you could run this script to confirm seed data is properly saved:
🏁 Script executed:
#!/bin/bash # Verify that 300 models with `string=match` were indeed created # and the search parameter is recognized. # 1. Grep logs or code for model creation. rg -A 5 $'->count(300)->create([ \'string\' => \'match\' ])' # 2. Check if the test is referencing the correct environment or database # (Adjust if a different DB connection is used) # 3. Look for chunk usage or override in the code, ensuring chunk callback is invoked properly. rg -A 10 'chunk('Length of output: 561
I'll re-run the checks using corrected regex patterns to gather more reliable data. Please execute the following shell script to verify that:
#!/bin/bash # 1. Confirm that the test file creates 300 models with 'string' set to 'match' rg -n "->count(300)->create\(\[" tests/Feature/Controllers/ActionsOperationsTest.php # 2. Locate any usage of the chunk callback in the repository with correct escaping for parentheses rg -n "chunk\(" -A 10Once you share the output of these commands, we can more confidently determine whether the test seed data and the chunking logic (including any "disableDefaultLimit" adjustments) are functioning as expected.
src/Actions/DispatchAction.php (1)
224-224
: Good practice adding a return type.Specifying
: self
clarifies the method’s fluent interface and can prevent certain type mismatches. Keep integrating return types throughout the code to maintain consistency.
closes #149, closes #114
Summary by CodeRabbit
Summary by CodeRabbit
New Features
150
, for better user experience in API responses.Bug Fixes
Tests