Skip to content

feat: prune env-specific canisters from deploys even in workspaces - #734

Open
adamspofford-dfinity wants to merge 10 commits into
mainfrom
spofford/consistent-env
Open

feat: prune env-specific canisters from deploys even in workspaces#734
adamspofford-dfinity wants to merge 10 commits into
mainfrom
spofford/consistent-env

Conversation

@adamspofford-dfinity

@adamspofford-dfinity adamspofford-dfinity commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

icp deploy -e foo should not deploy any canisters not listed in environment foo, but this does not work in workspaces. This PR fixes that.

Copilot AI balanced review requested due to automatic review settings August 26, 2026 18:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Honors dependency-specific environment canister selections within workspaces.

Changes:

  • Prunes excluded dependency canisters during manifest consolidation.
  • Adjusts member-scoped deployment binding handling.
  • Adds tests and documentation for workspace environment selection.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
CHANGELOG.md Records the behavior change.
docs/concepts/environments.md Documents workspace selection behavior.
docs/concepts/project-dependencies.md Explains dependency environment precedence.
crates/icp/src/project.rs Consolidates member selections and overrides.
crates/icp-cli/src/commands/deploy.rs Skips missing excluded binding targets.
crates/icp-cli/tests/dependency_tests.rs Adds end-to-end pruning coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/icp-cli/src/commands/deploy.rs Outdated
Comment thread crates/icp/src/project.rs Outdated
@adamspofford-dfinity
adamspofford-dfinity requested a balanced review from Copilot August 26, 2026 19:08
@adamspofford-dfinity
adamspofford-dfinity marked this pull request as ready for review August 26, 2026 19:09
@adamspofford-dfinity
adamspofford-dfinity requested a review from a team as a code owner August 26, 2026 19:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread crates/icp/src/project.rs Outdated
Comment thread docs/concepts/environments.md Outdated

@lwshang lwshang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read every hunk and verified the first two findings empirically in a throwaway worktree. The partition model reads well and the nested <path>:<canister> resolution is careful, but two cases behave worse than before the change. Details inline.

Comment thread crates/icp/src/project.rs Outdated
Comment thread crates/icp/src/project.rs Outdated
Comment thread crates/icp-cli/src/operations/settings.rs Outdated
@adamspofford-dfinity
adamspofford-dfinity changed the base branch from main to spofford/canister-exclude August 26, 2026 21:01
@adamspofford-dfinity
adamspofford-dfinity force-pushed the spofford/consistent-env branch 2 times, most recently from 936f128 to 81ad117 Compare August 26, 2026 21:50
@adamspofford-dfinity
adamspofford-dfinity changed the base branch from spofford/canister-exclude to main August 27, 2026 18:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Persisted IDs can still wire excluded canisters after an environment selection is tightened.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment on lines +681 to +682
if !env.canisters.contains_key(target) {
continue;
Comment on lines +26 to +28
`icp deploy` deploys **all** of the dependency's canisters into the same environment, not just the exposed ones. A dependency's canisters may call each other, and icp-cli does not track an internal "requires" graph, so the whole dependency is always deployed — exactly as it would deploy on its own. `canisters:` here is an **exposure** filter (which IDs your canisters see), not a deployment filter.

"Exactly as it would deploy on its own" includes its own environments: if the dependency's environment [names a subset of its canisters](#which-canisters-an-environment-holds), only those are deployed to that environment.
Comment thread docs/concepts/project-dependencies.md Outdated
adamspofford-dfinity and others added 2 commits September 8, 2026 08:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants