Skip to content

fix(launch): honor DDEV_DEBUG and support router-disabled templates - #196

Merged
rfay merged 2 commits into
mainfrom
20260808_claude_launch_ddev_debug
Aug 8, 2026
Merged

fix(launch): honor DDEV_DEBUG and support router-disabled templates#196
rfay merged 2 commits into
mainfrom
20260808_claude_launch_ddev_debug

Conversation

@rfay

@rfay rfay commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

The shared ddev launch override (image/scripts/.ddev/commands/host/launch, used by all three templates) had two bugs:

  1. It never checked DDEV_DEBUG/DDEV_VERBOSE before printing the interactive Coder URL listing, so any tooling relying on stock ddev's DDEV_DEBUG=true ddev launch -> FULLURL <url> contract (DDEV's own docs/tests/*.bats suite, TestLaunchCommand) got the interactive listing instead of a parseable line.
  2. It only ever worked for the freeform template. drupal-core/drupal-contrib omit ddev-router and bind the web container directly to a fixed host port, so the Traefik coder-routes file this script depends on never exists there — ddev launch always dead-ended on "no coder-routes file found; run 'ddev coder-setup' then 'ddev start'", even after a clean start.

Changes

  • Added an early DDEV_DEBUG/DDEV_VERBOSE branch that prints FULLURL <url> and exits, with the same path-suffix/mailpit-port adjustment the interactive branches apply, matching stock ddev's launch script contract.
  • Added detection via ddev describe -j's .raw.router_disabled. When true (drupal-core/drupal-contrib), the URL is built directly from the ddev-web/mailpit coder_app slugs using Coder's documented named-app URL pattern (docs/reference/coder-url-patterns.md) — no Traefik dependency. When false (freeform), behavior is unchanged.
  • Added an OSC 8 clickable-hyperlink helper (gated on [ -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 freeform workspace by copying this script into ~/.ddev/commands/host/launch and running against ddev/ddev's own docs/tests/*.bats suite (which exercises exactly this DDEV_DEBUG=true ddev launch contract):

  • generic.bats, nodejs.bats, sveltekit.bats, wagtail.bats all pass — including path-suffix (ddev launch /admin) and plain cases.
  • Confirmed the freeform/router-enabled interactive path (ddev coder-setup && ddev coder-routes, then ddev launch / ddev launch /path / ddev launch -m) is unchanged from before this PR.
  • Simulated the router-disabled (drupal-core/drupal-contrib) case with ddev config global --omit-containers=ddev-router on a throwaway project: ddev launch, ddev launch /some/path, and ddev launch -m all now produce working ddev-web/mailpit named-app URLs instead of the old dead end.
  • bash -n confirms 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 under image/scripts/, then make push-all-templates for existing workspaces to pick it up on next rebuild. No Terraform changes.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-08 03:08 UTC

@rfay
rfay marked this pull request as ready for review August 8, 2026 02:33
rfay and others added 2 commits August 7, 2026 20:45
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
rfay force-pushed the 20260808_claude_launch_ddev_debug branch from 8ecad9e to 7d5fe48 Compare August 8, 2026 02:45
@rfay
rfay merged commit 445099c into main Aug 8, 2026
16 checks passed
@rfay
rfay deleted the 20260808_claude_launch_ddev_debug branch August 8, 2026 03:07
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