Skip to content

Commit eeeacfe

Browse files
committed
chore(stack): merge the shared supervision refactor with main (#4701) into provider token resolvers
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
2 parents 124228a + 57a99e1 commit eeeacfe

44 files changed

Lines changed: 6157 additions & 935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/test-release-canary/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Loopback registration auto-derives the gateway name to `openshell` if `--name` i
144144
| Sandbox create or exec fails | Published sandbox and supervisor artifacts are missing, incompatible, or cannot establish the protected runtime channel. | Gateway logs plus Docker, Podman, VM, snap, or Kubernetes runtime diagnostics for the job. |
145145
| `macos`/`ubuntu-deb`/`fedora` job fails on `openshell status` | Local gateway service did not start (systemd/brew/podman). Often a driver issue. | Service logs in the job log; `OPENSHELL_COMPUTE_DRIVER` env in the "Ensure …" step. |
146146
| `ubuntu-snap-system-docker` fails during `install.sh` | System Docker was unavailable to the runner user, the edge revision or automatic interfaces were unavailable, or the user gateway did not become reachable. | Failure diagnostics dump system Docker, snap service/connection/change state, user and legacy gateway journals, snap logs, and port 17670 listeners. |
147-
| `ubuntu-snap-system-docker` fails during the prover checks | The prover artifact is missing or packaged for the wrong architecture, `openshell.prover` is not exposed or confined to read the test policies, or its solver linkage is not runnable. | The `Install and check status` and `Check a policy boundary with the snap prover` steps, plus `snap info openshell` and `snap connections openshell`. |
147+
| `ubuntu-snap-system-docker` fails during the prover checks | The prover artifact is missing or packaged for the wrong architecture, `openshell.prover` is not exposed, missing the alias to `openshell-prover`, or not permitted to read the test policies, or its solver linkage is not runnable. | The `Install and check status` and `Check a policy boundary with the snap prover` steps, plus `snap info openshell` and `snap connections openshell`. |
148148
| `ubuntu-snap-docker-preflight` unexpectedly succeeds | The installer no longer fails before installing the OpenShell snap when Docker is absent or supplied by the Docker snap. | Inspect `install.log`, `docker-snap.log`, `snap list`, and snapd changes. |
149149
| `kubernetes` job fails on `helm install --wait` | Chart did not deploy in 5 min — usually image pull failure or readiness probe failing. | "Diagnostics on failure" step dumps `helm status`, manifest, pod describe, pod logs. |
150150
| `kubernetes` job fails on `kubectl wait` | Gateway pod stuck `CrashLoopBackOff` or `ImagePullBackOff`. | Diagnostics dump; check `:dev` image existence at `ghcr.io/nvidia/openshell/gateway`. |

‎.github/workflows/branch-checks.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ jobs:
221221
cargo fmt --manifest-path examples/governance-interceptor/Cargo.toml --all -- --check
222222
cargo fmt --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --all -- --check
223223
cargo fmt --manifest-path examples/isolation-backend-v8/Cargo.toml --all -- --check
224+
cargo fmt --manifest-path tests/testkit/Cargo.toml --all -- --check
224225
225226
cargo-lockfiles:
226227
name: Cargo lockfiles
@@ -277,6 +278,7 @@ jobs:
277278
cargo clippy --locked --manifest-path examples/governance-interceptor/Cargo.toml --all-targets -- -D warnings
278279
cargo clippy --locked --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --all-targets -- -D warnings
279280
cargo clippy --locked --manifest-path examples/isolation-backend-v8/Cargo.toml --all-targets -- -D warnings
281+
cargo clippy --locked --manifest-path tests/testkit/Cargo.toml --all-targets -- -D warnings
280282
281283
rust-test:
282284
name: Rust test (${{ matrix.system }})
@@ -325,6 +327,7 @@ jobs:
325327
run: |
326328
cargo nextest run --locked --profile ci --workspace --features openshell-server/test-support
327329
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml
330+
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/testkit/Cargo.toml
328331
329332
rust-postgres-test:
330333
name: Rust PostgreSQL tests

‎.github/workflows/release-canary.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
docker info
240240
sudo snap connections openshell | grep -E '^docker +openshell:docker +:docker +'
241241
openshell --version
242-
openshell.prover --version
242+
openshell-prover --version
243243
snap services openshell
244244
systemctl --user is-enabled --quiet snap.openshell.user-gateway.service
245245
systemctl --user is-active snap.openshell.user-gateway.service
@@ -283,7 +283,7 @@ jobs:
283283
read_only:
284284
- /usr
285285
EOF
286-
result=$(openshell.prover check "$prover_dir/candidate.yaml" \
286+
result=$(openshell-prover check "$prover_dir/candidate.yaml" \
287287
--boundary "$prover_dir/boundary.yaml")
288288
grep -q '^result: within_boundary$' <<<"$result"
289289

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Do not rely on this file for a full inventory. The detailed public and contribut
5454
| `crates/openshell-driver-mxc/` | Microsoft MXC compute driver | In-process Windows AppContainer and isolation-session compute backend |
5555
| `crates/openshell-prover/` | Policy prover | Policy verification and proof generation |
5656
| `crates/openshell-prover-cli/` | Policy prover CLI | Standalone local policy boundary checks |
57-
| `crates/openshell-server-macros/` | Server macros | Compile-time helpers for gateway RPC authorization |
5857
| `crates/openshell-supervisor-middleware/` | Middleware runtime | Generic middleware registry, remote service integration, and chain execution |
5958
| `crates/openshell-supervisor-middleware-builtins/` | Built-in middleware | First-party in-process middleware implementations |
6059
| `crates/openshell-supervisor-network/` | Network supervisor | Proxying, L7 enforcement, policy evaluation, and provider credential injection |
@@ -63,6 +62,7 @@ Do not rely on this file for a full inventory. The detailed public and contribut
6362
| `python/openshell/` | Python SDK | Python bindings and CLI packaging |
6463
| `sdk/typescript/` | TypeScript SDK | Native Connect client, curated sandbox API, and generated protobuf types |
6564
| `proto/` | Protobuf definitions | gRPC service contracts |
65+
| `tests/testkit/` | E2E testkit | Support library and `#[testkit::test]` attribute for SDK-driven E2E suites |
6666
| `deploy/` | Docker, Helm, K8s | Dockerfiles, Helm chart, manifests |
6767
| `docs/` | Published docs | MDX pages, navigation, and content assets |
6868
| `fern/` | Docs site config | Fern site config, components, and theme assets |

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ These are the primary `mise` tasks for day-to-day development:
344344
| `sdk/typescript/` | TypeScript SDK (Connect client and generated protobuf bindings) |
345345
| `proto/` | Protocol buffer definitions and [public API conventions](proto/README.md) |
346346
| `tasks/` | `mise` task definitions and build scripts |
347+
| `tests/testkit/` | Support library for SDK-driven end-to-end suites |
347348
| `deploy/` | Dockerfiles, Helm chart, Kubernetes manifests |
348349
| `docs/` | Published Fern docs source, navigation, and content assets |
349350
| `fern/` | Fern site config, components, and theme assets |

‎Cargo.lock‎

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎TESTING.md‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ crates/*/tests/ # Rust integration tests
1616
python/openshell/ # Python unit tests (*_test.py suffix)
1717
e2e/python/ # Python E2E tests (test_*.py prefix)
1818
e2e/rust/ # Rust CLI E2E tests
19+
tests/testkit/ # Support library for SDK-driven E2E suites
1920
```
2021

2122
## Rust Tests
@@ -129,6 +130,16 @@ requires mTLS.
129130
runtime. It covers the current schema and the Podman in-tree versus external
130131
driver configuration boundary.
131132

133+
### testkit (`tests/testkit/`)
134+
135+
`testkit` is the support library for SDK-driven end-to-end suites. Tests are
136+
`#[testkit::test]` functions with a required doc comment. They find the
137+
gateway the same way the CLI does, through `OPENSHELL_GATEWAY_ENDPOINT`,
138+
`OPENSHELL_GATEWAY`, or the active gateway, and `cx.cli` runs the CLI named
139+
by `OPENSHELL_BIN`. See
140+
[tests/testkit/README.md](tests/testkit/README.md) for how to write and run
141+
tests.
142+
132143
### Python E2E (`e2e/python/`)
133144

134145
`mise run e2e:python` builds `openshell/e2e-python:dev` from
@@ -447,14 +458,19 @@ OPENSHELL_E2E_KUBE_TEST=smoke mise run e2e:kubernetes
447458
```
448459

449460
**OpenShift**: when the target cluster exposes the `route.openshift.io` API
450-
group, the harness automatically applies SCC-compatible Helm overrides, grants
451-
the required SCCs (`privileged` to `openshell-sandbox`, and `anyuid` to the
452-
PostgreSQL fixture for DB scenarios), and drives the gateway through a
453-
passthrough Route with mandatory mTLS instead of port-forward. No extra flags are
454-
needed, but `oc` must be installed and authenticated against the target cluster
455-
with permission to modify SCC bindings (`oc adm policy add-scc-to-user`) — the
456-
harness exits early if `oc` is missing. The SCC grants and extracted client
457-
mTLS material are removed during cleanup, including on failure or interrupt.
461+
group, the harness automatically applies SCC-compatible Helm overrides and
462+
drives the gateway through a passthrough Route with mandatory mTLS instead of
463+
port-forward. No extra flags are needed, but `oc` must be installed and
464+
authenticated against the target cluster; the harness exits early if `oc` is
465+
missing. DB scenarios grant `anyuid` to the PostgreSQL fixture and require
466+
permission to modify SCC bindings (`oc adm policy add-scc-to-user`). That grant
467+
and extracted client mTLS material are removed during cleanup, including on
468+
failure or interrupt.
469+
470+
Sandbox pods use the namespace-assigned UID/GID and run under `restricted-v2`
471+
without a privileged SCC grant to `openshell-sandbox`. Earlier versions required
472+
that grant for in-container isolation setup. [RFC 0012](https://github.com/NVIDIA/OpenShell/blob/main/rfc/0012-isolation-backend/README.md#motivation)
473+
explains the isolation backend separation behind the capability-free runtime.
458474

459475
On a **remote** cluster, drop the `e2e-host-gateway` feature. Those tests rely
460476
on the sandbox-side `host.openshell.internal` alias reaching the machine running

‎crates/openshell-cli/Cargo.toml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ hyper-util = { workspace = true }
5454
hyper-rustls = { version = "0.27", default-features = false, features = ["native-tokio", "http1", "http2", "tls12", "logging"] }
5555
rustls = { workspace = true }
5656
rustls-pemfile = { workspace = true }
57-
tokio-rustls = { workspace = true }
58-
tower = { workspace = true }
5957
reqwest = { workspace = true }
6058

6159
# Error handling
@@ -71,9 +69,6 @@ tempfile = "3"
7169
oauth2 = { version = "5", default-features = false, features = ["reqwest"] }
7270
base64 = { workspace = true }
7371

74-
# WebSocket (Cloudflare tunnel proxy)
75-
tokio-tungstenite = { workspace = true }
76-
7772
# Streams
7873
futures = { workspace = true }
7974
tokio-stream = { workspace = true }

‎crates/openshell-cli/src/completers.rs‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ use openshell_bootstrap::edge_token::load_edge_token;
99
use openshell_bootstrap::oidc_token::{is_token_expired, load_oidc_token, store_oidc_token};
1010
use openshell_bootstrap::{list_gateways, load_active_gateway, load_gateway_metadata};
1111
use openshell_core::ObjectName;
12-
use openshell_core::auth::EdgeAuthInterceptor;
13-
use openshell_core::proto::open_shell_client::OpenShellClient;
1412
use openshell_core::proto::{ListProvidersRequest, ListSandboxesRequest, ListWorkspacesRequest};
15-
use tonic::service::interceptor::InterceptedService;
16-
use tonic::transport::Channel;
1713

1814
use crate::oidc_auth::oidc_refresh_token;
19-
use crate::tls::{TlsOptions, build_channel};
15+
use crate::tls::{GrpcClient, TlsOptions, grpc_client};
2016

2117
/// Complete gateway names from local metadata files (no network call).
2218
pub fn complete_gateway_names(_prefix: &OsStr) -> Vec<CompletionCandidate> {
@@ -130,10 +126,7 @@ fn resolve_active_gateway() -> Option<(String, String)> {
130126
Some((metadata.gateway_endpoint, name))
131127
}
132128

133-
async fn completion_grpc_client(
134-
server: &str,
135-
gateway_name: &str,
136-
) -> Option<OpenShellClient<InterceptedService<Channel, EdgeAuthInterceptor>>> {
129+
async fn completion_grpc_client(server: &str, gateway_name: &str) -> Option<GrpcClient> {
137130
let mut tls_opts = TlsOptions::default().with_gateway_name(gateway_name);
138131
tls_opts.gateway_insecure = std::env::var("OPENSHELL_GATEWAY_INSECURE")
139132
.is_ok_and(|v| !v.is_empty() && v != "0" && v != "false");
@@ -172,13 +165,7 @@ async fn completion_grpc_client(
172165
}
173166
}
174167

175-
let channel = build_channel(server, &tls_opts).await.ok()?;
176-
let interceptor = EdgeAuthInterceptor::new(
177-
tls_opts.oidc_token.as_deref(),
178-
tls_opts.edge_token.as_deref(),
179-
)
180-
.ok()?;
181-
Some(OpenShellClient::with_interceptor(channel, interceptor))
168+
grpc_client(server, &tls_opts).await.ok()
182169
}
183170

184171
/// Run an async future on a dedicated thread to avoid nested tokio runtime panics.

0 commit comments

Comments
 (0)