chore: migrate rust/query_stats to icp-cli#1400
Merged
Merged
Conversation
9ad4874 to
5a519c1
Compare
5a519c1 to
8f077c8
Compare
- Replace dfx.json with icp.yaml using @dfinity/rust@v3.3.0 recipe - Move src/lib.rs to backend/lib.rs; add workspace Cargo.toml - Update ic-cdk to 0.20 and replace deprecated ic_cdk::api::management_canister with ic-cdk-management-canister = "0.1.1" - Add Makefile with test and test-stats targets (fast API check + polling loop) - Add rust-toolchain.toml with wasm32-unknown-unknown target - Update README with icp-cli prerequisites and query stats explanation - Add rust-query_stats job to .github/workflows/query_stats.yml - Delete dfx.json, BUILD.md, query-stats.did, .devcontainer/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…:canister_self() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop redundant networks block from icp.yaml - Remove references to non-existent test-stats.sh and make test-stats - Simplify README to accurately describe what test.sh does Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion Mirrors the Motoko example's test-stats.sh: makes 13 --query calls to load() every 3s and polls get_query_stats() until Number of calls shows a non-zero value (or times out after 30s). 13+ calls are needed per round because PocketIC simulates a 13-node subnet and uses integer division (num_calls / 13). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
⚠️ Not ready to approve
The Motoko workflow step runs make test but the example directory has no Makefile, so CI will fail unless the workflow is corrected.
Pull request overview
Migrates the rust/query_stats example from dfx to icp-cli, aligning it with the repo’s canonical Rust example layout (workspace + backend/ crate), updated dependencies, and icp-cli based CI/testing.
Changes:
- Replaced dfx project files with
icp.yaml, a Rust workspaceCargo.toml, and updatedCargo.lockfor the new dependency set. - Moved canister source to
backend/lib.rs, upgraded toic-cdk = 0.20, and switched toic-cdk-management-canisterAPIs (plusexport_candid!()). - Added
test.sh+test-stats.sh, and extended the existingquery_statsGitHub Actions workflow with a Rust job.
File summaries
| File | Description |
|---|---|
| rust/query_stats/test.sh | Adds a fast smoke test for load() and get_query_stats() output shape. |
| rust/query_stats/test-stats.sh | Adds a polling/load script to demonstrate non-zero query stats locally. |
| rust/query_stats/rust-toolchain.toml | Ensures the wasm target is available for builds. |
| rust/query_stats/README.md | Updates documentation for icp-cli usage and explains query-stats behavior/requirements. |
| rust/query_stats/query-stats.did | Removes the old dfx-era .did file. |
| rust/query_stats/icp.yaml | Adds icp-cli project definition for the Rust backend canister. |
| rust/query_stats/dfx.json | Removes the old dfx project definition. |
| rust/query_stats/Cargo.toml | Converts the root crate into a workspace. |
| rust/query_stats/Cargo.lock | Updates lockfile for the workspace + upgraded deps (ic-cdk, etc.). |
| rust/query_stats/BUILD.md | Removes ICP Ninja / dfx-oriented build instructions. |
| rust/query_stats/backend/lib.rs | Ports canister code to new layout and updated management-canister APIs; exports candid. |
| rust/query_stats/backend/Cargo.toml | Adds backend crate definition and updated dependencies. |
| rust/query_stats/.devcontainer/devcontainer.json | Removes per-example devcontainer config. |
| .github/workflows/query_stats.yml | Adds Rust job trigger/run and adjusts Motoko job command (currently problematic). |
Copilot's findings
- Files reviewed: 13/14 changed files
- Comments generated: 2
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ale) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
schneiderstefan
approved these changes
Jun 19, 2026
raymondk
approved these changes
Jun 19, 2026
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.
Summary
Migrates
rust/query_statsfrom dfx to icp-cli.Removed:
dfx.json,BUILD.md,query-stats.did,.devcontainer/Changed:
src/lib.rstobackend/lib.rswith a workspaceCargo.tomlic-cdkbumped to0.20; replaced removedic_cdk::api::management_canisterwithic-cdk-management-canister = "0.1.1"; replaced removedic_cdk::id()withic_cdk::api::canister_self()Added:
icp.yamlwith@dfinity/rust@v3.3.0recipetest.shwith 2 tests:load()returns a non-zero timestamp,get_query_stats()returns all four stat fieldstest-stats.sh— mirrors the Motoko example: makes 13--querycalls every 3s and polls untilNumber of callsis non-zero (up to 30s)rust-toolchain.tomlwithwasm32-unknown-unknowntargetrust-query_statsjob in.github/workflows/query_stats.ymlusingicp-dev-env-rust:1.0.1Test plan
icp network start -d && icp deploy && bash test.shpasses locallybash test-stats.shshows non-zero stats after ~12s locallyrust-query_statsjob passes🤖 Generated with Claude Code