Summary
balance run --vm accepts runtime configuration flags but returns from the VM execution branch before applying them. The program exits successfully even though requested durability, routing, identity, signing, profile, and replication settings are inactive.
Affected options
- module namespace bindings and module root
--event-log, --node-id, and --data-dir
--signing-key and --node-key
--pbft-service and --pbft-peers
--profile and profiles loaded from balance.toml
--remote-service registration and failover endpoints
Reproduction
At commit da9f90f989cb358c489461afadb47885cac23280:
cargo build
issue_dir=$(mktemp -d)
target/debug/balance run tests/programs/kv_store.bl \
--event-log "$issue_dir/interpreter.ndjson"
target/debug/balance run tests/programs/kv_store.bl --vm \
--event-log "$issue_dir/vm.ndjson"
find "$issue_dir" -maxdepth 1 -type f -printf '%f %s bytes\n' | sort
Actual output:
interpreter.ndjson 1368 bytes
Both Balance invocations exit successfully and print the same application output, but vm.ndjson is never created.
Expected behavior
Runtime configuration accepted by balance run should have the same semantics in evaluator and hosted-VM modes. Both commands above should create a non-empty event journal.
If an option is intentionally unsupported with --vm, the CLI should reject the combination with a non-zero exit and a specific error rather than silently ignoring it.
Cause
In crates/balance-cli/src/main.rs, the VM branch is at lines 539-623. It creates a fresh Evaluator, registers local services, drives host calls, and returns at line 623.
The shared-looking runtime setup is actually only in the evaluator path after that return, beginning at line 626. Persistence starts at lines 644-660, signing/identity at 662-694, PBFT at 696-723, profiles at 725-727 and 755-756, and remote services at 729-753.
Impact
- Users can believe durable event/state storage is enabled while execution remains ephemeral.
- VM clients cannot use endpoints supplied by
--remote-service.
- Profile-based trust/durability selection is bypassed.
- Requested signing, node identity, and PBFT backing are not installed.
- Module behavior can diverge between evaluator and VM execution.
Suggested fix
Extract common evaluator configuration into one function and invoke it before either execution branch registers services or evaluates the program. Avoid duplicating option setup between evaluator and VM paths.
Regression coverage
Please add CLI integration tests for:
- A non-empty journal from
run --vm --event-log <path>.
- VM recovery across processes using
--event-log and --data-dir.
- VM routing through
--remote-service.
- Matching validation of invalid/incomplete signing and PBFT options.
- Matching profile and module-resolution behavior.
The existing program corpus and persistence integration tests invoke only the default evaluator path.
Summary
balance run --vmaccepts runtime configuration flags but returns from the VM execution branch before applying them. The program exits successfully even though requested durability, routing, identity, signing, profile, and replication settings are inactive.Affected options
--event-log,--node-id, and--data-dir--signing-keyand--node-key--pbft-serviceand--pbft-peers--profileand profiles loaded frombalance.toml--remote-serviceregistration and failover endpointsReproduction
At commit
da9f90f989cb358c489461afadb47885cac23280:Actual output:
Both Balance invocations exit successfully and print the same application output, but
vm.ndjsonis never created.Expected behavior
Runtime configuration accepted by
balance runshould have the same semantics in evaluator and hosted-VM modes. Both commands above should create a non-empty event journal.If an option is intentionally unsupported with
--vm, the CLI should reject the combination with a non-zero exit and a specific error rather than silently ignoring it.Cause
In
crates/balance-cli/src/main.rs, the VM branch is at lines 539-623. It creates a freshEvaluator, registers local services, drives host calls, and returns at line 623.The shared-looking runtime setup is actually only in the evaluator path after that return, beginning at line 626. Persistence starts at lines 644-660, signing/identity at 662-694, PBFT at 696-723, profiles at 725-727 and 755-756, and remote services at 729-753.
Impact
--remote-service.Suggested fix
Extract common evaluator configuration into one function and invoke it before either execution branch registers services or evaluates the program. Avoid duplicating option setup between evaluator and VM paths.
Regression coverage
Please add CLI integration tests for:
run --vm --event-log <path>.--event-logand--data-dir.--remote-service.The existing program corpus and persistence integration tests invoke only the default evaluator path.