mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-26 01:11:21 +00:00
parent
20a839271c
commit
8b2491dfdb
7 changed files with 414 additions and 11 deletions
205
run.json
205
run.json
File diff suppressed because one or more lines are too long
1
stages/004-preflight_lint@1/output.log
Normal file
1
stages/004-preflight_lint@1/output.log
Normal file
|
|
@ -0,0 +1 @@
|
|||
blob://sha256/cfb3bdc41caef302fd122fc89d93befcfaec06062e8f3fda32985c19663988da
|
||||
8
stages/004-preflight_lint@1/script_timing.json
Normal file
8
stages/004-preflight_lint@1/script_timing.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"output": "blob://sha256/cfb3bdc41caef302fd122fc89d93befcfaec06062e8f3fda32985c19663988da",
|
||||
"exit_code": 101,
|
||||
"duration_ms": 228488,
|
||||
"termination": "exited",
|
||||
"output_bytes": 666,
|
||||
"live_streaming": true
|
||||
}
|
||||
6
stages/004-preflight_lint@1/status.json
Normal file
6
stages/004-preflight_lint@1/status.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"outcome": "failed",
|
||||
"notes": null,
|
||||
"failure_reason": "Script failed with exit code: 101\n\n## output\nerror: adding items after statements is confusing, since items exist from the start of the scope\n --> lib/crates/fabro-sandbox/src/docker.rs:232:9\n |\n232 | use std::io::Read as _;\n | ^^^^^^^^^^^^^^^^^^^^^^^\n |\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements\n = note: `-D clippy::items-after-statements` implied by `-D warnings`\n = help: to override `-D warnings` add `#[allow(clippy::items_after_statements)]`\n\nerror: could not compile `fabro-sandbox` (lib) due to 1 previous error\nerror: could not compile `fabro-sandbox` (lib test) due to 1 previous error\n",
|
||||
"timestamp": "2026-05-23T03:00:00.102981Z"
|
||||
}
|
||||
195
stages/005-fix_lints@1/prompt.md
Normal file
195
stages/005-fix_lints@1/prompt.md
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
Goal: # Named Environments Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task.
|
||||
|
||||
**Goal:** Replace run-scoped sandbox configuration with named, provider-explicit environments that runs can select by slug.
|
||||
|
||||
**Architecture:** Add a shared top-level environment catalog, resolve a selected environment into the run's dense settings, validate provider capabilities, and convert the resolved environment into the existing sandbox runtime specs. Keep "environment" as reusable desired configuration and "sandbox" as the concrete runtime instance created for a run.
|
||||
|
||||
**Tech Stack:** Rust config/types crates, TOML settings layers, Fabro workflow sandbox providers, OpenAPI-generated clients, public docs.
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Replace run-scoped sandbox configuration with named, provider-explicit environments. A run selects an environment by slug via `[run.environment] id = "..."`; Fabro resolves the environment catalog through normal config precedence, applies run-level environment overrides, validates provider capabilities, freezes the resolved environment into the run settings, and creates a concrete sandbox instance from it.
|
||||
|
||||
This is a greenfield break: no `[run.sandbox]` compatibility layer, no server policy layer, and no required/optional volume semantics.
|
||||
|
||||
## Key Interface Changes
|
||||
|
||||
- Add top-level `[environments.<slug>]` to the shared settings schema. It is valid in `settings.toml`, `.fabro/project.toml`, and `workflow.toml`.
|
||||
- Replace sandbox selection with:
|
||||
|
||||
```toml
|
||||
[run.environment]
|
||||
id = "fabro-dev"
|
||||
```
|
||||
|
||||
- Allow sparse run-level overrides under the same table:
|
||||
|
||||
```toml
|
||||
[run.environment.resources]
|
||||
memory = "32GB"
|
||||
|
||||
[run.environment.lifecycle]
|
||||
preserve = true
|
||||
```
|
||||
|
||||
- Environment shape:
|
||||
|
||||
```toml
|
||||
[environments.fabro-dev]
|
||||
provider = "daytona" # local | docker | daytona
|
||||
|
||||
[environments.fabro-dev.image]
|
||||
ref = "fabro-v11" # Docker image or Daytona snapshot name
|
||||
dockerfile = { path = "Dockerfile" }
|
||||
|
||||
[environments.fabro-dev.resources]
|
||||
cpu = 8
|
||||
memory = "16GB"
|
||||
disk = "20GB"
|
||||
|
||||
[environments.fabro-dev.network]
|
||||
mode = "block" # allow_all | block | cidr_allow_list
|
||||
allow = ["10.0.0.0/8"]
|
||||
|
||||
[environments.fabro-dev.lifecycle]
|
||||
preserve = false
|
||||
stop_on_terminal = true
|
||||
auto_stop = "30m"
|
||||
|
||||
[environments.fabro-dev.labels]
|
||||
repo = "fabro-sh/fabro"
|
||||
|
||||
[[environments.fabro-dev.volumes]]
|
||||
id = "vol-agent-state"
|
||||
mount_path = "/home/daytona/agent-state"
|
||||
subpath = "auth"
|
||||
|
||||
[environments.fabro-dev.env]
|
||||
NODE_ENV = "development"
|
||||
```
|
||||
|
||||
- Built-in default becomes:
|
||||
|
||||
```toml
|
||||
[run.environment]
|
||||
id = "default"
|
||||
|
||||
[environments.default]
|
||||
provider = "docker"
|
||||
|
||||
[environments.default.image]
|
||||
ref = "buildpack-deps:noble"
|
||||
|
||||
[environments.default.resources]
|
||||
cpu = 2
|
||||
memory = "4GB"
|
||||
|
||||
[environments.default.lifecycle]
|
||||
preserve = false
|
||||
stop_on_terminal = true
|
||||
```
|
||||
|
||||
## Implementation Changes
|
||||
|
||||
- Add environment sparse and dense types:
|
||||
- Sparse layer in `fabro-config` for `EnvironmentLayer`, `RunEnvironmentLayer`, image/resources/network/lifecycle/volume sublayers, and `[environments]` as a `MergeMap`.
|
||||
- Dense types in `fabro-types` for `EnvironmentSettings`, `RunEnvironmentSettings`, `EnvironmentProvider`, `EnvironmentNetworkMode`, and related subsettings.
|
||||
- Add `environments` to the top-level `SettingsLayer` and resolved `WorkflowSettings`; add selected `environment` to `RunNamespace`.
|
||||
- Resolve environments before run consumers use sandbox data:
|
||||
- Merge environment definitions by slug.
|
||||
- Resolve `[run.environment].id`; error if the slug is missing.
|
||||
- Overlay sparse `[run.environment.*]` fields onto the selected environment.
|
||||
- Validate provider is `local`, `docker`, or `daytona`.
|
||||
- Validate CIDRs with existing `ipnet`.
|
||||
- Store the selected resolved environment in `RunNamespace.environment`.
|
||||
- Replace sandbox runtime mapping:
|
||||
- Convert `RunNamespace.environment` to `SandboxSpec` in workflow start and server preflight paths.
|
||||
- Daytona: `image.ref` maps to snapshot name, `dockerfile` to snapshot Dockerfile, resources to snapshot sizing, network to Daytona policy, labels/volumes/env/lifecycle to existing provider fields.
|
||||
- Docker: `image.ref` maps to Docker image, `cpu` maps to `cpu_quota = cpu * 100000`, memory maps to memory limit, `network.mode = block` maps to `network_mode = none`, `allow_all` maps to default/bridge.
|
||||
- Local: use resolved working directory; env overlays process env as today.
|
||||
- Capability diagnostics:
|
||||
- Hard error for explicit security/isolation properties a provider cannot enforce:
|
||||
- local with `network.mode = block` or `cidr_allow_list`
|
||||
- docker with `network.mode = cidr_allow_list`
|
||||
- Warnings only for unsupported resource limits, volumes, labels, `auto_stop`, and Docker `image.dockerfile`.
|
||||
- If Daytona has `image.dockerfile` without `image.ref`, error because snapshot creation needs a name.
|
||||
- Remove old sandbox config surface:
|
||||
- Delete `[run.sandbox]` parsing/resolution/types from user-facing config.
|
||||
- Replace CLI/API/tool manifest args named `sandbox` with `environment` where they select execution profile.
|
||||
- Keep runtime/public "sandbox" terminology only for concrete instances, e.g. `fabro sandbox ssh`, `RunSandbox`, sandbox details.
|
||||
- Update docs and generated clients:
|
||||
- Update run configuration, environments, Daytona, server configuration, CLI reference, and OpenAPI spec.
|
||||
- Regenerate Rust API types/client and TypeScript API client after OpenAPI changes.
|
||||
|
||||
## Test Plan
|
||||
|
||||
- Config tests:
|
||||
- default resolves to `run.environment.id = "default"` and Docker environment settings.
|
||||
- project/workflow/run layers merge environment catalog by slug.
|
||||
- `[run.environment]` overrides selected environment fields.
|
||||
- `env` and `labels` merge by key; `volumes` replace wholesale.
|
||||
- missing environment slug errors.
|
||||
- old `[run.sandbox]` is rejected as an unknown field.
|
||||
- Provider mapping tests:
|
||||
- Daytona environment maps to snapshot/resources/network/labels/volumes/env.
|
||||
- Docker environment maps image, CPU, memory, network block, and env.
|
||||
- Local environment ignores non-security unsupported fields with warnings.
|
||||
- Validation tests:
|
||||
- docker plus CIDR allow-list errors.
|
||||
- local plus blocked network errors.
|
||||
- resource limits unsupported by provider produce warnings, not errors.
|
||||
- volumes unsupported by provider produce warnings, not errors.
|
||||
- Daytona dockerfile without image ref errors.
|
||||
- Integration/API tests:
|
||||
- run manifest with `[environments.<slug>]` and `[run.environment]` starts with the selected provider.
|
||||
- Dockerfile path bundling works from environment image config.
|
||||
- preflight reports capability warnings and security errors.
|
||||
- CLI/API `environment` override wins over config selection.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- No compatibility behavior is required for `[run.sandbox]` or `--sandbox`.
|
||||
- No server-side environment policy or quota enforcement is in scope.
|
||||
- Volumes are simple provider hints; unsupported volume config warns and continues.
|
||||
- Resource limits are best-effort hints; unsupported resource fields warn and continue.
|
||||
- Provider names remain explicit for now: `local`, `docker`, and `daytona`.
|
||||
|
||||
|
||||
## Completed stages
|
||||
- **toolchain**: succeeded
|
||||
- Script: `command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1`
|
||||
- Output:
|
||||
```
|
||||
cargo 1.95.0 (f2d3ce0bd 2026-03-21)
|
||||
```
|
||||
- **preflight_compile**: succeeded
|
||||
- Script: `cargo check -q --workspace 2>&1`
|
||||
- Output: (empty)
|
||||
- **preflight_lint**: failed
|
||||
- Script: `cargo +nightly-2026-04-14 clippy -q --workspace --all-targets -- -D warnings 2>&1`
|
||||
- Output:
|
||||
```
|
||||
error: adding items after statements is confusing, since items exist from the start of the scope
|
||||
--> lib/crates/fabro-sandbox/src/docker.rs:232:9
|
||||
|
|
||||
232 | use std::io::Read as _;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
|
||||
= note: `-D clippy::items-after-statements` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::items_after_statements)]`
|
||||
|
||||
error: could not compile `fabro-sandbox` (lib) due to 1 previous error
|
||||
error: could not compile `fabro-sandbox` (lib test) due to 1 previous error
|
||||
```
|
||||
|
||||
## Context
|
||||
- failure_class: deterministic
|
||||
- failure_signature: preflight_lint|deterministic|script failed with exit code: <n> ## output error: adding items after statements is confusing,since items exist from the start of the scope --> lib/crates/fabro-sandbox/src/docker.rs:<n>:<n> | <n> | use std::io::read as _; | ^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
The preflight lint step failed. Read the build output from context and fix all clippy lint warnings.
|
||||
5
stages/005-fix_lints@1/provider_used.json
Normal file
5
stages/005-fix_lints@1/provider_used.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"mode": "agent",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-opus-4-7"
|
||||
}
|
||||
5
stages/005-fix_lints@1/response.md
Normal file
5
stages/005-fix_lints@1/response.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Clippy passes cleanly now. Summary of fixes:
|
||||
|
||||
1. **`lib/crates/fabro-sandbox/src/docker.rs`** — moved `use std::io::Read as _;` (with its `#[expect(clippy::disallowed_types, ...)]` attribute) to the top of `download_file_bytes`, before any statements, to satisfy `clippy::items_after_statements`.
|
||||
|
||||
2. **`lib/crates/fabro-agent/src/apply_patch.rs`** — replaced four `std::fs::{write, read_to_string}` test calls (disallowed in Tokio paths) with `tokio::fs` equivalents, added `use tokio::fs;` to the test module, and rewrote the calls as `fs::…` to also satisfy `clippy::absolute_paths`.
|
||||
Loading…
Add table
Reference in a new issue