Skip to content

chore: migrate motoko/daily_planner to icp-cli#1370

Open
marc0olo wants to merge 13 commits into
masterfrom
chore/migrate-daily-planner-to-icp-cli
Open

chore: migrate motoko/daily_planner to icp-cli#1370
marc0olo wants to merge 13 commits into
masterfrom
chore/migrate-daily-planner-to-icp-cli

Conversation

@marc0olo

@marc0olo marc0olo commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Migrates motoko/daily_planner from dfx to icp-cli.

  • Replace dfx.json with icp.yaml (@dfinity/motoko@v5.0.0 + @dfinity/asset-canister@v2.2.1)
  • Source already in backend/app.mo; replace import IC "ic:aaaaa-aa" with import { ic } "mo:ic" + import IC "mo:ic/Types"
  • Fix getMonthData month prefix to zero-pad single-digit months
  • Update mops.toml: moc 1.9.0, core 2.5.0, ic 4.0.0, json, map; apply mops check --fix
  • Add CI workflow (icp-dev-env-motoko:0.3.2), Makefile with 6 tests (null state, add note, read note, month filter, complete note, empty month)
  • Use clearly fake test dates (2000-01-15, month (2000, 1))
  • README: drop ## Overview / GitHub link; fix dapp→app; fix "on the network" / "data from external services"

Frontend adjustments for icp-cli toolchain:

  • Zero-pad month and day in date keys to match the Motoko backend's zero-padded getMonthData prefix
  • Adapt type handling to icp-sdk bindgen: bindgen unwraps opt T to null | T (not the raw Candid JS [] | [T] that dfx produced); updated getDayData result handling and onThisDay rendering accordingly
  • Fix pre-existing: await renderDayDetail() in handleFetchOnThisDay (was not awaited, causing a race with hideLoading)

Test plan

  • motoko-daily_planner CI passes
  • Frontend shows notes and "On This Day" data correctly after deploy

🤖 Generated with Claude Code

marc0olo and others added 13 commits June 10, 2026 17:21
Replace dfx.json with icp.yaml, update mops.toml to moc 1.9.0 and
core 2.5.0, add ic = 4.0.0 dependency, replace ic:aaaaa-aa with
import { ic } "mo:ic" + IC "mo:ic/Types", add icp-bindgen-based
vite.config.js and actor.js, add Makefile with numbered tests for
all public functions, add CI workflow, and delete BUILD.md,
dfx.json, and .devcontainer/.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- await renderDayDetail() in handleFetchOnThisDay — without it, hideLoading()
  fires before getDayData returns, causing stale state display
- Zero-pad month and day in dateString (2026-06-11 not 2026-6-11) to match
  the zero-padded prefix generated by getMonthData in the Motoko backend;
  without this, calendar month indicators never appear for notes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The icp-sdk bindgen plugin processes Candid opt types at the binding layer:
- getDayData returns null | DayData (not [] | [DayData])
- onThisDay field is null | OnThisDay (not [] | [OnThisDay])

The frontend was written for raw Candid JS arrays, causing:
- data?.length > 0 always false (plain object has no .length)
- onThisDay.length > 0 always false (plain object has no .length)
Both conditions always fell back to the empty default, hiding all data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- vite.config.js: remove dfx fallback block and dfx comment; remove
  CANISTER_ID_BACKEND env var baking (only needed as dfx fallback)
- actor.js: remove dfx fallback canister ID resolution and dfx mentions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo marked this pull request as ready for review June 11, 2026 21:32
@marc0olo marc0olo requested review from a team as code owners June 11, 2026 21:32
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