Repository navigation
Name the organization in control-plane URLs - #283
Merged
Merged
Conversation
Workspace pages now start with the organization's slug, for example /acme/apps/<id>. Links open the organization they name, and tabs of one session can show different organizations. Remote functions receive the page's organization as an argument instead of reading the session. The session only remembers the organization opened last for addresses without one and for API requests without the organization header. Organization slugs cannot take the name of a top-level page.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 563d085 | Nov 22 2026, 10:33 AM |
Hovering a link preloads its page data through the request hook, so only document requests now remember the organization a page names. The organization menu opens its entries as documents. The workspace query redirects an ended session to sign-in, like the other remote functions, instead of failing with a 401.
The account endpoint returned the browser account page without the organization's slug, so the CLI printed an address that no longer exists. Personal connection returns and the account link now share one slug lookup.
The menu links turn off data preloading instead of forcing a document load, so the session remembers the organization on client-side navigation too. Error reports name the organization the page shows.
Workspace addresses already name the organization, so the session no longer remembers one. The start page opens the member's only organization or the chooser, whose links fill the choice into the destination's [organization] placeholder; MCP sign-in returns with the chosen organization in its address. API requests name their organization with X-Widefleet-Organization only. App icons take it from the app because browsers load them without headers, and template icons and browser error reporting only require a signed-in person. PUT /api/v1/organization is removed.
The lookup of an icon's app organization now wraps database errors in DatabaseUnavailable, so the endpoint answers 503 like the other reads.
Browsers cannot send the API's organization header for images. Instead of a special API path that looked up the app before checking the login, workspace pages now load icons from /<slug>/apps/<id>/icon, which the request hook authorizes like the page itself. The API icon endpoint is back to header-based authentication, so anonymous requests always get 401 and app existence stays hidden.
…ab recheck No caller reads the session ID since the session no longer stores an organization. The workspace still rechecks when a tab returns, because roles and sessions can change while it is hidden.
This was referenced Nov 22, 2026
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.
Workspace pages now start with the organization's slug, for example
/acme/apps/<id>. Before, the active organization lived only in the browser session and was shared by every tab. A shared link opened the receiver's active organization, so an app from another organization showed "not found". Two organizations could not be open side by side: another tab's switch made open forms fail with a 409 and reloaded the page.Changes:
(workspace)/[organization=organization]/. Theorganizationmatcher (src/params.ts) accepts slug-shaped segments only, so other paths still 404. Static top-level pages win over the parameter.reservedOrganizationSlugsin@platform/contractskeeps new organizations from taking their names, and a test fails when a new top-level route is missing from the list.identity.memberwithorganizationSlug) before any load runs, as introduced in Authorize workspace pages in the request hook instead of the layout #275. An organization the person cannot open looks the same as one that does not exist. The new[organization]/+layout.server.tsturns it into a 404 rendered by+error.svelte, because errors thrown inhandleonly reach the fallback page.organizationIdas an argument. The remote functions docs state that queries are cached by their arguments and cannot readparamsorurl.remoteContextandcommandContextresolve that organization directly, so the stale-selection check (409 "Your organization selection changed") is gone. Pages read the ID from the workspace context. OnlygetWorkspacetakes the slug, and its result supplies the ID./and/welcomeopen the member's only organization or the chooser (openOrganization). The chooser's entries are links: destinations chosen before the organization is known name it with an[organization]placeholder, such as/[organization]/welcome, which the chooser fills in (chosenDestination). MCP sign-in returns from the chooser withorganization=<slug>in its address and asks again for an organization the person cannot open.PUT /api/v1/organizationandidentity.selectOrganizationare removed; the CLI never used them, it always sendsX-Widefleet-Organization. Better Auth's organization plugin keeps itsactiveOrganizationIdcolumn, which Widefleet no longer reads.X-Widefleet-Organization; without it, the extension's default or the member's only organization applies, as for tokens. Browsers cannot send that header for images, so workspace pages load app icons from/<slug>/apps/<id>/icon, which the request hook authorizes like the page./api/v1/apps/<id>/iconkeeps header-based authentication for API clients. Template icons,GET /api/v1/reporting/statusandPOST /api/v1/reporting/errorsserve the whole installation and only require a signed-in person. Error reports from pages and the API name their organization.workspacePath(slug, path)or the context'spath(). The organization menu and the chooser now use plain links instead of selection forms, the menu switches without reloading the page, and an open tab no longer reloads when another tab switches organizations. The app tabs read the active tab from the route ID instead of a fixed URL segment./<slug>/connections, andGET /api/v1/account(widefleet account) returns/<slug>/account. Recovery opens the installation organization's company sign-in. A newly created organization lands on its own welcome page, and an accepted invitation opens its organization. The legacy/catalogredirect is removed;/<slug>/settingsstill opens its first section.Behavior changes:
/apps, now 404. Nobody depends on the old addresses yet, so this adds no redirects./missing.html) still 404./instead of returning to the last one./api/v1/...with several organizations and no header return403 ORGANIZATION_REQUIRED, like token requests.localsbelongs to the whole request. Page and API errors keep it.Tests:
organization-selection.integration.test.tscovers page resolution by slug, scoping by header, the header requirement with a second organization and that a stored session value is ignored. The browser suite covers parallel tabs in two organizations, creating apps in the organization a tab shows, app links whatever the session holds, 404s for foreign organizations, the sidebar switch without a page reload, the start-page chooser, external destinations in the chooser, MCP sign-in with the chosen organization and app icons from the workspace address (served for members, 404 for other organizations, sign-in for anonymous requests). The remaining specs use/widefleet/...for the installation organization. New unit test:organization-paths.test.ts.UI: layouts and components are unchanged; only addresses differ. The chooser's entries became links with the same look. The screenshots below show the same steps on
mainand on this branch, with the address shown at the bottom of each image.mainChecked: home, organization menu and My apps at 1280 and 390 px in light and dark, switching with the menu (desktop) and the chooser (mobile). Not checked visually: the 404 page for a foreign organization (unchanged
+error.svelte, covered by the browser suite).Validation:
pnpm checkpnpm exec vitest run: 130 files passed, 44 skipped (1240 tests)test:e2e --grep-invert cli-login.spec.ts) against a freshpnpm build: 91 passed, 1 skipped (source suite, gated)Docs: #284 (draft, waits for a release with this change).


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue remains.Summary
Workspace pages now name their organization in the URL. Remote calls receive an explicit
organizationId, so tabs no longer share an organization selection.Reviews (10) · Last reviewed commit: "Drop the unused session ID from authenti..." · Reviewed by Greptile