Skip to content

build-web-service: fix ROOT_PATH placement and document URL handling#178

Open
gnguralnick wants to merge 1 commit into
mainfrom
submit/build-web-service-url-prefix
Open

build-web-service: fix ROOT_PATH placement and document URL handling#178
gnguralnick wants to merge 1 commit into
mainfrom
submit/build-web-service-url-prefix

Conversation

@gnguralnick

Copy link
Copy Markdown
Contributor

The scaffolded services.toml command set ROOT_PATH=/service/<name> at the front of ROOT_PATH=... python3 scripts/forward_port.py ... && uv run <name>, but a VAR=val cmd1 && cmd2 prefix binds the variable to cmd1 only -- so it reached forward_port.py (which ignores it) while the actual app ran with ROOT_PATH unset and FastAPI's root_path empty. Every scaffolded service was therefore emitting non-prefixed server-side URLs (OpenAPI, redirects, url_for) despite the docs claiming otherwise. This moves the assignment onto uv run <name> and documents the other half of the problem -- client-side URLs in the app's HTML/JS must be relative (an absolute path escapes to the workspace shell; a hardcoded prefix breaks standalone and on rename) -- after hitting it live: a 'view raw' iframe with an absolute src loaded the workspace shell instead of the service route. The previously-false gotchas claim that the scaffolded happy path 'just works' is corrected.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

The scaffolded services.toml command set ROOT_PATH at the front of
`ROOT_PATH=... python3 scripts/forward_port.py ... && uv run <name>`,
but a `VAR=val cmd1 && cmd2` prefix binds the variable to cmd1 only --
so it reached forward_port.py (which ignores it) while the app ran with
ROOT_PATH unset and FastAPI's root_path empty. Move the assignment onto
`uv run <name>`, and document the client-side half: URLs in the app's
HTML/JS must be relative (an absolute path escapes to the workspace
shell; a hardcoded prefix breaks standalone and on rename). Correct the
previously-false gotchas claim that the scaffolded happy path emits
prefix-correct URLs without further work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gnguralnick gnguralnick force-pushed the submit/build-web-service-url-prefix branch from 7e6f126 to e8bf3b1 Compare June 18, 2026 21:09
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