diff --git a/.config/nextest.toml b/.config/nextest.toml index 65282c997..fd4faaf7a 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -3,6 +3,11 @@ slow-timeout = { period = "1s", terminate-after = 3 } leak-timeout = "500ms" + # Real Docker worker crashes wait for supervisor cleanup and retain files. + [[profile.default.overrides]] + filter = "package(fabro-cli) & test(worker_crash_honors_the_docker_stop_policy_and_retains_files)" + slow-timeout = { period = "30s", terminate-after = 3 } + [[profile.default.overrides]] filter = "package(fabro-cli)" slow-timeout = { period = "6s", terminate-after = 4 } diff --git a/.fabro/Dockerfile b/.fabro/Dockerfile index 6268a5484..9797ddb7f 100644 --- a/.fabro/Dockerfile +++ b/.fabro/Dockerfile @@ -55,7 +55,7 @@ RUN cargo install cargo-nextest --locked ENV CARGO_INCREMENTAL=0 # Bun -RUN curl -fsSL https://bun.sh/install | bash +RUN curl -fsSL https://bun.sh/install | bash -s -- bun-v1.4.4 ENV PATH="/root/.bun/bin:${PATH}" WORKDIR /root diff --git a/.fabro/project.toml.bak b/.fabro/project.toml.bak index 24f0d8384..75fb36868 100644 --- a/.fabro/project.toml.bak +++ b/.fabro/project.toml.bak @@ -40,7 +40,7 @@ RUN cargo install cargo-nextest --locked ENV CARGO_INCREMENTAL=0 # Bun -RUN curl -fsSL https://bun.sh/install | bash +RUN curl -fsSL https://bun.sh/install | bash -s -- bun-v1.4.4 ENV PATH="/root/.bun/bin:${PATH}" WORKDIR /root diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b80b429f6..756b2f1b3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -45,7 +45,7 @@ jobs: - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 if: steps.skip.outputs.skip != 'true' with: - bun-version: 1.3.14 + bun-version: 1.4.4 no-cache: true - name: Install bun deps (for SPA verify) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f72e5c42c..a1e35eee2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.3.14 + bun-version: 1.4.4 no-cache: true - name: Install bun deps diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index f2086669e..1da01d53d 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -45,7 +45,7 @@ jobs: persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.3.14 + bun-version: 1.4.4 - run: bun install --frozen-lockfile - run: cd apps/fabro-web && bun run typecheck - run: cd lib/packages/fabro-api-client && bun run typecheck @@ -61,7 +61,7 @@ jobs: persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.3.14 + bun-version: 1.4.4 - run: bun install --frozen-lockfile - run: cd apps/fabro-web && bun run test @@ -76,7 +76,7 @@ jobs: persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.3.14 + bun-version: 1.4.4 - run: bun install --frozen-lockfile - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable with: diff --git a/Cargo.lock b/Cargo.lock index 50d5b636b..e8a87051e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -355,9 +355,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.16.3" +version = "1.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec6fb3fe69024a75fa7e1bfb48aa6cf59706a101658ea01bfd33b2b248a038f" +checksum = "faac5829c2b74c28f830747e7818ccfb684261b5f48a1118b1e2a13d36dfab13" dependencies = [ "aws-lc-sys", "untrusted 0.7.1", @@ -366,14 +366,15 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.40.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50037ee5e1e41e7b8f9d161680a725bd1626cb6f8c7e901f91f942850852fe7" +checksum = "f1622d8446a2d4b2ce0c7eefc73dd43a99779028d5ee5c2dd8073a658ba8a2bc" dependencies = [ "cc", "cmake", "dunce", "fs_extra", + "pkg-config", ] [[package]] @@ -1991,7 +1992,7 @@ dependencies = [ [[package]] name = "fabro-api" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "chrono", "fabro-automation", @@ -2017,7 +2018,7 @@ dependencies = [ [[package]] name = "fabro-auth" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2042,7 +2043,7 @@ dependencies = [ [[package]] name = "fabro-automation" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2063,11 +2064,11 @@ dependencies = [ [[package]] name = "fabro-build-support" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" [[package]] name = "fabro-checkpoint" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "fabro-config", "fabro-types", @@ -2075,7 +2076,7 @@ dependencies = [ [[package]] name = "fabro-cli" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "assert_cmd", @@ -2171,7 +2172,7 @@ dependencies = [ [[package]] name = "fabro-client" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "bytes", @@ -2200,7 +2201,7 @@ dependencies = [ [[package]] name = "fabro-config" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2229,7 +2230,7 @@ dependencies = [ [[package]] name = "fabro-db" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2242,7 +2243,7 @@ dependencies = [ [[package]] name = "fabro-dev" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "assert_cmd", @@ -2261,7 +2262,7 @@ dependencies = [ [[package]] name = "fabro-dot" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "fabro-template", "fabro-types", @@ -2273,7 +2274,7 @@ dependencies = [ [[package]] name = "fabro-dump" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "bytes", @@ -2287,7 +2288,7 @@ dependencies = [ [[package]] name = "fabro-environment" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2309,7 +2310,7 @@ dependencies = [ [[package]] name = "fabro-github" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2334,7 +2335,7 @@ dependencies = [ [[package]] name = "fabro-graphviz" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "fabro-dot", @@ -2344,7 +2345,7 @@ dependencies = [ [[package]] name = "fabro-http" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "fabro-static", "http 1.4.0", @@ -2354,7 +2355,7 @@ dependencies = [ [[package]] name = "fabro-install" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "fabro-config", @@ -2371,7 +2372,7 @@ dependencies = [ [[package]] name = "fabro-interview" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "async-trait", "fabro-types", @@ -2383,7 +2384,7 @@ dependencies = [ [[package]] name = "fabro-llm" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "async-trait", "bytes", @@ -2408,7 +2409,7 @@ dependencies = [ [[package]] name = "fabro-macros" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "clap", "fabro-options-metadata", @@ -2419,7 +2420,7 @@ dependencies = [ [[package]] name = "fabro-manifest" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2448,7 +2449,7 @@ dependencies = [ [[package]] name = "fabro-mcp-server" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "fabro-client", @@ -2468,7 +2469,7 @@ dependencies = [ [[package]] name = "fabro-mcp-store" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "chrono", "fabro-db", @@ -2486,7 +2487,7 @@ dependencies = [ [[package]] name = "fabro-oauth" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "axum", @@ -2508,7 +2509,7 @@ dependencies = [ [[package]] name = "fabro-options-metadata" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "serde", "serde_json", @@ -2516,7 +2517,7 @@ dependencies = [ [[package]] name = "fabro-petri" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2571,7 +2572,7 @@ dependencies = [ [[package]] name = "fabro-proc" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "libc", "tempfile", @@ -2583,7 +2584,7 @@ dependencies = [ [[package]] name = "fabro-redact" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "aho-corasick", "pebble-coding-agent", @@ -2595,12 +2596,13 @@ dependencies = [ "toml 0.8.23", "tracing", "tracing-subscriber", + "ulid", "url", ] [[package]] name = "fabro-server" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2695,7 +2697,7 @@ dependencies = [ [[package]] name = "fabro-slack" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "fabro-http", "fabro-interview", @@ -2716,18 +2718,18 @@ dependencies = [ [[package]] name = "fabro-spa" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "rust-embed", ] [[package]] name = "fabro-static" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" [[package]] name = "fabro-store" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "bytes", "chrono", @@ -2755,7 +2757,7 @@ dependencies = [ [[package]] name = "fabro-telemetry" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "base64", @@ -2781,7 +2783,7 @@ dependencies = [ [[package]] name = "fabro-template" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "fabro-types", @@ -2795,7 +2797,7 @@ dependencies = [ [[package]] name = "fabro-test" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "assert_cmd", @@ -2820,7 +2822,7 @@ dependencies = [ [[package]] name = "fabro-tool" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2844,7 +2846,7 @@ dependencies = [ [[package]] name = "fabro-tracker" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2858,7 +2860,7 @@ dependencies = [ [[package]] name = "fabro-types" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "chrono", "clap", @@ -2885,7 +2887,7 @@ dependencies = [ [[package]] name = "fabro-util" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "console 0.15.11", @@ -2908,7 +2910,7 @@ dependencies = [ [[package]] name = "fabro-variable" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2925,7 +2927,7 @@ dependencies = [ [[package]] name = "fabro-vault" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "chrono", @@ -2944,7 +2946,7 @@ dependencies = [ [[package]] name = "fabro-workflow" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "anyhow", "async-trait", @@ -2989,7 +2991,7 @@ dependencies = [ [[package]] name = "fabro-workflow-version" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "fabro-config", "fabro-dot", @@ -3716,7 +3718,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots 1.0.6", + "webpki-roots 1.0.10", ] [[package]] @@ -4301,7 +4303,7 @@ checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "lithos-llm" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/lithos-llm?branch=main#b47b0065df903cb759a0911100d151bd04fc5546" +source = "git+https://github.com/lithoscomputer/lithos-llm?branch=main#e8fd3ecf593fa943646ad5cd7bf584fa117dfca9" dependencies = [ "async-trait", "aws-config", @@ -5091,7 +5093,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pebble-agent" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/pebble?branch=main#68955515624540dc582636e377ddc3210dec8503" +source = "git+https://github.com/lithoscomputer/pebble?branch=main#65a3bab8b35f4ce46ef0742599511a331de5885b" dependencies = [ "async-trait", "futures-util", @@ -5108,7 +5110,7 @@ dependencies = [ [[package]] name = "pebble-cli-core" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/pebble?branch=main#68955515624540dc582636e377ddc3210dec8503" +source = "git+https://github.com/lithoscomputer/pebble?branch=main#65a3bab8b35f4ce46ef0742599511a331de5885b" dependencies = [ "anyhow", "async-trait", @@ -5137,7 +5139,7 @@ dependencies = [ [[package]] name = "pebble-coding-agent" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/pebble?branch=main#68955515624540dc582636e377ddc3210dec8503" +source = "git+https://github.com/lithoscomputer/pebble?branch=main#65a3bab8b35f4ce46ef0742599511a331de5885b" dependencies = [ "async-trait", "futures-util", @@ -5179,7 +5181,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "petri-attractor-steps" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "globset", @@ -5210,7 +5212,7 @@ dependencies = [ [[package]] name = "petri-driver" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "getrandom 0.3.4", @@ -5230,7 +5232,7 @@ dependencies = [ [[package]] name = "petri-engine" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "petri-ir", "serde", @@ -5242,7 +5244,7 @@ dependencies = [ [[package]] name = "petri-execution" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "petri-driver", @@ -5266,7 +5268,7 @@ dependencies = [ [[package]] name = "petri-executor" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "libc", @@ -5281,7 +5283,7 @@ dependencies = [ [[package]] name = "petri-executor-sandbox" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "petri-executor", @@ -5303,7 +5305,7 @@ dependencies = [ [[package]] name = "petri-frontend" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "marked-yaml", "petri-ir", @@ -5317,7 +5319,7 @@ dependencies = [ [[package]] name = "petri-frontend-attractor" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "minijinja", "petri-frontend", @@ -5334,7 +5336,7 @@ dependencies = [ [[package]] name = "petri-frontend-fabro" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "petri-frontend", "petri-frontend-attractor", @@ -5342,7 +5344,6 @@ dependencies = [ "regex", "serde", "serde_json", - "shlex", "smol_str", "toml 0.9.12+spec-1.1.0", ] @@ -5350,7 +5351,7 @@ dependencies = [ [[package]] name = "petri-frontend-native" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "petri-frontend", "petri-ir", @@ -5361,7 +5362,7 @@ dependencies = [ [[package]] name = "petri-ir" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "regex", "serde", @@ -5374,7 +5375,7 @@ dependencies = [ [[package]] name = "petri-runtime" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "petri-driver", @@ -5395,7 +5396,7 @@ dependencies = [ [[package]] name = "petri-steps" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "petri-executor", @@ -5411,7 +5412,7 @@ dependencies = [ [[package]] name = "petri-store" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "getrandom 0.3.4", @@ -5426,7 +5427,7 @@ dependencies = [ [[package]] name = "petri-testkit" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/petri.git?branch=main#56ec3849ca693974ff778aa5ad4f9f9410d47d29" +source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2" dependencies = [ "async-trait", "petri-driver", @@ -6018,7 +6019,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams 0.4.2", "web-sys", - "webpki-roots 1.0.6", + "webpki-roots 1.0.10", ] [[package]] @@ -6283,9 +6284,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.103.13" +version = "0.103.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" dependencies = [ "aws-lc-rs", "ring", @@ -6317,24 +6318,27 @@ dependencies = [ [[package]] name = "sandbox-driver" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "async-trait", + "futures-util", "globset", "humantime", + "jsonschema", "rand 0.10.1", "serde", "serde_json", "thiserror 2.0.18", "tokio", "tokio-util", + "toml 0.8.23", "tracing", ] [[package]] name = "sandbox-driver-daytona" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "anyhow", "async-trait", @@ -6362,7 +6366,7 @@ dependencies = [ [[package]] name = "sandbox-driver-daytona-config" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "sandbox-driver-docker-config", "serde", @@ -6372,7 +6376,7 @@ dependencies = [ [[package]] name = "sandbox-driver-docker" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "anyhow", "async-trait", @@ -6393,7 +6397,7 @@ dependencies = [ [[package]] name = "sandbox-driver-docker-config" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "serde", "serde_json", @@ -6402,7 +6406,7 @@ dependencies = [ [[package]] name = "sandbox-driver-host" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "anyhow", "async-trait", @@ -6420,7 +6424,7 @@ dependencies = [ [[package]] name = "sandbox-driver-protocol" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "async-trait", "base64", @@ -6437,11 +6441,13 @@ dependencies = [ [[package]] name = "sandbox-driver-testing" version = "0.1.0" -source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#4b35158b591337a9ac17295ca53158f9e8ce4029" +source = "git+https://github.com/lithoscomputer/sandbox-driver?branch=main#e5e9582567524963b689d23e868f4dd2c342fa74" dependencies = [ "async-trait", "sandbox-driver", + "serde_json", "tokio", + "tokio-util", ] [[package]] @@ -7925,7 +7931,7 @@ dependencies = [ [[package]] name = "twin-github" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" dependencies = [ "axum", "base64", @@ -8427,9 +8433,9 @@ dependencies = [ [[package]] name = "webpki-root-certs" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" +checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb" dependencies = [ "rustls-pki-types", ] @@ -8440,14 +8446,14 @@ version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" dependencies = [ - "webpki-roots 1.0.6", + "webpki-roots 1.0.10", ] [[package]] name = "webpki-roots" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9" dependencies = [ "rustls-pki-types", ] diff --git a/Cargo.toml b/Cargo.toml index 15fbf3259..8a714c981 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ resolver = "2" [workspace.package] edition = "2021" -version = "0.387.0-nightly.0" +version = "0.400.0-nightly.0" license = "MIT" [workspace.dependencies] diff --git a/apps/fabro-web/app/components/environment-form.test.ts b/apps/fabro-web/app/components/environment-form.test.ts index 0b661278c..976234da6 100644 --- a/apps/fabro-web/app/components/environment-form.test.ts +++ b/apps/fabro-web/app/components/environment-form.test.ts @@ -1,9 +1,16 @@ import { describe, expect, test } from "bun:test"; +import { createElement, useState } from "react"; +import TestRenderer, { act } from "react-test-renderer"; +import type { Environment, EnvironmentResourcesSettings } from "@qltysh/fabro-api-client"; +import { setupReactTestEnv } from "../lib/test-utils"; import { EMPTY_ENVIRONMENT_FORM, + EnvironmentFormFields, createRequestFromForm, + environmentToFormValues, isEnvironmentFormValid, + replaceRequestFromForm, type EnvironmentFormValues, } from "./environment-form"; @@ -48,3 +55,115 @@ describe("environment image source", () => { expect(request.image.dockerfile?.value).toBe("FROM ubuntu"); }); }); + +function environment(resources: EnvironmentResourcesSettings): Environment { + return { + id: "roundtrip", + revision: "revision-1", + provider: "docker", + image: { docker: "ubuntu:24.04", dockerfile: null }, + resources, + network: { mode: "allow_all", allow: [] }, + lifecycle: { preserve: false, stop_on_terminal: true, auto_stop: null }, + labels: { owner: "api", purpose: "roundtrip" }, + env: { TZ: "UTC" }, + }; +} + +describe("environment resource round trips", () => { + const cases: EnvironmentResourcesSettings[] = [ + // API response for 512MiB; regression originally reported in #952. + { cpu: null, memory: "536870912B", disk: null }, + { cpu: 4, memory: "4GB", disk: "8GB" }, + { cpu: null, memory: null, disk: null }, + { cpu: 32, memory: "64GB", disk: "2TB" }, + { cpu: 1, memory: "512MiB", disk: "1GiB" }, + { cpu: 2, memory: "1.5GB", disk: "512MB" }, + { cpu: 2, memory: "1B", disk: "1TiB" }, + ]; + + for (const resources of cases) { + test(`no-op save preserves ${JSON.stringify(resources)}`, () => { + const original = environment(resources); + const { id, revision, ...settings } = original; + expect(replaceRequestFromForm(environmentToFormValues(original))).toEqual(settings); + }); + + test(`unrelated edits preserve ${JSON.stringify(resources)} and labels`, () => { + const original = environment(resources); + const values = environmentToFormValues(original); + const saved = replaceRequestFromForm({ + ...values, + dockerRef: "ubuntu:26.04", + preserve: true, + autoStop: "30m", + envVars: [...values.envVars, { key: "EDITOR", value: "vi" }], + }); + expect(saved.resources).toEqual(resources); + expect(saved.labels).toEqual(original.labels); + expect(saved.image.docker).toBe("ubuntu:26.04"); + expect(saved.lifecycle).toEqual({ preserve: true, stop_on_terminal: true, auto_stop: "30m" }); + expect(saved.env).toEqual({ TZ: "UTC", EDITOR: "vi" }); + }); + } + + test("editing one resource preserves the other resources", () => { + const values = environmentToFormValues(environment(cases[0])); + expect(replaceRequestFromForm({ ...values, cpu: 6 }).resources).toEqual({ + ...cases[0], cpu: 6, + }); + expect(replaceRequestFromForm({ ...values, memory: "6GB" }).resources).toEqual({ + ...cases[0], memory: "6GB", + }); + expect(replaceRequestFromForm({ ...values, disk: "12GB" }).resources).toEqual({ + ...cases[0], disk: "12GB", + }); + }); + + test("new environments keep the existing resource defaults", () => { + expect(createRequestFromForm(form({ dockerRef: "ubuntu:24.04" })).resources) + .toEqual({ cpu: 4, memory: "8GB", disk: "16GB" }); + }); +}); + +test("sliders preserve loaded resources until that specific slider changes", () => { + const cleanup = setupReactTestEnv(); + let renderer: TestRenderer.ReactTestRenderer | undefined; + let saved: ReturnType | undefined; + function Editor() { + const [values, setValues] = useState(() => environmentToFormValues(environment({ + cpu: null, memory: "536870912B", disk: null, + }))); + saved = replaceRequestFromForm(values); + return createElement(EnvironmentFormFields, { values, onChange: setValues, lockId: true }); + } + try { + act(() => { renderer = TestRenderer.create(createElement(Editor)); }); + const input = (label: string) => renderer!.root.findByProps({ "aria-label": label }); + for (const [label, min, max] of [["CPU", 1, 8], ["Memory", 1, 16], ["Disk", 1, 20]] as const) { + expect(input(label).props.type).toBe("range"); + expect(input(label).props.min).toBe(min); + expect(input(label).props.max).toBe(max); + expect(input(label).props.step).toBe(1); + } + expect(input("CPU").props["aria-valuetext"]).toBe("Provider default"); + expect(input("Memory").props.value).toBe(1); + expect(input("Memory").props["aria-valuetext"]).toBe("536870912B"); + expect(input("Disk").props["aria-valuetext"]).toBe("Provider default"); + act(() => { input("Image reference").props.onChange({ target: { value: "alpine:latest" } }); }); + expect(saved!.resources).toEqual({ cpu: null, memory: "536870912B", disk: null }); + expect(saved!.labels).toEqual({ owner: "api", purpose: "roundtrip" }); + act(() => { input("CPU").props.onChange({ target: { value: "6" } }); }); + expect(saved!.resources).toEqual({ cpu: 6, memory: "536870912B", disk: null }); + // Selecting the displayed fallback is an explicit edit, even when the + // numeric position matches the initial projection of the loaded value. + act(() => { input("Memory").props.onChange({ target: { value: "2" } }); }); + act(() => { input("Memory").props.onChange({ target: { value: "1" } }); }); + expect(saved!.resources).toEqual({ cpu: 6, memory: "1GB", disk: null }); + act(() => { input("Disk").props.onChange({ target: { value: "12" } }); }); + expect(saved!.resources).toEqual({ cpu: 6, memory: "1GB", disk: "12GB" }); + } finally { + act(() => { renderer?.unmount(); }); + cleanup(); + } +}); diff --git a/apps/fabro-web/app/components/environment-form.tsx b/apps/fabro-web/app/components/environment-form.tsx index a78a6cc10..bdc12ad6b 100644 --- a/apps/fabro-web/app/components/environment-form.tsx +++ b/apps/fabro-web/app/components/environment-form.tsx @@ -39,8 +39,8 @@ export function parseCreatableProvider(value: string | null): string { // Environment ids are server-managed file names: lowercase, digits, hyphens. const ENVIRONMENT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/; -// Resource sliders pick a concrete value within a fixed range. Memory and disk -// are expressed in whole GB; the wire format keeps the `GB` suffix string. +// Sliders select values within these ranges; loaded API values remain intact +// until the user moves that resource's slider. const CPU = { min: 1, max: 8, step: 1, default: 4 }; const MEMORY = { min: 1, max: 16, step: 1, default: 8 }; const DISK = { min: 1, max: 20, step: 1, default: 16 }; @@ -57,9 +57,9 @@ export interface EnvironmentFormValues { imageSource: ImageSource; dockerRef: string; dockerfile: string; - cpu: number; - memory: number; - disk: number; + cpu: number | null; + memory: string | null; + disk: string | null; blockNetwork: boolean; preserve: boolean; stopOnTerminal: boolean; @@ -78,8 +78,8 @@ export const EMPTY_ENVIRONMENT_FORM: EnvironmentFormValues = { dockerRef: "", dockerfile: "", cpu: CPU.default, - memory: MEMORY.default, - disk: DISK.default, + memory: `${MEMORY.default}GB`, + disk: `${DISK.default}GB`, blockNetwork: false, preserve: false, stopOnTerminal: true, @@ -95,9 +95,9 @@ export function environmentToFormValues(environment: Environment): EnvironmentFo imageSource: environment.image.dockerfile ? "dockerfile" : "image", dockerRef: environment.image.docker ?? "", dockerfile: environment.image.dockerfile?.value ?? "", - cpu: clampGb(environment.resources.cpu, CPU), - memory: parseGb(environment.resources.memory, MEMORY), - disk: parseGb(environment.resources.disk, DISK), + cpu: environment.resources.cpu, + memory: environment.resources.memory, + disk: environment.resources.disk, blockNetwork: environment.network.mode === EnvironmentNetworkMode.BLOCK, preserve: environment.lifecycle.preserve, stopOnTerminal: environment.lifecycle.stop_on_terminal, @@ -169,8 +169,8 @@ function imageFromForm(values: EnvironmentFormValues): EnvironmentApiImageSettin function resourcesFromForm(values: EnvironmentFormValues): EnvironmentResourcesSettings { return { cpu: values.cpu, - memory: `${values.memory}GB`, - disk: `${values.disk}GB`, + memory: values.memory, + disk: values.disk, }; } @@ -181,8 +181,8 @@ interface ResourceRange { default: number; } -// Snap a numeric value into the slider range, falling back to the default when -// the environment leaves the resource unset (provider default). +// Project values onto the slider for display only. Never serialize this +// rounded/clamped position unless the user explicitly changes the slider. function clampGb(value: number | null, range: ResourceRange): number { if (value === null) return range.default; return Math.min(range.max, Math.max(range.min, Math.round(value))); @@ -198,9 +198,10 @@ function parseGb(value: string | null, range: ResourceRange): number { const amount = Number(match[1]); if (!Number.isFinite(amount)) return range.default; const perGb: { [unit: string]: number } = { - "": 1, g: 1, gb: 1, gib: 1, - m: 1 / 1000, mb: 1 / 1000, mib: 1 / 1000, - t: 1000, tb: 1000, tib: 1000, + "": 1, g: 1, gb: 1, gib: 1024 ** 3 / 1e9, + b: 1 / 1e9, k: 1e-6, kb: 1e-6, kib: 1024 / 1e9, + m: 1 / 1000, mb: 1 / 1000, mib: 1024 ** 2 / 1e9, + t: 1000, tb: 1000, tib: 1024 ** 4 / 1e9, }; const factor = perGb[match[2].toLowerCase()] ?? 1; return clampGb(amount * factor, range); @@ -322,27 +323,27 @@ export function EnvironmentFormFields({ patch({ cpu })} - format={(n) => `${n} CPU`} + displayValue={values.cpu === null ? "Provider default" : `${values.cpu} CPU`} /> patch({ memory })} - format={(n) => `${n} GB`} + value={parseGb(values.memory, MEMORY)} + onChange={(memory) => patch({ memory: `${memory}GB` })} + displayValue={values.memory?.replace(/GB$/, " GB") ?? "Provider default"} /> patch({ disk })} - format={(n) => `${n} GB`} + value={parseGb(values.disk, DISK)} + onChange={(disk) => patch({ disk: `${disk}GB` })} + displayValue={values.disk?.replace(/GB$/, " GB") ?? "Provider default"} /> @@ -429,13 +430,13 @@ function ResourceSlider({ value, range, ariaLabel, - format, + displayValue, onChange, }: { value: number; range: ResourceRange; ariaLabel: string; - format: (value: number) => string; + displayValue: string; onChange: (value: number) => void; }) { const fill = ((value - range.min) / (range.max - range.min)) * 100; @@ -448,6 +449,7 @@ function ResourceSlider({ - - {format(value)} + + {displayValue} ); diff --git a/apps/fabro-web/app/components/markdown.test.tsx b/apps/fabro-web/app/components/markdown.test.tsx new file mode 100644 index 000000000..722fd9a05 --- /dev/null +++ b/apps/fabro-web/app/components/markdown.test.tsx @@ -0,0 +1,27 @@ +import { describe, expect, test } from "bun:test"; +import { renderToStaticMarkup } from "react-dom/server"; + +import { Markdown } from "./markdown"; + +describe("Markdown", () => { + test("renders GitHub-flavored Markdown", () => { + const html = renderToStaticMarkup( + , + ); + + expect(html).toContain("

Plan

"); + expect(html).toContain('type="checkbox"'); + expect(html).toContain("Review this"); + }); + + test("strips raw HTML and unsafe URLs", () => { + const html = renderToStaticMarkup( + alert("no")\n\n[bad](javascript:alert("no"))'} + />, + ); + + expect(html).not.toContain("