fix(proxy): use project.name for proxy hostname when set#2128
Open
jlaneve wants to merge 1 commit into
Open
Conversation
standalone and docker proxy modes derived the `<x>.localhost` hostname purely from the project's directory name, which meant subdir layouts (e.g. `airflow/`) ended up at `airflow.localhost` regardless of project identity. the `astro dev proxy` help text already advertises `<project>.localhost`, so this aligns behavior with documentation. `DeriveHostname` now takes `projectName` (read from `.astro/config.yaml`'s `project.name`) and prefers it over the directory name when set. in worktrees, `projectName` replaces the repo segment but the per-worktree segment is preserved so URLs stay distinct across multiple worktrees of the same project. verified end-to-end against a repo where `airflow/` is a subdir and project.name is "circus": URL changed from `airflow.localhost:6563` to `circus.localhost:6563` Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 0Coverage remained the same at 39.746%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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
<x>.localhosthostname purely from the project directory name, which meant subdir layouts (e.g.airflow/) ended up atairflow.localhostregardless of project identityastro dev proxyhelp text already advertises<project>.localhost, so this aligns behavior with documentationDeriveHostnamenow takesprojectName(from.astro/config.yaml'sproject.name) and prefers it over the directory name when set; in worktrees, projectName replaces the repo segment while the per-worktree segment is preserved so URLs stay distinct across multiple worktrees of the same projectBehavior change
~/foo/foo.localhostfoo.localhost(unchanged)circus~/circus/airflow/airflow.localhostcircus.localhostcircuswt/feat-x/of repocircusfeat-x.circus.localhost(was repo-derived)feat-x.circus.localhost(now project.name-derived; same shape)existing users with
project.name == dirnamesee no change. existing users withproject.name != dirnameget the documented<project>.localhostbehavior, which may differ from what they had cached. worth a release noteAPI note
pkg/proxy.DeriveHostnameandairflow/proxy.DeriveHostnamegain a leadingprojectName stringparameter. these are exported but used internally by the CLI; any external Go importers would need to update call sitesTest plan
go test ./pkg/proxy/...passes (existing tests + 5 new cases for project name behavior)go test ./airflow/...passes (delegate test updated)go build ./...cleanastro dev startincircus/airflow/(project.name=circus), URL went fromhttp://airflow.localhost:6563tohttp://circus.localhost:6563, served HTTP 200