Skip to content

ci(go): make the FFI tests run instead of silently skipping - #273

Open
YuanYuYuan wants to merge 5 commits into
mainfrom
ci/ffi-tests-must-run
Open

ci(go): make the FFI tests run instead of silently skipping#273
YuanYuYuan wants to merge 5 commits into
mainfrom
ci/ffi-tests-must-run

Conversation

@YuanYuYuan

@YuanYuYuan YuanYuYuan commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Go FFI tests step in the Go Tests job has never run a test. It reports success anyway.

Part of #270, and the cheapest part of it.

The defect

fact where
The step runs nu scripts/test-go.nu --ffi-only ci.yml L617-L618
That path runs the FFI tests only if libhiroz.a exists has-ffi-library, guarding the FFI branch
No step in the go-tests job built hiroz with --features ffi go-tests job in .github/workflows/ci.yml
A missing library was a warning; the script exited 0 test-runtime in scripts/test-go.nu

Every run logged Skipping hiroz FFI tests (Rust library not built). The step concluded success.

What that leaves unchecked:

scope detail
42 pub unsafe extern "C" functions crates/hiroz/src/ffi/
No clippy invocation enables ffi checked across .github/workflows/, scripts/test-pure-rust.nu, scripts/test-ros.nu
The module is not entirely uncompiled Interop Tests builds it with --features ffi, then runs --integration
That workflow is not an unconditional gate it skips on draft PRs; it carries a paths-ignore list
It also omits the Go hiroz package unit tests those are what --ffi-only covers

The gap is not hypothetical. #270 records a re-entrancy defect on publish_bytes that manual review found, not any check. That is the path rmw-zenoh-rs publishes through. Its fix is #250, still open.

What this PR does

change file
Build hiroz with --features ffi --release before the FFI step, so the tests have something to link against .github/workflows/ci.yml
Add --require-ffi to test-runtime; a missing library becomes an error make, not a warning scripts/test-go.nu
Pass --require-ffi only from --ffi-only scripts/test-go.nu

Two files, +21/-2.

--ffi-only is the path CI uses, and running the FFI tests is its entire point. The default and --runtime-only paths still warn and skip, so a Go-only contributor without a Rust toolchain can run the suite. --codegen-only and --vet-only never touched the library. This PR does not change them.

Evidence

All measurements taken on 198e4e3d4a50b412bae9822c0bfdcba325d414a4, the current head.

claim measurement
The FFI tests now run The Go FFI tests step of Go Tests (ubuntu-latest) printed 119 --- PASS lines and ok github.com/ZettaScaleLabs/hiroz/crates/hiroz-go/hiroz
Nothing failed in that step 0 --- FAIL lines
The skip is gone Skipping hiroz FFI tests does not appear in that job's log
Both matrix legs pass Go Tests (ubuntu-latest) and Go Tests (macos-latest) are both SUCCESS
CI is green 28 checks completed, 0 failed, 0 pending

Breaking changes

None to library code.

tag what changes who is affected before → after action
BC1 test-go.nu --ffi-only with no libhiroz.a CI, and anyone invoking that flag directly warn and exit 0 → error with a build hint run cargo build -p hiroz --features ffi --release first

The default invocation, --runtime-only, --codegen-only and --vet-only are not affected by BC1.

Coverage this does not have

None of these block this change. They bound what green CI proves.

Important

This does not close #270.

tag gap detail
G1 The header is not regenerated in CI cbindgen is not installed on the runners. build.rs turns its absence into a non-fatal cargo:warning=. The Go side compiles against the committed crates/hiroz-go/hiroz/hiroz_ffi.h.
G2 Clippy still does not lint the module Enabling --features ffi for clippy is deliberately out of scope.
G3 test-integration and test-examples still skip and succeed when the library is absent test-integration and test-examples.

Caveats on the table above:

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ensures Go FFI CI tests execute against a built Rust FFI library and fail when the library is unavailable.

Changes:

  • Builds hiroz with the ffi feature before Go FFI tests.
  • Makes --ffi-only require the Rust library instead of silently skipping.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/ci.yml Builds the required static FFI library.
scripts/test-go.nu Enforces library availability for FFI-only tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The "Go FFI tests" step gated on `has-ffi-library` and, finding none,
logged "Skipping hiroz FFI tests" and reported success. Nothing in CI ever
built with `--features ffi`, so the step has never executed a single test
while appearing green on every PR.

That is how a missing re-entrancy guard in `RawPublisher::publish_bytes`
shipped unnoticed -- the path `rmw-zenoh-rs` publishes through -- and it is
why the committed cbindgen header has drifted from the generator.

Build the library in the job, and turn the skip into an error so the
absence of a library can never again read as a pass.

Refs #270
Adversarial review caught that `error make` sat in `test-runtime`, which
is reached by three dispatch paths: --ffi-only (intended), --runtime-only,
and the no-flag default. A Go-only contributor with no Rust toolchain
running `nu scripts/test-go.nu` after a fresh clone previously got
warnings and all four phases; with the error they got a hard abort at
phase 2, and test-examples and test-vet -- neither of which needs the
library -- never ran.

Gate it behind --require-ffi, set only by the --ffi-only path that CI
uses. The default and --runtime-only keep skipping with the warning.
--codegen-only was never affected.
The step name and issue reference carry it; the rest belonged in the PR
description, where it already is.
@YuanYuYuan
YuanYuYuan force-pushed the ci/ffi-tests-must-run branch from 198e4e3 to 594d462 Compare August 14, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FFI module is never compiled, linted or tested; the "Go FFI tests" CI step silently skips

2 participants