Skip to content

SYM-212: add foundational thread RPC query hooks#1272

Draft
jwalin-shah wants to merge 1 commit intotinyhumansai:mainfrom
jwalin-shah:codex/SYM-212-thread-rpc-query-hooks
Draft

SYM-212: add foundational thread RPC query hooks#1272
jwalin-shah wants to merge 1 commit intotinyhumansai:mainfrom
jwalin-shah:codex/SYM-212-thread-rpc-query-hooks

Conversation

@jwalin-shah
Copy link
Copy Markdown
Contributor

Summary

  • Adds useThreads() and useThreadMessages(threadId) hook foundations over the existing threadApi RPC client.
  • Exposes data, loading, error, isRefetching, and refetch() states without migrating chat/runtime consumers yet.
  • Adds request sequencing so stale async results do not overwrite the latest query result.
  • Covers success, RPC error, disabled/no-thread-id, refetch, and refetching-with-prior-data behavior.

Problem

The broader thread cache migration is too large for one PR. The app needs a small tested hook layer over the existing thread RPC API before consumers can migrate safely.

Solution

A new app/src/hooks/useThreadQueries.ts module wraps threadApi.getThreads() and threadApi.getThreadMessages() with lightweight React state and debug logging. This PR does not change ChatRuntimeProvider, streaming behavior, or Conversations.tsx consumers.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per docs/TESTING-STRATEGY.md
  • Diff coverage >= 80% - changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by .github/workflows/coverage.yml. Run pnpm test:coverage and pnpm test:rust locally; PRs below 80% on changed lines will not merge.
  • Coverage matrix updated - added/removed/renamed feature rows in docs/TEST-COVERAGE-MATRIX.md reflect this change (N/A: internal hook foundation only)
  • All affected feature IDs from the matrix are listed in the PR description under ## Related (N/A: no matrix feature IDs affected)
  • No new external network dependencies introduced (mock backend used per docs/TESTING-STRATEGY.md)
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) (N/A: not a release-cut surface)
  • Linked issue closed via Closes #NNN in the ## Related section (N/A: Linear issue plus upstream tracking issue only)

Impact

No user-visible behavior change. This is a foundation for later thread UI/cache migration work.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

Commit & Branch

  • Branch: codex/SYM-212-thread-rpc-query-hooks
  • Commit SHA: 85165c60cbb4e6eed42e4c74b8adec28b5f64dec

Validation Run

  • pnpm --filter openhuman-app format:check via focused pnpm --dir app exec prettier --check src/hooks/useThreadQueries.ts src/hooks/useThreadQueries.test.ts
  • pnpm typecheck via pnpm --filter openhuman-app compile
  • Focused tests: pnpm --dir app exec vitest run src/services/api/threadApi.test.ts src/hooks/useThreadQueries.test.ts --config test/vitest.config.ts
  • Rust fmt/check (if changed): N/A, no Rust changed
  • Tauri fmt/check (if changed): N/A, no Tauri changed

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: none for current UI consumers.
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: existing threadApi RPC methods remain the backing source of truth.
  • Guard/fallback/dispatch parity checks: no provider/runtime migration in this slice; hook tests cover disabled, error, success, and refetch states.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): N/A
  • Canonical PR: this PR
  • Resolution (closed/superseded/updated): N/A

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a35144f-0cf9-4430-9b46-45e16da0ddc4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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