You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce runtime policies for Ferret CLI: add support for filesystem and HTTP policies (#41)
* Introduce runtime policies for Ferret CLI: add support for filesystem and HTTP policies, update tests, and enhance documentation.
* Reject binary flags in unsupported runtimes: validate runtime options, update helpers, tests, and use `slices.Concat` for argument assembly.
Mock API entries use the same binding syntax as static serving: `<path>`, `<path>:<port>`, `<path>@<alias>`, and `<path>@<alias>:<port>`. `--serve-bind` and `--serve-host` also apply to mock API servers.
666
666
667
-
### 🔒 Built-in Filesystem Policy
667
+
### 🔒 Filesystem Policy
668
668
669
-
The built-in runtime exposes FQL filesystem functions through a sandbox rooted at Lab's current working directory. Use `--policy-fs-root` to select a narrower relative or absolute root, and add `--policy-fs-read-only` to permit reads while rejecting writes, directory changes, and removals.
669
+
The built-in runtime exposes FQL filesystem functions through a sandbox rooted at Lab's current working directory. Use `--policy-fs-root` to select a narrower relative or absolute root, and add `--policy-fs-read-only` to permit reads while rejecting writes, directory changes, and removals. When `--runtime=bin:...` selects a Ferret CLI v2 binary, Lab forwards the same explicitly configured policy values to `ferret run`.
670
670
671
671
```bash
672
672
lab run \
@@ -697,7 +697,7 @@ lab run \
697
697
698
698
When the runtime URL already includes a path, Lab sends `run` requests to that exact path. The optional `runtime-param=path` value overrides the run endpoint only. `lab version --runtime=...` uses the runtime URL path and requests its sibling `/info` endpoint.
699
699
700
-
The `--policy-fs-*` and `--policy-http-*` flags configure only Lab's built-in Ferret runtime. Lab rejects them when `--runtime` selects an HTTP or binary adapter because policy enforcement belongs to that external runtime.
700
+
Lab rejects `--policy-fs-*` and `--policy-http-*` options for HTTP runtimes because their request protocol has no policy contract. Built-in and Ferret CLI v2 binary runtimes both support these options.
701
701
702
702
The HTTP runtime sends POST requests with:
703
703
@@ -712,25 +712,35 @@ The HTTP runtime sends POST requests with:
712
712
713
713
#### External Binary Runtime
714
714
715
-
Use custom Ferret CLI installations:
715
+
Use Ferret CLI v2-compatible installations. Lab invokes the binary as `ferret run`, passes the FQL source through stdin, and serializes test parameters as `--param=name=<JSON>` arguments.
716
716
717
717
```bash
718
718
# Use specific Ferret binary
719
719
lab run --runtime=bin:./custom-ferret tests/
720
720
721
-
# With runtime params forwarded as --param entries
721
+
# With shared runtime params forwarded as --param entries
Only explicitly configured Lab policy values are forwarded, so unset values retain the external CLI's configuration and defaults. Raw policy flags remain available when the corresponding Lab policy option is unset. Lab rejects raw flags that duplicate a managed policy option or conflict with its timeout/limit counterpart.
743
+
734
744
#### Runtime Comparison Testing
735
745
736
746
Test against multiple runtime versions:
@@ -794,8 +804,8 @@ These flags apply to `lab run`.
794
804
|`--timeout`|`-t`|`LAB_TIMEOUT`|`30`| Test timeout in seconds |
For HTTP runtimes, `path` overrides the run endpoint only. For binary runtimes, `flags` is special and is appended directly to the external binary argv. All other runtime params are still passed as `--param=name:value`.
944
+
For HTTP runtimes, `path` overrides the run endpoint only. For binary runtimes, `flags` is special and is appended after the generated `run` subcommand. All other binary runtime params are passed as `--param=name=<JSON>`. Raw flags that conflict with managed policy options are rejected before execution.
0 commit comments