test: verify remote export at the CLI boundary - #4
Merged
Merged
Conversation
Add tests/cli_remote_export.rs, which runs the real binary via CARGO_BIN_EXE_grainx against a std::net::TcpListener /metrics fixture: - success: exit 0, JSON and CSV written, network byte-count fields intact - unreachable endpoint: exit 4, controlled error, no panic text - malformed JSON: exit 4, controlled error, no panic text - 127.0.0.1:0: exact historical runtime-drop panic repro, now exit 4 Record current CLI evidence in demos/verification_2026-09-11-remote-export.md and mark the 5dde108 panic as historical in demos/README.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
grainx export --remote <url>panicked withCannot drop a runtime in a context where blocking is not allowedbecausereqwest::blocking::Clientwas built inside#[tokio::main]. That was fixed in3dfa107by running the blocking request on a dedicated OS thread, with unit tests insrc/metrics.rs. This PR adds the remaining CLI-boundary acceptance and a current demo record.New behavior / tests
tests/cli_remote_export.rsspawns the real compiled binary viaenv!("CARGO_BIN_EXE_grainx")against a minimalstd::net::TcpListener/metricsfixture. No new dependencies, no internet.network_rx_bytes/network_tx_bytesstay byte counts (no rename to rates)remote metrics: ...error, nopanicked/Cannot drop a runtimetextinvalid metrics JSONerror, no panichttp://127.0.0.1:0(the exact historical repro): exit 4, controlled errordemos/verification_2026-09-11-remote-export.md: base commit, dirty count, toolchain, build command, binary SHA-256, exact capture commands, exit codes/outputs for all four cases, and remaining limits.demos/README.md: links the new record and marks the5dde108panic as historical (it is not presented as a success).Test commands
cargo fmt --check cargo check --locked --all-targets cargo clippy --locked --all-targets -- -D warnings cargo test --lockedAll pass.
cargo test --locked: 45 library + 2 bin + 4cli_remote_export+ 13 integration = 64 passed, 0 failed.CLI captures against the frozen binary
sha256 5e485df1469c1163db9b253794a30f7124b763969ea8abf39ae908584c7492b6:grainx agenthttp://127.0.0.1:0Limits
src/metrics.rsandsrc/ui.rsare untouched.