You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(build): generate .most file via --stable-types (#456)
## Summary
- `mops build` now always passes `--stable-types` to `moc`, generating a
`<canister>.most` (Motoko stable types) file alongside `.wasm` and
`.did` for every canister
- `--stable-types` is registered in `managedFlags` so users get a clear
warning if they try to pass it manually via `[build].args` or `--` extra
args
## Test plan
- `custom output path via config outputDir` — asserts `main.most` is
produced in the configured output dir
- `--output CLI option` — asserts `foo.most` is produced alongside
`foo.wasm` and `foo.did`
- `warns when args contain managed flags` — now also passes
`--stable-types` to cover the duplicate-flag warning; snapshot updated
- Verbose-mode snapshots (`build ok 1`, `build error 1`) updated to
reflect `--stable-types` in the logged moc args
## Notable decisions
- No changes to how the `.most` file is consumed — it is left in the
output directory for tooling (e.g. upgrade compatibility checks) to pick
up
- Flag placement mirrors `--idl`: immediately after `-c`, before `-o`
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Ryan Vandersmith <ryanvandersmith@gmail.com>
Copy file name to clipboardExpand all lines: cli/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
## Next
4
4
5
+
-`mops build` now generates a `.most` (Motoko stable types) file alongside `.wasm` and `.did` for each canister; the `.most` file can be passed directly to `mops check-stable` to verify upgrade compatibility
5
6
-`mops.lock` is now created automatically the first time dependencies are installed — no need to run `mops i --lock update` once to opt in. Triggered by `mops install`, `mops add`, `mops remove`, `mops update`, `mops sync`, and `mops init` (when it installs dependencies). Applications should commit `mops.lock`; library authors should add it to `.gitignore`.
Custom output directory for compiled Wasmand Candid files. The path is relative to the `mops.toml` location.
91
+
Custom output directory for compiled Wasm, Candid, and stable types files. The path is relative to the `mops.toml` location.
91
92
92
93
Default `.mops/.build`
93
94
@@ -100,3 +101,18 @@ If a `candid` field is specified in the canister configuration, the build comman
100
101
If the compatibility check fails, the build will fail with an error message.
101
102
102
103
For manual compatibility checking, see [`mops check-candid`](/cli/mops-check-candid).
104
+
105
+
## Stable Types
106
+
107
+
Each build produces a `<canister>.most` file in the output directory alongside the `.wasm` and `.did` files. This file captures the stable variable type signatures of the current canister version.
108
+
109
+
To use it for upgrade safety checking, save the `.most` file before deploying a new version (e.g. copy it to a committed path), then point `mops check` to it via `mops.toml`:
110
+
111
+
```toml
112
+
[canisters.backend.check-stable]
113
+
path = ".deployed/backend.most"
114
+
```
115
+
116
+
With this in place, `mops check` automatically verifies upgrade compatibility on every run.
117
+
118
+
See [`mops check`](/cli/mops-check#stable-compatibility-checking) for full configuration details.
Copy file name to clipboardExpand all lines: docs/docs/cli/4-dev/05-mops-check-stable.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,10 @@ Path to the old (deployed) version of the actor. Accepts two formats:
46
46
-**`.mo` file** — the old Motoko source file. The command generates the `.most` stable type signature automatically.
47
47
-**`.most` file** — a pre-generated stable type signature. Used directly without compilation.
48
48
49
+
:::tip
50
+
`mops build` generates a `.most` file for each canister alongside `.wasm` and `.did`. Save it before deploying an upgrade, then configure `[canisters.<name>.check-stable]` in `mops.toml` so `mops check` verifies upgrade safety automatically on every run.
51
+
:::
52
+
49
53
### `[canister]`
50
54
51
55
Name of the canister to check against (as defined in `mops.toml`). The current entrypoint is resolved from `[canisters.<name>].main`.
0 commit comments