fix(launch): honor DDEV_DEBUG and support router-disabled templates - #196
Merged
Conversation
|
rfay
marked this pull request as ready for review
August 8, 2026 02:33
The Issue
The shared `ddev launch` override (image/scripts/.ddev/commands/host/launch)
never checked DDEV_DEBUG/DDEV_VERBOSE before printing the interactive Coder
URL listing, breaking any tooling that relies on stock ddev's
`DDEV_DEBUG=true ddev launch` -> `FULLURL <url>` contract (e.g. DDEV's own
bats docs/tests and TestLaunchCommand).
Separately, the script only ever worked for the freeform template: it reads
the per-project Traefik `coder-routes` file that `ddev coder-routes` writes
when ddev-router is running. drupal-core and drupal-contrib omit ddev-router
and bind the web container directly to a fixed host port (see
docs/reference/coder-url-patterns.md), so that file never exists there and
`ddev launch` always dead-ended on "no coder-routes file found; run
'ddev coder-setup' then 'ddev start'" -- even after a successful start.
How This PR Solves The Issue
- Add an early DDEV_DEBUG/DDEV_VERBOSE check that prints
`FULLURL ${DDEV_PRIMARY_URL}` and exits, matching stock ddev's launch
script exactly, before any Coder-specific logic runs.
- Detect routing mode via `ddev describe -j`'s `.raw.router_disabled`. When
true (drupal-core/drupal-contrib), construct the URL directly from the
`ddev-web`/`mailpit` `coder_app` slugs using Coder's named-app URL pattern
(no Traefik/coder-routes dependency at all). When false (freeform),
behavior is unchanged.
- Add an OSC 8 hyperlink helper so the printed URL is clickable in terminals
that support it (VS Code's integrated terminal does), gated on `[ -t 1 ]`
so piped/non-interactive output (tooling, tests) stays plain text.
Manual Testing Instructions
Freeform-style (router enabled), unaffected:
1. In a freeform workspace, `ddev config --project-type=php && ddev start`,
then `ddev coder-setup && ddev start` again to register routing.
2. `DDEV_DEBUG=true ddev launch` -> `FULLURL <primary-url>`.
3. `ddev launch` / `ddev launch -m` -> same Web/Mailpit/other-addon lines as
before (verified byte-identical modulo the added hyperlink escapes, which
are invisible when stdout isn't a real TTY).
Direct-bind style (drupal-core/drupal-contrib), newly supported: simulate
with `ddev config global --omit-containers=ddev-router && ddev restart` on
any project.
1. `ddev describe -j | jq -r .raw.router_disabled` -> `true`.
2. `DDEV_DEBUG=true ddev launch` -> `FULLURL <primary-url>` (unchanged).
3. `ddev launch` -> "Coder URL for project '<name>': Web:
https://ddev-web--<workspace>--<owner>.<domain>" instead of the old
"no coder-routes file found" dead end. `ddev launch /some/path` appends
the path; `ddev launch -m` prints the mailpit named-app URL.
4. `ddev config global --omit-containers=` to revert.
Automated Testing Overview
No automated test harness exists for these shell scripts in this repo; verified
manually as above in a live workspace. `bash -n` confirms no syntax errors.
Release/Deployment Notes
Requires rebuilding and pushing the base image (`make build-and-push`) since
this script lives under `image/scripts/`, then `make push-all-templates` so
existing workspaces pick it up on next rebuild. No Terraform changes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…y-exit
The Issue
The previous commit's DDEV_DEBUG/DDEV_VERBOSE early-exit printed
`FULLURL ${DDEV_PRIMARY_URL}` unconditionally, before flags/path were
parsed. Verified against ddev's own docs/tests/*.bats suite (copied this
script into a live workspace's ~/.ddev/commands/host/launch and ran the
tests against ../ddev): `wagtail.bats` failed because
`DDEV_DEBUG=true ddev launch /admin` ignored the `/admin` suffix entirely.
How This PR Solves The Issue
Move flag/path parsing (MAILPIT, PATH_SUFFIX) to the top of the script, run
once, and reuse it both in the DDEV_DEBUG branch (building FULLURL from
DDEV_PRIMARY_URL with the same path/mailpit-port adjustment the stock ddev
launch script applies) and in the existing interactive branches further
down (unchanged, just reusing the already-parsed values instead of
re-parsing).
Manual Testing Instructions
Copied this script into a live Coder workspace and ran the full relevant
subset of ddev's docs/tests/*.bats suite against it:
- generic.bats, nodejs.bats, sveltekit.bats, wagtail.bats (the four files
using a generic webserver with deferred web_extra_exposed_ports) - all
pass.
- Verified DDEV_DEBUG=true ddev launch, `ddev launch /admin/foo`, and
`ddev launch -m` all produce the correctly-adjusted FULLURL.
- Verified the freeform/router-enabled interactive path (plain, path
suffix, and -m) is still byte-identical to before this change.
Automated Testing Overview
No automated harness for these shell scripts in this repo; verified
manually as above. `bash -n` confirms no syntax errors.
Release/Deployment Notes
Same as the previous commit on this branch - requires an image rebuild/push
and template push to take effect in existing workspaces.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
rfay
force-pushed
the
20260808_claude_launch_ddev_debug
branch
from
August 8, 2026 02:45
8ecad9e to
7d5fe48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The shared
ddev launchoverride (image/scripts/.ddev/commands/host/launch, used by all three templates) had two bugs:DDEV_DEBUG/DDEV_VERBOSEbefore printing the interactive Coder URL listing, so any tooling relying on stock ddev'sDDEV_DEBUG=true ddev launch->FULLURL <url>contract (DDEV's owndocs/tests/*.batssuite,TestLaunchCommand) got the interactive listing instead of a parseable line.freeformtemplate.drupal-core/drupal-contribomitddev-routerand bind the web container directly to a fixed host port, so the Traefikcoder-routesfile this script depends on never exists there —ddev launchalways dead-ended on "no coder-routes file found; run 'ddev coder-setup' then 'ddev start'", even after a clean start.Changes
DDEV_DEBUG/DDEV_VERBOSEbranch that printsFULLURL <url>and exits, with the same path-suffix/mailpit-port adjustment the interactive branches apply, matching stock ddev's launch script contract.ddev describe -j's.raw.router_disabled. When true (drupal-core/drupal-contrib), the URL is built directly from theddev-web/mailpitcoder_appslugs using Coder's documented named-app URL pattern (docs/reference/coder-url-patterns.md) — no Traefik dependency. When false (freeform), behavior is unchanged.[ -t 1 ]) for the human-facing output, since a real browser can't be opened from inside the workspace container — the closest practical substitute. Falls back to plain text for piped/non-interactive output.Testing
Verified in a live
freeformworkspace by copying this script into~/.ddev/commands/host/launchand running againstddev/ddev's owndocs/tests/*.batssuite (which exercises exactly thisDDEV_DEBUG=true ddev launchcontract):generic.bats,nodejs.bats,sveltekit.bats,wagtail.batsall pass — including path-suffix (ddev launch /admin) and plain cases.ddev coder-setup && ddev coder-routes, thenddev launch/ddev launch /path/ddev launch -m) is unchanged from before this PR.ddev config global --omit-containers=ddev-routeron a throwaway project:ddev launch,ddev launch /some/path, andddev launch -mall now produce workingddev-web/mailpitnamed-app URLs instead of the old dead end.bash -nconfirms no syntax errors; no automated test harness exists for these shell scripts in this repo.Release/Deployment Notes
Requires an image rebuild/push (
make build-and-push) since this script lives underimage/scripts/, thenmake push-all-templatesfor existing workspaces to pick it up on next rebuild. No Terraform changes.🤖 Generated with Claude Code