Skip to content

feat(desktop): TickTick importer port (32d4) - #5270

Open
h4yfans wants to merge 3 commits into
feat/3549-d3-todoistfrom
feat/3549-d4-ticktick
Open

h4yfans wants to merge 3 commits into
feat/3549-d3-todoistfrom
feat/3549-d4-ticktick

Conversation

@h4yfans

@h4yfans h4yfans commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #3549
Part of #3517

Stage 32d4: the TickTick importer, ported from Electron. Stacked on #5241 (feat/3549-d3-todoist).

What it ports (Electron on origin/main)

  • packages/importers/src/ticktick/parse-csv.ts:71 parseTickTickCsv -> import/ticktick.rs (streaming reader: preamble rows skipped until Folder Name, first header wins, empty rows dropped).
  • packages/importers/src/ticktick/map-rows.ts:39 mapRows -> ticktick/map.rs (lists, kanban statuses, the "{list} {column}" key collision kept, parents, positions per (project, status)).
  • packages/importers/src/ticktick/dates.ts:20 splitDateTime -> ticktick/dates.rs; duration.ts:4 parseIsoDurationMs -> dates.rs::duration_ms.
  • rrule.ts:21 -> ticktick/rrule.rs; priority.ts:7 -> map.rs; the BigInt order key -> ticktick/order.rs.
  • apps/desktop/src/main/import/ticktick/apply-plan.ts:72 applyPlan -> ticktick.rs::apply; ticktick-importer.ts:55,94 preview and run -> TickTickImporter.
  • Sink: create_status_project, project_statuses, create_ticktick_task, create_reminder; complete_task, archive_task, inbox_project_id reused.
  • Renderer and IPC: nothing to wire. The Tauri renderer already lists ticktick (import-section.tsx, import-source-icon.tsx, import-message.ts keys), and the registry entry is the only Rust hook, as for Todoist. pnpm ipc:generate produced no diff.

Interfaces used from #5241: import::csv_lex::{lex, step, steps}, MAX_PLANNED_BYTES, todoist::{parse_int, json_number} (now pub(super)).

This round (on top of the WIP commit 3e8c8b4)

  • Fix: dates.rs panicked (Timestamp::from_millisecond(..).expect) for any instant past about year 9000. JIFF_SAFE_MS was 9,000 years from 1970, outside jiff's -9999..9999. Now 7,900 years; the 400-year cycle shift lands inside. Three tests went red with the panic before the fix.
  • The test files compile (one lifetime fix in the row helper) and run: 32 TickTick tests.
  • Factory special case removed: jiff reads Factory as UTC, which is Electron's fallback after ICU throws (oracle: 08:00 for 08:00Z), so the branch changed nothing.
  • Three far-rule cases added to the years test, checked against Electron: +100000-01-01 NY 07:00 (EST), +250000-03-12 NY 08:00 (DST start day), +012345-11-05 London 05:30.
  • Non-ASCII file name (REVIEW-5241 Low): a_non_ascii_file_name_is_the_preview_label writes Ki\u{15f}isel.CSV at runtime (from the WIP; now runs green).

Parity proof (Electron's own code as oracle)

/tmp/d4/oracle.mts runs origin/main's parseTickTickCsv + mapRows + applyPlan with a recording sink. The same CSVs ran through TickTickImporter (temporary dump test, not committed). Ops, preview counts and warnings were compared after dropping nulls.

Set Cases Result
Seeded fuzz: 1-8 rows from value pools over all 25 columns (lists, kanban columns, parents, statuses, repeats, reminders, orders, zones, bad dates); 37 of them fail with Invalid time value 300 identical
Date split / zone / years (TZ=UTC) 3 (34 rows) 1 diff = Departure 7 (US/Pacific-New)
Zone-less local times (TZ=America/New_York) 1 (8 rows) 1 diff = Departure 8 (2020-05-07 08:00)
Priorities and their warnings 2 identical

The hand-reasoned expectations the handoff flagged all match Electron: priorities [0,1,2,3,0,3,2,0,0,1,0] and the 1e20 warning, -100000 NY LMT 07:03, +100000 NY DST 08:00, legacy local May 7 2020 08:00 -> 12:00 UTC in New York.

Guards shown red without the guard (production code broken, test counters untouched)

Guard Break Test that went red
Reader budget charge charge(cost * 0) an_export_past_the_budget_fails_and_writes_none_of_its_tasks
Per-task cancel in apply if false && ctx.is_cancelled() a_cancel_after_the_first_task_creates_no_more
List grouping (rows_of_list) per-list scan of every row reading_takes_steps_linear_in_the_export: input 2, 2,501,389,346 steps vs bound 4,017,393
Gap/fold offset (before) after a_time_without_a_zone_is_local_with_the_offset_before_a_gap_or_fold

The header bitmask is not a complexity guard: a header has 19 known columns, and a contains scan short-circuits at the first match, so no input makes it quadratic. The steps test's input 1 (50,000 duplicate Title columns) stayed green with the scan, as expected.

Proof (local)

Command Result
cargo test -p memry-desktop --test integration importer_ticktick 32 passed
cargo test -p memry-desktop --test integration importer (all importers) 158 passed
cargo test -p memry-desktop --test integration article / extract (shared utils/date.rs) 42 / 3 passed
cargo check -p memry-desktop --tests ok
cargo clippy -p memry-desktop --all-targets -- -D warnings; cargo clippy --workspace --tests -- -D warnings ok
cargo fmt --all --check, node scripts/check-line-ceilings.mjs ok (2179 files)
pnpm ipc:generate then pnpm ipc:check no diff, ok
pnpm lint, pnpm typecheck, pnpm format:check, git diff --check ok

No TS changed, so no vitest file was run.

jiff dependency (Kaan is asked separately)

The handoff planned chrono-tz; the WIP used jiff 0.2.38 (std, tz-system, tzdb-bundle-always). Both jiff and jiff-tzdb were already in Cargo.lock (optional deps of serde_with and jiff-tzdb-platform), so the lock diff is two dependency lines and no new package. chrono-tz is not in the lock. Electron's results need a tzdb with the full history and the rules past 2037: local mean time before a zone's first rule (1800-01-01 Istanbul 01:55, -100000 NY 07:03), DST far in the future, and V8's "offset before the transition" in a gap or a fold, which jiff's AmbiguousOffset::{Gap,Fold}.before gives directly. All matched the oracle above.

Departures

  1. Bounded memory: the shared MAX_PLANNED_BYTES budget across the run; a file past it fails before any write with "The picked TickTick files hold more tasks than one import can take…".
  2. Streaming reader keeps only 19 columns. Created Time is dropped because Electron never passed it to createTask.
  3. Preview warnings drop row, as in feat(desktop): Raindrop importer with conformance vectors (32d2) #5214 and feat(desktop): port the Todoist importer (32d3) #5241.
  4. Read errors use OS text and the 100 MB cap.
  5. A sink Err from create_status_project is handled as Electron's success:false: that list's tasks are skipped with "no project" (an Electron throw aborted the whole run). A create_reminder Err is logged (Electron pushed a warning nobody read).
  6. Order key: a big decimal against a big 0x/0o/0b value compares by bit length when the lengths are within 3. The order stays total, so sort cannot panic.
  7. Zones: ICU-only legacy names not in the tzdb (US/Pacific-New) fall back to UTC (Electron: PDT). The tzdb version is jiff-tzdb's.
  8. Date.parse coverage is the shared port's: V8 legacy forms it does not parse (2020-05-07 08:00) give no date (Electron read it as local time). TickTick exports write ISO instants with an offset.
  9. Conformance vectors: none in this PR. They wait for Kaan, as Raindrop's and Todoist's did.

Known limits

  • A local build ran at 31 GB free disk (rule: 40 GB); noted, no harm observed.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions github-actions Bot added enhancement New feature or request test labels Nov 20, 2026
@h4yfans h4yfans mentioned this pull request Nov 20, 2026
22 tasks
@h4yfans

h4yfans commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Review (REVIEW-5270) on e07592a: MERGE (Lows to fold)

  • No panic site found: the dates.rs:36 shift stays inside jiff's ±9999, the i64 arithmetic can't overflow, and the order.rs/rrule.rs slices are on ASCII or get-checked boundaries. csv_lex, MAX_PLANNED_BYTES and the one-call-per-item Result sink are reused correctly. Cancel never splits a task from its reminders, and a budget failure writes nothing for that file.
  • jiff is a new compiled dependency for memry-desktop only (pinned 0.2.38). tzdb-zoneinfo is off, so results are deterministic. The tzdb data is 204 KB. It's a better fit than chrono-tz (gap handling, year range).
    Lows:
  1. ticktick/dates.rs:90 (departure 7): US/Pacific-New doesn't need to be a departure. Node's ICU still accepts it (also SystemV/PST8PDT, Canada/East-Saskatchewan), and the UTC fallback shifts timed tasks by the zone offset. Alias it to America/Los_Angeles (and the others if jiff's tzdb lacks them), or list them in departure 7.
  2. ticktick.rs:434 and :497: no test cancels the preview loop or cancels between files (the REVIEW-5214 Low 4 pattern).
  3. ticktick.rs:74, :252, :516, :40: a third copy of Budget::charge, a second message() and a third count() (also in todoist.rs and raindrop.rs). Move them to import/mod.rs.
  • Departure 8 (2020-05-07 08:00 dropped) is acceptable: real exports are ISO with an offset.
    importer_ticktick 32, importer 158 pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant