diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8a35c6a..fea49ec 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,8 +1,7 @@ # CI: the three checks CLAUDE.md requires before any work is finished, -# enforced on every push. Runs on the self-hosted mac-arm64 runner in host -# mode (no containers), so the toolchain is the same one releases are built -# with. The corpus is not in the repository, so corpus scoring stays a -# local-only check (scripts/score.sh). +# plus the corpus gate, enforced on every push. Runs on the self-hosted +# mac-arm64 runner in host mode (no containers), so the toolchain is the +# same one releases are built with. name: ci on: push: @@ -20,3 +19,21 @@ jobs: run: cargo clippy --all-targets -- -D warnings - name: cargo test run: cargo test --workspace + + # The 99.1% headline, enforced: score the 820-file corpus and fail on any + # regression below scripts/corpus-baseline (verification errors and + # crashes fail outright). The corpus is pinned-rev clones (not in the + # repo), cached on the runner host and fetched once on a cache miss. + corpus: + runs-on: macos-arm64 + steps: + - uses: actions/checkout@v4 + - name: Ensure the cached corpus + run: | + corpus="$HOME/.cache/lucisv-corpus" + [ -d "$corpus" ] || tools/corpus_fetch.sh "$corpus" + echo "CORPUS=$corpus" >> "$GITHUB_ENV" + - name: Build the release binary the scorer drives + run: cargo build --release -p lucisv + - name: Score and gate + run: scripts/corpus_gate.sh "$CORPUS" diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 948d6cd..fc64176 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -21,6 +21,8 @@ jobs: - uses: actions/checkout@v4 - name: Build release artifacts for every target run: tools/release.sh --cross + - name: Audit the cross-built artifacts + run: tools/audit_artifacts.sh dist - name: Check the tag against the crate version run: | v=$(target/release/lucisv --version | awk '{print $2}') diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df054e..02e8b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,47 @@ All notable changes to lucisv are recorded here. Versions follow [semantic versioning](https://semver.org/); until 1.0 the CLI's exit codes (see `README.md`) are the only frozen contract. +## 0.7.2 — 2026-08-26 + +Honest columns, honest docs, and a CI that enforces the headline number. + +### Formatter: the printer's column survives multi-line raw text + +Raw text that carries a string literal across a line break, and the +`#( ... )` of a parameterized type reference, were emitted as a single +text node with embedded newlines — leaving the printer's column tracker +stale for the rest of the line, so later width checks broke +conservatively. Both now ride the `Doc::Inline` path, which resumes +measuring from the text's own last line. Bytes only change where the +stale column forced a spurious break: across the 813-file passing corpus +exactly one file improves (a `= new;` initializer after a multi-line +`#( ... )` rejoins its line). Found by adversarial QA during 0.7.1's +directive-split round. + +### README truth pass + +0.7.1's release page made the README wrong in three places, now fixed: +prebuilt downloads exist (five platforms + the `.vsix` per release, with +`SHA256SUMS`), `tools/release.sh` grew `--cross` a while ago, and the +sideload example no longer hardcodes `0.5.0`. One claim was stale in the +other direction: the "server does not read `lucisv.toml` yet" caveat — +the server has read it since the config ladder landed; the README now +states the actual precedence (`lucisv.toml` > `lucisv.*` settings > +editor tab size > defaults). The README also now says plainly that +Linux/Windows artifacts are cross-built and audited, not executed. +`.DS_Store` is untracked and ignored. + +### CI: the corpus score is a gate, and releases audit their artifacts + +The 99.1% corpus number is now CI-enforced: every push scores the +820-file corpus (pinned-rev cache on the runner) and fails on any drop +below `scripts/corpus-baseline` — and on any verification error or +crash, which are formatter bugs at any count. Release builds audit every +cross-built binary before publishing (`tools/audit_artifacts.sh`): the +musl build must be fully static, the linux-gnu build's glibc ceiling +must stay ≤ 2.28 (RHEL 8), and every file must be the object format its +name claims. Details: `docs/features/ci-release/README.md`. + ## 0.7.1 — 2026-08-26 Conditional-split recovery and an automated release. diff --git a/Cargo.lock b/Cargo.lock index 0e73519..7e47ac1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,7 @@ dependencies = [ [[package]] name = "lucisv" -version = "0.7.1" +version = "0.7.2" dependencies = [ "lucisv_core", "rayon", @@ -108,11 +108,11 @@ dependencies = [ [[package]] name = "lucisv_core" -version = "0.7.1" +version = "0.7.2" [[package]] name = "lucisv_server" -version = "0.7.1" +version = "0.7.2" dependencies = [ "lsp-server", "lsp-types", @@ -248,14 +248,14 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "vlog_formatter" -version = "0.7.1" +version = "0.7.2" dependencies = [ "vlog_parser", ] [[package]] name = "vlog_linter" -version = "0.7.1" +version = "0.7.2" dependencies = [ "vlog_formatter", "vlog_parser", @@ -264,11 +264,11 @@ dependencies = [ [[package]] name = "vlog_parser" -version = "0.7.1" +version = "0.7.2" [[package]] name = "vlog_refactor" -version = "0.7.1" +version = "0.7.2" dependencies = [ "vlog_parser", "vlog_semantic", @@ -276,7 +276,7 @@ dependencies = [ [[package]] name = "vlog_semantic" -version = "0.7.1" +version = "0.7.2" dependencies = [ "vlog_parser", ] diff --git a/Cargo.toml b/Cargo.toml index 8bcc3f9..0efa51d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ ] [workspace.package] -version = "0.7.1" +version = "0.7.2" authors = ["Guoliang Chen"] edition = "2021" license = "MIT" diff --git a/docs/features/ci-release/README.md b/docs/features/ci-release/README.md index 1dbe605..7e1e7bd 100644 --- a/docs/features/ci-release/README.md +++ b/docs/features/ci-release/README.md @@ -25,8 +25,10 @@ green checks, matching versions, and written notes. - One runner, capacity 1: CI and release jobs queue rather than race. A release build and a local `cargo build` can still contend for the machine; acceptable on a solo project. -- The corpus is not in the repository, so CI does not score it; - `scripts/score.sh` stays a local check. +- The corpus is not in the repository; CI scores it from a pinned-rev + cache on the runner host (`~/.cache/lucisv-corpus`, fetched once by + `tools/corpus_fetch.sh` on a miss) and gates on + `scripts/corpus-baseline` via `scripts/corpus_gate.sh`. - `secrets.GITHUB_TOKEN` is auto-provided by Gitea Actions with rights to create releases and attach assets on this repo. - Release notes are written by hand (by the lead/Claude, specific to the @@ -58,6 +60,14 @@ green checks, matching versions, and written notes. - [x] `tools/release_notes.sh` (+ missing-section failure path tested), `tools/publish_release.sh` (get-or-create, skip-attached re-run safety). - [x] End-to-end verification with a real tag (v0.7.1). +- [x] Corpus score as a CI gate (`corpus` job: cached corpus + + `scripts/corpus_gate.sh` against `scripts/corpus-baseline`; regression, + verification error or crash fails the push). +- [x] Release-time artifact audit (`tools/audit_artifacts.sh`: musl + static-ness, linux-gnu glibc ceiling <= 2.28, PE/Mach-O file types) — + automates what RELEASING.md documented as manual; Linux/Windows binaries + remain audited, never executed (no such machine in the loop, and no + container runtime on the runner). - [ ] A second runner on a non-macOS host, if native-built (rather than cross-built) Linux artifacts are ever wanted. @@ -74,6 +84,14 @@ green checks, matching versions, and written notes. than a fallback body. Version bumped to 0.7.1 and released end-to-end as the verification. +- 2026-08-26 — lead (round 2, after external review). Added the corpus + gate job and the release artifact audit; both tested before landing (the + gate against the local corpus at exactly the 813 baseline, the audit + against the 10 downloaded v0.7.1 release binaries — all pass). Docker + was considered for executing the musl build's tests on Linux and + rejected: no container runtime exists on the runner Mac, and installing + a VM stack is an owner decision, not a CI increment. + ## QA log _(no QA round — infrastructure, verified by the live v0.7.1 run; see work log)_ diff --git a/editors/vscode/package-lock.json b/editors/vscode/package-lock.json index 6d39a97..465a4ec 100644 --- a/editors/vscode/package-lock.json +++ b/editors/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "lucisv", - "version": "0.7.1", + "version": "0.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lucisv", - "version": "0.7.1", + "version": "0.7.2", "license": "MIT", "dependencies": { "vscode-languageclient": "9.0.1" diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 438f44c..42bd7ed 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -2,7 +2,7 @@ "name": "lucisv", "displayName": "lucisv — Verilog/SystemVerilog", "description": "Formatting, diagnostics, navigation and semantic highlighting for Verilog and SystemVerilog, served by the lucisv language server.", - "version": "0.7.1", + "version": "0.7.2", "publisher": "guoliangchen", "author": "Guoliang Chen", "license": "MIT", diff --git a/scripts/corpus-baseline b/scripts/corpus-baseline new file mode 100644 index 0000000..4dc06e6 --- /dev/null +++ b/scripts/corpus-baseline @@ -0,0 +1 @@ +813 diff --git a/scripts/corpus_gate.sh b/scripts/corpus_gate.sh new file mode 100755 index 0000000..0371ed5 --- /dev/null +++ b/scripts/corpus_gate.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# CI gate over the corpus score: fail on any regression from the recorded +# baseline. `scripts/corpus-baseline` holds the passing-file count the tree +# must sustain; a verification error or a crash fails regardless of the +# count — those are formatter bugs by definition (see tools/corpus_check.sh). +# +# Usage: scripts/corpus_gate.sh [corpus-dir] +# +# An improvement does not fail, it nags: bump the baseline in the same +# change that earns it, so the gate ratchets and never slides back. + +set -eu + +here=$(cd "$(dirname "$0")" && pwd) +corpus=${1:-corpus} +baseline=$(cat "$here/corpus-baseline") + +json=$("$here/score.sh" "$corpus") +printf '%s\n' "$json" + +passing=$(printf '%s' "$json" | jq .passing) +verr=$(printf '%s' "$json" | jq '.failures_by_category["verification-error"] // 0') +crash=$(printf '%s' "$json" | jq '.failures_by_category.crash // 0') + +status=0 +[ "$verr" -eq 0 ] || { echo "FAIL: $verr verification error(s) — always a formatter bug" >&2; status=1; } +[ "$crash" -eq 0 ] || { echo "FAIL: $crash crash(es) — always a formatter bug" >&2; status=1; } +if [ "$passing" -lt "$baseline" ]; then + echo "FAIL: corpus regression — $passing passing, baseline is $baseline" >&2 + status=1 +elif [ "$passing" -gt "$baseline" ]; then + echo "note: $passing passing beats the baseline $baseline — bump scripts/corpus-baseline" +fi +exit $status diff --git a/tools/RELEASING.md b/tools/RELEASING.md index 530393f..93cea8e 100644 --- a/tools/RELEASING.md +++ b/tools/RELEASING.md @@ -230,3 +230,9 @@ mode), running via `brew services start gitea-runner`; config at one-time and minted in Gitea's admin UI; nothing secret lives in this repo — the release workflow authenticates with the `GITHUB_TOKEN` Gitea Actions injects per job. + +Since 0.7.2 the release workflow also runs `tools/audit_artifacts.sh` +before publishing — the automated form of the manual symbol/file-type +audit above (musl static-ness, the GLIBC_2.28 ceiling, PE/Mach-O types) — +and ordinary CI gates every push on the corpus score +(`scripts/corpus_gate.sh` against `scripts/corpus-baseline`). diff --git a/tools/audit_artifacts.sh b/tools/audit_artifacts.sh new file mode 100755 index 0000000..bfbaa98 --- /dev/null +++ b/tools/audit_artifacts.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Audit the cross-built release artifacts in a dist directory. +# +# Usage: tools/audit_artifacts.sh [dist-dir] +# +# There is no Linux or Windows machine in the release loop, so the +# non-macOS artifacts are never executed; this automates the audit +# tools/RELEASING.md documented as manual, and the release fails if any +# check does: +# *-linux-musl ELF x86-64, statically linked (zero NEEDED entries) +# *-linux-gnu ELF x86-64, glibc symbol ceiling <= 2.28 (RHEL 8) +# *-windows-gnu.exe PE32+ x86-64 +# *-apple-darwin Mach-O 64-bit (arm64 / x86_64 per triple) +# +# Needs the messense x86_64-unknown-linux-gnu toolchain's objdump for the +# ELF checks (the same toolchain the linux-gnu build itself needs). + +set -eu + +dist=${1:-dist} +objdump=x86_64-unknown-linux-gnu-objdump +glibc_max=2.28 + +command -v "$objdump" >/dev/null || { echo "no $objdump on PATH" >&2; exit 2; } +[ -d "$dist" ] || { echo "no dist directory at $dist" >&2; exit 2; } + +status=0 +fail() { echo "FAIL: $*" >&2; status=1; } +checked=0 + +for f in "$dist"/lucisv-*; do + [ -f "$f" ] || continue + name=$(basename "$f") + case $name in + *.vsix | SHA256SUMS | RELEASE_NOTES.md) continue ;; + esac + kind=$(file -b "$f") + case $name in + *x86_64-unknown-linux-musl) + case $kind in + *ELF*x86-64*) ;; + *) fail "$name: not an x86-64 ELF: $kind" ;; + esac + if "$objdump" -p "$f" | grep -q NEEDED; then + fail "$name: musl build has dynamic dependencies (must be static)" + fi + ;; + *x86_64-unknown-linux-gnu) + case $kind in + *ELF*x86-64*) ;; + *) fail "$name: not an x86-64 ELF: $kind" ;; + esac + top=$("$objdump" -T "$f" | grep -o 'GLIBC_[0-9.]*' | sort -Vu | tail -1) + top=${top#GLIBC_} + highest=$(printf '%s\n%s\n' "$top" "$glibc_max" | sort -V | tail -1) + if [ "$highest" != "$glibc_max" ]; then + fail "$name: glibc ceiling $top exceeds $glibc_max (breaks RHEL 8)" + fi + ;; + *x86_64-pc-windows-gnu.exe) + case $kind in + *PE32+*x86-64*) ;; + *) fail "$name: not a PE32+ x86-64 executable: $kind" ;; + esac + ;; + *aarch64-apple-darwin) + case $kind in + *Mach-O*arm64*) ;; + *) fail "$name: not a Mach-O arm64 binary: $kind" ;; + esac + ;; + *x86_64-apple-darwin) + case $kind in + *Mach-O*x86_64*) ;; + *) fail "$name: not a Mach-O x86_64 binary: $kind" ;; + esac + ;; + *) + fail "$name: unrecognized artifact name — teach this script about it" + ;; + esac + checked=$((checked + 1)) + echo "ok: $name" +done + +[ "$checked" -gt 0 ] || { echo "no binaries found under $dist" >&2; exit 2; } +echo "audited $checked binaries" +exit $status