feat: proxy reports its mounted workspace - #154
Open
Anuj-72 wants to merge 2 commits into
Open
Conversation
- add handleWorkspace() route in main.go - pass ATLAS_PROJECT_DIR via docker-compose.yml - add a total of 7 subtests in main_test.go - add 6 in TestHandleWorkspace + 1 in TestRequireServiceToken - update proxy_openapi.yaml, atlas-proxy-deployment.yaml.tmpl - update API.md, CHANGELOG.md
checkAlignment now takes an optional client and consults GET /workspace first, so a wrong-folder session is caught at activation instead of after an invisible edit. The endpoint is authoritative for "no" only. It reports the proxy's own bind and knows nothing about the sandbox's, so a proxy-side match cannot conclude aligned on its own — only `atlas workspace` compares both binds and sees a SPLIT, the case where file tools read one tree while run_command uses another and every health check stays green. A proxy-side match therefore falls through to the CLI; only a proxy-side mismatch short-circuits. getWorkspace returns null rather than throwing on any failure. An older proxy without the route, or one that is simply unreachable, must read as "cannot tell" and fall through — a client must never nag a user whose setup is fine. covers() ports workspace.py's _covers: containment, not equality, so a subdirectory of the bind is aligned. It resolves symlinks via realpath and falls back to path.resolve when the path does not exist yet, which keeps it testable without a real filesystem.
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.
The proxy was bound to
~/snake-gamewhile VS Code had~/demo2open. Every tool call was truthful and useless.alignment.ts(#145) asksatlas workspace, but that needs the CLI on PATH, and the proxy never reported what it had mounted.GET /workspacereturnsproject_dir(host bind),working_dir,containerized. Behind the service token — it discloses a host path, so it is deliberately not in the/health,/ready,/versionexemption list. The extension consults it first and falls back to the CLI.Two decisions worth review:
project_diris emptied unless absolute. Compose defaultsATLAS_PROJECT_DIRto".", which resolves against the container's cwd, not the host's — reporting it raw makes every client conclude mismatch. Empty means "cannot tell".atlas workspacesees a SPLIT. So a proxy-side match still consults the CLI. Two tests fence this — collapsing it into one early return silently reintroduces the split-brain case.containerizedstats/.dockerenv, since the local launcher also setsATLAS_WORKSPACE_DIR(runtime.py:283).Also fixed: Compose passed
ATLAS_PROJECT_DIRonly at compose-time, so it never reached the container and the endpoint would have had nothing to report. The K3s manifest sets it fromATLAS_PROJECTS_DIR.Tests: Go pass (
vet/gofmtclean), 145 vitest (tsc/eslint clean), 90 contract tests including OpenAPI↔route and OpenAPI↔API.mdparity. Both behavioral guarantees are mutation-tested.Verified live: proxy run standalone (no llama/lens needed) —
/workspacereturns 200 with the token, 401 without and on a wrong token, 405 on POST, and emptiesproject_dirwhenATLAS_PROJECT_DIR=".". Thecontainerized:truebranch is unit-tested only.