Skip to content

Commit defdf41

Browse files
author
Ralph Küpper
committed
fix(perry-ffi): unbreak cargo test -p perry-ffi (undefined js_register_ffi_handle_exists_probe)
#5083 added a `js_register_ffi_handle_exists_probe(...)` call inside `register_handle` (handle.rs) for the runtime's handle-vs-timer disambiguation probe. That symbol is defined in perry-runtime, but perry-ffi's `runtime-link` feature is off by default and CI runs `cargo test -p perry-ffi` per-package in isolation (no --workspace feature unification). The handle-registry tests (bare `#[cfg(test)]`) call `register_handle`, so the test binary retained a reference to an unlinked symbol and failed at `cc` with `undefined reference`. Gating the handle tests on `runtime-link` (the pattern other perry-ffi test modules use) would drop them from CI entirely (the per-package loop never enables the feature). Instead add a test-only no-op stub gated `#[cfg(all(test, not(feature = "runtime-link")))]` so the registry tests keep running and the binary links; the real extern declaration is gated out of that exact config to avoid an E0428 name clash. The stub can never collide with perry-runtime's real definition (it exists only in perry-ffi's own test binary with runtime-link off). Verified: `cargo test -p perry-ffi` links + passes (13); `cargo test -p perry-ffi --features runtime-link` uses the real symbol + passes (35).
1 parent e092362 commit defdf41

5 files changed

Lines changed: 136 additions & 80 deletions

File tree

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
## v0.5.1164 — fix(perry-ffi): unbreak `cargo test -p perry-ffi` (undefined `js_register_ffi_handle_exists_probe`)
2+
3+
The `cargo-test` CI gate was red on `main`: #5083 added a
4+
`js_register_ffi_handle_exists_probe(...)` call inside `register_handle`
5+
(`crates/perry-ffi/src/handle.rs`) to wire up the runtime's handle-vs-timer
6+
disambiguation probe. That symbol is defined in `perry-runtime`, but
7+
`perry-ffi`'s `runtime-link` feature (which pulls `perry-runtime` into the
8+
Cargo graph) is **off** by default, and CI runs `cargo test -p perry-ffi`
9+
per-package in isolation — no `--workspace` feature unification. So the
10+
handle-registry tests (a bare `#[cfg(test)]` module that calls
11+
`register_handle`) retained a reference to a symbol that wasn't linked, and the
12+
test binary failed at `cc` with `undefined reference to
13+
js_register_ffi_handle_exists_probe`.
14+
15+
All other `perry-ffi` test modules avoid this by gating on
16+
`#[cfg(all(test, feature = "runtime-link"))]`, but gating the handle tests the
17+
same way would drop them from CI entirely (the per-package loop never enables
18+
the feature). Instead, this adds a **test-only no-op stub** for the symbol,
19+
gated `#[cfg(all(test, not(feature = "runtime-link")))]`, so the registry tests
20+
keep running and the binary links. The real `extern` declaration is gated out
21+
of that exact configuration to avoid an `E0428` name clash. The stub can never
22+
collide with `perry-runtime`'s real definition: it exists only in `perry-ffi`'s
23+
own `test` binary with `runtime-link` off — not in `runtime-link`-on builds
24+
(real symbol used) nor in the lib builds that npm wrappers link against
25+
`libperry_runtime.a`.
26+
27+
Verified: `cargo test -p perry-ffi` now links and passes (13 tests); `cargo test
28+
-p perry-ffi --features runtime-link` still uses the real perry-runtime symbol
29+
and passes (35 tests), no collision.
30+
131
## v0.5.1163 — fix: chalk boolean style modifiers — `<Text dimColor>` no longer renders `[object Object]` (#5039)
232

333
Fixes #5039 — ink's `<Text dimColor>` (and `bold`/`italic`/`underline`/…)

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
88

99
Perry is a native TypeScript compiler written in Rust that compiles TypeScript source code directly to native executables. It uses SWC for TypeScript parsing and LLVM for code generation.
1010

11-
**Current Version:** 0.5.1163
11+
**Current Version:** 0.5.1164
1212

1313

1414
## TypeScript Parity Status

0 commit comments

Comments
 (0)