From cebb333bd7df73a5426cf8626a554dde91066011 Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Thu, 27 Aug 2026 02:03:10 -0700 Subject: [PATCH] All-platforms VSIX + the release flow consolidated in one script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 7th package, lucisv--all.vsix, carries every platform's binary pair under bin/-/ and the extension picks the right one at runtime — flat bin/ (platform package) first, then the platform-arch subdirectory, then PATH. Target-less on purpose, so Alpine and anything else vsce refuses to name gets working static binaries. The release.yml inline prune step moves into tools/prune_release_assets.sh, which now requires all seven packages by name before anything is published. Co-Authored-By: Claude Fable 5 --- .gitea/workflows/release.yml | 35 +- README.md | 14 +- docs/features/ci-release/README.md | 81 +++- docs/features/editor-platform-vsix/README.md | 424 +++++++++++++++++-- editors/vscode/extension.js | 35 +- tools/RELEASING.md | 50 ++- tools/prune_release_assets.sh | 42 ++ tools/release.sh | 88 +++- 8 files changed, 662 insertions(+), 107 deletions(-) create mode 100755 tools/prune_release_assets.sh diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 271053c..5b2a44c 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,10 +1,12 @@ # Release: pushing a tag `vX.Y.Z` builds every distribution artifact and # publishes a Gitea release with the CHANGELOG section for that version as -# its notes. What the release page carries is the six .vsix packages — -# the universal one plus darwin-arm64/darwin-x64/linux-x64/linux-arm64/ -# win32-x64 with the lucisv + lucisv-server binaries embedded — and -# SHA256SUMS; each platform package is a must, and a missing one fails -# the release. The loose binaries are still built for every target +# its notes. What the release page carries is the seven .vsix packages — +# the universal one, the five (darwin-arm64/darwin-x64/linux-x64/ +# linux-arm64/win32-x64) with the lucisv + lucisv-server binaries embedded, +# and the all-platforms one carrying every pair at once — plus SHA256SUMS. +# Every package is a must: a missing one fails the release, by name +# (tools/prune_release_assets.sh). The loose binaries are still built for +# every target # (the packages are made from them) and still audited, but they are not # attached: anyone who wants a standalone binary builds it with # `cargo build --release` (docs/features/editor-platform-vsix). @@ -34,26 +36,11 @@ jobs: echo "tag $GITHUB_REF_NAME does not match crate version $v" >&2 exit 1 } - # The release page ships extension packages only. All six must exist - # (release.sh would have failed earlier, but a missing package here is - # exactly the failure this release exists to prevent, so it is checked - # by name); the loose binaries were needed to build and audit them and - # are dropped now. SHA256SUMS is filtered, not recomputed — the - # published hashes are the audited ones — and re-verified after. + # The release page ships extension packages only: all seven checked by + # name, SHA256SUMS filtered down to them and re-verified, the loose + # binaries (needed to build and audit the packages) dropped. - name: Keep only the extension packages - run: | - v=${GITHUB_REF_NAME#v} - cd dist - for t in "" -darwin-arm64 -darwin-x64 -linux-x64 -linux-arm64 -win32-x64; do - [ -f "lucisv-$v$t.vsix" ] || { - echo "missing lucisv-$v$t.vsix" >&2 - exit 1 - } - done - grep '\.vsix$' SHA256SUMS > SHA256SUMS.tmp - mv SHA256SUMS.tmp SHA256SUMS - find . -type f ! -name '*.vsix' ! -name SHA256SUMS -delete - shasum -a 256 -c SHA256SUMS + run: tools/prune_release_assets.sh dist "${GITHUB_REF_NAME#v}" - name: Extract the release notes from CHANGELOG.md run: tools/release_notes.sh "${GITHUB_REF_NAME#v}" > dist/RELEASE_NOTES.md - name: Create the release and attach the artifacts diff --git a/README.md b/README.md index 9cc5be6..35d2bf1 100644 --- a/README.md +++ b/README.md @@ -620,6 +620,10 @@ and sideload it: code --install-extension lucisv--darwin-arm64.vsix ``` +— or take `lucisv--all.vsix`, which carries all five platforms' binaries +in one file and picks the right pair at startup, when the machine is not known +in advance (or is Alpine, which VS Code never offers a Linux package to). + Every other editor (and the universal `lucisv-.vsix`, the fallback for platforms not listed) finds `lucisv-server` on `PATH`; the binary comes from the same build as the CLI: @@ -703,10 +707,12 @@ expected outputs with `UPDATE_SNAPSHOTS=1 cargo test -p vlog_formatter`. Prebuilt downloads live on the [releases page](https://git.luci.ooo/lucio/lucisv/releases): every tagged -version carries **six `.vsix` packages** — platform-specific ones for +version carries **seven `.vsix` packages** — platform-specific ones for Apple Silicon and Intel macOS, x86-64 and ARM64 Linux (static musl) and -Windows, each with `lucisv` and `lucisv-server` embedded, plus the -universal no-binary fallback — and a `SHA256SUMS` to verify them with +Windows, each with `lucisv` and `lucisv-server` embedded, an +all-platforms one carrying every pair at once for unknown or mixed +machines, plus the universal no-binary fallback — and a `SHA256SUMS` to +verify them with (`shasum -a 256 -c SHA256SUMS`). Sideload the one for your machine with `code --install-extension`. Standalone binaries are not published; build them with `cargo build --release` (or `tools/release.sh --cross` for the @@ -720,7 +726,7 @@ To build the same artifact set yourself: ```bash tools/release.sh # host binaries + the .vsix + SHA256SUMS, into dist/ -tools/release.sh --cross # ...plus the four cross-built platforms +tools/release.sh --cross # ...plus the four cross-built platforms and the all package ``` The script itself publishes nothing anywhere; publishing is CI's job — diff --git a/docs/features/ci-release/README.md b/docs/features/ci-release/README.md index 8acd50e..952f1cf 100644 --- a/docs/features/ci-release/README.md +++ b/docs/features/ci-release/README.md @@ -6,17 +6,17 @@ Automate the checks and the release. Every push to master runs the three checks CLAUDE.md requires (fmt, clippy, test) on Gitea Actions; every tag `vX.Y.Z` builds the full cross-platform artifact set (Apple Silicon + x86_64 macOS, static-musl x86-64/ARM64 and RHEL 8-compatible Linux, -Windows — both binaries each — plus the six `.vsix` packages and +Windows — both binaries each — plus the seven `.vsix` packages and `SHA256SUMS`) and publishes a Gitea release whose notes are the CHANGELOG -section for that version. **Published assets are the six `.vsix` packages +section for that version. **Published assets are the seven `.vsix` packages only** (since 2026-08-27, owner decision): the extension is the product a -release delivers, each platform package is checked by name before -publishing, and the loose binaries — still built and audited, since the -packages embed them — stay unpublished; a standalone binary is +release delivers, every package is checked by name before publishing, and +the loose binaries — still built and audited, since the packages embed +them — stay unpublished; a standalone binary is `cargo build --release` for whoever wants one (docs/features/editor-platform-vsix). The point is that a release is one `git tag` + `git push` and cannot ship without green checks, matching -versions, written notes, and all six packages. +versions, written notes, and all seven packages. ## Assumptions @@ -46,10 +46,19 @@ versions, written notes, and all six packages. - Consumes `tools/release.sh --cross` unchanged: artifact names (`lucisv[-server]--[.exe]`, - `lucisv-[-].vsix`, `SHA256SUMS`) and the - version-from-binary convention. The workflow's pruning step depends on - those `.vsix` names exactly — it checks all six by name and filters - `SHA256SUMS` down to `.vsix` lines before publishing. + `lucisv-[-].vsix`, `lucisv--all.vsix`, + `SHA256SUMS`) and the version-from-binary convention. + `tools/prune_release_assets.sh` depends on those `.vsix` names exactly — + it checks all **seven** by name and filters `SHA256SUMS` down to `.vsix` + lines before publishing. A package added, renamed or dropped in + `release.sh` must be reflected in that script's suffix list, or the + release fails naming the file it could not find + (docs/features/editor-platform-vsix). +- The workflow's steps are one-liners calling `tools/` scripts, so every + release step is runnable by hand on a developer machine and testable + without pushing a tag. `prune_release_assets.sh` in particular is safe to + re-run: a second run over an already-pruned directory finds the same seven + packages and verifies them again. - Consumes `CHANGELOG.md`'s heading convention: `## — `; `tools/release_notes.sh` keys on the second word of `## ` headings. - `tools/publish_release.sh` expects the GitHub-compatible CI environment @@ -79,12 +88,17 @@ versions, written notes, and all six packages. remain audited, never executed (no such machine in the loop, and no container runtime on the runner). - [x] Publish `.vsix` packages only (2026-08-27): after the audit, the - workflow asserts all six packages exist by name, filters `SHA256SUMS` + workflow asserts all seven packages exist by name, filters `SHA256SUMS` down to them (keeping the audited hashes), re-verifies it, and deletes the loose binaries from `dist/` so `publish_release.sh` attaches only the packages. Prune logic tested locally against a real `--cross` `dist/`, with a negative control (one package removed → the step fails naming it). +- [x] That logic lives in `tools/prune_release_assets.sh` (2026-08-27), not + inline in the workflow: every release step is a one-line call into + `tools/`, so it can be run and negative-controlled on a developer machine + without pushing a tag. The seventh (all-platforms) package joined the + must-exist list at the same time. - [ ] A second runner on a non-macOS host, if native-built (rather than cross-built) Linux artifacts are ever wanted. @@ -127,6 +141,51 @@ versions, written notes, and all six packages. platform package and say binaries are build-your-own), and this README's Goal/Handshakes/Status. +- 2026-08-27 — dev (all-platforms package round). Two changes here, both + in service of the seventh `.vsix` (`docs/features/editor-platform-vsix`): + + - **The inline "Keep only the extension packages" step became + `tools/prune_release_assets.sh `.** Same logic, + same order — check every package by name, filter `SHA256SUMS` to its + `.vsix` lines rather than recompute, delete everything else, re-verify + with `shasum -c` — now in a script with a usage header like its + siblings, so `release.yml` is back to one-line steps and the step is + testable without a tag. It grew the `-all` suffix and argument + validation (`[ $# -eq 2 ]`, missing dir, missing `SHA256SUMS` → exit 2, + matching `publish_release.sh`'s convention); a missing package is still + exit 1 naming the file. + - **`release.yml`**: the step body is now + `tools/prune_release_assets.sh dist "${GITHUB_REF_NAME#v}"`, and the + header comment says seven packages. Nothing else in the workflow moved; + the prune still sits between the artifact audit and the notes + extraction, so the audit keeps gating on the loose binaries before they + are deleted. + + **Verified**, from the real repo path, against the real `dist/` from a + `tools/release.sh --cross` run of 0.10.1 (copies only — `dist/` itself was + left intact for the lead, since the script deletes files): + + | Check | Result | + |---|---| + | `bash -n tools/prune_release_assets.sh` | clean | + | positive: a 20-file `dist/` copy | exit 0, 8 survivors (7 `.vsix` + `SHA256SUMS`), `SHA256SUMS` down to 7 lines, all 7 verify `OK` | + | negative: `lucisv-0.10.1-all.vsix` removed | exit 1, `missing lucisv-0.10.1-all.vsix`, **and nothing deleted** — all 19 remaining files still there, because the name check runs before any destructive step | + | negative: wrong version argument (`0.10.0`) | exit 1, `missing lucisv-0.10.0.vsix`, nothing deleted | + | negative: one argument / missing dir / dir without `SHA256SUMS` | exit 2 each, with the usage or the specific reason | + | re-run over an already-pruned directory | exit 0, same 7 packages verify again — a CI job re-run is safe | + | `python3 -c yaml.safe_load` on `release.yml` | parses; the six step names unchanged | + + The negative controls were run on copies in the session scratchpad, but + the script itself and every `release.sh` run were driven from + `/Users/guoliangchen/repo/verilogrustformatter` — `vsce` collects zero + files under the scratchpad's UUID path + (`docs/features/editor-packaging` QA Finding 2). + + Not verified: the workflow has not been run on the Gitea runner in this + round — no tag was pushed (and pushing one is the lead's call). The step + is a one-line invocation of a script proven by hand on the same machine + the runner is, which is as close as this gets without cutting a release. + ## QA log _(no QA round — infrastructure, verified by the live v0.7.1 run; see work log)_ diff --git a/docs/features/editor-platform-vsix/README.md b/docs/features/editor-platform-vsix/README.md index ed0b8eb..17efe1d 100644 --- a/docs/features/editor-platform-vsix/README.md +++ b/docs/features/editor-platform-vsix/README.md @@ -35,13 +35,15 @@ binary on `PATH`). embeds musl: a statically linked binary runs on any distro at any glibc vintage, which is exactly the property an extension installed by a stranger needs. There is no second `linux-x64` package to choose between. -- **Alpine is an accepted gap.** `vsce` has separate `alpine-x64` / - `alpine-arm64` targets and VS Code running on Alpine looks for *those*, not - for `linux-x64` — so an Alpine user gets the universal package and needs - `lucisv-server` on `PATH`, even though the musl binary we ship would have run - there perfectly. Building two more packages with identical contents to satisfy - a name is not worth the release-matrix growth today; if someone asks, it is a - two-line change (`alpine-x64` ← the same musl triple). +- **Alpine is an accepted gap in the *targeted* packages.** `vsce` has separate + `alpine-x64` / `alpine-arm64` targets and VS Code running on Alpine looks for + *those*, not for `linux-x64` — so an Alpine user gets no platform package. + Building two more `--target`ed packages with identical contents to satisfy a + name is not worth the release-matrix growth today; if someone asks, it is a + two-line change (`alpine-x64` ← the same musl triple). Since 2026-08-27 the + all-platforms package covers that user anyway (see below): it is target-less, + so Alpine is offered it, and Node's `process.platform` there is plain + `'linux'`, which is the directory our static-musl binaries sit in. - **VSIX extraction does not preserve the executable bit.** This is why `extension.js` chmods what it is about to spawn rather than trusting the package's file modes — the same thing rust-analyzer's extension does, for the @@ -67,16 +69,42 @@ feature changes is *which path* is spawned, never how. naming. The staging step reads those exact names; renaming an artifact breaks packaging loudly (a missing `cp` source), not silently. -**Promised to `extension.js`** — a platform package always contains **both** -binaries under `bin/`, named plainly (`lucisv`, `lucisv-server`, with `.exe` on -Windows) with no version or triple in the name; the universal package contains -**no** `bin/` directory at all. `release.sh` asserts both with `unzip -Z1` -after every package it builds, so "the extension found a stale binary from the -previous target" cannot ship. +**Promised to `extension.js`** — the `bin/` layout contract, three shapes and +no fourth: + +| package | `bin/` holds | +|---|---| +| universal `lucisv-.vsix` | **nothing** — no `bin/` directory at all | +| a platform `lucisv--.vsix` | exactly `lucisv` and `lucisv-server` (`.exe` on Windows), flat | +| the all-platforms `lucisv--all.vsix` | exactly ten files, `-/lucisv{,-server}` for the five platforms | + +Names are always plain — no version, no triple. `release.sh` asserts all three +shapes with `unzip -Z1` after every package it builds, so "the extension found a +stale binary from the previous target" cannot ship. The all-platforms +directory names are literally the `${process.platform}-${process.arch}` strings +`extension.js` builds at runtime; that they also happen to equal vsce's target +names is a convenience, not a dependency (nothing passes `--target` for that +package). **Promised to `tools/audit_artifacts.sh`** — every loose binary in `dist/` is -still named `lucisv[-server]--`; the new `.vsix` names all end -in `.vsix` and are skipped by the audit's existing case arm. +still named `lucisv[-server]--`; the `.vsix` names all end in +`.vsix` — `lucisv--all.vsix` included — and are skipped by the audit's +existing case arm before its "unrecognized artifact name" arm can see them. + +**Promised to `tools/prune_release_assets.sh`** — a `--cross` run produces +exactly seven `.vsix` names, and those are the names the prune script checks +one by one: `lucisv-.vsix`, the five `lucisv--.vsix`, and +`lucisv--all.vsix`. Adding or renaming a package means editing that script's +suffix list too, or the release fails naming the file it could not find. + +**Requested of `editor-marketplace-page`** — that round rewrote +`editors/vscode/README.md` end-to-end for a marketplace audience while this one +was running, and any further rewrite of it must keep two things: its install +table naming **seven** packages, not six (the five platform ones, `all`, and the +universal fallback), and a bundled-binaries sentence covering both layouts — +`bin/lucisv-server` in a platform package, +`bin/-/lucisv-server` in the all-platforms one. Both were +re-applied additively onto their rewrite; see the work log. **Requested of other modules** — none. @@ -93,9 +121,11 @@ first: language-scoped variants counts as "the user set it"; `defaultValue` and `defaultLanguageValue` do not, because those are contributed defaults, not user intent. Most specific wins, matching VS Code's own `get()` precedence. -2. **The bundled binary**, `/bin/lucisv-server`(`.exe`), if the file - exists. Its existence is the whole runtime test for "am I a platform package - or the universal one" — no build-time flag, no manifest field. +2. **The bundled binary**, whichever of two layouts this package uses — + `/bin/lucisv-server`(`.exe`) first, then + `/bin/-/lucisv-server`(`.exe`). A file existing is + the whole runtime test for "which kind of package am I" — no build-time flag, + no manifest field. Both misses mean no bundled binary. 3. **The bare name `lucisv-server`**, looked up on `PATH`. What the universal package has always done, and what a `cargo build` + `PATH` install still does. @@ -105,6 +135,54 @@ the extension spawns it: it is shipped so a user who installed the extension already has the command-line tool, and a non-executable file would make that claim false. +## The all-platforms package + +`lucisv--all.vsix` is one package carrying **all five platforms' +binary pairs**, sorted into directories and chosen between at runtime: + +``` +bin/ + darwin-arm64/lucisv, lucisv-server + darwin-x64/lucisv, lucisv-server + linux-x64/lucisv, lucisv-server (static musl) + linux-arm64/lucisv, lucisv-server (static musl) + win32-x64/lucisv.exe, lucisv-server.exe +``` + +**The directory names are `${process.platform}-${process.arch}`**, not vsce +target names — `extension.js` concatenates those two Node values and looks the +result up. That the five strings happen to be spelled the same way vsce spells +its targets is a coincidence worth having (one vocabulary in the release script +instead of two) and nothing more: this package is built **without** `--target`, +so vsce's names never enter the picture. Picking Node's own vocabulary is what +makes the lookup a two-line function with no table in it, and what makes a +platform we do not ship fail the obvious way — nothing on disk, fall through to +`PATH`, exactly like the universal package. + +Why it exists, given five perfectly good targeted packages: + +- **Alpine, and anything else vsce names separately.** VS Code on Alpine asks + the marketplace for `alpine-x64`, not `linux-x64`, so it is never offered our + Linux package — but its `process.platform` is plain `'linux'` (Node does not + distinguish libc), so it walks straight into `bin/linux-x64/`, and the binary + there is statically linked musl, which is precisely what Alpine wants. The + gap the targeted matrix leaves open is closed by not participating in the + targeting at all. +- **One file to mirror.** An internal file share, a locked-down machine, an + offline lab: one `.vsix` that works on whatever the person on the other end + turns out to be running beats a table of five and a question. +- **Unknown or mixed fleets**, where whoever hands out the package does not know + the architecture in advance. + +The trade-off is size, and it is not small: every user downloads every +platform's binaries — 13.0 MB against 3.0 MB for a platform package (and 0.75 MB +for the universal one; measured on 0.10.1). That is why it is a seventh option +rather than the only one; when the platform is known, the platform package is +still the right answer. + +**Built only with `--cross`**, because it needs all five pairs to exist. An +ordinary `tools/release.sh` produces six of the seven names and no `-all` one. + ## What gets built, and when | | `release.sh` | `release.sh --cross` | @@ -112,12 +190,13 @@ claim false. | universal `lucisv-.vsix` | yes | yes | | `darwin-arm64` (host) | yes | yes | | the other four | no | yes | +| `lucisv--all.vsix` | no | yes | Without `--cross` there are no cross binaries to embed, so only the host package can be built — building it anyway (rather than only the universal one) keeps the packaging path exercised on every ordinary release run, including the embedded-server smoke test. The CI release workflow runs `--cross`, so releases -always carry all six. +always carry all seven. ## Status / TODO @@ -137,13 +216,26 @@ always carry all six. - [x] `tools/audit_artifacts.sh`: `aarch64-unknown-linux-musl` arm. - [x] `editors/vscode/.gitignore`: `bin/`. - [x] Docs: this file, `tools/RELEASING.md`, `editors/vscode/README.md`. -- [ ] **Not done, and not doable here:** none of the five packages has been +- [x] **The all-platforms package** (2026-08-27): `extension.js`'s layered + `bin/` lookup, `release.sh`'s `package_all_vsix` under `--cross`, the + ten-entry content assertion, and a second embedded-server smoke test + driven out of `bin//` inside that package. +- [x] `tools/prune_release_assets.sh`: the seven-package check moved out of + `release.yml`'s inline step into a tools/ script, checked by name. +- [x] Docs for the all package: this file, `tools/RELEASING.md`, the top-level + `README.md`, `docs/features/ci-release/README.md`, and + `editors/vscode/README.md` (re-applied onto the concurrent + `editor-marketplace-page` rewrite — see the work log). +- [ ] **Not done, and not doable here:** none of the seven packages has been *installed into a real VS Code*. `require('vscode')` resolves only in the - extension host, so the resolution order above is proven by reading it and - by the packaging assertions, not by an editor picking the right package - off a marketplace. The Linux and Windows packages have additionally never + extension host, so the resolution order above is proven by reading it, + by a stubbed-`context` harness over a fake directory tree, and by the + packaging assertions — not by an editor picking the right package off a + marketplace. The Linux and Windows packages have additionally never been *executed* anywhere — same standing limitation the loose binaries - have had since `--cross` existed. + have had since `--cross` existed. The Alpine claim in particular is + reasoned from Node's documented `process.platform` values, not observed + on an Alpine machine. - [ ] **Not done, deliberate:** `alpine-x64` / `alpine-arm64` packages (see Assumptions), and a `linux-x64` glibc variant. @@ -294,6 +386,180 @@ them — but no longer attached; standalone binaries are build-your-own. Nothing in this feature's scripts changed: `release.sh` still produces the full `dist/`, and the pruning lives in `release.yml` after the audit. +### 2026-08-27 — dev agent (round 2): the all-platforms package + +Owner request: a seventh package carrying every platform's binaries, chosen at +runtime — plus a consolidation of the CI release flow. Four code files. + +- **`extension.js`: `bundledBinary` became a two-candidate lookup**, flat first, + `bin/-/` second, `undefined` if both miss. It is a `.find()` + over two `asAbsolutePath` results and nothing else: no package-kind flag, no + manifest field, no table of platform names. Everything downstream — the + `.exe` suffix, the chmod-in-`try`/`catch`, the + `userServerPath() || bundledServer || 'lucisv-server'` order, the two calls in + `activate` — is untouched, so the fat layout is covered for the CLI and the + server at once. The doc comment now describes both layouts and states the + fall-through for a platform we ship nothing for (`win32-arm64`): nothing on + disk in either layout, so `PATH`, exactly like the universal package. +- **Node's vocabulary, not vsce's.** The directory names are + `${process.platform}-${process.arch}` because that is the string the extension + can build with no lookup table. That the five values happen to be spelled the + way vsce spells its targets is why `release.sh` can reuse `vsce_target_for` + for the staging directory names — a convenience recorded in Assumptions, not + a dependency: the package is built with **no** `--target`, so vsce's naming + never enters it. Verified in the artifact: `extension.vsixmanifest` in + `lucisv-0.10.1-all.vsix` carries no `TargetPlatform` attribute at all, same as + the universal package. +- **`release.sh`: `package_all_vsix`**, called only under `--cross`, and given + `$vsix_triples` — the same list the per-platform loop just used — rather than + a second copy of the five triples. It stages each pair into + `bin//`, `chmod +x`es them, packages with no `--target`, removes + the staging dir, and asserts the contents. It builds its expected-entry list + in the same loop that stages, so the assertion cannot drift from what was + staged. +- **`expect_vsix_bins` needed no change, which I checked rather than assumed.** + Info-ZIP's `*` matches `/` (unlike a shell glob), so `extension/bin/*` lists + nested paths — confirmed on a hand-built zip with both a flat and a nested + entry before touching `release.sh`. The one wrinkle that could have bitten: + the same test showed Info-ZIP *also* returns directory entries + (`extension/bin/`, `extension/bin/darwin-arm64/`), which would have broken an + exact-set comparison — but vsce writes **no** directory entries at all + (`unzip -Z1 … | grep -c '/$'` = 0 on a real package), so the ten filenames + come back and nothing else. Both facts are now in the function's comment. +- **The embedded smoke test was made a function and called twice**, once per + layout: the host platform package out of `extension/bin/`, the all-platforms + package out of `extension/bin/darwin-arm64/`. That is the difference that + matters — a fat package whose binaries were staged one directory too deep + would package, assert fine, and then fail to spawn for every user; driving a + real LSP session out of the nested path is what rules that out. +- **`tools/prune_release_assets.sh`** is new and is the CI-flow half of the + round; it is logged in full in `docs/features/ci-release/README.md`. The + handshake it creates with this feature — the seven exact package names — is + now in Handshakes above. +- Did not bump any version, did not `git commit`/`git push`, did not touch + `CHANGELOG.md` or `crates/`. `TODO.md` was read again; §6's editor-packaging + and release-prep items are still `[x]` and still say nothing about the package + matrix, so nothing was checked off. + +**Validation, all from the real repo path (never the scratchpad — `vsce` +collects zero files there, `docs/features/editor-packaging` QA Finding 2):** + +| Check | Result | +|---|---| +| `bash -n` on `release.sh`, `audit_artifacts.sh`, `prune_release_assets.sh` | clean | +| `node --check editors/vscode/extension.js` | clean | +| `cargo fmt --check` | clean | +| `cargo clippy --all-targets` | clean, 0 warnings | +| `cargo test -p lucisv_server` | **1015 unit + 50 e2e + 3 grammar**, 5 ignored, 0 failed | +| `tools/release.sh --cross` | exit 0 — 12 loose binaries + **7** `.vsix` + `SHA256SUMS`, every `bin/ contents ok` | +| `tools/release.sh -o target/relcheck-dist` (no `--cross`) | exit 0 — host pair, universal `.vsix`, `darwin-arm64` `.vsix`, `SHA256SUMS`, **no `-all.vsix`**, one embedded smoke test rather than two | +| `tools/audit_artifacts.sh dist` | **12 binaries audited, exit 0** — the 7 `.vsix`, `-all` included, all skipped by the `*.vsix` arm before the "unrecognized artifact name" arm sees them | +| `shasum -a 256 -c SHA256SUMS` in `dist/` | 19/19 OK | +| embedded smoke, host platform package (`extension/bin/`) | `smoke: OK`, 10 messages | +| embedded smoke, all package (`extension/bin/darwin-arm64/`) | `smoke: OK`, 10 messages | + +**`lucisv-0.10.1-all.vsix` — what is actually in it**, checked rather than +assumed: + +- **Exactly ten `extension/bin/` entries**, no more: `darwin-arm64/`, + `darwin-x64/`, `linux-x64/`, `linux-arm64/` each with `lucisv` and + `lucisv-server`, `win32-x64/` with the two `.exe`s. Mode `-rwxr-xr-x` inside + the zip for all ten. +- **All ten are byte-identical to the audited loose binaries.** Compared by + SHA-256 of `unzip -p` output against `dist/lucisv[-server]-0.10.1-` + for all five triples, both binaries each — ten of ten match. So the audit that + gates the release covers what is inside this package too, transitively, the + same way it does for the platform packages. +- **No `TargetPlatform`** in its `extension.vsixmanifest` (checked), which is + what makes VS Code offer it to any machine — Alpine included. +- Size 13,025,877 bytes against 2,987,672 for `darwin-arm64` and 754,239 for the + universal package. The "13.0 MB vs 3.0 MB" in the section above is that + measurement, not an estimate. +- The universal package still carries **no** `bin/` — `unzip -Z1 + lucisv-0.10.1.vsix 'extension/bin/*'` answers "filename not matched". It is + asserted at build time by `expect_vsix_bins` with an empty expected set, and + it is packaged before anything is staged, so nothing built later can reach + back into an already-written zip. + +**The extension's layered lookup was exercised, not only read.** The extension +host is still the only place `require('vscode')` resolves, so I wrote a harness +that stubs `vscode` and `vscode-languageclient/node` through +`Module._load`, hands `activate()` a `context` whose `asAbsolutePath` points at +a fake extension directory, and reads back the `command` the `LanguageClient` +was constructed with. Thirteen assertions, all passing: + +| Fake package | Resolved to | +|---|---| +| no `bin/` at all | `lucisv-server` (PATH) | +| flat `bin/` | `bin/lucisv-server` | +| `bin/darwin-arm64/` | `bin/darwin-arm64/lucisv-server` | +| both layouts present | the **flat** one — most specific first | +| only a foreign platform's directory | `lucisv-server` (PATH) | +| `bin/darwin-arm64/` + a user `serverPath` | the user's path | + +plus: both binaries come out `0755` in the flat and the nested layouts **and** +when a user setting won the spawn (the lead's unconditional-chmod fix from round +1 still holds in the nested layout), and a directory for another platform is +left at `0644` — we do not chmod what we did not choose. This proves the file +resolution and the chmod, and nothing about how VS Code behaves around it. + +**The `EXIT` trap was negative-controlled against the new nested staging**, not +assumed to still work: a fake `npx` on `PATH` proxying to the real one except +when an argument ends in `-all.vsix`, where it exits 23. `tools/release.sh -o +target/relfail --cross` built the universal package and all five platform +packages (each asserted `bin/ contents ok`), then died on the all package with +exit 23 — and `editors/vscode/bin/` was gone afterwards, five subdirectories and +ten binaries included, with `git status --short editors/vscode` showing only +this round's edits. A failure in the fat-package path cannot leave 13 MB of +binaries in the working tree. + +**Not verified, honestly:** + +- **No package was installed into a real VS Code**, so which package the + marketplace/`code --install-extension` hands a given machine, and whether the + extension host's `context.asAbsolutePath` behaves as the harness stubs it, are + still unproven here. Unchanged limitation since 2026-08-19. +- **The Alpine claim is reasoning, not an observation.** It rests on two facts I + did not test on an Alpine box: Node reports `process.platform === 'linux'` + there (it does not distinguish libc), and VS Code on Alpine requests + `alpine-x64`/`alpine-arm64` from a marketplace. Both are documented behaviour, + and the second one is moot for a package with no `TargetPlatform` — but nobody + here has watched an Alpine VS Code start our server. +- **The Linux and Windows binaries inside the fat package have never been + executed**, same as the loose ones and the platform packages. Only the + `darwin-arm64` directory's server has been spawned. +- **`x86_64-unknown-linux-gnu` is still in no package**, fat one included: the + fat package carries the same five platforms the targeted packages do. +- **A concurrent round was editing the tree.** `editors/vscode/package.json` and + `editors/vscode/images/` were being changed by another agent (marketplace + metadata, `docs/features/editor-marketplace-page/`) while these runs happened; + one intermediate run of mine failed on *their* half-landed `"icon"` field + before `images/icon.png` existed, which is a race between two agents and not a + finding about either change. The numbers quoted above are from a final + `--cross` run made after that settled, so they describe the tree as it stands. + I did not touch either of their files. + +**`editors/vscode/README.md` was written twice, and the second version is the +one that survives — lead, this file has two rounds in it.** I first updated the +old developer-facing README as this round asked: §0 gained the all-platforms +package, the bundled-binary sentence covered both layouts, the +`lucisv.serverPath` settings row and the Troubleshooting entry stopped naming +only the universal package. The `editor-marketplace-page` round then **deleted +that file** mid-round and replaced it, 70 seconds later, with a complete +marketplace-audience rewrite — taking those edits with it. I did not restore my +version over theirs; theirs is the better file for its audience and clobbering a +finished rewrite to recover four paragraphs would be the wrong trade. Instead I +re-applied the *requirement* onto their structure, additively and in their +voice: an `all` row in their install table, a paragraph on when to pick it (with +the Alpine reason and the 13 MB-vs-3 MB cost) and where the binaries sit in each +layout, and one clause in their "Release 0.10.1 highlights" list. Their +`lucisv.serverPath` row already reads "bundled" and their Troubleshooting entry +already avoids naming the universal package, so those two needed nothing. The +standing requirement is in Handshakes above for whoever edits that file next. + +If the lead lands only one of the two rounds, note the dependency: their README +now names a package that only *this* round's `release.sh` builds. + ## QA log ### 2026-08-27 — QA agent @@ -369,6 +635,88 @@ const serverPath = userServerPath() || bundledBinary(context, 'lucisv-server') | **Verdict: ship.** +### 2026-08-27 — QA agent (round 2): the all-platforms package + CI consolidation + +Scope: the dev's round-2 work log claims only — the seventh `lucisv--all.vsix` +package, `extension.js`'s layered `bundledBinary` lookup, `release.sh`'s +`package_all_vsix`/`expect_vsix_bins` under `--cross`, `tools/prune_release_assets.sh`, +and the `release.yml` step that calls it. Did not re-review the earlier +six-package round (its own QA log entry above stands) or the concurrent +`editor-marketplace-page` round, except where its output could break packaging. +Ran everything from the real repo path (`/Users/guoliangchen/repo/verilogrustformatter`), +never the scratchpad. No source file was edited; `dist/` was rebuilt by my own +`--cross` run and left intact afterward (verified: 20 files, `shasum -c` 19/19 +OK, as the last action before writing this entry). + +**Gates — all green.** + +| Check | Result | +|---|---| +| `bash -n tools/release.sh tools/audit_artifacts.sh tools/prune_release_assets.sh` | clean | +| `node --check editors/vscode/extension.js` | clean | +| `python3 -c "import yaml; yaml.safe_load(...)"` on `.gitea/workflows/release.yml` | valid | +| `cargo fmt --check` | clean | +| `cargo clippy --all-targets` | clean, 0 warnings | +| `cargo test -p lucisv_server` | **1015 unit + 50 e2e + 3 grammar**, 5 ignored, 0 failed — exact match to the dev's numbers | + +**`tools/release.sh --cross`, re-run independently on this machine (lucisv 0.10.1) — exit 0, 12 loose binaries + 7 `.vsix` + `SHA256SUMS` (20 files, 19 checksummed entries), matching the dev's claimed set.** + +- `unzip -Z1 lucisv-0.10.1-all.vsix 'extension/bin/*'`: exactly 10 entries — `darwin-arm64/`, `darwin-x64/`, `linux-x64/`, `linux-arm64/` each with `lucisv`+`lucisv-server`, `win32-x64/` with `lucisv.exe`+`lucisv-server.exe` only (`.exe` confirmed absent from the other four directories). `unzip -Z1 ... | grep -c '/$'` = 0, confirming vsce writes no directory entries here either. +- Universal package still has no `bin/`: `unzip -Z1 lucisv-0.10.1.vsix 'extension/bin/*'` → "filename not matched". The five platform packages are unchanged — flat two entries each (`extension/bin/lucisv[-server]`, `.exe` only for `win32-x64`). +- `extension.vsixmanifest`: no `TargetPlatform` attribute in `lucisv-0.10.1-all.vsix` or the universal package; `TargetPlatform="darwin-arm64"`/`"darwin-x64"`/`"linux-x64"`/`"linux-arm64"`/`"win32-x64"` present and correct in the respective five platform packages (checked all five). +- Both embedded smoke tests ran during the build: `smoke: OK`, 10 messages, for the host platform package (`extension/bin/`) and for the all package (`extension/bin/darwin-arm64/`). +- `tools/audit_artifacts.sh dist`: 12 binaries audited, exit 0. +- `shasum -a 256 -c SHA256SUMS` in `dist/`: 19/19 OK. +- `dist/` left intact at the end (re-verified after all later runs used throwaway `-o` dirs or copies). + +**Byte-identity spot-check, `all` package vs. loose `dist/` binaries (SHA-256, both directions of the pair, two platforms as asked):** + +- `darwin-arm64`: `unzip -p lucisv-0.10.1-all.vsix extension/bin/darwin-arm64/lucisv` and `extension/bin/darwin-arm64/lucisv-server` both hash identically to `dist/lucisv-0.10.1-aarch64-apple-darwin` and `dist/lucisv-server-0.10.1-aarch64-apple-darwin` (`51ca1cf2...` and `edaff0df...` respectively). +- `win32-x64`: `unzip -p lucisv-0.10.1-all.vsix extension/bin/win32-x64/lucisv.exe` and `.../lucisv-server.exe` both hash identically to `dist/lucisv-0.10.1-x86_64-pc-windows-gnu.exe` and `dist/lucisv-server-0.10.1-x86_64-pc-windows-gnu.exe` (`f6c2dbfc...` and `6628bfeb...` respectively). + +Four of four match. Confirms the audit that gates the release covers the fat package's contents transitively, as claimed. + +**`tools/prune_release_assets.sh`, on copies of `dist/`, never the original — independent runs, not the dev's.** + +- **Positive**: copied the full 20-file `dist/` to a scratch dir, ran `prune_release_assets.sh 0.10.1` — exit 0, 8 survivors (the 7 `.vsix` + `SHA256SUMS`), `shasum -c` re-verify inside the script passed for all 7. +- **Negative, missing `-all.vsix`**: removed it from a fresh copy before running — `missing lucisv-0.10.1-all.vsix` on stderr, exit 1, **file count unchanged (19 before and after)** — the name-check loop runs entirely before any deletion, so a missing package deletes nothing rather than partially pruning. +- **Negative, wrong version arg**: ran with `9.9.9` against the real 0.10.1 tree — `missing lucisv-9.9.9.vsix`, exit 1, file count unchanged (20 before and after, since this copy still had its original `dist/` contents). +- **Negative, missing directory**: ran against a nonexistent path — `no dist directory at ...`, exit 2, as coded. + +**`extension.js`'s layered `bundledBinary` lookup — exercised with my own harness, not the dev's** (none was left in the tree to re-run; confirmed via `find` and `git status --short`, which shows no untracked harness file). Wrote an independent Node script (`/tmp/qa_ext_harness/harness.js`, discarded after use) that stubs `vscode` and `vscode-languageclient/node` via `Module._load`, builds fake extension directories with `fs`, and calls `activate()` against a fake `context.asAbsolutePath`, reading back `serverOptions.command` from the `LanguageClient` constructor call and the on-disk file modes afterward. Eight cases, all matching the documented behaviour: + +| Case | Result | +|---|---| +| no `bin/` at all | `lucisv-server` (PATH) | +| flat `bin/` only | flat path, chmod 755 | +| nested `bin//` only | nested path, chmod 755 | +| both layouts present | **flat** wins (most specific first); flat chmod'ed to 755, **nested left at 644 — not touched** | +| only a foreign platform's directory present | falls through to `lucisv-server` (PATH) | +| nested layout + user `serverPath` set (`globalValue`) | **user's path wins the spawn**, but the nested bundled server is **still chmod'ed to 755** — confirms the lead's round-1 fix (unconditional `bundledServer` resolution ahead of the `\|\|` chain) survived the new two-candidate lookup | +| flat layout + user `serverPath` set to the literal string `"lucisv-server"` | counts as "set" (per `inspect()`, not `get()`); command resolves to that string, flat binary still chmod'ed | +| nested layout + user `serverPath` set to a whitespace-only string | counts as unset; falls through to the nested bundled path | + +This independently confirms: flat-over-nested precedence, foreign-platform fall-through, the "only chmod what was chosen" behavior the dev's own harness claimed, and — the specific thing this round's instructions flagged as a prior finding to re-check — that both bundled binaries still get chmod'ed even when a user-set `serverPath` wins the spawn, in the nested layout as well as the flat one. + +**`EXIT` trap, negative-controlled a third way** (independently of both the round-1 QA control and the dev's round-2 control): a fake `npx` on `PATH` that fails only when an argument ends in `-all.vsix` (exit 42), proxying to the real `npx` otherwise. `tools/release.sh -o /tmp/qa_relfail --cross` built the universal package and all five platform packages (each asserted `bin/ contents ok`) before dying on the all-platforms step; `editors/vscode/bin/` (which by then holds five subdirectories, ten binaries) was gone immediately after, and `git status --short editors/vscode` showed only this round's four tracked-file edits — no residue. + +**Docs vs. reality.** + +- `tools/RELEASING.md`'s "twelve binaries and seven `.vsix` files" claim, the `.vsix`-in-detail section's staging/assertion description, and the publishing section's "seven `.vsix` packages plus `SHA256SUMS`" all match the actual `--cross` output above. +- `docs/features/ci-release/README.md`'s seven-package claims, its `prune_release_assets.sh` validation table (20-file copy → 8 survivors, missing `-all.vsix` → exit 1 deletes nothing), and its description of the `release.yml` step order all match what I independently reproduced above. +- `.gitea/workflows/release.yml` calls the script as `tools/prune_release_assets.sh dist "${GITHUB_REF_NAME#v}"`, between the artifact audit and the release-notes extraction — confirmed by reading the file; `RELEASE_NOTES.md` is written into `dist/` *after* pruning, so the prune step (which deletes everything not `*.vsix`/`SHA256SUMS`) cannot touch it. +- Top-level `README.md` (lines 623, 710) states the `all` package and the seven-package release claim; both match reality. +- `tools/audit_artifacts.sh`'s `*.vsix | SHA256SUMS | RELEASE_NOTES.md` skip arm (line 39) still covers `-all.vsix` before the "unrecognized artifact name" arm — confirmed by the clean 12-binary audit above. +- `editors/vscode/.vscodeignore` still does not exclude `bin/`; `editors/vscode/.gitignore` still ignores it with a comment pointing at this feature. + +**Finding 1 (confirmed, moderate, not blocking build/packaging) — `editors/vscode/README.md`'s install table names six packages, not the seven this feature's own Handshakes section promises.** + +This feature's Handshakes section (`docs/features/editor-platform-vsix/README.md:103-104`, written by the dev in this same round) states as a requirement of `editor-marketplace-page`'s rewrite: "its install table naming **seven** packages, not six (the five platform ones, `all`, and the universal fallback)". The dev's own round-2 work log (lines 552-558) claims to have "re-applied the *requirement* onto their structure" and that the marketplace README's `lucisv.serverPath` row and Troubleshooting entry "already" satisfied the requirement, needing no change — but does not claim to have added the universal package to the install table, and it was never there. Checked directly: `editors/vscode/README.md:36-43`'s install table has exactly six rows (`darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `win32-x64`, `all`); `grep -n "universal\|lucisv-\.vsix\|PATH\\b" editors/vscode/README.md` finds no mention of the universal/platform-independent package anywhere in the file — not in the install table, not in Troubleshooting, not elsewhere. A reader of this developer-facing README has no way to learn the plain `lucisv-.vsix` (PATH-based, smallest download, the fallback for a platform none of the six named packages cover) exists at all. This does not break packaging or any gate — `vsce package` for the universal target still runs and is still asserted `bin/`-free by `release.sh` — it is purely a documentation gap against the feature's own stated (and, per the work log, believed-satisfied) handshake. Filed rather than fixed, per QA's scope (verify, don't redesign); the fix is one added table row plus a clause, in `editor-marketplace-page`'s voice, matching the pattern already used for the `all` row. + +**No other findings.** Every claim in the dev's round-2 work log — the seventh package's build and contents, the layered lookup and its chmod behavior (including the specific "still chmod'ed when a user setting wins" fix-survival check this round asked for), `expect_vsix_bins`'s handling of nested paths, the `EXIT` trap under the new nested staging, `prune_release_assets.sh`'s positive and negative behavior, and the docs — was independently reproduced with fresh runs, fresh negative controls, and a fresh harness rather than re-trusting the dev's own. The concurrent `editor-marketplace-page` round's `package.json` changes (icon, keywords, homepage) do not break packaging: the full `--cross` run above packaged all seven `.vsix` cleanly against the current tree, icon file present and valid. + +**Verdict: ship, with Finding 1 (moderate, doc-only) for the lead to route — either fix `editors/vscode/README.md`'s install table now or hand it back to `editor-marketplace-page`.** + ## Review **2026-08-27 — lead. Verdict: accepted; commits with this round.** @@ -407,3 +755,31 @@ accepted: No version bump here: the packages are cut from whatever version the tree is at, and the next tagged release ships all six automatically via the unchanged `release.yml` → `release.sh --cross` path. + +**2026-08-27 — lead review of round 2 (the all-platforms package + CI +consolidation). Verdict: accepted; commits with this round; ships as 0.10.2.** + +Reviewed the diff, the dev's work log, and QA's independent reproduction +(its own Node harness for the layered lookup, its own `EXIT`-trap stub, a +fresh `--cross` run, byte-identity spot-checks). Points accepted: + +1. **The layered `bundledBinary` lookup is the smallest correct shape**: the + file's existence remains the only runtime test for "which package am I", + the flat layout wins so a platform package can never accidentally pick a + foreign binary out of a fat layout, and the prior round's + chmod-both-binaries fix survives (QA proved it with a user-set + `serverPath` against a nested layout). +2. **The `-all` package is target-less on purpose** — no `TargetPlatform` in + its manifest, asserted by `release.sh` — which is precisely what makes it + the honest answer for Alpine and any platform vsce refuses to name. +3. **`tools/prune_release_assets.sh` consolidates the release contract in + one place**: seven names checked, audited hashes preserved by filtering + rather than recomputing, deletion only after every check passes (QA's + negative controls confirm a failure deletes nothing). +4. **QA's Finding 1** (the marketplace rewrite dropped the universal package + from the install table, breaking this round's requested Handshake) was + fixed by the lead in the marketplace round's review — a seventh row names + the universal fallback. + +Accepted limitations, unchanged from round 1: no real-editor run, four +non-host platforms' binaries never executed, Alpine reasoned not observed. diff --git a/editors/vscode/extension.js b/editors/vscode/extension.js index b784df0..6ee2ec0 100644 --- a/editors/vscode/extension.js +++ b/editors/vscode/extension.js @@ -87,29 +87,42 @@ function userServerPath() { * The path to a binary this package carries under `bin/`, or `undefined` if it * carries none. * - * The universal `.vsix` has no `bin/` at all and the platform-specific ones - * have both binaries, so the file's existence is the runtime test that tells - * the two packages apart (docs/features/editor-platform-vsix). On anything but - * Windows the executable bit is restored first: VSIX extraction does not - * reliably preserve it — the same chmod, for the same reason, that + * Two layouts are looked at, most specific first + * (docs/features/editor-platform-vsix): + * + * 1. `bin/` — a **platform package**, stamped with vsce's `--target`, so + * its `bin/` is flat and holds exactly one platform's binaries. + * 2. `bin/-/` — the **all-platforms package**, which + * carries every platform's pair at once and picks between them here, at + * runtime. The directory names are literally `${process.platform}-${process.arch}`. + * + * The universal package has no `bin/` at all, so both lookups miss and the + * caller falls back to `PATH`. So does a platform we ship no binaries for — + * `win32-arm64`, say: it finds nothing in either layout, and the all-platforms + * package behaves for it exactly like the universal one. + * + * On anything but Windows the executable bit is restored first: VSIX extraction + * does not reliably preserve it — the same chmod, for the same reason, that * rust-analyzer's extension does — and a server that cannot be spawned looks * to the user exactly like a server that crashed. */ function bundledBinary(context, name) { - const file = context.asAbsolutePath( - path.join('bin', process.platform === 'win32' ? `${name}.exe` : name), - ); - if (!fs.existsSync(file)) return undefined; + const file = process.platform === 'win32' ? `${name}.exe` : name; + const found = [ + context.asAbsolutePath(path.join('bin', file)), + context.asAbsolutePath(path.join('bin', `${process.platform}-${process.arch}`, file)), + ].find((candidate) => fs.existsSync(candidate)); + if (!found) return undefined; if (process.platform !== 'win32') { try { - fs.chmodSync(file, 0o755); + fs.chmodSync(found, 0o755); } catch { // A read-only install, or a file owned by someone else. Spawning may // still work; if it does not, the language client says so in its own // output channel, which is where the user is already looking. } } - return file; + return found; } /** Spawn the server and attach it to Verilog/SystemVerilog documents. */ diff --git a/tools/RELEASING.md b/tools/RELEASING.md index a015ef5..19ee673 100644 --- a/tools/RELEASING.md +++ b/tools/RELEASING.md @@ -26,20 +26,23 @@ for shops that require a native glibc link. that carries those two binaries inside it, so installing the extension needs no separate binary install (`docs/features/editor-platform-vsix/README.md`). The platform-independent `.vsix` — the same JavaScript, no binaries, server looked -up on `PATH` — is still built as the universal fallback. +up on `PATH` — is still built as the universal fallback, and one more package, +`lucisv--all.vsix`, carries **all five pairs at once**. -| vsce target | rust triple | +| package | rust triple | |---|---| | `darwin-arm64` | `aarch64-apple-darwin` (host; built without `--cross` too) | | `darwin-x64` | `x86_64-apple-darwin` | | `linux-x64` | `x86_64-unknown-linux-musl` | | `linux-arm64` | `aarch64-unknown-linux-musl` | | `win32-x64` | `x86_64-pc-windows-gnu` | +| `all` | all five of the above, under `bin/-/` | `x86_64-unknown-linux-gnu` deliberately gets no package: `linux-x64` ships the static musl build, which runs on any distro. Alpine's own `alpine-x64` / -`alpine-arm64` targets are not built either, so VS Code on Alpine falls back to -the universal package — an accepted gap, recorded in the feature README. +`alpine-arm64` targets are not built either, so VS Code on Alpine is never +offered a targeted package — the `all` package covers it instead, since it +carries no `--target` and Alpine's `process.platform` is plain `linux`. One-time setup on the build Mac (2026-08-25, all via Homebrew): @@ -132,9 +135,11 @@ dist/ SHA256SUMS ``` -With `--cross` the loose binaries appear for all six triples and the remaining -four platform packages (`darwin-x64`, `linux-x64`, `linux-arm64`, `win32-x64`) -join them — twelve binaries and six `.vsix` files, plus `SHA256SUMS`. +With `--cross` the loose binaries appear for all six triples, the remaining four +platform packages (`darwin-x64`, `linux-x64`, `linux-arm64`, `win32-x64`) join +them, and so does the all-platforms `lucisv--all.vsix` — twelve +binaries and **seven** `.vsix` files, plus `SHA256SUMS`. The `all` package needs +all five pairs to exist, so it is the one artifact a plain run cannot produce. Verify the checksums the way a downloader would: @@ -182,12 +187,15 @@ npx @vscode/vsce package --target darwin-arm64 \ `unzip -l dist/lucisv-.vsix | grep syntaxes` must print the grammar — without it, hover cards ship unhighlighted. - **`editors/vscode/bin/` is transient.** `release.sh` stages one platform's - pair into it, packages, and removes it again, with an `EXIT` trap so a failed - run cannot leave binaries in the working tree; it is gitignored as a second - line of defence. Every package is then asserted with + pair into it (or, for the `all` package, all five pairs into + `bin/-/` subdirectories), packages, and removes it again, with + an `EXIT` trap so a failed run cannot leave binaries in the working tree; it is + gitignored as a second line of defence. Every package is then asserted with `unzip -Z1 'extension/bin/*'`: nothing for the universal one, exactly - `lucisv` and `lucisv-server` (`.exe` for `win32-x64`) for a platform one. A - stale `bin/` would otherwise ship one platform's server to another's users. + `lucisv` and `lucisv-server` (`.exe` for `win32-x64`) for a platform one, and + exactly ten entries under five subdirectories for the `all` one — Info-ZIP's + `*` matches `/`, so one pattern covers both layouts. A stale `bin/` would + otherwise ship one platform's server to another's users. ## 5. Install / distribute @@ -204,10 +212,13 @@ code --install-extension dist/lucisv-0.7.0.vsix # or: server from The platform package is the one to hand a user: it carries `lucisv` and `lucisv-server` for that machine, so the two `install -m 755` lines above become optional. Pick the package by machine — `darwin-arm64`, `darwin-x64`, -`linux-x64`, `linux-arm64`, `win32-x64` — and fall back to the universal -`lucisv-.vsix` anywhere else. +`linux-x64`, `linux-arm64`, `win32-x64`. When the machine is *not* known in +advance — a mixed fleet, an offline mirror, Alpine — hand over +`lucisv--all.vsix` instead: same binaries, all five platforms in the +one file, at ~13 MB rather than ~3 MB. The universal `lucisv-.vsix` +remains the no-binaries fallback. -Publishing means attaching the six `.vsix` packages plus `SHA256SUMS` to a +Publishing means attaching the seven `.vsix` packages plus `SHA256SUMS` to a git tag / release page on `git.luci.ooo` — the CI release does exactly that and nothing more (the loose binaries stay unpublished; see "CI releases" below). Tag after the gate is green: @@ -264,10 +275,11 @@ git push origin v ``` does the rest on the `mac-arm64` runner: `tools/release.sh --cross`, a -tag-vs-`lucisv --version` consistency check, a pruning step that keeps -**only the six `.vsix` packages** in `dist/` (each checked by name — a -missing platform package fails the release — and `SHA256SUMS` filtered -down to them and re-verified), `tools/release_notes.sh` (a missing +tag-vs-`lucisv --version` consistency check, +`tools/prune_release_assets.sh dist `, which keeps **only the +seven `.vsix` packages** in `dist/` (each checked by name — a missing +package fails the release — and `SHA256SUMS` filtered down to them and +re-verified), `tools/release_notes.sh` (a missing CHANGELOG section fails the release), and `tools/publish_release.sh`, which creates the Gitea release and attaches what remains. The loose binaries are built and audited on the runner — the packages are made diff --git a/tools/prune_release_assets.sh b/tools/prune_release_assets.sh new file mode 100755 index 0000000..3e7bd84 --- /dev/null +++ b/tools/prune_release_assets.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Reduce a built dist/ directory to the assets a release publishes. +# +# Usage: tools/prune_release_assets.sh +# tools/prune_release_assets.sh dist 0.10.0 +# +# A release page carries the seven .vsix packages and SHA256SUMS, nothing else +# (docs/features/ci-release): the extension is the product, and the loose +# per-triple binaries exist only so the packages can be built and audited from +# them. Every package is checked by name first -- tools/release.sh would have +# failed earlier, but a release quietly missing a platform is exactly the +# failure this step exists to prevent -- then SHA256SUMS is *filtered* down to +# its .vsix lines rather than recomputed, so the hashes published are the ones +# tools/audit_artifacts.sh already gated on, everything else is deleted, and +# what remains is re-verified the way a downloader would. +# +# Exit status: 0 if all seven packages were present and verified. + +set -eu + +[ $# -eq 2 ] || { echo "usage: $0 " >&2; exit 2; } +dist=$1 +version=$2 +[ -d "$dist" ] || { echo "no dist directory at $dist" >&2; exit 2; } +[ -f "$dist/SHA256SUMS" ] || { echo "no SHA256SUMS in $dist" >&2; exit 2; } + +cd "$dist" + +# The universal fallback, the five platform packages, and the all-platforms one. +# Each is a must: a missing platform package strands that platform's users on +# "install a binary yourself", which is the whole thing these packages fix. +for suffix in "" -darwin-arm64 -darwin-x64 -linux-x64 -linux-arm64 -win32-x64 -all; do + [ -f "lucisv-$version$suffix.vsix" ] || { + echo "missing lucisv-$version$suffix.vsix" >&2 + exit 1 + } +done + +grep '\.vsix$' SHA256SUMS > SHA256SUMS.tmp +mv SHA256SUMS.tmp SHA256SUMS +find . -type f ! -name '*.vsix' ! -name SHA256SUMS -delete +shasum -a 256 -c SHA256SUMS diff --git a/tools/release.sh b/tools/release.sh index f7dd67f..a28344d 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -16,7 +16,12 @@ # aarch64) and Windows binaries, when the toolchains are present (rustup # stable + the five targets, and mingw-w64 for Windows; see # tools/RELEASING.md), plus the four remaining platform-specific .vsix -# packages. It publishes nothing anywhere. +# packages and +# dist/lucisv--all.vsix (every platform's pair in one package, +# under bin/-/ directories +# extension.js selects from at runtime) +# -- seven packages in all. The all-platforms one needs all five pairs, so it +# exists only on a --cross run. It publishes nothing anywhere. # # Usage: tools/release.sh [-o dist-dir] [--no-vsix] [--cross] # @@ -146,7 +151,10 @@ vsce_target_for() { # rust triple -> vsce target name, empty if we ship none # What a package carries under bin/ is the contract extension.js resolves # against, so it is asserted rather than assumed: the universal package must -# carry nothing, a platform package exactly its two binaries. +# carry nothing, a platform package exactly its two binaries, the all-platforms +# package exactly ten under five subdirectories. Info-ZIP's `*` matches `/` +# too (unlike a shell glob), so the one pattern covers the nested layout as +# well -- and vsce writes no directory entries, so nothing but files comes back. expect_vsix_bins() { # vsix file name, then the extension/bin entries expected vsix=$1; shift got=$(unzip -Z1 "$dist/$vsix" 'extension/bin/*' 2>/dev/null | LC_ALL=C sort | tr '\n' ' ') @@ -184,6 +192,54 @@ package_vsix() { # vsce target, rust triple vsix_built="$vsix_built lucisv-$version-$vsce_target.vsix" } +# One package for every platform at once: each pair under bin/-/, +# the exact string extension.js builds from `process.platform`/`process.arch` to +# pick its own. Deliberately packaged with no --target, like the universal one, +# so VS Code offers it to any machine -- including the ones vsce calls alpine-x64 +# and alpine-arm64, where our static-musl Linux binaries run perfectly but a +# linux-x64-targeted package is never even offered. The price is that every user +# downloads every platform's binaries (docs/features/editor-platform-vsix). +package_all_vsix() { # rust triples, one per platform to carry + echo "==> packaging the VS Code extension for all platforms" + rm -rf "$bin_dir" + all_bins="" + for triple in "$@"; do + vsce_target=$(vsce_target_for "$triple") + [ -n "$vsce_target" ] || continue + case $triple in *windows*) exe=.exe ;; *) exe="" ;; esac + mkdir -p "$bin_dir/$vsce_target" + cp "$dist/lucisv-$version-$triple$exe" "$bin_dir/$vsce_target/lucisv$exe" + cp "$dist/lucisv-server-$version-$triple$exe" "$bin_dir/$vsce_target/lucisv-server$exe" + chmod +x "$bin_dir/$vsce_target/lucisv$exe" "$bin_dir/$vsce_target/lucisv-server$exe" + all_bins="$all_bins extension/bin/$vsce_target/lucisv$exe extension/bin/$vsce_target/lucisv-server$exe" + done + ( + cd "$repo_root/editors/vscode" + npx @vscode/vsce package --out "$dist/lucisv-$version-all.vsix" + ) + rm -rf "$bin_dir" + # shellcheck disable=SC2086 # deliberate word splitting: one arg per entry + expect_vsix_bins "lucisv-$version-all.vsix" $all_bins + vsix_built="$vsix_built lucisv-$version-all.vsix" +} + +# Unzip a package and drive the server it carries through a full LSP session, so +# "install the extension and it works" is proven against a binary that has been +# through the zip rather than against the one in dist/. unzip does not restore +# the executable bit reliably -- the same reason extension.js chmods what it +# spawns. +smoke_embedded_server() { # vsix file name, the bin/ path inside the package + vsix=$1 + inner=$2 + echo "==> smoke-testing the server embedded in $vsix" + unpacked=$repo_root/target/vsix-check + rm -rf "$unpacked" + unzip -q "$dist/$vsix" -d "$unpacked" + chmod +x "$unpacked/$inner/lucisv" "$unpacked/$inner/lucisv-server" + node "$repo_root/editors/vscode/smoke.js" "$unpacked/$inner/lucisv-server" + rm -rf "$unpacked" +} + vsix_built="" if [ "$want_vsix" -eq 1 ]; then echo "==> packaging the VS Code extension" @@ -218,20 +274,24 @@ if [ "$want_vsix" -eq 1 ]; then package_vsix "$vsce_target" "$triple" done - # The host package gets one more check: unzip it and drive the *embedded* - # server through a full LSP session, so "install the extension and it works" - # is proven against a binary that has been through the zip rather than - # against the one in dist/. unzip does not restore the executable bit - # reliably -- the same reason extension.js chmods what it spawns. + # The all-platforms package carries all five pairs, so it can only be built + # when all five exist -- which is exactly what --cross means here. + if [ "$want_cross" -eq 1 ]; then + # shellcheck disable=SC2086 # deliberate word splitting: one arg per triple + package_all_vsix $vsix_triples + fi + + # Two packages get one more check each: unzip and drive the *embedded* server + # through a full LSP session. The host platform package proves the flat bin/ + # layout, the all-platforms package proves the bin/-/ one -- + # the two layouts extension.js resolves against, both tested against a binary + # that has actually been through a zip. host_vsce_target=$(vsce_target_for "$host") if [ -n "$host_vsce_target" ] && command -v node >/dev/null 2>&1; then - echo "==> smoke-testing the server embedded in the $host_vsce_target package" - unpacked=$repo_root/target/vsix-check - rm -rf "$unpacked" - unzip -q "$dist/lucisv-$version-$host_vsce_target.vsix" -d "$unpacked" - chmod +x "$unpacked/extension/bin/lucisv" "$unpacked/extension/bin/lucisv-server" - node "$repo_root/editors/vscode/smoke.js" "$unpacked/extension/bin/lucisv-server" - rm -rf "$unpacked" + smoke_embedded_server "lucisv-$version-$host_vsce_target.vsix" extension/bin + if [ "$want_cross" -eq 1 ]; then + smoke_embedded_server "lucisv-$version-all.vsix" "extension/bin/$host_vsce_target" + fi fi fi