Commit b36cce0
chore: migrate rust/guards to icp-cli (#1396)
* chore: migrate rust/guards to icp-cli
Replace dfx.json with icp.yaml using @dfinity/rust@v3.3.0, restructure
source into backend/ subdirectory, update management canister usage to
ic-cdk-management-canister, add Makefile with guard behavior tests, and
add CI workflow.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(rust/guards): test.sh over Makefile, bump CI image to 1.0.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): drop pinned channel 1.78 from rust-toolchain.toml
Transitive dependencies pulled in by ic-cdk 0.20 require edition2024
support (stabilized in Rust 1.85). Removing the 1.78 pin lets rustup
use the current stable toolchain.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): add ic_cdk::export_candid!() for candid-extractor
Required for the icp-cli recipe to extract the Candid interface from
the compiled WASM via get_candid_pointer.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): fix set -e interaction with expected-panicking canister calls
The panicking calls return a non-zero exit code (canister rejection).
In the old script, 'A && B; C' meant if B failed, set -e exited before
C ran — so the assertion after the panic was never checked.
Fix: split setup and panicking call onto separate lines, add '|| true'
to the panicking call to explicitly allow failure. The setup call still
uses '&&' so it fails loudly if the state reset itself fails.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): restore doc anchor links, drop redundant networks block
- Restore #inter-canister-calls-and-rollbacks and
#securely-handle-traps-in-callbacks fragment identifiers that were
dropped during migration
- Remove redundant networks block from icp.yaml (managed mode is default)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): use docs.internetcomputer.org link format consistently
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): update async-code link to inter-canister-calls
The old URL now redirects to the inter-canister calls page.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): shorten intro sentence and consolidate security link
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(rust/guards): restore PocketIC integration tests, fix docs links
- Restore backend/tests/tests.rs with pocket-ic 14.0.0 API (updated from
original v5 — WasmResult/UserError replaced by direct Vec<u8>/RejectResponse)
- Covers all original scenarios including parallel processing prevention
(submit_call/await_call for concurrent calls — not expressible in bash)
- Fix remaining building-apps/ doc links to guides/security/inter-canister-calls
- README explains both test approaches and how to run PocketIC tests locally
- CI downloads pocket-ic server via gh release download (authenticated, no
rate limit risk) and runs cargo test as a separate step
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* improve(rust/guards): assert exact trap message in test.sh
Capture stderr from expected-panicking calls and verify it contains
'panicking callback!' — same check the PocketIC tests perform.
Extracted into assert_traps() helper to avoid repetition.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): use curl instead of gh for PocketIC server download
gh CLI is not available in the icp-dev-env-rust container.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs(rust/guards): mention trap message assertion in test.sh description
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(rust/guards): use dfinity/pocketic action to install PocketIC server
Replaces manual curl download with the official dfinity/pocketic composite
action — handles OS/arch detection, rate-limit-safe, sets POCKET_IC_BIN
automatically.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 41ddee2 commit b36cce0
14 files changed
Lines changed: 616 additions & 1973 deletions
File tree
- .github/workflows
- rust/guards
- .devcontainer
- backend
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
This file was deleted.
This file was deleted.
0 commit comments