Commit e9e76f7
chore: release 0.49.0 — ic-management-canister-types 0.8.0, query-default reads, list_canisters (#737)
* feat: bump ic-management-canister-types to 0.8.0
Bump `ic-management-canister-types` 0.7.1 -> 0.8.0 and adjust ic-utils for
the new types/fields:
- `CanisterSettings`/`DefiniteCanisterSettings` gained a `snapshot_visibility`
field; add `with_snapshot_visibility` to `CreateCanisterBuilder` and
`UpdateSettingsBuilder` and thread it through every settings literal.
- Add `ManagementCanister::canister_metrics()` (ingress-callable per the IC
interface spec) plus the `MgmtMethod::CanisterMetrics` variant.
- Re-export the new types: `SnapshotVisibility`, `CanisterIdRange`,
`ListCanistersResult`, `CyclesConsumed`, `CanisterMetricsArgs`,
`CanisterMetricsResult`.
Bump all workspace crates 0.48.1 -> 0.49.0 (the re-exported settings structs
are not `#[non_exhaustive]`, so the new field is a breaking change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat: add list_canisters + bump pocket-ic to 15.0.0 for ref-tests
Add `ManagementCanister::list_canisters`, the subnet-scoped, query-only
management-canister method. Per the IC interface spec it may only be called by
subnet administrators via non-replicated queries, so it is signed and routed to
the subnet-scoped `/api/v3/subnet/<id>/query` endpoint via
`Agent::query_signed(EffectiveId::Subnet(_), _)` — reusing the existing agent
mechanism rather than adding a `QueryBuilder::with_effective_subnet_id`, keeping
update/query API symmetry (there is no `UpdateBuilder::with_effective_subnet_id`
either). Adds the `MgmtMethod::ListCanisters` variant and an `icx` arm that
bails, since it can't be routed by effective canister id.
Bump the ref-tests pocket-ic git rev to release-2026-07-09_04-35-base
(pocket-ic 13.0.0 -> 15.0.0) and the `icx` crates.io pin to 15.0.0 to keep the
major version in sync. Re-tune `provisional_create_canister_with_cycles` for
pocket-ic 15's stricter memory reserved-cycles floor.
Add (non-ignored) ref-tests for `canister_metrics` and `list_canisters`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(ic-utils): default canister_status/canister_metrics to query calls
`ManagementCanister::canister_status` and `canister_metrics` are the only two
management read methods the replica accepts as both a query and an update. They
now return a `QueryOrUpdateCall` builder that issues a cheap, non-replicated
query by default (`.call().await`), with `.as_update().call().await` to opt into
a replicated, certified update call. Query responses are replica-signed and
verified by the agent unless verification is disabled, which addresses the
"single replica" trust caveat for callers that don't need full replication.
`fetch_canister_logs` and `list_canisters` stay query-only (the interface spec
forbids replicated calls), so they don't get the update toggle.
BREAKING: `canister_status` previously returned `impl AsyncCall` and performed a
replicated update. Callers migrate `.call_and_wait().await` to `.call().await`
(query) or `.as_update().call().await` (previous behavior).
The `provisional_create_canister_with_cycles` ref-test uses `.as_update()` for
its cycle-balance reads, which need a certified read at a definite round rather
than a query whose auto-advancing timestamp reflects extra idle burn. The
`canister_metrics` ref-test exercises both call styles.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(ic-utils): add with_canister_settings to create/update builders
`CreateCanisterBuilder` and `UpdateSettingsBuilder` can now accept a fully built
`CanisterSettings` via `with_canister_settings(...)`, for callers that already
hold one (decoded from config, forwarded from another call, etc.) instead of
decomposing it into individual `with_*` setters. This lets downstream code (e.g.
icp-cli's create_mgmt) route a ready-made settings struct through the builder —
combined with `with_effective_subnet_id`, that replaces a hand-rolled
management-canister update call.
The whole-struct setter is currently mutually exclusive with the individual
settings setters: `build()`/`prepare()` returns an error if both are used. This
keeps the semantics unambiguous; the restriction can be loosened later to a
merge/override model without breaking callers.
Both builders' settings resolution is factored into a `resolve_settings` helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: fmt
* docs: changelog v0.49.0
* docs: note MgmtMethod new variants as a breaking change
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(ic-utils): inline settings resolution instead of &mut self helper
Address review feedback: the `resolve_settings(&mut self)` helper cleared the
builder's settings via `.take()`, gutting the receiver — an undocumented
footgun, even though `prepare()`/`build()` owned and immediately dropped `self`.
Inline the resolution into `prepare()` (create) and `build()` (update) instead,
so `self` is consumed naturally by value with no `&mut`/`take`. The shared
mutual-exclusivity error message is factored into a small `reject_mixed_settings`
helper to avoid duplicating the string.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3ac041c commit e9e76f7
11 files changed
Lines changed: 674 additions & 243 deletions
File tree
- ic-utils/src
- interfaces
- management_canister
- icx
- src
- ref-tests/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
11 | 28 | | |
12 | 29 | | |
13 | 30 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | 390 | | |
392 | 391 | | |
393 | 392 | | |
| |||
411 | 410 | | |
412 | 411 | | |
413 | 412 | | |
414 | | - | |
| 413 | + | |
415 | 414 | | |
416 | 415 | | |
417 | 416 | | |
| |||
0 commit comments