fix(env): align SF_PERMISSION_LEVEL enum with permission-profile values

Schema now accepts the same five levels used elsewhere in the codebase
(minimal/low/medium/high/bypassed) instead of the stale full/restricted/
sandbox triple. Docs and env test updated to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-14 21:11:36 +02:00
parent f88b48b0aa
commit a3b68bb269
3 changed files with 7 additions and 5 deletions

View file

@ -106,7 +106,7 @@ All debug flags are **0 or 1** (disabled or enabled):
### Extensions
- `SF_SKILL_MANIFEST_STRICT` (boolean) — Fail on invalid manifests
- `SF_PERMISSION_LEVEL` (enum: `full`, `restricted`, `sandbox`, default: `sandbox`)
- `SF_PERMISSION_LEVEL` (enum: `minimal`, `low`, `medium`, `high`, `bypassed`, default: `minimal`)
- `SF_GEMINI_PERMISSION_MODE` (enum: `ask`, `auto`, `deny`, default: `ask`)
- `SF_SESSION_BROWSER_DIR` — Override browser session directory
- `SF_SESSION_BROWSER_CWD` — Override browser working directory
@ -207,7 +207,7 @@ const positiveInteger = z
.pipe(z.number().int().positive());
// Enums with defaults
SF_PERMISSION_LEVEL: z.enum(["full", "restricted", "sandbox"]).optional()
SF_PERMISSION_LEVEL: z.enum(["minimal", "low", "medium", "high", "bypassed"]).optional()
```
### Two-schema approach

View file

@ -105,7 +105,9 @@ export const completeSfEnvSchema = sfEnvSchema.extend({
// Extensions
SF_SKILL_MANIFEST_STRICT: booleanOneZero,
SF_PERMISSION_LEVEL: z.enum(["full", "restricted", "sandbox"]).optional(),
SF_PERMISSION_LEVEL: z
.enum(["minimal", "low", "medium", "high", "bypassed"])
.optional(),
SF_GEMINI_PERMISSION_MODE: z.enum(["ask", "auto", "deny"]).optional(),
SF_SESSION_BROWSER_DIR: optionalNonEmptyString,
SF_SESSION_BROWSER_CWD: optionalNonEmptyString,

View file

@ -69,13 +69,13 @@ describe("env schema", () => {
it("parses enum fields with valid values", () => {
const result = completeSfEnvSchema.safeParse({
SF_PERMISSION_LEVEL: "full",
SF_PERMISSION_LEVEL: "medium",
SF_GEMINI_PERMISSION_MODE: "ask",
SF_DOCTOR_SCOPE: "deep",
});
expect(result.success).toBe(true);
if (result.success) {
expect(result.data.SF_PERMISSION_LEVEL).toBe("full");
expect(result.data.SF_PERMISSION_LEVEL).toBe("medium");
}
});