chore(cli): deprecate dfx replica in mops bench, mops test, mops watch#555
Merged
Conversation
dfx itself is being deprecated and PocketIC is the better fit for benchmarks (deterministic, in-process, no background daemon). Print a yellow warning when `mops bench` resolves to `dfx` or to the `dfx-pocket-ic` fallback, and call out the deprecation in `--help` and the docs. Behavior is unchanged for now; the `dfx` replica will be removed in a future release. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Cursor AI review👍 APPROVE — looks safe to merge
VerdictDecision: APPROVE Generated for commit 88a700b |
… removal in NEXT-MAJOR - Extract the warning into a shared `helpers/deprecate-dfx-replica.ts` and wire it through `mops bench`, `mops test --mode replica`, and `mops watch` (one-shot per watch session). - Recommend `mops toolchain use pocket-ic` in the warning text and docs, matching the existing wasmtime hint pattern in `test.ts`. - Annotate `mops test --replica`'s `--help` with the deprecation note, mirroring what `mops bench --replica` already says. - Add a NEXT-MAJOR.md item under "Drop dfx coupling" to remove the dfx replica paths entirely and flip the default to a mops-pinned PocketIC version. Calls out the bench-baseline drift for release notes. Co-authored-by: Cursor <cursoragent@cursor.com>
--replica dfx in mops benchmops bench, mops test, mops watch
`mops toolchain use pocket-ic` (no version) calls `promptVersion`, which is interactive and hangs agents / non-TTY callers. Pin a known- good version in the hint (`mops toolchain use pocket-ic 12.0.0`) so the command is copy-pasteable in both human shells and agent loops. `latest` would self-update but currently resolves to 13.0.0, which the shipped `pic-js-mops@0.14.8` does not support (missing `cloud_engine` in `subnet_config_set`), so an explicit pin is the right answer until `pic-js-mops` is bumped. Same interactive-hint footgun exists for the wasmtime warning in `cli/commands/test/test.ts:281`; left for a follow-up since it predates this PR. Co-authored-by: Cursor <cursoragent@cursor.com>
…e forms Surfaces a catalogue of commands that prompt for input (and hang in non-TTY agent loops) and the flag/argument form that bypasses each prompt. Triggered by the dfx-replica deprecation hint in this PR — `mops toolchain use pocket-ic` (no version) hits a `promptVersion` call and traps agents. Also adds guidance for future commands: prefer non-interactive defaults, and recommend the explicit form in any hint text. Co-authored-by: Cursor <cursoragent@cursor.com>
…eplica-in-bench # Conflicts: # cli/CHANGELOG.md
Drop `mops user import` row and the encrypted-identity paragraph (security: don't suggest unencrypted PEMs). Tighten intro and the template/toolchain cells.
`mops publish --bench` passed `replica: "dfx"` programmatically when no `[toolchain.pocket-ic]` was set. The deprecation warning treats that as a user-supplied `--replica dfx` flag and prints the wrong lead message. Drop the explicit `replica` field — `bench` does the same toolchain lookup internally, so the duplicated resolution becomes unreachable and the correct "Using `dfx` because no `pocket-ic` set" warning fires.
The previous unconditional `warnIfDfxReplica` at the top of `test()` fired even when no test would run in replica mode (interpreter-only or wasi-only projects without `[toolchain.pocket-ic]`). Move the call inside `testWithReporter`, gated on `hasReplicaTests`, so the warning only fires when at least one test file is detected as actor or `// @Testmode replica`. Add a module-level `alreadyWarned` flag so `mops watch` (which calls `testWithReporter` on every recompute) prints the warning at most once per process. Drop the now-redundant `warnedDfx` field and explicit call from `watch/tester.ts`. Plumb `explicitReplica` through `runAll`/`testWithReporter` so the "`--replica dfx`" lead message still fires when the user actually passed the flag. Bug surfaced by AI review on the prior commit.
AI review flagged that the dfx-replica deprecation warning is hooked up in code but not surfaced in the two places agents/users discover it: the `.agents/skills/mops-cli/SKILL.md` skill and the `mops watch` docs page. - SKILL.md: extend the "No dfx" principle to recommend pinning `pocket-ic`, add the pin to the minimal `[toolchain]` block, list `mops toolchain use pocket-ic 12.0.0` in the toolchain command cheatsheet, and add a short replica/deprecation note under `mops test`. - `mops watch` docs: add an info admonition under `--test` mirroring the test/bench pages, so users reading the watch docs learn about the deprecation and the one-line remediation. No code change. The hardcoded `12.0.0` in the warning text is intentional (see PR #555 / commit 3ed9624: `latest` currently resolves to 13.0.0 which the shipped `pic-js-mops@0.14.8` doesn't support) and is already documented in AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
dfxis being deprecated upstream, and for benchmarks and replica tests specifically PocketIC is the better fit anyway — it's deterministic, in-process, and doesn't need a separate background daemon.mopsalready preferspocket-icoverdfxwhen both are configured; this PR starts steering the remaining users off thedfxpath across all three commands that use a replica.What changes for users
A yellow warning now prints when
mops bench,mops test --mode replica, ormops watchresolves to a dfx-backed replica. Three variants:--replica dfx--replica dfxis deprecated and will be removed in a future release.--replica, nopocket-icin[toolchain]dfxreplica because nopocket-icversion is set in[toolchain]. Thedfxreplica is deprecated…--replica pocket-ic, no[toolchain.pocket-ic], dfx ≥ 0.24.1 on PATH (falls back to dfx-bundled PocketIC)pocket-icversion is set in[toolchain]. This fallback is deprecated…Each warning ends with:
Run `mops toolchain use pocket-ic` to pin a PocketIC version and silence this warning.--helpfor bothmops bench --replicaandmops test --replicareadsWhich replica to use… (\`dfx\` is deprecated; prefer \`pocket-ic\`). Docs pages for both commands call out the deprecation explicitly.For
mops watchthe warning fires once per watch session (not on every recompute).Behavior is otherwise unchanged.
--replica dfxstill works, defaults still resolve the same way, thedfx-pocket-icfallback still falls back. Removal lands in mops v3.Removal plan
Added under
NEXT-MAJOR.md→ "Dropdfxcoupling":Pocket-ic compatibility note (out of scope here)
While verifying I confirmed
mopsworks with PocketIC 9.x — 12.0.0. PocketIC 13.0.0 fails (pic-js-mops@0.14.8doesn't send the newcloud_enginefield). Bumpingpic-js-mopsis tracked separately — this PR is scoped to the dfx deprecation.Test plan
mops bench --replica dfx→ explicit-dfx warningmops benchwith no[toolchain.pocket-ic]→ default-fallback warningmops bench --replica pocket-icwith no[toolchain.pocket-ic]→ dfx-pocket-ic fallback warningmops benchwithpocket-ic = "12.0.0"→ no warning, bench runsmops test --mode replica --replica dfx→ explicit-dfx warningmops test --mode replicawith no[toolchain.pocket-ic]→ default-fallback warningmops test --mode replica --replica pocket-icwith no[toolchain.pocket-ic]→ dfx-pocket-ic fallback warningmops test --mode replicawithpocket-ic = "12.0.0"→ no warning, tests passnpm run checkpasses (tsc + svelte-check)