Skip to content

feat(foundation): backend seam (reads+writes), typed models, four-state mock, macOS CI, CDC tracer#3

Merged
farhan-syah merged 1 commit into
mainfrom
feat/foundation-sc
Jul 5, 2026
Merged

feat(foundation): backend seam (reads+writes), typed models, four-state mock, macOS CI, CDC tracer#3
farhan-syah merged 1 commit into
mainfrom
feat/foundation-sc

Conversation

@laksamanakeris

@laksamanakeris laksamanakeris commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Squash of the 16-task foundation milestone. Atomic 16-commit TDD history preserved on feat/foundation. 26 files, +1267/−583.

Why

The app runs on mock data behind a single ConnectionService trait. Before real NodeDB connectivity lands (blocked on NodeDB 0.5), the seam needed to be shaped so the real client plugs in without reshaping every screen: per-topic traits, typed models instead of tuples, a mock that can simulate all four async UI states, and a CI gate so regressions can't land silently. This PR is that foundation.

What changed

Backend seam — one front door, per-topic traits

  • services/backend.rs (new): Backend supertrait composing ConnectionService + StreamsData, with a blanket impl. The app provides ONE Rc<dyn Backend>; each screen reads only the method it needs. Adding a future domain trait (Explorer, Admin, …) extends the bound — additive, never a reshape.
  • services/streams_data.rs (new): Streams-tier reads. One method per screen's data; today cdc_feed(). The seam — not the view — owns the native-doc → display-JSON mapping (sonic_rs at the boundary).
  • services/connection_service.rs: first write through the seam — mark_all_read() with persistent mock state, so the notification feed stays consistent after reload (fixes POP-03: unread badge reappearing after mark-all-read).

Four-state mock

MockConnectionService gains ready() / empty() / erroring() constructors plus a delayed mode (MockBehavior), so every async screen can be driven through loading → loaded / empty / error in tests and demos without a server.

Typed CDC models

  • models/cdc.rs (new): CdcRow { id, time, op, collection, payload_json } + CdcOp enum replace the anonymous tuples the view carried. Stable id enables keyed Dioxus lists (no index keys).

Streams · CDC through the seam

  • views/streams/cdc.rs: rewritten to fetch via cdc_feed() with a fetch/presentational split; simulated live stream driven by tokio time with a working Pause; four-state SSR render tests.
  • components/live_tail.rs (new): reusable LiveTail layout shell (toolbar/body/footer slots) so future live screens (Notify, MV, Console) compose the same chrome instead of re-emitting it.
  • components/sparkline.rs (new): pure-Dioxus SVG sparkline spike — proves chart fidelity without a JS charting dep.

Mock data reorganization

data/mock.rs (523 lines, over the 500-line repo limit) split per-domain into data/mock/{connections,cdc,docs,notify}.rs.

CI (first remote run = this PR)

.github/workflows/ci.yml (new): macOS runner, cargo fmt --check + clippy -D warnings + cargo nextest run --workspace, with cargo caching. This PR is the workflow's first-ever execution on GitHub.

Tests

60/60 passing locally (fmt + clippy clean). Coverage added by this PR includes: mark-all-read persistence across reads, four-state cdc_feed behavior, loading→loaded transition without holding a signal guard across .await, stable/unique row ids, keyed-row SSR rendering, LiveTail slot rendering, sparkline SSR output.

Deferred (tracked, intentionally out of scope)

  • notify.rs / explorer/sidebar.rs still bypass the seam.
  • CDC live-stream vs base-state ownership question (design note recorded).

Merge note

Rebase / fast-forward merge to keep main at exactly one commit for this milestone; GitHub's squash-merge would rewrite the hash and message.

…te mock, macOS CI, CDC tracer

Squash of the 16-task foundation milestone (atomic history on feat/foundation).
Delivers: per-topic seam traits behind one Rc<dyn Backend> front door; mark_all_read
write + persistent mock state (fixes POP-03); typed CdcRow models; four-state mock
switch; macOS fmt/clippy/nextest CI gate; LiveTail primitive; Streams·CDC brought to
parity through the seam (fetch/presentational split, simulated stream, four-state SSR
tests); data/mock.rs split per-domain (<500 lines); pure-Dioxus SVG sparkline spike.
Deferred: notify.rs / explorer/sidebar.rs seam bypasses; CDC live-stream-vs-base-state
ownership (see docs/superpowers/notes/2026-06-18-cdc-stream-state-ownership.md).
@farhan-syah farhan-syah merged commit 4964d21 into main Jul 5, 2026
2 checks passed
@farhan-syah farhan-syah deleted the feat/foundation-sc branch July 5, 2026 11:49
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.

2 participants