Skip to content

Select organizations through shared browser, API and CLI access - #56

Merged
tnkuehne merged 8 commits into
feat/scoped-application-contextfrom
feat/organization-selection
Oct 20, 2026
Merged

tnkuehne merged 8 commits into
feat/scoped-application-contextfrom
feat/organization-selection

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Authenticated users can discover available organizations before choosing an application context. Without an explicit or saved selection, the only available organization is selected automatically. Browser sessions can choose at /organizations; API clients send X-Widefleet-Organization, and the CLI supports widefleet organizations, --organization ID and PLATFORM_ORGANIZATION. Multiple available organizations require a choice. Invalid or removed explicit or saved selections fail closed and can be repaired in the browser without signing out.

The shared identity service owns selection, membership checks and role resolution. An optional fleet admission policy can only narrow those memberships. Standard installations remain restricted to their default fleet. /me includes the selected application context, and organization administrators do not become installation administrators.

Browser forms and commands carry the organization displayed in their workspace. If another tab changes the session selection, the server rejects the stale write before issuing its principal; the browser explains the conflict and offers a page reload. This covers app, agent, access, workflow, member and settings mutations, including native forms without JavaScript. CLI deployment by name uses the shared authenticated request helper, retaining organization selection from app resolution through upload and deployment status.

App links retain their path and query through the organization chooser, including recovery from a stale selection. Both enhanced and native forms use the validated destination returned by the server. Sign-in and selection share validation that rejects external destinations, including paths that become unsafe after URL normalization.

Stacked on #55. This layer adds selection and admission contracts; it does not enable a complete hosted multi-organization deployment. Organization-specific login, directory configuration and deployment composition remain outside this change.

Validation on the complete implementation stack: strict workspace checks, 464 regular Vitest tests, 17 authenticated CLI/API integration tests and 14 browser organization tests with and without JavaScript. The real CLI test deploys an app, creates a flat named preview and deploys it again with automatic and explicit organization selection. Browser tests create flat app and preview addresses while retaining stale-tab and app-link protection. Node and Cloudflare builds pass. All services and identities are local synthetic fixtures.

Release-dependent documentation: #58 (publication blocked until the corresponding platform and CLI releases are published).

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

The PR appears safe to merge with the verified discovery and directory fixes in PR #57.

Summary

Adds shared organization discovery and selection for browser sessions, API requests, and the CLI.

  • Authenticated requests now use an organization the person belongs to.
  • People can choose an organization and return to the page they wanted.
  • Workspace writes stop when another tab changes the selected organization.
  • The CLI can list organizations and send a selected one with requests.
  • Workflow replay tests coordinate branch entry instead of relying on timers.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Browser session or API token"] --> B["Check identity and scope"]
  B --> C["Read memberships and apply fleet admission"]
  C --> D{"Organization chosen?"}
  D -->|No| E["Use the sole choice or show the chooser"]
  D -->|Yes| F["Check the selected membership"]
  E --> F
  F --> G{"Browser write matches the displayed organization?"}
  G -->|No| H["Reject with 409"]
  G -->|Yes or not a browser write| I["Issue the application context"]
Loading

Reviews (7) · Last reviewed commit: "Verify flat organization URLs through th..." · Reviewed by Greptile

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 45d9e12 Oct 20 2026, 02:11 PM

@tnkuehne
tnkuehne marked this pull request as ready for review October 19, 2026 22:44
Comment thread crates/platform-cli/src/main.rs Resolved
@tnkuehne
tnkuehne force-pushed the feat/organization-selection branch from 84ba495 to 45d9e12 Compare October 20, 2026 14:10
@tnkuehne
tnkuehne added this pull request to stack #60 October 20, 2026 15:40
@tnkuehne
tnkuehne merged commit 829732f into main Oct 20, 2026
33 of 50 checks passed
@tnkuehne
tnkuehne deleted the feat/organization-selection branch October 20, 2026 15:45
tnkuehne added a commit that referenced this pull request Oct 20, 2026
Connector catalog and deployment-agent discovery previously read
installation-wide records even when app access was scoped. Both shared
services now filter by the authenticated application fleet, including
agent creation and disable targets. UI remote functions and HTTP
handlers pass the same principal to connector discovery.

The central company directory uses installation credentials, so group
searches from other organizations now fail before requesting a directory
token or contacting the provider. Settings, connector management,
runtime releases and reporting remain restricted to installation
administrators.

Stacked on #56. This closes discovery leaks without introducing
organization-specific directory configuration or changing connector
administration permissions.

Validation: strict workspace type checks, formatting and type-aware
lint; 434 regular Vitest tests, including two-fleet discovery and denied
administrative API requests. The directory test verifies that
cross-organization searches make zero upstream requests. Node and
Cloudflare builds and the existing browser flows are also checked.

Release-dependent documentation: #58 (publication blocked until the
corresponding platform and CLI releases are published).














<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=83988862"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/mendra/github/widefleet/widefleet/-/pull/57"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge; no
actionable defects were found.

<details open><summary><h3>Summary</h3></summary>

Connector discovery and agent operations now use the authenticated
user’s selected fleet.

- Connector catalogs show options from the selected fleet.
- Agent lists and targets stay inside the selected fleet.
- Company group searches only run for the installation organization.

No actionable issues were found. Tests and builds were not run during
this review.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Authenticated request] --> B[Selected organization and fleet]
  B --> C[Connector catalog]
  B --> D[Agent operations]
  C --> E[Connectors in selected fleet]
  D --> F[Agents in selected fleet]
  B --> G{Installation organization?}
  G -->|No| H[Reject directory search]
  G -->|Yes, with permission| I[Search company directory]
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (7) · Last reviewed commit: ["Apply test readability
rules"](c8ae4fd)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
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