Repository navigation
Scope connector and agent discovery to the selected fleet - #57
Merged
tnkuehne merged 2 commits intoOct 20, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | c8ae4fd | Oct 20 2026, 02:12 PM |
tnkuehne
marked this pull request as ready for review
October 19, 2026 22:44
tnkuehne
force-pushed
the
fix/scoped-service-discovery
branch
from
October 20, 2026 07:25
0f369dc to
092e577
Compare
tnkuehne
force-pushed
the
fix/scoped-service-discovery
branch
4 times, most recently
from
October 20, 2026 08:56
8ac8dfb to
2619cb9
Compare
tnkuehne
force-pushed
the
fix/scoped-service-discovery
branch
from
October 20, 2026 14:10
2619cb9 to
c8ae4fd
Compare
tnkuehne
added a commit
that referenced
this pull request
Oct 20, 2026
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). <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=83988827"><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/56"><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 <sup><img alt="Tier: apex" title="Review tier: apex" src="https://greptile-static-assets.s3.amazonaws.com/badges/effort-apex.svg?v=3" height="12"></sup></h2> <!-- greptile-impact-verdict --> The PR appears safe to merge with the verified discovery and directory fixes in PR #57. <details open><summary><h3>Summary</h3></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. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{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"] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (7) · Last reviewed commit: ["Verify flat organization URLs through th..."](45d9e12) · [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 -->
tnkuehne
added a commit
that referenced
this pull request
Oct 20, 2026
Organization admins could discover connectors but could not deploy them, manage secrets or grant app bindings: those operations still required installation administration and selected the default fleet. Connector management now uses the authenticated organization's admin role and fleet in shared services. The CLI and API deploy and update connectors; the browser manages existing connectors. Two organizations can deploy the same connector name with separate artifacts, secrets, jobs and app bindings. Installation settings, deployment-agent administration and runtime upgrades retain their operator permissions. Cloudflare command admission checks the actor's organization against the target fleet. Subsequent Workflow steps match the immutable accepted command, and a rejected command cannot mark another operation as failed. Connector logs use the selected fleet and reject foreign targets before querying the backend. Native job claims retain their fleet boundary after opening a separate database connection. The browser adds connector status, secret management and app binding forms, with links to connector logs. Every write includes the displayed organization, so stale tabs cannot write into a newly selected organization. Secret values are redacted from failed form responses. Activation is shown as pending until confirmed. Failed disconnects keep their still-active bindings visible with retry controls until removal is confirmed. Connector deployment and code updates use the existing CLI/API workflow; the CLI bundles source projects. Complete connector removal is not an existing operation and is not added here. Stacked on #57. Release-dependent documentation is maintained separately in #58. This change does not enable a production multi-tenant installation or add onboarding, billing, domain provisioning or organization-specific app sign-in. Validation: - `pnpm check`: strict workspace types, formatting and type-aware lint. - Connector API/CLI suite: 12 tests passed, including deployment with the real CLI. - Local workerd connector suite: 9 tests passed, including two organizations' actual Dynamic Worker activation and secrets, plus rejected Workflow replays. - Real Rust CLI against the authenticated shared API, with organization-scoped list, secrets and app bindings; existing connector CLI suite also passed. The scoped real-CLI test is included in the `rust-runtime` CI job. - Browser organization suite: 14 tests passed with JavaScript enabled and disabled, including navigation to API-deployed connectors named `new`, multiline secrets, binding changes, failed-removal retries, role revocation, secret redaction and stale-tab rejection. - Node and Cloudflare control-plane builds passed. All fixtures and services were local; no production deployment or migration was run. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=84283902"><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/59"><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 new blocking issue remains. <details open><summary><h3>Summary</h3></summary> Connector management now uses the selected organization’s admin role and fleet across shared services, API, CLI and browser. - Organization admins can deploy connectors and manage secrets in their selected fleet. - Organization admins can assign connectors only to apps in their fleet. - Connector logs show output only from the selected organization’s fleet. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[Authenticated request] --> B[Selected organization] B --> C{Organization admin?} C -->|No| D[Reject management request] C -->|Yes| E[Use selected fleet] E --> F[Deploy connector] E --> G[Change secrets or app bindings] E --> H[Read connector logs] F --> I[Cloudflare steps match accepted command] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (5) · Last reviewed commit: ["Remove manual connector bundle upload fr..."](b9615dd) · [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 -->
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.
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).


Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
Connector discovery and agent operations now use the authenticated user’s selected fleet.
No actionable issues were found. Tests and builds were not run during this review.
Diagram
%%{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]Reviews (7) · Last reviewed commit: "Apply test readability rules" · Reviewed by Greptile