Skip to content

chore(deps): install base Rust crates (task 07)#4

Merged
mpiton merged 2 commits into
mainfrom
chore/task-07-cargo-add-base
May 2, 2026
Merged

chore(deps): install base Rust crates (task 07)#4
mpiton merged 2 commits into
mainfrom
chore/task-07-cargo-add-base

Conversation

@mpiton
Copy link
Copy Markdown
Owner

@mpiton mpiton commented May 2, 2026

Summary

Add 8 base Rust dependencies to src-tauri/Cargo.toml via cargo add (ADR-015): tokio multi-thread runtime, thiserror + anyhow error handling, tracing structured logging, uuid/time utility types. Unblocks T08 hexagonal layout, T10 cargo deny, T15 specta codegen. Sprint 0 bootstrap tooling.

Why

Sprint 0 goal: minimal scaffold only. These crates are the foundation for domain/application error handling (thiserror lib errors, anyhow bin errors), async/threading (tokio ADR-008), observability (tracing API + subscribers), and domain value objects (uuid, time). Deferred larger deps (libsql, git2, portable-pty, reqwest, etc.) to S1+.

Changes

  • src-tauri/Cargo.toml — 8 direct deps installed via cargo add:
    • tokio 1.52.1 features full (ADR-008 multi-thread runtime, optimized later)
    • thiserror 2.0.18, anyhow 1.0.102 (error handling layers per ADR-018)
    • tracing 0.1.44 logging API, tracing-subscriber 0.3.23 with fmt,env-filter,json, tracing-appender 0.2.5 (rolling log sinks)
    • uuid 1.23.1 features v4,serde (TaskId, RunId, AgentId)
    • time 0.3.47 features serde,formatting,parsing (domain/shared Timestamp)
  • src-tauri/Cargo.lock — auto-updated (164 lines, ~14 new transitive deps mostly from tracing-subscriber ecosystem)
  • CHANGELOG.md — [Unreleased]/Added entry documenting each dep + features + rationale

Testing

cd src-tauri
cargo build                                   # OK: 46.61s, 0 warnings
cargo clippy --workspace -- -D warnings       # OK: no issues
cargo fmt --check                             # OK: no diff
cargo test --workspace                        # OK: 0 tests (scaffold)
cargo deny check licenses                     # OK: exit 0
cargo audit                                   # OK: exit 0 (known-ignored transitive)
cargo tree --duplicates                       # OK: zero new dupes (thiserror v1 transitively from GTK3 chain, pre-existing)

Related Issues

  • Task 07 from .claude/output/sprints/sprint-2026-05-01/tasks/07-cargo-add-base-crates.md
  • Unblocks: T08 (hexagonal layout), T10 (cargo deny full), T15 (specta/ts-rs)

Notes for Reviewer

  • tokio features = ["full"] is by design per ARCHI.md §3.1 line 294. Sprint 0 pragmatism; will be tightened to ["rt-multi-thread", "macros", "fs", "process", "io-util", "sync", "time", "net"] later once all S1+ crate needs are clear.
  • Transitive thiserror v1.0.69 co-exists with our direct v2.0.18 due to Tauri's internal GTK3 dep tree (cairo-rs/gdk/gtk/wry). Not our problem; Tauri should migrate to webkit2gtk-6.0 (feat(tray): add enter, move and leave events tauri-apps/tauri#9777). In the meantime, the v1 and v2 lines are separate by crate boundary, so no macro/derive collision.
  • Deps follow ADR-015 rule: manifest never hand-edited; cargo add only. Hook scripts/no-manual-deps.sh will enforce this at pre-commit.
  • Binary impact: estimated +700 KB combined (tokio, tracing-subscriber json, time parsing) on 45 MB AppImage budget = <2% — acceptable.

Checklist

  • Deps installed via cargo add only (ADR-015)
  • Tests passing (cargo test --workspace)
  • Lints passing (cargo clippy -D warnings)
  • cargo deny check licenses green
  • cargo audit green
  • No manual edits to manifests
  • CHANGELOG updated
  • Self-reviewed
  • CI expected green (Sprint 0 scaffold, zero application code yet)

Summary by CodeRabbit

Release Notes

  • Chores
    • Added new project dependencies: tokio, uuid, tracing, time, anyhow, and thiserror to the backend configuration.
    • Updated CHANGELOG.md to document dependency additions.

mpiton added 2 commits May 2, 2026 10:30
Install the Sprint 0 minimal Rust dependency set in src-tauri/ via
`cargo add` (per ADR-015 — manifest never hand-edited):

- tokio --features full          (ADR-008 multi-thread async runtime)
- thiserror                      (lib errors via #[derive(Error)])
- anyhow                         (binary entry-point error coalescing)
- tracing                        (structured logging API)
- tracing-subscriber --features fmt,env-filter,json
- tracing-appender               (rolling-file sink for future logs)
- uuid --features v4,serde       (TaskId/RunId/AgentId)
- time --features serde,formatting,parsing  (domain/shared Timestamp)

serde + serde_json were already present from T05 scaffold.

Verification:
- cargo build              : OK (46.61s, no warnings)
- cargo clippy -D warnings : OK
- cargo fmt --check        : OK
- cargo test --workspace   : 0 tests, 0 failures (scaffold)
- cargo deny check licenses: ok (only unused-allowance warnings)
- cargo audit              : exit 0 (only known-ignored transitive RUSTSEC)
- cargo tree --duplicates  : none of our added deps duplicated;
  thiserror v1.0.69 transitive via cairo-rs/gdk/gtk/wry — out of our control
  until Tauri migrates to webkit2gtk-6.0 (tauri-apps/tauri#9777)

Unblocks: T08 (hexagonal layout uses serde/thiserror/uuid/time),
T10 (cargo deny check across installed deps), T15 (specta/ts-rs codegen).
Replace 280-word run-on paragraph with a one-line dep list whose density
matches the surrounding [Unreleased]/Added bullets (Sprint 0 task 06
entries average 30-60 words, single dash + comma-separated facts).
Same information, no facts dropped — just less prose.

Identified by /simplify code-quality review on commit 896f60d.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 704af0a5-e771-41ff-97fe-cabff2acf3c6

📥 Commits

Reviewing files that changed from the base of the PR and between 7fdf636 and b19247e.

⛔ Files ignored due to path filters (1)
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • CHANGELOG.md
  • src-tauri/Cargo.toml

📝 Walkthrough

Walkthrough

Dependencies for async runtime, error handling, and observability instrumentation (tokio, thiserror, anyhow, tracing, uuid, time) are added to src-tauri/Cargo.toml with documented versions and features. A changelog entry documents the additions and notes a transitive dependency from the GTK3 chain.

Changes

Async Runtime and Observability Dependencies

Layer / File(s) Summary
Dependency Declaration
src-tauri/Cargo.toml
Eight crates added: tokio (full features), thiserror, anyhow, tracing/tracing-subscriber (fmt, env-filter, json), tracing-appender, uuid (v4, serde), and time (serde, formatting, parsing).
Changelog Documentation
CHANGELOG.md
Unreleased section updated with dependency addition details, including transitive thiserror v1.0.69 from Tauri GTK3 dependency chain.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A rabbit hops through async lanes so bright,
Tokio threads and tracing lights alight,
With tokens, UUIDs, errors all squared,
Our observant burrow is wonderfully prepared! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: adding base Rust dependencies to the project via cargo add as part of task 07.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/task-07-cargo-add-base

Review rate limit: 3/5 reviews remaining, refill in 19 minutes and 19 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@mpiton mpiton merged commit fbef1a6 into main May 2, 2026
12 checks passed
mpiton added a commit that referenced this pull request May 10, 2026
* feat(interfaces): add TauriEventPublisher EventPublisher adapter (task T-115)

Bridges the in-process broadcast::Sender<AppEvent> to the Tauri renderer
via tauri::Emitter::emit. Construction subscribes to the bus and spawns a
forwarder tokio task; emit failures log via tracing::error! without
panicking, RecvError::Lagged warns and resumes (matches event_bus
overflow contract), RecvError::Closed exits cleanly. publish() drops on
no-subscribers via let _ = bus_tx.send(event) so producers stay
non-blocking when the renderer has not attached yet during boot.

Variant-to-event-name mapping lives in a pure event_name() helper
(TaskCreated -> "task:created", TaskMoved -> "task:moved") that is
exhaustive against the #[non_exhaustive] AppEvent — adding a future
variant will fail the match arm at compile time, forcing the wire
contract to be updated alongside.

4 unit tests cover event_name mapping for both variants, publish returns
Ok with no subscribers, and publish routes events through the bus to a
manually-attached subscriber. Full Tauri-runtime integration is deferred
to S2 once a tauri::test harness lands. Coverage publisher.rs 75.36%
lines / 83.33% functions (interfaces target >=70%).

Re-exported via pub use publisher::{TauriEventPublisher, event_name} in
interfaces/tauri_events/mod.rs so T-116 AppContainer can construct the
publisher without reaching into the submodule.

Refs: ARCHI.md #4 (driving adapters), #6.2 (listen wrappers).

* feat(app): add AppContainer composition root (task T-116)

Replaces the Sprint 0 placeholder header in `application/di.rs` with
the production composition root documented in ARCHI §4.3 / §5.3:

    pub struct AppContainer {
        task_repo:        Arc<dyn TaskRepository + Send + Sync>,
        event_publisher:  Arc<dyn EventPublisher  + Send + Sync>,
        events:           broadcast::Sender<AppEvent>,
        config:           Arc<AppConfig>,
        db:               Arc<libsql::Database>,
    }
    pub async fn build(cfg, app) -> Result<Self, AppError>

Build chains `Pool::open` (connect + V001 migration), `make_bus(1024)`,
`TauriEventPublisher::new`, `LibsqlTaskRepo::new`, then assembles the
struct with `Arc::new(cfg)` so every Tauri command reaches its
dependencies through `tauri::State<Arc<AppContainer>>`.

Two notes versus the literal task-spec snippet:

- The spec called `pool::connect` + `pool::run_migrations` directly,
  but both helpers are `pub(super)` to enforce the invariant "every
  caller routes through `Pool::open` so migrations always follow the
  connection." The composition root respects the encapsulation by
  going through `Pool::open` + `Pool::database()` instead, with the
  same observable side effects (DB opened, WAL on, V001 applied,
  history row recorded).

- `build` is a thin outer wrapper over a private `build_inner(cfg,
  events, publisher)` helper. The Tauri-runtime dependency stays in
  the wrapper (one line `TauriEventPublisher::new(app, events.clone())`
  already covered by T-115's tests); the testable assembly logic lives
  in `build_inner` so unit tests can exercise it with a stub
  `EventPublisher` instead of pulling `tauri::test::mock_app` (gated
  behind a feature the production build does not opt into).

5 tests cover: tempdir-config happy path + repo wired to migrated DB,
V001 schema actually landed (`sqlite_master` introspection through
`container.db`), event bus handle is the same channel passed in
(subscribe pre-build, publish post-build, recv equal), config
preserved inside the `Arc`, and `AppContainer: Send + Sync` (compile-
time, guards the `tauri::State<Arc<AppContainer>>` shape T-118+ needs).

Acceptance criteria from issue #31:
- cargo build clean
- build succeeds against tempdir AppConfig (test)
- migration V001 runs as part of build (test)
- cargo clippy -- -D warnings clean
- no .unwrap()/.expect() outside #[cfg(test)] mod tests

Refs: ARCHI.md §4.3, §5.3 / ADR-011. Closes #31.

---------

Co-authored-by: Mathieu Piton <27002047+mpiton@users.noreply.github.com>
mpiton added a commit that referenced this pull request May 11, 2026
* docs: add Sprint 1 quickstart + smoke probe to README (T-135, closes #49)

- Replace generic Setup with "Quickstart" section: clone, install-hooks, `pnpm exec tauri dev` boot flow targeting the ARCHI.md §23 onboarding criterion (< 5 min on a fresh clone).
- Add "Verify the Sprint 1 smoke flow" subsection mirroring `scripts/smoke-e2e.sh` (pilot-gated dev server + `tauri-pilot ipc tasks_list --args '{}'` probe with the v0.5 `--args` form, not the v0.4 positional `'{}'` referenced in the issue body).
- Add "What works in Sprint 1" section enumerating the landed deliverables (hexagonal layout, libsql + V001, `AppContainer::build`, `tasks_list` IPC, `TauriEventPublisher`, `tracing` redaction, Sidebar/WelcomeScreen, Zustand `useTaskStore`, i18n FR+EN, codegen-types, llvm-cov 75 gate, smoke E2E gate) so the README delta after Sprint 0 is visible without diffing CHANGELOG.
- Add explicit link "ARCHI.md §4 — Layout du repo" (GFM anchor `#4-layout-du-repo`) for full architecture rationale.
- Pin `tauri-pilot-cli` install hint to `=0.5.1 --locked` to match `tauri-plugin-pilot = "0.5.1"` in `src-tauri/Cargo.toml` (same hardening rationale as PR #66 CodeRabbit fix).
- Add Smoke E2E badge alongside CI / Release / CodSpeed.
- Update Status line from "Sprint 0 closure" to "Sprint 1 closure — smoke E2E gate green on main".
- Replace pre-existing broken `[AGPL-3.0](LICENSE)` link with the canonical `gnu.org/licenses/agpl-3.0` URL (no `LICENSE` file in repo; matches the badge target). Adding the file itself is out of scope.

CHANGELOG `[Unreleased]` already enumerates Sprint 1 additions (130 entries, verified each spec-required entry present: hexagonal, AppConfig, ensure_dirs, tracing redaction, libsql V001, domain/tasks, EventPublisher, AppContainer, tasks_list, codegen-types, Sidebar/WelcomeScreen/useTaskStore/i18n, UI primitives, llvm-cov gate). No CHANGELOG change needed.

Tests: doc-only (per T-135 spec).

* docs(readme): address PR #67 review (CodeRabbit / cubic / qodo)

- Windows shell note for `./scripts/install-hooks.sh` (run via Git Bash or WSL; PowerShell/cmd.exe will not execute the bash script). Per CodeRabbit comment on L44.
- Reword smoke verification block: explicit "terminal 1" / "terminal 2" labels, drop the ambiguous "instead of" phrasing. Apply CodeRabbit suggested diff on L56 verbatim.
- Correct CI trigger claim: `.github/workflows/smoke-e2e.yml` is `workflow_dispatch` only — README previously said "runs in CI on every push" which is wrong. Per qodo finding on L61.
- Drop links to `ARCHI.md` (`§23` onboarding ref + `§4` architecture link) and `PRD.md` (roadmap ref) because both files are intentionally gitignored at `.gitignore:55-56` ("Specs"). Cubic and qodo correctly flagged the broken internal links. The "Architecture" section now inlines the dependency rule + composition-root invariants that previously lived behind the ARCHI.md §4 link, so the design rationale is still surfaced without depending on a local-only spec file.

T-135 spec mentioned an `ARCHI.md §4` link as a sub-criterion, but that pre-dated the deliberate gitignore policy on the specs files. Honoring the gitignore wins — the AC "no broken markdown link" is the stronger constraint.

---------

Co-authored-by: Mathieu Piton <27002047+mpiton@users.noreply.github.com>
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