Sync upstream updates: queue retry deadlines, inline Blade templates and batch completion
Merged
BI
1d ago+2785+2785+0123456789012345678901234567890123456789-442-442-012345678901234567890123456789
Laravel Updates
- Add releaseUsingBackoff() to InteractsWithQueue, which releases a job using the backoff for its current attempt. Document it under manually releasing jobs.
- Add the RetryFor queue attribute for jobs, queued listeners, mailables and notifications, and refresh its deadline when queue:retry retries a job. Document it under time-based attempts.
- Cover cursor pagination of unions ordered by an aliased expression. Hypervel pages union members by column position and asks for fromSub() when a paging column is computed, so the test checks that guidance and the fromSub() form.
- Allow from() with a subquery and no alias.
- Add RawTemplate for inline Blade components, with the inline make:component stub and documentation.
- Add withoutAffectingStickiness() to database connections, so writes inside the callback don't send later reads to the write connection. Regenerate the DB facade and document it.
- Port the wildcard primary-attribute validation tests. Hypervel's existing reverse lookup map already resolves these in one pass, so the source keeps it.
- Render bound attributes of dynamic components the same way as the component tag.
- Extend the tagged Redis cache read tests. Hypervel already reads tagged keys with a single MGET, so the tests check that instead of a pipeline.
- Mark batches that allow failures as finished once all their jobs have run. BatchFinished is still dispatched only when all of them succeed.
- Let findOrFail() and findOr() accept models, comparing the found rows by key, including on through relations. Port master's logger assertions for exception context.
- Add min(), max(), between() and exactly() to the list rule builder, with documentation.
- Name the renamed sticky-connection worker tests in the note explaining their removal. Each Hypervel queue job already runs with its own record-modification state.
- Remove unused protected methods.
- Use Exceptions::fake() in the exception-throttling reporting tests.
Additional Hypervel changes
- Refresh a queued listener's deadline on queue:retry from its retryUntil() method, called with the original event, or from its RetryFor window. Previously the retried job kept its expired deadline from dispatch and failed straight away. A job's own retryUntil property is no longer replaced by its RetryFor window.
- Use hypervel_table as the default alias for an unaliased from() subquery, since PostgreSQL rejects the empty alias Laravel uses.
- Stop Blade::render() with deleteCachedView from deleting a template file that a component or another render of the same template is still using. Each such render now compiles its own copy and removes it afterward.
- Decide whether a batch that allows failures has finished from its distinct failed job IDs, inside the same locked update, so a job that fails more than once is counted once. A retried job that is still listed as failed keeps batching() true, and Horizon retries keep the original batch job ID, so "Retry batch" no longer re-runs completed jobs.
- Count batched jobs that use Batchable without InteractsWithQueue, so their batches finish and a retry still runs after its batch finishes with failures.
- Keep backoff schedules given as lists or comma-separated --backoff options, such as those Horizon passes to its workers. Previously workers kept only the first delay, and a list returned by a job's backoff() became "Array". A schedule is also kept when the deprecated --delay is passed.
- Make find() with models or a collection of models query only their keys. Previously every attribute value was used as a key, so it could return unrelated rows, and findOrFail() failed with "Array to string conversion". findOrFail() and findOr() also read a lazy collection of IDs only once.
- Keep requested numeric cache keys in many() and get() from taking another entry's default on a miss.
- Keep a coroutine's cancellation visible when it interrupts Sleep, instead of letting the rest of the sleep or its next while() iteration clear it.
- Detect streaming HTTP cancellation only at the transport's own waits, so requests made after a handled cancellation no longer fail. Require hypervel/guzzle 8.5.0.2 in every package that uses it, since its transport stops promptly on cancellation.
- Report AWS credential failures as cancellations only when this call's own waits were canceled.
- Classify Redis cancellation at each native operation, so ordinary phpredis failures after a handled cancellation keep their RedisException.
- Check generated PHP with php -l before writing it, so make: commands no longer write classes PHP can't load, such as one named like a class it imports (make:mail Envelope) or a nested reserved name (make:model School/Class). The command stops with PHP's error before writing, even with --force. A name on the reserved list now fails the command too, so --force no longer creates its companion files.
- Track removing native Windows runtime support and Pest integration in the todo list.
Summary by cubic
This syncs upstream Laravel updates and fixes inherited defects in queue retry deadlines, batch completion, inline Blade components, and cancellation handling.
Queues, batches, and queries
- Adds the
RetryForattribute for fixed retry windows on jobs, queued listeners, mailables, and notifications, and refreshes the deadline whenqueue:retryretries a job. - Adds
releaseUsingBackoff()to release a job using the delay for its current attempt. - Marks batches that allow failures as finished once every job has run, counting distinct failed job IDs so a job failing more than once is counted once; retried batch jobs keep their original batch identity.
- Makes
find()and related methods accept models and compare rows by key instead of using every attribute as a key. - Adds
withoutAffectingStickiness()so writes inside its callback don't route later reads to the write connection.
Templates, validation, and runtime
- Adds
RawTemplatefor inline Blade components;Blade::render()withdeleteCachedViewno longer deletes a template another render is still using. - Extends the
Rule::list()builder withmin(),max(),between(), andexactly(). - Classifies Redis, HTTP streaming, and AWS credential cancellations only from the operation's own waits, so ordinary failures after a handled cancellation keep their original exception.
- Requires
hypervel/guzzle8.5.0.2 and fixesSleepinterruption and cachemany()/get()handling of numeric keys.
[!NOTE]
Sync upstream updates: queue retry deadlines, inline Blade templates, batch completion
- Adds a
RetryFor(seconds, minutes, hours) attribute for queued jobs, mailables, notifications, and listeners. Each derives retryUntil from the attribute when no method or property is set, and queue:retry recalculates the deadline when retrying (RetryFor.php, Dispatcher.php, RetryCommand.php).
- Supports backoff schedules (comma-separated or arrays) end-to-end:
WorkerOptions, ListenCommand, WorkCommand, Listener, and a new InteractsWithQueue::releaseUsingBackoff that picks the delay for the current attempt.
- Fixes batch completion for batches that allow failures: batches now finish when every job has run once and only failures remain, tracked atomically in
DatabaseBatchRepository via completedFirstPass. Batch job IDs are tracked for commands without InteractsWithQueue through a static WeakMap in Batch (Batch.php, DatabaseBatchRepository.php).
- Adds inline Blade component support: a
RawTemplate type, a new inline component stub, raw-template caching in ComponentTagCompiler/BladeCompiler, and cleanup of temporary source and compiled files after inline renders. Rule::list() now returns a ListRule builder with size constraints instead of a string.
- Reworks Redis/Swoole cancellation classification: the Swoole error state is cleared before native operations, and exceptions are classified as cancellation only when caused by
CanceledException or when the socket error is SOCKET_ECANCELED (RedisCancellation.php, RedisConnection.php).
- Behavioral Change:
Rule::list() returns a ListRule object, not a string; generator commands now fail on reserved names and lint generated PHP before writing; Batchable commands whose batch finished with failures may still run; missing cache keys with canonical numeric-string forms no longer return defaults.
Macroscope summarized 75dc0ab.
Summary by CodeRabbit
- New Features
- Added fixed-duration retry windows for queued jobs, listeners, mailables, and notifications, plus a way to release jobs using their configured backoff schedule.
- Added fluent list-validation rules with item-count constraints.
- Added support for inline Blade component templates and improved handling of dynamic component attributes.
- Added an option for writes that should not change sticky read routing.
- Bug Fixes
- Improved batch completion and retry tracking, model lookups from collections and lazy inputs, streaming-request cancellation handling, and Redis cancellation reporting.
- Subqueries without an explicit alias now receive a default alias.
- Invalid or conflicting generated class names are rejected before files are changed.
- Documentation
- Expanded guidance for inline templates, retries, sticky connections, and list validation.