Repository navigation
Fix Eloquent cast updates and inherited queue attributes - #88
Conversation
Queueable declares nullable routing properties on the child class. Those defaults must not hide Connection, Queue or Delay attributes inherited from a parent. Ignore null properties when deciding whether a child property overrides an attribute, while retaining non-null overrides and cached reflection metadata. Port laravel/framework#61826 from 1e3185debc2949e73d6d7fe3146bce09a8f127a6, reconciled against the recorded 13.x target 5d7797528723107cd4f495326838a7d7d67fbb20. Include the upstream parent/child dispatch regression with exact connection, queue and delay assertions. Validation: the regression fails before the correction. The complete dispatcher test file, affected queue attribute consumers, formatting and full source, type-fixture and skeleton analysis pass.
JSON-path writes now merge pending object mutations before editing the stored value, use the correct encryption path for encrypted class casts, and clear stale accessor values afterward. Normal assignments also clear the accessor cache. Keep strict JSON handling and per-model cache ownership. Reconcile laravel/framework#61834 (09991edb59), #61847 (297e6acacb), #61962 (f618f7911d) and #62035 (bff5d2a24e) together against 13.x target 5d7797528723107cd4f495326838a7d7d67fbb20. These changes share the same attribute write paths and regression files; include every applicable upstream test and assertion. Correct related stale-cache paths through enum casts, custom class casts and both mutator forms. Invalidate after successful writes because callbacks can read and repopulate old values. Cache setter inputs only for attributes with getters, preventing a write-only input object from overwriting subsequent mutations to a class-cast object. Paired accessor and setter object retention remains intact. Encrypted class-cast dirty checks now use Crypt for decryption and previous keys, matching the casts themselves. A separately configured model encrypter continues to serve primitive encrypted casts. This prevents MAC failures and incorrect key-rotation decisions when the two encrypters differ. Validation: upstream and additional regressions reproduce the defects before correction. Complete model and encrypted-cast test files, affected Eloquent and casting integration tests on isolated SQLite, formatting and full source, type-fixture and skeleton analysis pass. Server-specific createOrFirst cases retain their existing driver requirements.
Cover root and nested route matching when the application is served below a URL prefix, including repeated trailing slashes. Preserve all request server metadata and assertions from laravel/framework#61794 (916931af14). The compiled matcher already trims the request path without rewriting REQUEST_URI, so no source change is needed. These cases protect base-URL detection and the existing route-cache behavior. Validation: the complete CompiledRouteCollectionTest passes, along with formatting and framework static analysis.
Integrate laravel/framework#61837, #61838, #61841 and #62131 from revisions 2c3294632c, 71cf667d43, a76d678087 and 6d0f491630. Reject invalid row-value operators, quote literal cursor columns correctly, retain union select and join bindings, and remove union page bounds from grouped pagination counts. Correct related pagination defects at the query-builder boundary. Each union member resolves its own selected columns and expressions, nested unions receive the page conditions, and bindings are rebuilt in SQL order. Bounded selects and union groups keep their original row selection while paging filters the resulting rows. Reverse navigation changes the page ordering rather than the ordering that chooses bounded rows. Counts retain that ordering only when it affects membership. Track the conditions and bindings owned by paging until scopes and query callbacks finish. This preserves normal Eloquent scope removal, eager loading, model cursor casts, direct page-builder identity, later ordering and limit changes, and caller-updated bindings. Clone shared union members and retire consumed markers so reusing a builder cannot apply old page filters again. Ordinary queries avoid normalized condition copies and unrelated nested-group clones. Complete embedded callbacks before validating statement options or capturing bindings. Make property resets respect nullable and non-nullable types, and document the custom-driver hooks for embedding, row selection and aggregate ordering. Source comments explain the reasons for these differences. Port all applicable upstream assertions and add regressions for compound aliases, nested and bounded unions, forward and backward iteration, quoted output aliases, current bindings, builder reuse and custom-driver isolation. Validation: formatting and full source, type-fixture and skeleton analysis pass; database unit tests and affected SQLite integration tests pass, as do cursor, binary and query-builder tests on isolated PostgreSQL, MySQL and MariaDB. The dependent custom-driver implementation and its analytical paging tests were also verified against this branch.
Bring in the latest queue cancellation, batch-failure reporting and SQS overflow handling fixes before publishing the database changes. The incoming changes do not overlap the pagination, cast-cache or attribute-reader edits, and no merge resolutions or adaptations are required. The combined bus, queue driver and outbox test selection passes.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Class-cast cache lifecycle and writeback src/database/src/Eloquent/Concerns/HasAttributes.php, src/database/src/Eloquent/Model.php, tests/Database/DatabaseEloquentModelTest.php |
Cached class casts track backing values and reconcile writeback with current attributes. Cache state is cleared when attributes are replaced, discarded, removed, or serialized. Tests cover mutable casts, backing columns, and raw replacement. |
Mutator writes and accessor cache updates src/database/src/Eloquent/Concerns/HasAttributes.php, tests/Database/DatabaseEloquentModelTest.php |
Setter output is merged with current attributes, and related accessor caches are invalidated. Tests cover accessor refresh, setter side effects, and in-place cast edits. |
JSON-path updates and encrypted class casts src/database/src/Eloquent/Concerns/HasAttributes.php, tests/Database/DatabaseEloquentModelTest.php, tests/Integration/Database/EloquentModelEncryptedCastingTest.php |
JSON-path operations handle encrypted array-object and collection casts. Encrypted-cast equivalence checks use Crypt. Tests cover JSON-path updates and rotating keys. |
Query builder condition validation
| Layer / File(s) | Summary |
|---|---|
Cursor column handling src/database/src/Concerns/BuildsQueries.php, tests/Database/DatabaseQueryBuilderTest.php |
Cursor conditions wrap a parenthesized original column only when it differs from the cursor column. Added coverage checks identifier wrapping and bindings. |
Row-value operator validation src/database/src/Query/Builder.php, tests/Database/DatabaseQueryBuilderTest.php |
whereRowValues rejects unsupported operators before adding conditions or bindings. Added coverage checks rejection of an SQL-like operator. |
Inherited class attributes
| Layer / File(s) | Summary |
|---|---|
Inherited attribute resolution and dispatch src/support/src/Traits/ReadsClassAttributes.php, tests/Bus/BusDispatcherTest.php |
A subclass property overrides an inherited attribute only when it is non-null. A dispatch test checks inherited connection, queue, and delay attributes. |
Compiled route matching coverage
| Layer / File(s) | Summary |
|---|---|
Subdirectory and repeated-slash route cases tests/Integration/Routing/CompiledRouteCollectionTest.php |
Added cases for root and regular compiled routes requested beneath /app/, including repeated slashes. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Bug fix
Possibly related PRs
- hypervel/components-backup#87: Both PRs modify cursor-condition behavior in
BuildsQueries.php; their merged result depends on how the edits combine.
Merge Risk: 
Minimal · previous review bd90a
-
No change-related issue remains identified; the PR is mergeable after normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 85.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 20 functions across 10 files.
Full details: Description check
-
Explanation
The description clearly explains the bug fixes, affected behavior, regression coverage, and reported verification results. It does not explicitly select a contribution type, list exact verification commands, or complete the submission checklist, but it is otherwise substantially complete and relevant.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai review |
✅ Action performed
|
PR Summary by QodoFix union keyset pagination and Eloquent cast updates
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
Code Review by Qodo
1.
|
Remove the coupled union pagination, count, query preparation and embedding changes from this branch so they can be completed together in a dedicated change. Restore the previous query-builder implementation, corresponding tests and driver documentation. Keep the independent Laravel #61837 and #61838 fixes: quote literal cursor columns containing parentheses and reject invalid row-value operators. Their complete regression tests remain in this branch. Validated the restored query-builder, embedding, pagination and integration test files, the Database suite, formatting and full static analysis.
Clearing every class-cast cache entry after a mutator loses edits made to the cached object inside that mutator. Keeping every entry instead allows an old object to overwrite replacement values. Track the values each cached object read or last wrote, and compare only its backing columns during writeback. Explicit replacements take precedence for their columns while pending object edits to other columns survive. Discard the obsolete object after merging the remaining writes. Keep the record on the model instance and clear it wherever the object cache is cleared; no additional caster calls are needed. Evaluate caster and Attribute callbacks before merging the current attributes so their other writes and encrypted-cast synchronizations are retained. Clear caches before synchronizing raw replacement attributes, preventing objects from the previous row from overwriting the replacement. Regression coverage includes both setter styles, encrypted and plain casts, held object references, partial backing-column replacements, reads and edits within setters, raw-row replacement, and callback side effects. Formatting, full static analysis, the Database suite and affected Eloquent integration tests pass.
|
@coderabbitai review |
✅ Action performed
|
A cached Attribute value could overwrite a raw column updated by another setter. Apply the same backing-value comparison used for class casts through one shared writeback helper. Explicit replacements win while pending edits to other columns survive. Validate cached null and get-only values against their own raw input without invoking a setter or inferring dependencies on other attributes. Preserve normal same-key invalidation and caching flags, and clear the new per-model records with their cache entries. Keep baseline values for columns omitted by partial setter responses, including when an object is first assigned. Update only entries whose values changed so unchanged reads do not copy the shared snapshot. Regression coverage includes sibling setter writes, cached nulls, paired multi-column accessors and partial responses after reads and assignments. Formatting, full static analysis, affected database suites and focused model and casting checks pass.
|
@coderabbitai The contribution-template check does not apply to this maintainer-directed change, as stated at the beginning of AGENTS.md. The description covers the final changes and validation. |
|
@coderabbitai review |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
The description covers the final changes and reported validation. No contribution-template changes are needed for this PR. 🧠 Learnings used
You are interacting with an AI system. |
|
Laravel Updates
Queueableand its corresponding property is null. Non-null child properties still take precedence.Additional Hypervel Fixes
Attributesetters. Evaluate their callbacks before merging the resulting values, so the merge uses the current attributes instead of an earlier snapshot.The changes include the upstream regression tests and additional cases for the corrected behavior. Formatting, full static analysis, the database unit suite and affected SQLite integration tests pass. CI runs the supported database matrix. Source comments explain the changes that future upstream updates need to preserve.
Note
Fix stale cached Eloquent casts and inherited queue dispatch attributes
Attributeaccessors now record a raw-attribute baseline, and setter results are merged against that baseline so edits made during setters and partial writebacks are preserved instead of lost or overwrittensetRawAttributes(),discardChanges(),offsetUnset(), and serialization now invalidate the matching cached cast value and baseline, so cached objects no longer go stale or write back against replaced rowsAsEncryptedArrayObjectandAsEncryptedCollectioncasts now encrypt/decrypt viaCrypt(not the model's primitive encrypter) for JSON-path updates, reads, and dirty checks, via the newisEncryptedClassCastable()predicateConnection,Queue, andDelayattributes declared on a parentShouldQueueclass are inherited by queued child commandsBuilder.whereRowValues()throwsInvalidArgumentExceptionon invalid operators, andReadsClassAttributes.propertyOverridesAttribute()ignores null subclass propertiesCryptingetArrayAttributeByKey()andoriginalIsEquivalent(); check existing rows written by the old pathMacroscope summarized 2bff3de.