Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Exact engine IDs can incorrectly produce ambiguity errors when they match another engine’s name.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds cloud-engine targeting by name to canister creation and deployment, reusing existing subnet placement behavior.
Changes:
- Adds
--engineresolution, subnet-ID passthrough, and argument conflicts. - Introduces engine registry interfaces and shared missing-canister detection.
- Adds tests and documents engine selection.
| File | Description |
|---|---|
| docs/reference/environment-variables.md | Documents the registry override. |
| docs/reference/cli.md | Documents --engine options. |
| docs/guides/deploying-to-specific-subnets.md | Adds cloud-engine examples. |
| crates/icp-project/src/operations/create.rs | Uses shared missing-canister detection. |
| crates/icp-project/src/calls.rs | Adds shared detection and tests. |
| crates/icp-cli/tests/deploy_tests.rs | Tests argument conflicts. |
| crates/icp-cli/tests/canister_create_tests.rs | Tests subnet passthrough and lookup errors. |
| crates/icp-cli/src/main.rs | Registers the engine module. |
| crates/icp-cli/src/engine.rs | Implements engine selection and resolver tests. |
| crates/icp-cli/src/commands/deploy.rs | Resolves engines before building. |
| crates/icp-cli/src/commands/canister/create.rs | Integrates engine targeting. |
| crates/icp-canister-interfaces/src/engine_canister.rs | Adds registry types and override tests. |
| CHANGELOG.md | Announces engine targeting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`icp deploy` and `icp canister create` take `--engine <name>`, which resolves the engine's subnet through the engine canister and then behaves as `--subnet` would with it. The name is looked up among the engines visible to the identity in use (`listVisibleEngines`, then `getEngineMetadata` for each); `name/slug` or the engine's id picks one of several engines sharing a name, and a subnet id passed as the engine is used as-is. A name nobody can see lists the visible engines, a shared name lists each candidate, and a network without the engine canister says so. The Candid types for the two queries join the engine-canister interface, and the canister-not-found check the operator lookup used moves onto `CallError` so both lookups share it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
raymondk
force-pushed
the
rk/engine-flag
branch
from
October 5, 2026 22:33
60dd4fd to
cb49163
Compare
An engine's id is unique and settles the lookup by itself, so it is answered before any name is compared: an engine whose name happens to be another engine's id no longer makes that id ambiguous. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
raymondk
added this pull request to stack #804
October 6, 2026 00:18
This branch has not been deployed
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
icp deployandicp canister createtake--engine <name>to target a cloud engine by name. The name is resolved to the engine's subnet through the engine canister (q6cfj-fyaaa-aaaar-qb77q-caion mainnet,ENGINE_CANISTER_IDoverrides it), and the command then behaves exactly as--subnetwould with that subnet.--engine <name>callslistVisibleEngines, drops deleted engines, fetchesgetEngineMetadatafor the rest, and matches the input against an engine's name, its id, orname/slug.--engine <subnet-id>is--subnet <subnet-id>: a principal is taken to be the subnet itself, with no lookup.--engineconflicts with--subnetand--proxy, and on deploy with--no-create, exactly like--subnet.Code
crates/icp-cli/src/engine.rs(new):EngineSelector(the clap value type),resolve_subnetand its error enum, with unit tests against a fakeCanisterCalls.icp-canister-interfaces::engine_canister: Candid types forEngine,EngineMetadata,EngineErrorandMetadataResult, taken from the canister's livecandid:serviceon mainnet, plus the two method names.CallError::is_canister_not_foundinicp-project: the check the engine-operator lookup already did, moved onto the error type so both lookups share it.The engine canister id stays hard-coded (with the existing env override). A per-network setting is left for a follow-up.
Test plan
cargo test -p icp-cli --bin icp engine,cargo test -p icp-canister-interfaces,cargo test -p icp-project(default and--no-default-features)canister_create_on_requested_engine(creates on the given subnet via--engine <subnet-id>on a multi-subnet local network, then checks the named-engine refusal where no engine canister exists), the clap conflict tests for both commands, and the existing Dockerdeploy_cloud_engine/canister_create_cloud_enginetestscargo clippy --all-targets,cargo fmt --check, wasm32 clippy foricp-project,scripts/check-no-host-reach.shscripts/generate-cli-docs.shregenerateddocs/reference/cli.mdicp deploy -e ic --engine <your engine>against mainnet with an identity that can see an engine🤖 Generated with Claude Code