Visual Studio Code, rebuilt in Rust
Rust
ci: check SAFETY comments in their own job and pause Windows
rokarturf77205609b40
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 5eccf2c5fab..ba25dbbfb8e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -46,6 +46,32 @@ jobs:arguments: --lockedcommand: check advisories+ # clippy::undocumented_unsafe_blocks (native/Cargo.toml); every other clippy lint is off. The crates without unsafe+ # code forbid it, which the build itself checks (docs/memory-safety.md). Its own job: clippy's build shares nothing+ # with the test build, and inside the macOS test job it added 261 s to the run. Not expected red on any OS.+ safety:+ name: SAFETY comments (${{ matrix.os }} ${{ matrix.arch }})+ strategy:+ fail-fast: false+ matrix:+ include:+ - os: macos+ arch: arm64+ runner: macos-26+ - os: linux+ arch: x64+ runner: ubuntu-24.04+ - os: linux+ arch: arm64+ runner: ubuntu-24.04-arm+ runs-on: ${{ matrix.runner }}+ timeout-minutes: 90+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ - uses: ./.github/actions/setup+ - working-directory: native+ run: cargo clippy -p app -p exthost --all-targets --locked -- -A clippy::all+test:name: test (${{ matrix.os }} ${{ matrix.arch }})strategy:@@ -65,30 +91,14 @@ jobs:arch: arm64runner: ubuntu-24.04-armexpected-red: true- # Expected red until M24 Windows fixes its test failures (port/ledger.md).- - os: windows- arch: x64- runner: windows-latest- expected-red: true- - os: windows- arch: arm64- runner: windows-11-arm- expected-red: true+ # Windows (M24) is paused: its tests run by hand in windows.yml, and its caches left too little of the 10 GB+ # cache limit for macOS's.runs-on: ${{ matrix.runner }}continue-on-error: ${{ matrix.expected-red == true }}timeout-minutes: 240steps:- # The runners check out with CRLF, which port/patches/*.patch and the tests' fixtures do not expect;- # node_modules paths pass MAX_PATH.- - if: runner.os == 'Windows'- run: git config --global core.autocrlf false && git config --global core.longpaths true- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1- uses: ./.github/actions/setup- # clippy::undocumented_unsafe_blocks (native/Cargo.toml); every other clippy lint is off. The crates without- # unsafe code forbid it, which the build itself checks (docs/memory-safety.md).- - name: unsafe blocks have a SAFETY comment- working-directory: native- run: cargo clippy -p app -p exthost --all-targets --locked -- -A clippy::all- name: cargo testworking-directory: native# The dialog, keyboard and system-wide keybinding tests open X11 windows; GPUI's headless renderer uses Mesa's Vulkan.diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex e1ef47b9828..c9b379d6313 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -184,7 +184,7 @@ The tools in `port/tools` each start with a header that states their use. The ma- Build inputs. The build needs the upstream checkout: `native/vscode_src.rs` resolves it for the build scripts. `app/build.rs` makes the NLS index from upstream's `localize` calls and renders the Dock icons. A few modules embed upstream files, and tests read upstream fixtures. A binary outside a package also reads the checkout at run time as its app root: `product.json`, icons and the built-in extensions.- Build order. Compile upstream once, run `bun port/tools/build-exthost`, then `cargo gc build --release -p app`. `README.md` has the commands. The debug profile builds dependencies with optimization and the port's crates without (`native/Cargo.toml`).- Packaging. `port/tools/package-app` makes the signed macOS app and its update files. `port/tools/package-linux` makes the Linux archive. `port/tools/app-files.ts` lists the files a package ships.-- CI. `.github/workflows/ci.yml` runs the repository checks and every crate's tests on macOS, Linux and Windows for each push to `main` and each pull request. `.github/workflows/linux.yml` and `.github/workflows/windows.yml` build a package by hand. A release is a manual step.+- CI. `.github/workflows/ci.yml` runs the repository checks and every crate's tests on macOS and Linux for each push to `main` and each pull request (Windows, paused, by hand in `windows.yml`). `.github/workflows/linux.yml` and `.github/workflows/windows.yml` build a package by hand. A release is a manual step.## Cross-cutting rulesdiff --git a/README.md b/README.mdindex 850babfe716..dca5a866bb9 100644--- a/README.md+++ b/README.md@@ -120,7 +120,7 @@ bun port/tools/build-exthostnative/target/release/vsrustium```-[CI](.github/workflows/ci.yml) runs the ledger, README coverage and license checks, and `cargo test --workspace` on macOS arm64, Linux x64 and arm64, and Windows x64 and arm64, on every push to main and pull request.+[CI](.github/workflows/ci.yml) runs the ledger, README coverage and license checks, and `cargo test --workspace` on macOS arm64 and Linux x64 and arm64, on every push to main and pull request. Windows runs by hand in [windows.yml](.github/workflows/windows.yml) while it is paused.`port/tools/package-app` (macOS) and `port/tools/package-linux` make the release app. How the work is tracked and checked: [CONTRIBUTING.md](CONTRIBUTING.md). Security issues: [SECURITY.md](SECURITY.md).diff --git a/docs/memory-safety.md b/docs/memory-safety.mdindex fa0d47794dd..f651c1de2ab 100644--- a/docs/memory-safety.md+++ b/docs/memory-safety.md@@ -82,7 +82,7 @@ Each check fails on a violation. "Shown red" names the planted violation that pr|---|---|---|---|| No `unsafe` in the eight pure crates | `#![forbid(unsafe_code)]` at each crate root | Every build | An `unsafe` block added to `diff/src/lib.rs` stops the build. || An unsafe operation in an `unsafe fn` needs its own block | `unsafe_op_in_unsafe_fn = "deny"` in `native/Cargo.toml` | Every build | A raw pointer read without a block in an `unsafe fn` of `exthost` stops the build. |-| Each block has a `SAFETY` comment | `clippy::undocumented_unsafe_blocks = "deny"` in `native/Cargo.toml` | `cargo clippy -p app -p exthost --all-targets --locked -- -A clippy::all`, in the `test` jobs of `.github/workflows/ci.yml` | A block without a comment in `exthost/src/utc.rs` fails clippy. |+| Each block has a `SAFETY` comment | `clippy::undocumented_unsafe_blocks = "deny"` in `native/Cargo.toml` | `cargo clippy -p app -p exthost --all-targets --locked -- -A clippy::all`, in the `safety` jobs of `.github/workflows/ci.yml` | A block without a comment in `exthost/src/utc.rs` fails clippy. || `unsafe` only in the listed files | `bun port/tools/docs-check.ts` | Seconds, anywhere, and in the `checks` job of `.github/workflows/ci.yml` | A file with `unsafe` that is not in the inventory fails the check. || No known vulnerable dependency | `cargo deny --locked check advisories` with `native/deny.toml` | Seconds, needs the advisory database. In the `checks` job of `.github/workflows/ci.yml` | The first run on the lock file failed on four advisories. |@@ -93,7 +93,7 @@ Notes on the checks:- Windows: `port/tools/windows-build 'cargo xwin clippy -p app -p exthost --all-targets --target x86_64-pc-windows-msvc --locked -- -A clippy::all'`- Linux: `port/tools/linux-build 'cd native && rustup component add clippy && cargo gc clippy --workspace --all-targets --locked -- -A clippy::all'`. The image of `port/tools/linux/Dockerfile` has no clippy, so each run adds it.- An ignored advisory in `native/deny.toml` has a reason. If the reason no longer holds, remove the entry.-- `.github/workflows/ci.yml` runs clippy in each `test` job, so once per OS. The Linux and Windows jobs are `expected-red` until their tests pass: a clippy failure there shows in the job but does not fail the workflow. Until then the `port/tools/windows-build` and `port/tools/linux-build` commands of this list are the gate for those two.+- `.github/workflows/ci.yml` runs clippy in its own `safety` job on macOS arm64 and Linux x64 and arm64, none of them expected red, so a missing SAFETY comment fails the run on each. Windows is paused and out of ci.yml: there the `port/tools/windows-build` command of this list is the gate.## What the checks do not provediff --git a/docs/testing.md b/docs/testing.mdindex 9ebf60a44b4..35a4806fb5b 100644--- a/docs/testing.md+++ b/docs/testing.md@@ -8,7 +8,7 @@ Builds and tests run on the build machine (the Studio), not on a laptop: `port/t`port/tools/cargo-test [-p <crate>] [<filter>...]` (default crate `app`) runs `cargo gc test` in `native/` and prints only compile errors, failed tests and the summary lines. It exits non-zero when cargo fails or when the filter matches no test, where `cargo test ... | rg` passes on both. Use it on any machine, through `port/tools/studio` too.-`.github/workflows/ci.yml` runs on each push to `main` and each pull request: the repository checks (`ledger-check`, the tests of `port/tools`, `docs-check`, licenses, advisories) and `cargo test --workspace` on macOS, Linux and Windows. The Linux and Windows jobs are `expected-red` until milestones M23 and M24 close their test gaps. The checks that need the reference app and a window do not run there.+`.github/workflows/ci.yml` runs on each push to `main` and each pull request: the repository checks (`ledger-check`, the tests of `port/tools`, `docs-check`, licenses, advisories), clippy's SAFETY check, and `cargo test --workspace` on macOS and Linux. The Linux test jobs are `expected-red` until milestone M23 closes its test gaps; Windows (M24) is paused and runs by hand in `windows.yml`. The checks that need the reference app and a window do not run there.The workspace has about 4000 tests. The `app` suite takes about a minute after the build.diff --git a/port/notes.md b/port/notes.mdindex 28fe207ab1f..9718ed14592 100644--- a/port/notes.md+++ b/port/notes.md@@ -1061,7 +1061,8 @@ What to do (milestone 21, in order):- `.github/actions/setup` is shared by ci.yml and windows.yml: the system packages of `port/tools/linux/Dockerfile` on Linux, Node 24, Bun, Rust, rust-cache, and `upstream/` cloned, installed, compiled and with its built-in extensions fetched, cached per OS and arch (1.5 GB each). Tests on Linux run under `xvfb-run`; GPUI's headless renderer takes Mesa's Vulkan.- macOS runs on `macos-26`: app's build.rs renders the Dock icons with Xcode 26's `ictool`, which `macos-15` lacks.- Linux x64's apt downloads stalled at ~100 kB/s on the image's `azure.archive.ubuntu.com` mirror (12 and 15 min in 2 of 3 runs). [awalsh128/cache-apt-pkgs-action](https://github.com/awalsh128/cache-apt-pkgs-action) (Apache-2.0) caches the packages' files but restores neither dpkg's database nor the postinst triggers WebKitGTK and Mesa need, and its docs name the same stall with the fix the setup takes: apt pointed at `archive.ubuntu.com`. arm64 already uses `ports.ubuntu.com`.-- Linux and Windows test jobs are `continue-on-error` until M23 and M24 close their test failures; `checks` and the macOS tests fail the run. Outside CI: ui-pair, pixel-check and api-tests, which drive the reference app in a GUI session on the Studio.+- Linux test jobs are `continue-on-error` until M23 closes its test failures; `checks`, the `safety` jobs and the macOS tests fail the run. Outside CI: ui-pair, pixel-check and api-tests, which drive the reference app in a GUI session on the Studio.+- Speed (fast-ci, 6 push runs before the change): the wall clock is the macOS test job, p50 1004 s and p90 1725 s. In its run on 06ecd24b0eb: setup 139 s (96 s of it restoring the 1.5 GB `upstream/` cache), clippy 261 s, `cargo test` 714 s (about 450 s building, 238 s of app tests), cache save 40 s. Clippy moved to its own `safety` job, off that path. Windows left ci.yml while M24 is paused (Artur): its four caches (4.6 GB) and the other five passed the 10 GB repository limit, so GitHub evicted macOS's Rust cache and every few runs macOS set up cold (setup p90 1022 s).## Documents and guardrails (branch worktree-docs)