Skip to content

feat: Add --no-create flag to icp deploy#652

Merged
lwshang merged 5 commits into
mainfrom
spofford/flag-no-create
Jul 16, 2026
Merged

feat: Add --no-create flag to icp deploy#652
lwshang merged 5 commits into
mainfrom
spofford/flag-no-create

Conversation

@adamspofford-dfinity

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 23:52
@adamspofford-dfinity
adamspofford-dfinity requested a review from a team as a code owner July 15, 2026 23:52

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

Adds an intended --no-create safeguard to icp deploy.

Changes:

  • Adds missing-canister validation.
  • Documents the flag in the changelog.
  • Regenerates the CLI reference, but leaves it truncated.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
crates/icp-cli/src/commands/deploy.rs Adds deployment guard logic.
CHANGELOG.md Announces the new flag.
docs/reference/cli.md Updates generated CLI documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/icp-cli/src/commands/deploy.rs
Comment thread crates/icp-cli/src/commands/deploy.rs Outdated
Comment thread crates/icp-cli/src/commands/deploy.rs Outdated
Comment thread crates/icp-cli/src/commands/deploy.rs
Comment thread docs/reference/cli.md
@marc0olo

Copy link
Copy Markdown
Member

This looks solid overall — clean implementation, good test coverage (both the missing and already-exists paths), and CHANGELOG + CLI docs are updated. 👍

Leaving final approval to Linwei/Raymond since this introduces a new flag.

A few optional, non-blocking nits:

  1. Creating canisters: is logged unconditionally at deploy.rs:181, so the --no-create failure prints Creating canisters: immediately followed by the "will not create" error, which reads a little oddly. Could move that log into the else create branch.
  2. Suppressing the All canisters already exist message under --no-create is a minor special case — deploy proceeds identically either way when everything exists, so leaving it unconditional would be simpler.
  3. Not a request to change here, just noting: the build runs before the --no-create check, so the flag doesn't fail-fast before building. Fine given the check needs the env/agent/ids.

None of these block merge.

lwshang and others added 4 commits July 16, 2026 13:10
The unconditional "Creating canisters:" header over-claimed the phase: it
printed even when nothing would be created, which read oddly ahead of both
"All canisters already exist" and the new --no-create error. Rewording to
"Ensuring canisters exist:" makes every follow-up line read naturally, and
lets the "already exist" message print unconditionally again (dropping the
--no-create special case).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
--subnet and --cycles only affect canister creation, so combining them with
--no-create silently ignored them. Reject the combination at parse time so the
user gets immediate feedback. --proxy is intentionally excluded since it is
used well beyond creation (install, settings, sync). The defaulted --cycles
only conflicts when explicitly passed, not via its default value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Locks in the parse-time conflict added for --no-create. The explicit
--cycles case also guards against a future regression where the flag's
default value could start spuriously triggering the conflict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lwshang

lwshang commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
  • Reworded the phase header "Creating canisters:" → "Ensuring canisters exist:". The old header over-claimed — it printed even when nothing would be created, reading oddly ahead of both "All canisters already exist" and the new --no-create error. The new wording reads naturally everywhere, and "All canisters already exist" now prints unconditionally again.
  • Made --no-create conflict with --subnet/--cycles at parse time (with a test). They only affect creation, so combined with --no-create they were silently ignored — now clap rejects the combo up front. --proxy is left out since it's used beyond creation.

@lwshang
lwshang enabled auto-merge (squash) July 16, 2026 17:22
@lwshang
lwshang merged commit 71765ca into main Jul 16, 2026
97 checks passed
@lwshang
lwshang deleted the spofford/flag-no-create branch July 16, 2026 17:29
lwshang added a commit that referenced this pull request Jul 16, 2026
* refactor: drop universal deploy header, print per state

Follow-up to #652. Instead of an always-printed phase header, print a line
that reflects what actually happens: "All canisters already exist" when there
is nothing to create, or "Creating canisters:" only in the branch that creates.

This drops the awkward "Ensuring canisters exist:" on a normal deploy, and
avoids "Creating canisters:" ever sitting in front of "All canisters already
exist" or the `--no-create` error. Output now follows the state, not the flag:
`deploy` and `deploy --no-create` print the same thing whenever they do the
same thing (all canisters exist), and differ only when the behavior differs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: assert deploy canister-phase messages per state

Addresses a Copilot review comment: the existing --no-create tests only
checked success/failure, so a regression that printed "Creating canisters:"
before the --no-create error (or dropped "All canisters already exist") would
pass silently.

- missing + --no-create: error prints with no "Creating canisters:" header.
- creating deploy: prints "Creating canisters:".
- all-exist + --no-create: prints "All canisters already exist", no header.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.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