Skip to content

Pre-release 4.2.109 → 4.2.108 — task 4.3 queue swap (illuminate/queue v13) - #81

Merged
agissept merged 1 commit into
masterfrom
pre-release/4.2.109
Oct 1, 2026
Merged

agissept merged 1 commit into
masterfrom
pre-release/4.2.109

Conversation

@oonid

@oonid oonid commented Sep 29, 2026 •

Copy link
Copy Markdown

Task 4.3 — queue swap (illuminate/queue v13) · matched pair: dicoding-dev/dicoding#5942

Last L2 sub-unit of Wave 4.3. Moves illuminate/queue from replace to require ^13 (v13.33.0); v13's Queue tree shadows the fork via PSR-4 (seed mechanism). pda/pheanstalk ~4.0 → ^8.0 (v13's Beanstalkd driver targets the Pheanstalk 7/8 API). Stacks on #79.

Fork glue

  • Foundation\Bus\Dispatchable copied verbatim from L13 v13.33.0. v13 CallQueuedClosure / ChainedBatch use the trait, so Queue::push(Closure) fatals without it (Foundation is still the fork).
  • Bus: Application registers Illuminate\Bus\BusServiceProvider as a base provider (it is an L13 default provider). Closure/object jobs run through CallQueuedHandler, which needs the Bus dispatcher.
  • Core aliases: queue → Contracts\Queue\{Factory,Monitor}, queue.connection → Contracts\Queue\Queue, queue.failer → Queue\Failed\FailedJobProviderInterface (mirrors v13; the Bus dispatcher's queue resolver needs Factory).
  • Queue commands: v13's QueueServiceProvider registers none (L13 does it in Foundation's ArtisanServiceProvider). The fork-only Queue\FailConsoleServiceProvider (already listed in ConsoleSupportServiceProvider) now registers queue:work, queue:listen, queue:restart, queue:failed, queue:retry, queue:forget, queue:flush, make:queue-failed-table (alias queue:failed-table), bound by class like L13. queue:subscribe (Iron) has no v13 equivalent and is dropped.
  • Exception\ExceptionHandlerAdapter: the v13 Worker reports failed jobs through Contracts\Debug\ExceptionHandler; the adapter hands them to the fork Handler (handleConsole() → App::error() handlers), as the L4.2 worker did. Bound only when queue:work is built: bound globally, v13's routing Pipeline would start reporting and rendering HTTP exceptions itself instead of letting them reach the fork Handler (and would stop rethrowing them in tests).
  • IlluminateQueueClosure kept (classmap) so closure jobs queued by 4.2.108 before the deploy still drain.

Deleted vendored-behavior tests

tests/Queue/* (they assert L4.2 queue internals now owned by v13). Added tests/Queue/QueueForkBridgeTest (9 tests: aliases, Bus, adapter scope, worker command, string and closure jobs, pre-swap string and closure payloads, command registration). Each glue piece was checked by removing it: the matching test goes red.

Verification

  • Fork suite 332 green (−59 deleted vendored tests, +9 new). Convergence ratchet green. The real composer.json (with rector) resolves the way CI installs it (no lock).
  • Downstream, on the app pair dicoding-dev/dicoding#5942 (details there):
    • artisan list boots; --help works for every queue command, including the queue:failed-table alias; the app also boots with a provider manifest left over from 4.2.108.
    • Real v13 worker (Redis and Beanstalkd): string and closure jobs finish DONE; a throwing job shows FAIL, is written to failed_jobs with its exception, and reaches the app's App::error() handlers.
    • A normal (non-worker) boot leaves Contracts\Debug\ExceptionHandler unbound.
    • App unit suite 8468 green (with deck's Asia/Jakarta timezone); full-project Psalm clean.
    • App integration suite, all 2982 tests: the failures that remain are identical on an unmodified 4.2.108 baseline in the same environment (mostly no mail catcher); none are introduced by 4.2.109.

Matched-pair app changes (dicoding-dev/dicoding#5942)

  1. app/start/error.php — Queue::failing(static function ($connection, $job, $data)): v13 passes a single Illuminate\Queue\Events\JobFailed event. The old closure threw ArgumentCountError, and because it ran before WorkCommand's own JobFailed listener, the failed job was not recorded at all. Now reads the job and payload from the event.
  2. failed_jobs.exception column — v13 DatabaseFailedJobProvider::log() inserts exception; the 2015 migration has none. New nullable longText migration, to run before workers move to 4.2.109.
  3. app/config/queue.php (beanstalkd) — 'ttr' => 180 is ignored by v13, which reads retry_after (default 60). Now 'retry_after' => 180.
  4. BeanstalkdQueueBoringTest — Pheanstalk 8 value objects; the closure job's $job is untyped (v13 passes CallQueuedClosure).
  5. Job type-hints — v13's abstract Illuminate\Queue\Jobs\Job does not declare attempts() (only the Contracts\Queue\Job contract does, which every concrete job implements). CourseCertificateListener now type-hints the contract; Psalm flagged it.
  6. Tests that push closures on the sync driver — v13's SyncQueue serializes closures like any driver (L4.2 ran them in place). NotificationListenerTest now registers a listener class instead of a closure bound to the test case.

Deploy notes

  • v13 queue:work / queue:listen default to --tries=1 (L4.2 default was 0 = unlimited). deck's supervisor already passes --tries=1; check the production worker commands.
  • Redis driver only: jobs queued by 4.2.108 carry attempts: 1, and v13 increments it on reserve, so with --tries=1 they are failed without running (verified). SQS and Beanstalkd count attempts on the broker and are unaffected. If the Redis driver is used, drain it before deploying.
  • String and closure jobs queued by 4.2.108 still run on 4.2.109 (tested).
  • Tag 4.2.109 (lightweight, on 5b19e660) still needs to be pushed.

Remaining Wave 4 after this: 4.4 (evaporate) and 4.5 (foundation + mail + auth).

🤖 Generated with Claude Code

https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo

@agissept
agissept added this pull request to stack #80 September 29, 2026 09:08
Base automatically changed from pre-release/4.2.108 to master October 1, 2026 03:06
@agissept
agissept marked this pull request as ready for review October 1, 2026 03:07
Move illuminate/queue from replace (self.version) to require ^13; v13's
Queue tree shadows the fork via PSR-4 (seed mechanism). This is the last
L2 sub-unit of Wave 4.3. pda/pheanstalk ~4.0 -> ^8.0 (v13's Beanstalkd
driver targets the Pheanstalk 7/8 API).

Fork glue (the whole break surface):
- Foundation\Bus\Dispatchable copied verbatim from L13 v13.33.0: v13
  CallQueuedClosure/ChainedBatch use the trait, so Queue::push(Closure)
  fatals without it (Foundation is still the fork).
- Application registers Illuminate\Bus\BusServiceProvider as a base
  provider (an L13 default provider): closure/object jobs run through
  CallQueuedHandler, which needs the Bus dispatcher.
- Core aliases: queue -> Contracts\Queue\{Factory,Monitor},
  queue.connection -> Contracts\Queue\Queue, queue.failer ->
  FailedJobProviderInterface (mirrors v13's alias cluster; the Bus
  dispatcher's queue resolver needs Factory).
- Queue\FailConsoleServiceProvider now registers the v13 queue commands
  (work/listen/restart + failed/retry/forget/flush/failed-table): v13's
  QueueServiceProvider registers none (L13 does it in Foundation's
  ArtisanServiceProvider). queue:subscribe (Iron) has no v13 equivalent.
- Exception\ExceptionHandlerAdapter bridges Contracts\Debug\ExceptionHandler
  (the v13 Worker reports failed jobs through it) to the fork Handler's
  App::error() handlers. Bound only when queue:work is built: bound
  globally, v13's routing Pipeline would start rendering HTTP exceptions
  itself instead of letting them reach the fork Handler.
- IlluminateQueueClosure kept (classmap) to drain closure jobs queued by
  L4.2 before the deploy.

Deleted vendored-behavior tests: tests/Queue/* (they assert L4.2 queue
internals now owned by v13). Added tests/Queue/QueueForkBridgeTest for the
glue above, including pre-swap string/closure payloads.

Fork suite 332 green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo
@agissept
agissept force-pushed the pre-release/4.2.109 branch from 881aa1e to ca58c12 Compare October 1, 2026 03:07
@agissept
agissept merged commit 3e15c64 into master Oct 1, 2026
2 checks passed
@agissept
agissept deleted the pre-release/4.2.109 branch October 1, 2026 04:06
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.

3 participants