test(onboarding): link the foreign folder while its tenant owns the deployment

Since #112 only the deployment owner can link a host folder, so the
discovery test creates the other tenant's linked space while that tenant
holds the deployment, then hands the deployment to the scanning owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
This commit is contained in:
Claude 2026-10-03 17:08:39 +00:00
parent 28206f21ca
commit 2273e8f82b
No known key found for this signature in database

View File

@ -149,13 +149,15 @@ describeWithDatabase("onboarding discovery through the API", () => {
it("creates the chosen projects in the owner's own spaces and saves only the chosen facts", async () => { it("creates the chosen projects in the owner's own spaces and saves only the chosen facts", async () => {
const owner = await account("discovery-creator"); const owner = await account("discovery-creator");
const intruder = await account("discovery-intruder"); const intruder = await account("discovery-intruder");
await makeDeploymentOwner(owner.actor);
const atlasFolder = path.join(home, "code/atlas"); const atlasFolder = path.join(home, "code/atlas");
// Another tenant already linked a space with the same name to the same folder. // Another tenant already linked a space with the same name to the same folder, back when
// they held the deployment (only the deployment owner can link host folders).
await makeDeploymentOwner(intruder.actor);
const foreign = await rpc<{ id: string }>(app, intruder.cookie, "spaces/create", { const foreign = await rpc<{ id: string }>(app, intruder.cookie, "spaces/create", {
name: "atlas", name: "atlas",
workspacePath: atlasFolder, workspacePath: atlasFolder,
}); });
await makeDeploymentOwner(owner.actor);
const scan = await finishedScan(owner.cookie); const scan = await finishedScan(owner.cookie);
const choice = { const choice = {