Skip to content

feat: apply per-canister moc args in check and check-stable#487

Merged
Kamirus merged 5 commits intomainfrom
fix/moc-args-canister-handling
Apr 14, 2026
Merged

feat: apply per-canister moc args in check and check-stable#487
Kamirus merged 5 commits intomainfrom
fix/moc-args-canister-handling

Conversation

@Kamirus
Copy link
Copy Markdown
Collaborator

@Kamirus Kamirus commented Apr 14, 2026

Problem

[canisters.<name>].args from mops.toml were only passed to moc during mops build. The check and check-stable commands silently ignored per-canister args, using only global [moc].args.

This meant flags like --enhanced-migration=migrations/backend worked in mops build but were missing during mops check, causing check failures. The only workaround was setting the flag in global [moc].args, which doesn't work for multi-canister projects where each canister needs a different migration path.

Fix

Per-canister [canisters.<name>].args are now applied in all three commands (build, check, check-stable) with consistent ordering: [moc].args[canisters.<name>].args → CLI -- flags.

New CLI capabilities

mops check now accepts canister names:

mops check              # check all canisters
mops check backend      # check a specific canister
mops check src/main.mo  # check a file (unchanged)

mops check-stable now supports a no-args mode:

mops check-stable              # check all canisters with [check-stable] configured
mops check-stable backend      # check a specific canister
mops check-stable old.most     # check using an old file (unchanged)

Both commands apply [canisters.<name>].args when checking canisters, matching mops build behavior.

Docs updated

  • mops check — updated arguments, examples, and description for canister-name support
  • mops check-stable — documented canister mode and file mode as separate usage patterns
  • mops.toml — clarified that [canisters.<name>].args applies to check, check-stable, and build; added multi-canister example

Test plan

  • mops check with no args checks all canisters with per-canister args
  • mops check backend filters to a specific canister
  • mops check nonexistent errors with available canister names
  • [canisters.X].args with -Werror correctly applied in check
  • mops check-stable with no args checks all canisters with [check-stable] config
  • mops check-stable backend filters to a specific canister
  • [canisters.X].args with --enhanced-migration correctly applied in check-stable
  • All 45 existing check/check-stable tests pass

[canisters.<name>].args from mops.toml were only passed to moc during
build but silently ignored by check and check-stable. This caused
flags like --enhanced-migration=<path> to work in build but fail
in check, forcing users to set global [moc].args that don't make
sense for multi-canister projects where each canister needs different
paths.

- check and check-stable now accept canister names as arguments
  (e.g. mops check backend, mops check-stable backend)
- check-stable supports a no-args mode that checks all canisters
  with [check-stable] configured
- per-canister args are applied alongside global [moc].args in
  all three commands (build, check, check-stable)
- shared helpers extracted: filterCanisters, validateCanisterArgs,
  looksLikeFile, resolveStablePath

Made-with: Cursor
@Kamirus Kamirus requested a review from a team as a code owner April 14, 2026 11:07
Kamirus added 4 commits April 14, 2026 13:19
- hoist sources in checkStable canister loop (avoid repeated sourcesArgs)
- rename logAllLibsSupport → checkAllLibsSupport (name matches behavior)
- pass fileArgs to checkFiles (clearer intent)
- bind args[0] once in check-stable file mode (remove ! assertions)
- docs: fix "file paths" wording, clarify [build].args scope in [moc] section

Made-with: Cursor
@Kamirus Kamirus changed the title fix: apply per-canister moc args in check and check-stable feat: apply per-canister moc args in check and check-stable Apr 14, 2026
@Kamirus Kamirus merged commit 93aedfc into main Apr 14, 2026
27 checks passed
@Kamirus Kamirus deleted the fix/moc-args-canister-handling branch April 14, 2026 12:15
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.

1 participant