Skip to content

chore: test improvements - #12

Merged
kp2pml30 merged 1 commit into
v0.2-devfrom
pr/v0.2/chore/test-improvements
Aug 1, 2026
Merged

chore: test improvements#12
kp2pml30 merged 1 commit into
v0.2-devfrom
pr/v0.2/chore/test-improvements

Conversation

@kp2pml30

@kp2pml30 kp2pml30 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Auto-opened executor mirror of genlayerlabs/genvm-manager#17.

Carries the executor-side work for that manager PR. Auto-closed as merged when the manager PR lands (its pr/v0.2/chore/test-improvements branch is moved onto v0.2-dev).

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of virtual machine error formats and contract-related error reporting.
    • Strengthened precompiled module lookup by accepting only authorized runners and verifying required artifacts exist.
    • Improved reliability of precompiled data updates by preventing incomplete files from replacing existing ones.
  • Tests

    • Added coverage for valid and invalid precompiled runner lookups, including custom runners and unlisted artifacts.
    • Added coverage for virtual machine error codes and invalid error descriptions.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fa273a48-6c9c-41d9-aa80-ad06c575b30a

📥 Commits

Reviewing files that changed from the base of the PR and between 9064b28 and 1c8126d.

📒 Files selected for processing (6)
  • executor/Cargo.toml
  • executor/crates/sdk-rs/src/abi/consts.rs
  • executor/crates/sdk-rs/tests/vm_error_codes.rs
  • executor/src/exe/precompile.rs
  • executor/src/rt/supervisor/actions.rs
  • executor/tests/precompile_lookup.rs

📝 Walkthrough

Walkthrough

The change adds VM error prefixes and validation, writes precompiled modules atomically, restricts precompile lookup to registered runners, checks both module variants, and consolidates development optimization profiles.

Changes

VM error validation

Layer / File(s) Summary
Error prefixes and validation
executor/crates/sdk-rs/src/abi/consts.rs, executor/crates/sdk-rs/tests/vm_error_codes.rs
OOM and invalid-contract types expose canonical prefixes. VmError::is_valid_ validates static and dynamic error formats. Debug tests verify that WASM trap and host descriptions cannot be empty.

Precompiled module safety

Layer / File(s) Summary
Atomic precompile writes
executor/src/exe/precompile.rs
Precompiled modules use temporary files, synchronization, rename replacement, cleanup, and contextual errors.
Authorized runner lookup and verification
executor/src/rt/supervisor/actions.rs, executor/tests/precompile_lookup.rs
Precompile loading requires a registered runner and hash. Tests cover listed runners, custom runners, unlisted hashes, and both module paths.

Development build settings

Layer / File(s) Summary
Optimized development profiles
executor/Cargo.toml
Development package profiles optimize Cranelift, Wasmtime, parser, compiler-support, and related packages at level 2.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PrecompileBuilder
  participant Filesystem
  participant load_modules
  participant RunnerRegistry

  PrecompileBuilder->>Filesystem: Write temporary precompiled artifacts
  Filesystem-->>PrecompileBuilder: Rename artifacts into destination
  load_modules->>RunnerRegistry: Verify runner ID and hash
  RunnerRegistry-->>load_modules: Return authorized runner
  load_modules->>Filesystem: Check both module variants
  Filesystem-->>load_modules: Return available artifacts
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.21% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the test-focused objective, although it does not describe the related production changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr/v0.2/chore/test-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
executor/tests/precompile_lookup.rs (1)

9-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a panic-safe temp directory for test cleanup.

custom_runner_is_not_in_the_registry only removes root at line 61, after all assert! calls succeed. If any assertion on lines 48-59 fails, the test panics and the temp directory under std::env::temp_dir() is never removed. Repeated test failures accumulate orphaned directories.

Use tempfile::TempDir, which removes its directory on drop regardless of panics, instead of unique_dir plus a manual remove_dir_all call.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@executor/tests/precompile_lookup.rs` around lines 9 - 62, Update
registry_with_one_builtin and custom_runner_is_not_in_the_registry to use
tempfile::TempDir for the temporary root, relying on its Drop cleanup instead of
unique_dir and the manual remove_dir_all call. Preserve returning and using the
TempDir path needed by runners::cache::Reader while ensuring cleanup occurs when
assertions panic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@executor/crates/sdk-rs/src/abi/consts.rs`:
- Around line 377-392: The dynamic constructors for __VmError::WasmTrap and
__VmError::Host must align with VmError::is_valid_ by rejecting empty input or
updating validation to accept empty suffixes; preserve consistency between
val_str and validation, and add tests covering empty input for both
constructors.

---

Nitpick comments:
In `@executor/tests/precompile_lookup.rs`:
- Around line 9-62: Update registry_with_one_builtin and
custom_runner_is_not_in_the_registry to use tempfile::TempDir for the temporary
root, relying on its Drop cleanup instead of unique_dir and the manual
remove_dir_all call. Preserve returning and using the TempDir path needed by
runners::cache::Reader while ensuring cleanup occurs when assertions panic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 20b8aeeb-5b2a-4469-9c27-3f63764efcb0

📥 Commits

Reviewing files that changed from the base of the PR and between 934acbe and e521415.

📒 Files selected for processing (5)
  • executor/Cargo.toml
  • executor/crates/sdk-rs/src/abi/consts.rs
  • executor/src/exe/precompile.rs
  • executor/src/rt/supervisor/actions.rs
  • executor/tests/precompile_lookup.rs

Comment on lines +377 to +392
if let Some(rest) = s.strip_prefix("exit_code ") {
if rest.parse::<i32>().is_ok_and(|v| v.to_string() == rest) {
return true;
}
}
if let Some(rest) = s.strip_prefix("wasm_trap ") {
if !rest.is_empty() {
return true;
}
}
if let Some(rest) = s.strip_prefix("host ") {
if !rest.is_empty() {
return true;
}
}
false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align dynamic constructors with VmError::is_valid_.

__VmError::WasmTrap::val_str("") and __VmError::Host::val_str("") create wasm_trap and host , but this validator rejects both values because the suffix is empty. Reject empty input in the constructors, or accept empty suffixes here. Add tests for both dynamic constructors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@executor/crates/sdk-rs/src/abi/consts.rs` around lines 377 - 392, The dynamic
constructors for __VmError::WasmTrap and __VmError::Host must align with
VmError::is_valid_ by rejecting empty input or updating validation to accept
empty suffixes; preserve consistency between val_str and validation, and add
tests covering empty input for both constructors.

* chore(executor): harden the precompile cache and speed up dev builds 🔒️⚡
* chore(sdk-rs): reject an empty description in vm_error constructors ✅
@kp2pml30
kp2pml30 force-pushed the pr/v0.2/chore/test-improvements branch from 9064b28 to 1c8126d Compare August 1, 2026 09:28
@kp2pml30
kp2pml30 merged commit 1c8126d into v0.2-dev Aug 1, 2026
1 check was pending
@kp2pml30
kp2pml30 deleted the pr/v0.2/chore/test-improvements branch August 4, 2026 06:19
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.

1 participant