Skip to content

chore: migrate motoko/composite_query to icp-cli - #1382

Merged
marc0olo merged 7 commits into
masterfrom
chore/migrate-composite_query-to-icp-cli
Jun 15, 2026
Merged

marc0olo merged 7 commits into
masterfrom
chore/migrate-composite_query-to-icp-cli

Conversation

@marc0olo

@marc0olo marc0olo commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Migrates motoko/composite_query from dfx to icp-cli.

Code:

  • Replace dfx.json with icp.yaml using @dfinity/motoko@v5.0.0
  • Update mops.toml: moc 1.9.0, core 2.5.0, --default-persistent-actors
  • Move src/map/Map.mo → backend/app.mo, src/map/Buckets.mo → backend/Buckets.mo
  • Remove persistent from the main actor (covered by --default-persistent-actors); keep persistent on actor class Bucket (actor classes require the explicit keyword)

Tests (Makefile):

  • 5 tests: put, composite get, getUpdate comparison, null for missing key
  • Test 5 uses keys 0–3 (each routes to a different bucket via k % 4) to actually verify cross-bucket routing — the composite query must call the right child canister for all four buckets

Docs:

  • README opens with the core concept: regular queries cannot call other canisters; composite queries lift this restriction
  • Explains getUpdate alongside get as an intentional comparison (update call vs composite query, same result, different latency)
  • ASCII diagram shows the key % 4 sharding to four buckets (all rows aligned)
  • Links to the composite queries developer docs
  • CI workflow at .github/workflows/composite_query.yml using icp-dev-env-motoko:0.3.2 with icp deploy --cycles 30t
  • Delete old dfx-based workflow, dfx.json

Test plan

  • icp network start -d && icp deploy --cycles 30t && make test passes
  • CI workflow passes all 5 tests
  • make topup works when canister runs low on cycles

marc0olo and others added 7 commits June 12, 2026 22:10
Replace dfx.json with icp.yaml, update mops.toml to moc 1.9.0 and
core 2.5.0, move src/map/ to backend/, rename Map.mo to app.mo,
add Makefile with test target, add CI workflow, and update README.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… from README

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…EADME

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Open with the core constraint: regular queries cannot call other
  canisters; composite queries lift this restriction
- Explain why getUpdate exists: same operation as a comparison point
  (update call vs composite query, same result, different latency)
- Add ASCII diagram of the key % 4 sharding to buckets
- Move cycles note into the deploy section where it belongs
- Add Candid regeneration section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t routing tests

- Fix ASCII diagram: all bucket rows now start at the same column
- Link to composite queries developer docs
- Test 5 now uses keys 0-3 (each routes to a different bucket) instead
  of 0, 4, 8 (all in Bucket 0) — actually verifies cross-bucket routing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo
marc0olo marked this pull request as ready for review June 15, 2026 14:37
@marc0olo
marc0olo requested a review from a team as a code owner June 15, 2026 14:37
@marc0olo
marc0olo requested a review from Copilot June 15, 2026 14:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the motoko/composite_query example from dfx-based tooling to icp-cli, updating project configuration, CI, and documentation accordingly while keeping the example’s composite-query multi-canister architecture.

Changes:

  • Replace dfx.json with icp.yaml, and update mops.toml toolchain/dependencies and moc args for the icp-cli workflow.
  • Update build/test automation to use icp commands and add a topup target for cycle replenishment.
  • Add a new GitHub Actions workflow for the example and remove the old dfx-based workflow; refresh README to match the new flow and explain composite queries.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
motoko/composite_query/README.md Rewrites README to explain composite queries and updates command-line instructions for icp-cli.
motoko/composite_query/mops.toml Bumps moc/core versions, adds --default-persistent-actors, and points the backend canister main to backend/app.mo.
motoko/composite_query/Makefile Replaces dfx-based build/test with icp-cli calls and adds a topup target.
motoko/composite_query/icp.yaml Adds icp-cli canister recipe using @dfinity/motoko@v5.0.0.
motoko/composite_query/dfx.json Removes dfx project configuration.
motoko/composite_query/backend/Buckets.mo Adds Bucket canister implementation and marks get as a query for composite-query routing.
motoko/composite_query/backend/app.mo Adjusts actor persistence behavior to rely on --default-persistent-actors.
.github/workflows/motoko-composite-query-example.yaml Removes the previous dfx-based CI workflow.
.github/workflows/composite_query.yml Adds new CI workflow running in icp-dev-env-motoko container using icp-cli deploy + tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marc0olo
marc0olo merged commit f51b370 into master Jun 15, 2026
7 checks passed
@marc0olo
marc0olo deleted the chore/migrate-composite_query-to-icp-cli branch June 15, 2026 14:56
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.

3 participants