From a1455d621de87407b714e21f69adb7372781327d Mon Sep 17 00:00:00 2001 From: Beinan Date: Thu, 17 Sep 2026 22:04:02 +0000 Subject: [PATCH] fix: validate Rust registry metadata before publishing --- .github/workflows/rust-publish.yml | 27 +++++++++++++++++++++++++ crates/lance-context-metrics/Cargo.toml | 1 + 2 files changed, 28 insertions(+) diff --git a/.github/workflows/rust-publish.yml b/.github/workflows/rust-publish.yml index 90fd1932..652d1865 100644 --- a/.github/workflows/rust-publish.yml +++ b/.github/workflows/rust-publish.yml @@ -7,6 +7,8 @@ on: pull_request: paths: - .github/workflows/rust-publish.yml + - Cargo.toml + - crates/**/Cargo.toml workflow_dispatch: inputs: mode: @@ -46,6 +48,31 @@ jobs: - uses: rui314/setup-mold@v1 + - name: Validate registry metadata + run: | + python3 - <<'PY' + import json + import subprocess + + metadata = json.loads( + subprocess.check_output( + ["cargo", "metadata", "--no-deps", "--format-version", "1", "--locked"], + text=True, + ) + ) + errors = [] + for package in metadata["packages"]: + if package["publish"] == []: + continue + if not (package.get("description") or "").strip(): + errors.append(f"{package['name']}: missing description") + if not package.get("license") and not package.get("license_file"): + errors.append(f"{package['name']}: missing license or license-file") + if errors: + raise SystemExit("\n".join(errors)) + print("All publishable crates have the required registry metadata") + PY + - name: Validate Rust crate packages if: github.event_name == 'pull_request' run: cargo package --workspace --exclude lance-context-python --allow-dirty --no-verify --all-features --locked diff --git a/crates/lance-context-metrics/Cargo.toml b/crates/lance-context-metrics/Cargo.toml index d41f0403..43a5dfac 100644 --- a/crates/lance-context-metrics/Cargo.toml +++ b/crates/lance-context-metrics/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "lance-context-metrics" version = "0.1.0" +description = "Shared Prometheus metrics and HTTP instrumentation for lance-context" edition.workspace = true license.workspace = true