Skip to content

Update Quickstart for Rust to v5#242

Open
Aaron LaBeau (biozal) wants to merge 14 commits intomainfrom
da-138-update-v5-rust
Open

Update Quickstart for Rust to v5#242
Aaron LaBeau (biozal) wants to merge 14 commits intomainfrom
da-138-update-v5-rust

Conversation

@biozal
Copy link
Copy Markdown
Contributor

@biozal Aaron LaBeau (biozal) commented Feb 17, 2026

This PR is for updating the Rust-Tui example QuickStart from v4 to v5.

Summary

  • SDK upgrade: dittolive-ditto = "4.13.1""=5.0.0" (pinned)
  • New init API: Ditto::builder().with_root().with_identity() is gone — replaced by DittoConfig::new(database_id, DittoConfigConnect::Server { url }) +
    Ditto::open_sync(config)
  • New auth refresh model: added a TokenHandler that implements DittoAuthExpirationHandler and is registered via ditto.auth()?.set_expiration_handler(...). Replaces the
    old "pass token to OnlinePlayground" flow.
  • Sync API moved to a sub-builder: every call site updated from ditto.start_sync() / ditto.is_sync_active() to ditto.sync().start() / ditto.sync().is_active() etc.
  • *_v2 suffixes dropped: register_subscription_v2, register_observer_v2, execute_v2 are now just register_subscription, register_observer, execute.
  • Removed v3 / strict-mode workaroundsdisable_sync_with_v3() and ALTER SYSTEM SET DQL_STRICT_MODE = false are no longer needed in v5.
  • Rust 2024 edition, toolchain pinned to 1.91.1 in CI.
  • Minor cleanup: dropped unused hashbrown dependency, deleted the empty src/input.rs, removed two unused fields from Todolist that were superseded by the existing
    TodoMode enum, fixed the edit dialog showing the wrong title, README rewording.

API migration cheat sheet

Before (v4.13) After (v5)
Ditto::builder().with_root().with_identity(OnlinePlayground::new(...))?.build()? `Ditto::open_sync(DittoConfig::new(database_id, DittoConfigConnect::Server { url
}).with_persistence_directory(...))?`
OnlinePlayground::new(root, app_id, token, false, Some(auth_url)) TokenHandler { token } registered via ditto.auth()?.set_expiration_handler(...)
app_id: AppId (parsed) database_id: String
ditto.start_sync() ditto.sync().start()?
ditto.stop_sync() ditto.sync().stop()
ditto.is_sync_active() ditto.sync().is_active()
ditto.disable_sync_with_v3() removed
ALTER SYSTEM SET DQL_STRICT_MODE = false removed
ditto.sync().register_subscription_v2(...) ditto.sync().register_subscription(...)
ditto.store().register_observer_v2(...) ditto.store().register_observer(...)
ditto.store().execute_v2((sql, args)) ditto.store().execute((sql, args))

Environment variable changes

Variable Status
DITTO_APP_ID Still required — value semantically renamed in docs to "Database ID"
DITTO_PLAYGROUND_TOKEN Required
DITTO_AUTH_URL Required
DITTO_WEBSOCKET_URL No longer required by docs (still read by code if set)
DITTO_CLIENT_NAME Optional, unchanged
DITTO_P2P_ENABLED Optional, unchanged

Files changed

File Change
rust-tui/Cargo.toml SDK to =5.0.0, edition 2024, drop hashbrown
rust-tui/Cargo.lock Regenerated
rust-tui/src/bin/main.rs New init flow, TokenHandler, sync API migration
rust-tui/src/bin/integration_test.rs Same migration applied to the integration binary
rust-tui/src/tui/todolist.rs API migration, removed dead create_task_title/edit_task fields, fixed edit-dialog title
rust-tui/src/tui/mod.rs Import ordering for edition 2024
rust-tui/src/term.rs Import ordering
rust-tui/src/input.rs Deleted (was unused)
rust-tui/README.md Reworded for v5 ("Database ID" terminology), dropped DITTO_WEBSOCKET_URL from required setup
.github/workflows/rust-tui-ci.yml Pin toolchain to 1.91.1 on all four jobs

Notable behavior changes

  • render_todo_prompt (formerly render_new_todo_prompt) now shows " New Todo " vs " Edit Todo " based on TodoMode. Previously the edit dialog incorrectly displayed
    "New Todo".
  • Removed dead state: Todolist::create_task_title: Option<String> and Todolist::edit_task: Option<(String, String)> were never read after the TodoMode refactor — now
    removed.
  • Stricter error propagation: ditto.start_sync() (which returned () and was discarded with _ =) is replaced by ditto.sync().start()?, so a failure to start sync now
    surfaces as an error instead of being silently swallowed. Same for disable_sync_with_v3() / strict-mode disable, which are simply gone.

Test plan

  • cargo build from rust-tui/ succeeds
  • cargo clippy --all-targets is clean
  • cargo fmt --check is clean
  • cargo run launches the TUI and connects to Big Peer (Database ID + Playground Token + Auth URL set in .env)
  • Create / edit / delete / toggle-done work end-to-end
  • s toggles sync; status indicator flips green ↔ red
Working-UI

@biozal Aaron LaBeau (biozal) added the enhancement New feature or request label Feb 17, 2026
@biozal Aaron LaBeau (biozal) marked this pull request as ready for review May 5, 2026 19:14
Copilot AI review requested due to automatic review settings May 5, 2026 19:14
@biozal Aaron LaBeau (biozal) changed the title Draft: Update Quickstart for Rust to v5 - DO NOT MERGE Update Quickstart for Rust to v5 May 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the rust-tui Ditto quickstart from Ditto SDK v4 to v5, adjusting initialization/auth flows and migrating sync/store API calls while keeping the TUI tasks app behavior intact.

Changes:

  • Bumps Rust quickstart to dittolive-ditto v5 and updates Ditto sync/store APIs (subscriptions, observers, execute, sync start/stop).
  • Refactors the TUI create/edit prompt rendering to be mode-driven.
  • Updates CI toolchain pinning and revises README instructions for setup.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
rust-tui/src/tui/todolist.rs Migrates Ditto v4 APIs to v5 and updates create/edit prompt rendering.
rust-tui/src/tui/mod.rs Minor import reorder while keeping TUI task orchestration unchanged.
rust-tui/src/term.rs Minor re-export ordering update for ratatui terminal backend/types.
rust-tui/src/input.rs Removes unused input helper module.
rust-tui/src/bin/main.rs Reworks Ditto initialization for v5 (DittoConfig, auth expiration handler, sync start/stop).
rust-tui/src/bin/integration_test.rs Migrates integration test Ditto initialization to v5 and updates sync control.
rust-tui/README.md Updates quickstart setup instructions and environment variable guidance.
rust-tui/Cargo.toml Bumps edition to 2024 and pins dittolive-ditto to v5.0.0; removes unused dependency.
rust-tui/Cargo.lock Lockfile updates for Ditto v5 and transitive dependency changes.
.github/workflows/rust-tui-ci.yml Pins Rust toolchain in CI and keeps clippy/fmt/test/integration-test steps.
Comments suppressed due to low confidence (1)

rust-tui/README.md:13

  • The README instructs copying .env.sample, but the command shown is cp .sample.env .env. In this repo the file is named .env.sample at the repo root, so the command should match or new users will fail setup.
From the repo root, copy the `.env.sample` file to `.env`, and fill in the fields with your DatabaseID, Online Playground Token, and Auth URL:

cp .sample.env .env


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

Comment thread rust-tui/src/bin/main.rs
Comment thread rust-tui/src/bin/integration_test.rs
Comment thread rust-tui/README.md
Comment thread .github/workflows/rust-tui-ci.yml
Comment thread .github/workflows/rust-tui-ci.yml
Comment thread .github/workflows/rust-tui-ci.yml
Comment thread .github/workflows/rust-tui-ci.yml
Aaron LaBeau (biozal) and others added 3 commits May 5, 2026 14:24
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants