[agent/claude] Fix multi-domain route name duplication in LifecycleEventPro... #5

Closed
Virgil wants to merge 0 commits from agent/fix-multi-domain-route-name-duplication into main
Member

Task

Fix multi-domain route name duplication in LifecycleEventProvider. When Website Boot classes register the same route file on multiple domains (e.g. core.test, hub.core.test, core.localhost), Laravel's route:cache fails with 'Another route has already been assigned name'. The fix: in LifecycleEventProvider's route processing methods (fireWebRoutes, fireAdminBooting, fireApiRoutes, fireClientRoutes, fireConsoleBooting), after collecting route callbacks via $event->routeRequests(), deduplicate route names. Only the FIRST registration of a route name should keep it — subsequent domain registrations should have their names stripped. The DomainResolver::domainsFor() returns multiple domains per Website, and each domain gets the same route file with the same name prefix (e.g. 'hub.dashboard' appears 4 times). Key files: src/Core/LifecycleEventProvider.php (the fire* methods that process routeRequests), src/Core/Events/AdminPanelBooting.php and similar event classes. The route processing pattern is: foreach ($event->routeRequests() as $callback) { Route::middleware('web')->group($callback); } — each callback is a closure that registers routes with ->name() calls. The fix should track seen route names and skip naming on duplicates. Test with: php artisan route:cache in the host.uk.com app.

Agent: claude
Commits: 1
Branch: agent/fix-multi-domain-route-name-duplication


Auto-created by core-agent dispatch system.
Co-Authored-By: Virgil virgil@lethean.io

## Task Fix multi-domain route name duplication in LifecycleEventProvider. When Website Boot classes register the same route file on multiple domains (e.g. core.test, hub.core.test, core.localhost), Laravel's route:cache fails with 'Another route has already been assigned name'. The fix: in LifecycleEventProvider's route processing methods (fireWebRoutes, fireAdminBooting, fireApiRoutes, fireClientRoutes, fireConsoleBooting), after collecting route callbacks via $event->routeRequests(), deduplicate route names. Only the FIRST registration of a route name should keep it — subsequent domain registrations should have their names stripped. The DomainResolver::domainsFor() returns multiple domains per Website, and each domain gets the same route file with the same name prefix (e.g. 'hub.dashboard' appears 4 times). Key files: src/Core/LifecycleEventProvider.php (the fire* methods that process routeRequests), src/Core/Events/AdminPanelBooting.php and similar event classes. The route processing pattern is: foreach ($event->routeRequests() as $callback) { Route::middleware('web')->group($callback); } — each callback is a closure that registers routes with ->name() calls. The fix should track seen route names and skip naming on duplicates. Test with: php artisan route:cache in the host.uk.com app. **Agent:** claude **Commits:** 1 **Branch:** `agent/fix-multi-domain-route-name-duplication` --- Auto-created by core-agent dispatch system. Co-Authored-By: Virgil <virgil@lethean.io>
Virgil added 1 commit 2026-03-21 23:19:48 +00:00
fix(lifecycle): deduplicate route names from multi-domain registrations
Some checks failed
CI / PHP 8.4 (pull_request) Failing after 2m3s
CI / PHP 8.3 (pull_request) Failing after 2m18s
CI / PHP 8.4 (push) Failing after 2m2s
CI / PHP 8.3 (push) Failing after 2m20s
Publish Composer Package / publish (push) Failing after 10s
be304e7b1a
When the same route file is registered on multiple domains (e.g.
core.test, hub.core.test, core.localhost), Laravel's route:cache
fails with "Another route has already been assigned name". Add
deduplicateRouteNames() to strip names from duplicate routes,
keeping only the first registration. Extract processViews(),
processLivewire(), and refreshRoutes() helpers to reduce
duplication across fire* methods.

Co-Authored-By: Virgil <virgil@lethean.io>
Author
Member

Verification Failed

Command: go test ./...

go: inconsistent vendoring in /Users/snider/Code/.core/workspace/php-1774134377820714000/src:
	forge.lthn.ai/core/cli@v0.3.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	forge.lthn.ai/core/go-i18n@v0.1.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	forge.lthn.ai/core/go-io@v0.1.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/dunglas/frankenphp@v1.12.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/stretchr/testify@v1.11.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	gopkg.in/yaml.v3@v3.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	forge.lthn.ai/core/go@v0.3.3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	forge.lthn.ai/core/go-inference@v0.1.6: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	forge.lthn.ai/core/go-log@v0.0.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/MauriceGit/skiplist@v0.0.0-20211105230623-77f5c8d3e145: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/RoaringBitmap/roaring/v2@v2.15.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/aymanbagabas/go-osc52/v2@v2.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/beorn7/perks@v1.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/bits-and-blooms/bitset@v1.24.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/cespare/xxhash/v2@v2.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/charmbracelet/bubbletea@v1.3.10: is explicitly required in go....

Exit code: 1

## Verification Failed **Command:** `go test ./...` ``` go: inconsistent vendoring in /Users/snider/Code/.core/workspace/php-1774134377820714000/src: forge.lthn.ai/core/cli@v0.3.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt forge.lthn.ai/core/go-i18n@v0.1.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt forge.lthn.ai/core/go-io@v0.1.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/dunglas/frankenphp@v1.12.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/stretchr/testify@v1.11.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt gopkg.in/yaml.v3@v3.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt forge.lthn.ai/core/go@v0.3.3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt forge.lthn.ai/core/go-inference@v0.1.6: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt forge.lthn.ai/core/go-log@v0.0.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/MauriceGit/skiplist@v0.0.0-20211105230623-77f5c8d3e145: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/RoaringBitmap/roaring/v2@v2.15.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/aymanbagabas/go-osc52/v2@v2.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/beorn7/perks@v1.0.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/bits-and-blooms/bitset@v1.24.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/cespare/xxhash/v2@v2.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt github.com/charmbracelet/bubbletea@v1.3.10: is explicitly required in go.... ``` **Exit code:** 1
Virgil added the
needs-review
label 2026-03-21 23:19:49 +00:00
Author
Member

Needs Review

Tests failed after rebase. Auto-merge gave up after retry.

Labelled needs-review for human attention.

## Needs Review Tests failed after rebase. Auto-merge gave up after retry. Labelled `needs-review` for human attention.
Virgil closed this pull request 2026-03-24 11:12:04 +00:00
Some checks failed
CI / PHP 8.4 (pull_request) Failing after 2m3s
CI / PHP 8.3 (pull_request) Failing after 2m18s
CI / PHP 8.4 (push) Failing after 2m2s
CI / PHP 8.3 (push) Failing after 2m20s
Publish Composer Package / publish (push) Failing after 10s

Pull request closed

Sign in to join this conversation.
No description provided.