Skip to content

fix: restore fresh clone build and unit tests - #866

Open
roninjin10 wants to merge 1 commit into
mainfrom
shepherd/guillotine-issue-863
Open

fix: restore fresh clone build and unit tests#866
roninjin10 wants to merge 1 commit into
mainfrom
shepherd/guillotine-issue-863

Conversation

@roninjin10

Copy link
Copy Markdown
Contributor

Summary

  • keep the vendored Voltaire Rust package in its own Cargo workspace so release artifacts remain under lib/voltaire/target
  • prevent log smoke tests from emitting error-level output while preserving compile-time coverage for err

Testing

  • cargo metadata --manifest-path lib/voltaire/Cargo.toml --no-deps
  • cargo build --manifest-path lib/voltaire/Cargo.toml --release
  • cargo metadata --no-deps
  • zig build
  • zig build test-unit

Closes #863

Thanks @vladfdp for the report.

Note: This action was performed by Claude AI assistant, not @roninjin10 or @fucory

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
guillotine Ready Ready Preview Aug 7, 2026 4:30am
guillotine-docs Error Error Aug 7, 2026 4:30am

Request Review

@claude

claude Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Code Review

Reviewed the diff between dbdf61b (base) and cbabc97 (head) for PR #866, which closes #863.

Summary of the change:

  1. Cargo workspace isolation (Cargo.toml, lib/voltaire/Cargo.toml): adds lib/voltaire to the root workspace's exclude list and gives lib/voltaire/Cargo.toml its own empty [workspace] table, making it a standalone Cargo workspace. This is the correct root-cause fix -- previously lib/voltaire had no [workspace] of its own and wasn't excluded from the root workspace's explicit members list, so a direct cargo build in that directory implicitly joined the root workspace and put artifacts in the repo-root target/ instead of lib/voltaire/target/, which is exactly the path lib/voltaire/lib/bn254.zig's getRustLibraryPath expects (target/release/libcrypto_wrappers.a relative to lib/voltaire). This is more robust than the CARGO_TARGET_DIR env var workaround suggested in the issue, since it doesn't depend on build.zig remembering to set an env var. No workspace = true inherited fields exist in lib/voltaire/Cargo.toml, so splitting it into its own workspace shouldn't break anything.

  2. Test changes in src/log.zig: removes the err(...) calls from both log tests (since std.log.err calls make Zig's test runner treat the test as failed for logging errors), and replaces coverage of err with a comptime reference plus an assertion that TypeOf(err) equals TypeOf(warn).

Likely bug -- the new TypeOf(err) == TypeOf(warn) assertion:
err and warn (src/log.zig:20 and :27) both take an anytype parameter (args: anytype), which makes them generic functions in Zig. Generic functions don't get a shared structural function type the way plain (non-generic) functions do -- each generic function declaration has its own distinct, per-declaration comptime-only type (this is why a generic function can be passed as a comptime argument to something like fn call(comptime f: anytype, ...), and why you can't assign one generic function to a pointer-to-fn variable holding another). Because of this, TypeOf(err) and TypeOf(warn) are almost certainly two different types even though their signatures read identically, so the equality check evaluates to false, and std.testing.expect(false) fails with error.TestUnexpectedResult.

This lines up with what's currently showing on the PR: both build-test CI checks are failing. Since the whole point of this PR is to make 'zig build test-unit' pass on a fresh clone, this assertion likely reintroduces exactly the kind of failure the PR is trying to fix, just via a different mechanism (a bad assertion instead of a bad log level).

Suggested fix: drop the TypeOf equality check. The 'comptime { _ = &err; }' line alone already achieves the stated goal (preserve compile-time coverage for err) by forcing Zig to semantically analyze err's body without invoking it at runtime (recall pub alone doesn't guarantee a declaration gets analyzed under Zig's lazy analysis -- it still needs to be referenced somewhere). The type-equality check doesn't add meaningful coverage (whether two unrelated logging functions have the same type isn't a real invariant worth asserting) and appears to be the actual cause of the current CI failure.

Minor notes:

  • Removing the err(...) calls from both tests means there's no longer any test exercising err's actual runtime formatting/output path (e.g. the WASM-freestanding early-return branch at src/log.zig:21) -- only that it type-checks. Reasonable trade-off given the constraint (Zig's test runner fails a test that logs at error level), but worth noting as a small coverage regression.
  • The Cargo/build-system portion of the change is minimal, targeted, and matches the testing steps listed in the PR description (cargo metadata, cargo build --release, zig build). No concerns there.
  • No security or memory-safety implications -- this PR only touches build configuration and test code, not EVM execution logic.

Overall: The Cargo workspace fix looks solid and correctly addresses the root cause described in #863. The log.zig test fix is on the right track (avoid calling err() at runtime) but the added TypeOf equality assertion is almost certainly incorrect for generic (anytype-parameter) functions and is likely why CI is currently red on this PR. Recommend removing that assertion before merging.

Note: This review was performed by Claude AI assistant, not @roninjin10 or @fucory

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.

Fresh clone build/test failures: missing libcrypto_wrappers.a and log tests fail

1 participant