Skip to content

Pre-release 4.2.102 → 4.2.101 — task 4.2 console swap (illuminate/console ^13) - #73

Merged
agissept merged 5 commits into
masterfrom
pre-release/4.2.102
Sep 29, 2026
Merged

agissept merged 5 commits into
masterfrom
pre-release/4.2.102

Conversation

@agissept

Copy link
Copy Markdown
Member

Stacks on #72 (4.2.101 view swap). Task 4.2: swap illuminate/console to the real v13 package.

What

  • Drop illuminate/console from replace, require illuminate/console:^13 (pulls laravel/prompts + nunomaduro/termwind). v13 Illuminate\Console\* shadows the fork tree via PSR-4 → the 5 old console BC shims go dead (removed at 4.4/4.5).
  • Rewire Foundation\Artisan::getArtisan() — v13 Console\Application(Container, Dispatcher, version) self-bootstraps in its ctor and has no make()/start()/boot(). New flow: loadDeferredProviders → $app->boot() → new Console\Application → instance('artisan') → load start/artisan.php → setContainerCommandLoader().
  • Foundation shims surfaced by v13 database console cmds: Application::basePath(); rebind 'composer' → v13 Support\Composer (retype fork Optimize/AutoloadCommand); OptimizeCommand drops Process::getCommandLine() (v13 Composer dump* return int).
  • fire() → handle() on the 22 surviving fork console commands + command.stub.
  • Tests: fixed 5 fork command tests (v13 Command::run() needs a Foundation\Application laravel w/ env bound); deleted 2 vendored-behavior tests.

Two non-obvious gotchas

  • setContainerCommandLoader() is mandatory — v13 registers #[AsCommand] commands lazily into a commandMap; without the loader, illuminate/database's whole migrate family + queue:work are silently invisible (eager L4.2-style commands mask it).
  • $app->boot() before building the console — provider boot()s register runtime extensions (the app's Auth::extend('dicoding-auth')) that command resolution needs.

Verify

Fork suite 595 green. App-side (dicoding 4.2.102-rc1): artisan list=191 cmds incl. full migrate family + queue:work, optimize/env run clean, unit 8367 green.

🤖 Generated with Claude Code

@agissept agissept self-assigned this Sep 26, 2026
@agissept
agissept marked this pull request as draft September 26, 2026 04:52
Base automatically changed from pre-release/4.2.101 to master September 28, 2026 07:25
agissept and others added 5 commits September 28, 2026 14:42
- composer: drop illuminate/console from replace, require illuminate/console:^13
  (pulls laravel/prompts + nunomaduro/termwind); v13 Console\* shadows fork tree
  via PSR-4, so the 5 console BC shims go dead (removed at task 4.4/4.5).
- Foundation\Artisan::getArtisan() rewired: v13 Console\Application self-bootstraps
  in its ctor (Container, Dispatcher, version) and has no make()/start()/boot() — so
  rebind 'artisan' to the console + load start/artisan.php inline (until Foundation
  Kernel lands at 4.5).
- fire() -> handle() on the 22 surviving fork console commands (Foundation/Console 17,
  Auth/Console 3, Routing/Console 1, Workbench 1) + command.stub; v13 Command::execute()
  resolves handle() via container, not the old fire() fallback.
- tests: fixed 5 fork command tests (setLaravel a Foundation\Application w/ env bound,
  since v13 Command::run() calls runningUnitTests()); deleted 2 vendored-behavior tests
  (ConsoleApplicationTest, FoundationArtisanTest — assert old fork Console internals).

Fork suite 595 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Surfaced by app-side artisan boot-smoke (fork suite couldn't catch — no app):
- Foundation\Artisan::getArtisan(): call $app->boot() before building the console
  (the old Console\Application::make() did; provider boot()s register runtime
  extensions like the app's Auth::extend('dicoding-auth') that command resolution needs),
  and setContainerCommandLoader() after (v13 registers #[AsCommand] commands lazily into
  a commandMap — without the loader, illuminate/database's migrate family is invisible).
- Foundation\Application::basePath(): v13 database MigrationServiceProvider calls it.
- 'composer' binding -> illuminate/support Composer (v13 moved it there; MigrateMakeCommand
  type-hints Support\Composer); fork Optimize/AutoloadCommand retyped to match.

artisan list now clean: 191 commands incl. full migrate family + queue:work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (task 4.2)

v13 Support\Composer::dumpAutoloads()/dumpOptimized() return an int exit code, not a
Process — the fork command only used the result for a cosmetic 'Executed: ...' info line.
Fixes fatal in 'artisan optimize' (composer post-update hook).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v13 illuminate/console Command::execute() resolves handle() or __invoke(),
dropping L4.2's fire(). The fork queue console commands (still self.version)
kept fire(), so v13 fell back to __invoke() -> BoundMethod "__invoke() does
not exist" on queue:listen/work/retry/etc. Rename fire()->handle() to match
the v13 idiom the app-side sweep already applied to app commands.

Also drop ListFailedCommand's removed-Symfony 'table' HelperSet call in favour
of the v13 Command::table() helper (the old path only surfaced now that the
command actually reaches its body).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (task 4.2)

getArtisan() binds the v13 console as 'artisan' then require's start/artisan.php,
which calls Artisan::add() ~149x. The Artisan facade has already cached this
Foundation\Artisan wrapper, so each add() re-enters __call()->getArtisan(); with
$this->artisan memoized only at the end, every re-entry re-boots and re-requires
artisan.php -> unbounded recursion -> OOM (observed ~22GB) on any Artisan::call in
tests/runtime. Memoize the console before the require so re-entry short-circuits
and add() forwards to the console instance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agissept
agissept added this pull request to stack #80 September 28, 2026 10:04
@agissept
agissept marked this pull request as ready for review September 29, 2026 07:02
@agissept
agissept merged commit c6838cf into master Sep 29, 2026
2 checks passed
@agissept
agissept deleted the pre-release/4.2.102 branch September 29, 2026 07:02
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