diff --git a/docs/ci-audit.md b/docs/ci-audit.md index 87469467..454906e8 100644 --- a/docs/ci-audit.md +++ b/docs/ci-audit.md @@ -1,6 +1,7 @@ # CI and build audit (2026-11-02) -Base: local `main` at `f9003b7ce`. Branch `claude/ci-audit` (worktree `.git/wt/ci-audit`). Question from the owner: do the CI +Measured on local `main` at `f9003b7ce` (sections 3.1 and 3.2), then rebased onto `main` at `44fb442f5` (observability, unattended +and expert-profile merges) and re-verified (section 3.3). Branch `claude/ci-audit` (worktree `.git/wt/ci-audit`). Question from the owner: do the CI files and scripts prove that the code builds and that the checks pass? Every CI step was run one at a time on the laptop (x86_64, Windows 11 and WSL2 Ubuntu 24.04, Rust 1.99.0 on both, 16 cores, 39 GiB in WSL). Nothing here used a GPU, a model, the 5090 server or a system change (no apt, no Docker start, no settings). Raw logs and `results.tsv` (command, exit code, seconds @@ -12,7 +13,7 @@ per step) are in the worktree under `artifacts/ci-audit/` (ignored by Git, as th 2. the existing gates were red on `main`: `check-local.sh --fast`, `check-local.sh --full` (control-plane format and Clippy), `desktop.yml` (format, Clippy, hardware smoke), and nothing in the repository shows that any of them ran since 2026-10-14 (section 1); -3. several tests depend on the machine they run on instead of the code (section 4, findings 5 to 7). +3. several tests depend on the machine they run on instead of the code (section 4, findings 6 to 8). After this branch `check-local.sh --fast`, `--port` and the new `--product` pass on Linux (WSL in a real-filesystem namespace, section 3) and `--fast` on Windows, with the remaining debt reported by name. `--full` passes up to the steps that need tools @@ -77,10 +78,10 @@ two builds sharing the CPU. | `cargo test -p leleka-runtime` | WSL | FAIL-ENV 143 s | 2 tests (`failed_cleanup_or_replaced_inode_never_deletes_unowned_file`, `frozen_same_fd_hash_owner_and_source_independence`): fixtures under `../../target/` on 9p. PASS in WSL-ns, 631 tests | | `cargo test -p leleka-native-cpu-expert` | WSL | PASS 122 s | | | `cargo test -p leleka-deploy --features test-fakes` | Win | FAIL-ENV 40 s | `the_supervisor_starts_serves_status_and_reconfigure_...` refuses a 12 GiB budget: the laptop's real GPU has 1769 MiB free (another agent's engine holds VRAM) | -| `cargo test -p leleka-deploy --features test-fakes` | WSL | FAIL 53 s, 6 tests | 1 real (stale `8192` context assertion; the laptop profile is 262144), 4 FAIL-ENV (read the real GPU's free VRAM), 1 host-dependent (`dry_run_...`, section 4 finding 6) | +| `cargo test -p leleka-deploy --features test-fakes` | WSL | FAIL 53 s, 6 tests | 1 real (stale `8192` context assertion; the laptop profile is 262144), 4 FAIL-ENV (read the real GPU's free VRAM), 1 host-dependent (`dry_run_...`, section 4 finding 7) | | tests of the other 25 default-members, `--no-fail-fast` | Win / WSL | FAIL 254 s / 322 s | Win: only `leleka-experimental-ref` `literal_port` (4 tests, real). WSL adds 3 `leleka-model-format` tests (FAIL-ENV, 9p; PASS on Windows and in WSL-ns, 143 tests) | -| `cargo clippy -D warnings --no-deps` per product crate | Win / WSL | FAIL except `leleka-runtime-client` | counts in section 4 finding 8 | -| `cargo fmt --check` on the shipped crates | Win | FAIL | per-crate hunks in finding 8 | +| `cargo clippy -D warnings --no-deps` per product crate | Win / WSL | FAIL except `leleka-runtime-client` | counts in section 4 finding 9 | +| `cargo fmt --check` on the shipped crates | Win | FAIL | per-crate hunks in finding 9 | | `control-plane` format (`--full`) | WSL | FAIL | 290 hunks | | `control-plane` Clippy (`--full`, no `--no-deps`) | WSL | FAIL | it lints path dependency `leleka-model-format` (known debt) | | `desktop.yml`: Format / Lints / Hardware smoke | Win, WSL | FAIL / FAIL / FAIL | 22 hunks; same path-dependency Clippy failure; `cargo run` "could not determine which binary" (six binaries, no `default-run`) | @@ -88,11 +89,11 @@ two builds sharing the CPU. | `smoke-*.py` of `linux-static-cli` against the glibc `strata-next` | WSL | mostly FAIL-ENV | 9p lacks `chmod` (key-file mode checks), numpy missing, one script hangs without a timeout (`smoke-wait-ready`, killed after 21 min) | | python `test-*.py` of `--full` | WSL | 8 FAIL-ENV, 1 numpy | `chmod`, FIFO, symlink on 9p; `numpy` missing for `test-keyless-routing`; all PASS in WSL-ns except numpy | -### 3.2 After this branch (commit `d1861c28f` + the documentation commit) +### 3.2 After this branch, on the `f9003b7ce` base | Step | Platform | Result | Notes | | --- | --- | --- | --- | -| `check-local.sh --fast` | Win | PASS 173 s | the debt lines print `WARNING: known debt` (section 4 finding 8) | +| `check-local.sh --fast` | Win | PASS 173 s | the debt lines print `WARNING: known debt` (section 4 finding 9) | | `check-local.sh --fast` | WSL-ns | PASS 183 s | | | `check-local.sh --port` (type-check `x86_64-unknown-linux-gnu`, sampler host shim) | WSL-ns | PASS 168 s | live Python differentials SKIPPED (need a venv with numpy, PyYAML, tqdm, Jinja2, regex and a network fetch of llama.cpp `gguf-py`) | | sampler host shim alone | Win | PASS 9 s | needed a `cygpath` line for Git Bash | @@ -114,6 +115,21 @@ two builds sharing the CPU. | `cargo build --locked --release -p leleka-deploy` | Win, after | PASS | `leleka.exe` produced | | YAML parse of the four workflows, `test-gitea-release.py` | WSL-ns | PASS | the contract test only reads `linux.yml`; adding `product.yml` does not touch it | +### 3.3 After the rebase onto `44fb442f5` (the tree that would be merged; final commits) + +The rebase brought a new workspace member and new code, and the gates found problems in it at once. + +| Step | Platform | Result | Notes | +| --- | --- | --- | --- | +| `scripts/check-ci-coverage.py` | Win / WSL | **FAIL, then PASS** | `leleka-obs: workspace default-member with no CI coverage entry`: the gate did its job; one line in `scripts/ci-coverage.json` and `-p leleka-obs` in the product test list | +| `check-local.sh --product` (first run) | WSL-ns | FAIL 1468 s, 2 steps | (a) `control-plane/tests/log_failure_sse.rs` `no_panicking_log_macros_in_the_serving_crate` is red on `main` itself: the observability merge added two test-only `eprintln!` samples (`prometheus.rs`, `request_log.rs`) that this source-scanning test forbids; (b) Clippy `items_after_test_module` in `crates/deploy/src/facts.rs` (`lab_holder_running` sits after `mod tests`) | +| the same two fixed (a non-panicking `write_fmt` to stderr with the same output; the function moved above `mod tests`) | | | no behaviour change | +| `check-local.sh --product` | WSL-ns | **PASS** 1106 s | 2337 tests passed, 0 failed, 172 ignored; the same 4 debt warnings as 3.2 | +| `check-local.sh --fast` / `--port` | WSL-ns | **PASS** 160 s / 193 s | | +| `desktop.yml` Lints (`--no-deps`) / control-plane format and Clippy | WSL-ns | **PASS** 12 s / 10 s | | +| `cargo test` control-plane (425) / desktop-core (161) | WSL-ns | **PASS** 267 s / 46 s | | +| `cargo build --locked`, release `leleka`, `check-local.sh --fast`, coverage gate, format hard gates | Win | **PASS** 102 s / 25 s / 204 s / 0 s / 1 s | | + ## 4. Findings, ranked 1. **The product was not built or tested by CI** (section 2). Fixed by `product.yml` + `check-local.sh --product` + @@ -132,37 +148,40 @@ two builds sharing the CPU. tests (`kv_stream`, `kv_q4`, `kv_q8`, `qsa_attn`: 1, 5, 20 and 197 Original kernel-body lines missing from `crates/cuda-driver/src/experimental_*.cu`). Already noted in `docs/windows.md`; red on Windows and Linux alike. Now reported as debt, not hidden. Re-sync of those ports (kernel sources) is outside this audit. -5. **Tests that depend on the host instead of the code.** The `leleka-deploy` end-to-end tests read the real GPU through +5. **`main` itself has red tests the CI would have shown**: `log_failure_sse::no_panicking_log_macros_in_the_serving_crate` since the + observability merge, and `literal_port` (finding 4). The first is fixed here; the second is reported. +6. **Tests that depend on the host instead of the code.** The `leleka-deploy` end-to-end tests read the real GPU through `nvidia-smi` (free VRAM) and the default loopback ports 18766/18080. On this laptop, with another agent's engine running, 5 of 6 failures were of this kind; `docs/deploy.md` ("all passing in WSL") was true only on an idle GPU. A CI host has no GPU at all. `scripts/ci/nvidia-smi` is a stand-in that makes all but two of the 18 pass anywhere. -6. **Two deploy tests cannot both pass on one machine**: `dry_run_prints_the_plan_and_changes_nothing` needs a 5090-class host +7. **Two deploy tests cannot both pass on one machine**: `dry_run_prints_the_plan_and_changes_nothing` needs a 5090-class host with at least 141.7 GiB free disk and free default ports; `a_failing_preflight_stops_before_any_change_and_says_how_to_fix_it` needs a host that cannot hold the 5090 profile. They are reported as debt in the product job. Fix: each test writes its own stand-in `nvidia-smi` into its fixture and passes it through `PATH` (the facts reader already honours `PATH` first). -7. **Filesystem-dependent tests**: 2 `leleka-runtime`, 3 `leleka-model-format` and 8 Python test scripts need chmod, FIFO, +8. **Filesystem-dependent tests**: 2 `leleka-runtime`, 3 `leleka-model-format` and 8 Python test scripts need chmod, FIFO, symlink or ownership semantics. They fail on `/mnt/c` and pass on a real Linux filesystem. Run Linux checks from ext4 (`~/work/leleka` on the server), never from `/mnt/c`. -8. **Format and Clippy debt, by crate** (reported by `debt`; `STRICT_DEBT=1` makes it fatal). rustfmt hunks before this branch: +9. **Format and Clippy debt, by crate** (reported by `debt`; `STRICT_DEBT=1` makes it fatal). rustfmt hunks before this branch: `leleka-runtime` 2833, `leleka-cuda-driver` 1970, `leleka-native-cpu-expert` 396, `leleka-deploy` 281, `leleka-experimental-ref` 226, `leleka-memory` 224, `leleka-model-format` 143, `leleka-libc-shim` 34; now clean: `strata-control` (290), `strata-desktop-core` (22), `leleka-runtime-client` (8), `leleka-backend-api`, `leleka-context`. Clippy errors on Linux (`-D warnings`, lib target): `leleka-cuda-driver` 372, `leleka-runtime` 196, `leleka-model-format` 4. `leleka-memory` also has 3 Windows-only Clippy errors (unused imports, dead code) and `leleka-deploy` 2 (`layout.rs`, `winsys.rs`); the Linux gate does not see them. Other agents own those sources, so they were not mass-reformatted. -9. **Stale lock files.** `control-plane/Cargo.lock` and `desktop-core/Cargo.lock` (2026-10-05) are ignored by Cargo because both +10. **Stale lock files.** `control-plane/Cargo.lock` and `desktop-core/Cargo.lock` (2026-10-05) are ignored by Cargo because both crates are workspace members; `--locked` uses the root `Cargo.lock`. They disagree with it (tokio 1.53.1 vs 1.53.2) and give a false impression of what is locked. Recommend `git rm` (not done: no deletes). -10. **`smoke-wait-ready.py` has no timeout** and hung for 21 minutes when the engine mock could not start (9p run). A runner would +11. **`smoke-wait-ready.py` has no timeout** and hung for 21 minutes when the engine mock could not start (9p run). A runner would wait until its job timeout. -11. **Worktree pitfall.** The owner's global `core.autocrlf=true` makes `git worktree add` write CRLF into all 4434 text files - including the sealed `.ptx`, which makes the binary refuse to start. `scripts/dev/worktree.sh` now passes `-c core.autocrlf=false`, - `.gitattributes` marks `crates/cuda-driver/**/*.ptx` `-text`, and the product job fails if a CR is found in a sealed PTX. -12. **No timing or stability data**: nothing here is flaky-tested; each step was run once (twice for the fixed ones). +12. **Worktree pitfall.** The owner's global `core.autocrlf=true` makes `git worktree add` write CRLF into all 4434 text files + including the sealed `.ptx`, which makes the binary refuse to start. `scripts/dev/worktree.sh` now passes `-c core.autocrlf=false` (the same hazard was found independently on the release branch, + whose `*.ptx -text` line in `.gitattributes` is on `main`; the first commit of this branch also carried one and lost it in the rebase), and the product + job fails if a CR is found in a sealed PTX. +13. **No timing or stability data**: nothing here is flaky-tested; each step was run once (twice for the fixed ones). ## 5. What changed on this branch -Commit `a38b7b4eb` (CI and repairs): +Commit "ci: build and test what ships ..." (CI and repairs): * `.github/workflows/product.yml` (new, Gitea conventions of `linux.yml`): runs `scripts/check-local.sh --product` on `ubuntu-latest`. * `scripts/check-local.sh --product`: coverage gate; PTX LF check; `cargo build --locked`; release build of `leleka`, `strata-next` @@ -174,20 +193,22 @@ Commit `a38b7b4eb` (CI and repairs): exempt, when an entry is stale, or when no workflow or `check-local.sh` step names a "tested" crate. * `scripts/ci/nvidia-smi`: stand-in used by the product job for the deploy tests. * `check-local.sh`: `-p leleka-cuda-driver --features cuda-driver`; `literal_port` split out as debt; control-plane Clippy `--no-deps`. -* `desktop.yml`: hardware smoke with `--bin strata-desktop` (commit `a38b7b4eb`); Lints with `--no-deps` (the documentation commit). +* `desktop.yml`: hardware smoke with `--bin strata-desktop` (first commit); Lints with `--no-deps` (the "docs: ci-audit" commit). * Formatting of `leleka-backend-api` and `leleka-context`; a local type alias in `leleka-tokenizer` (`fast.rs`); four one-line Clippy fixes (`leleka-memory` `governor.rs` redundant cast, `leleka-deploy` `app.rs`, `wsl.rs`, `reconfigure.rs` test); the stale context assertion in `crates/deploy/tests/e2e.rs`. -* `run_port_host_tests.sh` under Git Bash; `worktree.sh` and `.gitattributes` against the autocrlf pitfall. +* `run_port_host_tests.sh` under Git Bash; `worktree.sh` against the autocrlf pitfall; `.gitattributes` keeps the CI scripts and workflows LF. -Commit `d1861c28f` (style, separable): `cargo fmt` on `strata-control`, `strata-desktop-core`, `leleka-runtime-client`, plus four -lints in them (`tool_output.rs`, a test `mut`, a collapsible `if` in `leleka-inference.rs`, `allow(dead_code)` on -`observer_adaptive_slots`). It touches 32 files in `control-plane/` and `desktop-core/`; no other local branch changes those directories -today (`claude/unattended` touches `crates/deploy`). Drop it and re-run `cargo fmt -p strata-control -p strata-desktop-core --p leleka-runtime-client` after other branches merge if conflicts matter. +Commit "ci: cover leleka-obs": `leleka-obs` added to `scripts/ci-coverage.json` and the product test list. + +Commit "style: cargo fmt on strata-control ..." (separable): `cargo fmt` on `strata-control`, `strata-desktop-core`, `leleka-runtime-client` (37 files), the +four Clippy lints in them (`tool_output.rs`, a test `mut`, a collapsible `if` in `leleka-inference.rs`, `allow(dead_code)` on +`observer_adaptive_slots`), the `log_failure_sse` fix and the `facts.rs` reorder of section 3.3. An earlier version of this commit +conflicted with the observability merge, which is why it was redone on top of it; if more branches land in these crates first, drop it +and re-run `cargo fmt -p strata-control -p strata-desktop-core -p leleka-runtime-client`. Nothing in this branch touches a kernel, `.cu`/`.ptx`, an engine numeric path, or runtime behaviour. The edits to compiled code -are formatting, a type alias, `then` to `then_some` of a struct holding borrows, `% 2 == 0` to `is_multiple_of(2)`, a removed +are formatting, a type alias, a function moved above a test module, a test-only `eprintln!` replaced by `write_fmt`, `then` to `then_some` of a struct holding borrows, `% 2 == 0` to `is_multiple_of(2)`, a removed identity cast, `chunks_exact(2)` to `as_chunks::<2>()` in a console-text decoder, and a removed unused `mut`. Release builds were re-run after them; bitwise identity of engine output is unaffected because no engine code path changed semantically. @@ -215,10 +236,10 @@ re-run after them; bitwise identity of engine output is unaffected because no en `test-keyless-routing`; cmake: `build-cpu.sh`; musl-tools: the static CLI; clang: the CUDA stub syntax check). `dotnet` SDK 10 for the desktop app. Start Docker Desktop (or use the Linux Docker on the server) for `test-cuda-driver-bootstrap.sh`, `test-cuda-fixed-ptx.sh` and the container smokes. I installed none of these. -* Decide on finding 3 (error `tool_result` key order in Messages prompts), finding 4 (re-sync of the experimental CUDA ports), finding 6 +* Decide on finding 3 (error `tool_result` key order in Messages prompts), finding 4 (re-sync of the experimental CUDA ports), finding 7 (per-test `nvidia-smi` stand-ins), and whether to `git rm` the two stale lock files. -* Merge: `claude/ci-audit` can be merged as is (`a38b7b4eb`, `d1861c28f` and this document); it adds a new workflow, which runs on - the next push once a runner exists. Expect the first hosted run to find host differences this laptop could not (disk space, runner +* Merge: `claude/ci-audit` (5 commits on top of `44fb442f5`) merges cleanly into `main` at `1cebffd58` (`git merge-tree`); it adds a new + workflow, which runs on the next push once a runner exists. Expect the first hosted run to find host differences this laptop could not (disk space, runner image, Docker access). ## 8. Reproduce