Skip to content

Spec: mops deployed command#560

Merged
Kamirus merged 5 commits into
mainfrom
cursor/spec-mops-deployed-1691
Jun 1, 2026
Merged

Spec: mops deployed command#560
Kamirus merged 5 commits into
mainfrom
cursor/spec-mops-deployed-1691

Conversation

@Kamirus
Copy link
Copy Markdown
Collaborator

@Kamirus Kamirus commented Jun 1, 2026

Proposal spec for a new mops deployed command group that produces the committed deployed snapshot (.most + .did) for a Motoko canister.

Why

mops build emits <name>.wasm, <name>.did, <name>.most from one compilation. The wasm is deployed; the other two must be committed as the deployed snapshot:

  • .most — consumed by mops check-stable to guard upgrades against state loss; must match what's on-chain.
  • .did — a committed record of the deployed interface for icp tooling (@icp-sdk/bindgen, icp canister call) and the repo. Not consumed by mops — placed at the icp-cli team's request.

Today this is copied by hand after deploy; forgetting it means the snapshot drifts from on-chain reality. This enables the in-progress icp-cli Motoko recipe to snapshot both files in its post-install sync phase, reusing the exact artifacts that produced the deployed wasm.

Key decisions

  • update, not syncsync is taken (deps reconciliation) and clashes with icp's sync phase; the action is advancing a snapshot forward.
  • Copy-or-error, never regenerate — strictly reuses mops build output so the snapshot can't decouple from the deployed wasm.
  • A configurable snapshot directory ([deployed].dir, default deployed/, --dir override) is the only thing that determines output paths. Both .most and .did go to <dir>/<name>.*.
  • Decoupled from check-stable.pathmops deployed never reads it. init points [check-stable].path at <dir>/<name>.most so the file update writes is the file check-stable reads. If a user points it elsewhere, update/init warn (no hard coupling).
  • The .did is a pure output artifact — mops doesn't consume it; no Candid compat check (check-candid deferred). --no-did opts out.
  • The existing candid field is ignored — it's a curated ahead-of-code interface that the build embeds; the snapshot is a generated lags-code record (see spec appendix).
  • init configures mops.toml — writes the empty-actor .most baseline and sets check-stable.path to coincide; no .did baseline needed. Flags the whole-file TOML rewrite caveat.
  • Canister selection follows mops build/mops check (no arg = all; named = strict). update doesn't require check-stable configured. Multi-canister icp deploys work because icp expands the recipe per canister.

Design proposal only — no implementation. Open questions: directory config surface (global vs per-canister), per-environment snapshots, future check-candid, optional deployed manifest.

Open in Web Open in Cursor 

cursoragent and others added 5 commits June 1, 2026 07:42
Co-authored-by: Kamil Listopad <listopadkamil@gmail.com>
…ig, partial tracking)

Co-authored-by: Kamil Listopad <listopadkamil@gmail.com>
… (most + did)

Co-authored-by: Kamil Listopad <listopadkamil@gmail.com>
…able [deployed].dir + warning)

Co-authored-by: Kamil Listopad <listopadkamil@gmail.com>
…ops generate candid` for interface files

The two file types have distinct lifecycles and consumers — coupling them
under one command was muddying the model:

- `.most` is a post-deploy snapshot consumed by `mops check-stable`; its
  reference must advance exactly when a deploy succeeds. `mops deployed`
  is now a focused post-deploy hook the user (or icp-cli `sync`) calls
  to promote the just-built `.most` into a committed reference path,
  plus `mops deployed init` for first-time baseline + check-stable
  wiring. No `--check`, no `status`, no `.did` handling.

- `.did` is a build-input contract: `mops build` subtype-checks against
  it and embeds it into the wasm; `@icp-sdk/bindgen` reads the same
  file for frontend bindings. Refresh is interface-change-driven, not
  deploy-driven. New `mops generate candid <canister>` (noun-namespace,
  extensible to future generators) (re)generates the curated `.did`
  from source via `moc --idl`, optionally setting `[canisters.<name>].candid`
  on first use. Default destination is next to `main`. Drift detection
  flagged as a follow-up extension of `mops check`.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kamirus Kamirus marked this pull request as ready for review June 1, 2026 14:49
@Kamirus Kamirus requested a review from a team as a code owner June 1, 2026 14:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Cursor AI review

👍 APPROVE — looks safe to merge

Category Assessment Details
Summary Adds two draft design specs: specs/mops-deployed.md (post-deploy .most snapshot via mops deployed / mops deployed init) and specs/mops-candid.md (curated .did maintenance via mops generate candid). No runtime code changes.
Code Quality Specs are well-scoped with explicit non-goals, copy-or-error semantics, and a DRY requirement to share moc invocation logic with build.ts.
Consistency Canister selection, --output defaults, empty-actor baseline, and writeConfig/TOML.stringify caveats match existing CLI patterns (build, check, check-stable, sync).
Security Local file operations only; no chain reads, no regeneration that could decouple artifacts from deployed wasm.
Tests Spec-only PR; follow-ups (e.g. candid drift in mops check) are explicitly deferred rather than assumed done.
Maintainability Clear split between deploy-driven .most and interface-driven .did; open questions and init-as-reserved-name edge case documented.

Verdict

Decision: APPROVE
Risk: Very Low
Reason: This is a documentation-only design proposal with no production code paths changed. The two specs are internally consistent, accurately reference existing CLI behavior, and defer implementation details appropriately.


Generated for commit 990dce5

@Kamirus Kamirus enabled auto-merge (squash) June 1, 2026 14:51
@Kamirus Kamirus merged commit 1280392 into main Jun 1, 2026
27 checks passed
@Kamirus Kamirus deleted the cursor/spec-mops-deployed-1691 branch June 1, 2026 14:57
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.

2 participants