Skip to content

Commit fcca705

Browse files
test: pin the workspace dev override to a non-production mount path (#1393)
The override tests use /dev/ws, so a hardcoded /workspaces mount fails them, and they check the cancel bounce. Documents ALTIMATE_WORKSPACE_WEB_URL in the CLI docs, including the mount path. Closes #1392
1 parent c89f457 commit fcca705

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

‎docs/docs/usage/cli.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Configuration can be controlled via environment variables:
9797
| `ALTIMATE_CLI_DISABLE_PRUNE` | Disable database pruning |
9898
| `ALTIMATE_CLI_DISABLE_MODELS_FETCH` | Don't fetch models from models.dev |
9999
| `ALTIMATE_WORKSPACE` | Opt into the workspace pilot (`1`). Off by default; nothing about workspaces is active without it |
100+
| `ALTIMATE_WORKSPACE_WEB_URL` | Development only: the base URL of a local web app's Workspaces pages, used instead of the tenant's for `link`'s browser hand-off and workspace links. Include the mount path, e.g. `http://acme.localhost:3000/workspaces` |
100101
| `ALTIMATE_INTEGRATIONS` | Set to `local` to keep warehouse tools local rather than routing them through a bound workspace's engine |
101102
| `ALTIMATE_CODE_SERVE` | Set to `1` by `altimate-code serve` itself, whether the IDE extension or you launched it. Marks that process as the extension's host — so it is the one that reads the pin variables — and is stripped from every child the bash and shell tools start |
102103
| `ALTIMATE_PINNED_WORKSPACE_ID` / `_NAME` / `_ROOT` | Set together by the IDE extension on `serve`: the workspace selected in its panel and the folder it applies to. All three or none — a partial pin is refused rather than ignored. Read only when `ALTIMATE_CODE_SERVE` is set; never persisted; stripped from child processes |

‎packages/opencode/test/altimate/workspace/browser-handoff.test.ts‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,13 @@ describe("runHandoffWithOpener end-to-end", () => {
406406
expect(bounceTarget(await page!)).toBe("https://acme.app.myaltimate.com/workspaces/")
407407
})
408408

409-
// The dev override names a local server's mount; its path must survive into
410-
// every URL, which ``new URL("/create-and-link", base)`` would have dropped.
411-
test("the dev override's path prefixes the hand-off page and the manage page", async () => {
412-
process.env["ALTIMATE_WORKSPACE_WEB_URL"] = "http://acme.localhost:3000/workspaces"
409+
// The dev override names a local server's mount. Its path is not the
410+
// production one, so a mount hardcoded anywhere in the URL builders shows up
411+
// here; ``new URL("/create-and-link", base)`` would also have dropped it.
412+
const OVERRIDE = "http://acme.localhost:3000/dev/ws"
413+
414+
test("the dev override's path prefixes the hand-off page and the success bounce", async () => {
415+
process.env["ALTIMATE_WORKSPACE_WEB_URL"] = OVERRIDE
413416
let authorizeUrl = ""
414417
let page: Promise<string> | undefined
415418
const result = await runHandoffWithOpener(
@@ -423,8 +426,23 @@ describe("runHandoffWithOpener end-to-end", () => {
423426
)
424427
expect(result.ok).toBe(true)
425428
const u = new URL(authorizeUrl)
426-
expect(u.origin + u.pathname).toBe("http://acme.localhost:3000/workspaces/create-and-link")
427-
expect(bounceTarget(await page!)).toBe("http://acme.localhost:3000/workspaces/w/7")
429+
expect(u.origin + u.pathname).toBe(`${OVERRIDE}/create-and-link`)
430+
expect(bounceTarget(await page!)).toBe(`${OVERRIDE}/w/7`)
431+
})
432+
433+
test("the dev override's path prefixes the cancel bounce", async () => {
434+
process.env["ALTIMATE_WORKSPACE_WEB_URL"] = OVERRIDE
435+
let page: Promise<string> | undefined
436+
const result = await runHandoffWithOpener(
437+
{ identifier: { projectPath: "/x" }, projectName: "x" },
438+
async (url) => {
439+
const { state, redirect } = parseHandoffUrl(url)
440+
page = fireCallback(redirect, { state, error: "cancelled", tenant: "acme" })
441+
await page
442+
},
443+
)
444+
expect(result.ok).toBe(false)
445+
expect(bounceTarget(await page!)).toBe(`${OVERRIDE}/`)
428446
})
429447
})
430448

0 commit comments

Comments
 (0)