From 61e938cd1dce9767bf8b4b5f883962ae2629eaff Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Fri, 17 Apr 2026 16:41:43 -0600 Subject: [PATCH] fix(publish): build native addon from source in preflight The preflight job ran `npm install && npm test` against the last-published native binary, while WASM ran from current source. When a PR updated both extractors in lockstep, the parity test would pass on CI (which rebuilds native from source) but fail on every subsequent publish run until the next release caught up. Mirror the ci.yml `parity` job pattern: compile the native addon from the current Rust source, copy it over the installed platform binary via ci-install-native.mjs, then run tests. WASM and native now come from the same commit. --- .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 75f527f94..758b9b2d1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,31 @@ jobs: - uses: actions/setup-node@v6 with: node-version: "22" + + # Build the native addon from the current Rust source so build-parity + # tests compare WASM and native engines built from the same commit. + # Without this, npm install pulls the last-published binary, which lags + # behind PR changes that touch both the TS and Rust extractors. + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: crates/codegraph-core + + - name: Install napi-rs CLI + run: npm install -g @napi-rs/cli@3 + - run: npm install + + - name: Build native addon from current source + working-directory: crates/codegraph-core + run: napi build --release + + - name: Install native addon over published binary + run: node scripts/ci-install-native.mjs + - run: npm test compute-version: