Skip to content

feat(dev): let apps/www run its committed Worker on demand - #859

Merged
choraria merged 3 commits into
mainfrom
lane/www-worker-optin
Jul 31, 2026
Merged

feat(dev): let apps/www run its committed Worker on demand#859
choraria merged 3 commits into
mainfrom
lane/www-worker-optin

Conversation

@choraria

Copy link
Copy Markdown
Contributor

next dev never loads a wrangler main, so the two routes www's Worker adds — the cookieless page-view write and the MTA-STS policy response — did not exist locally at all. Not "slower to reach": absent, with no way to exercise them short of deploying.

Keeping the fast loop as the default is right for a content site, and this doesn't change it. But "not the default" and "impossible" are different things, and only the first is a trade-off somebody chose.

Measured, not asserted

Same request, both ways:

GET /.well-known/mta-sts.txt (Host: mta-sts.webhook.co)
next dev (default) 404
dev:worker 200, real policy (mode: enforce)

Notes

  • The build must come first, and a test pins that ordering — the Worker serves ./out via its ASSETS binding, so wrangler dev against a stale export would serve yesterday's site and look like it worked. It's also why this can't be the default.
  • Derived from the same table as every other dev command, and offered only where the default actually skips the Worker: null for web (default is already the OpenNext preview) and for wrangler apps (they run their main by definition).

Test plan

  • pnpm lint — 992 pass, 0 fail, exit 0
  • Live: started www under wrangler dev, confirmed the policy route serves; control under next dev returns 404

🤖 Generated with Claude Code

`next dev` never loads a wrangler `main`, so the two routes www's Worker adds —
the cookieless page-view write to Analytics Engine and the MTA-STS policy
response — did not exist locally AT ALL. Not "slower to reach": absent, with no
way to exercise them short of deploying.

Keeping the fast loop as the default is right for a content site, and this does
not change it. But "not the default" and "impossible" are different things, and
only the first is a trade-off somebody chose. `dev:worker` builds the static
export and serves it through the real Worker on the same port.

Measured rather than asserted, same request both ways:

  next dev    → GET /.well-known/mta-sts.txt (Host: mta-sts.webhook.co)  404
  dev:worker  → the same request                                        200, mode: enforce

The build must come first and the test pins that ordering: the Worker serves
./out through its ASSETS binding, so `wrangler dev` against a stale or absent
export would serve yesterday's site and look like it had worked. It is also why
this cannot be the default — every change needs a rebuild.

Derived from the same table as every other dev command, and offered ONLY where
the default actually skips the Worker: null for web, whose default is already
the OpenNext preview, and null for wrangler apps, which run their main by
definition. A second name for something the default already does reads as a
capability rather than an option.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BRmGUnxeYsQoG9c8BCZcae
@choraria
choraria merged commit 1951bc8 into main Jul 31, 2026
30 checks passed
@choraria
choraria deleted the lane/www-worker-optin branch July 31, 2026 22:04
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