Skip to content

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

Merged
senamakel merged 2 commits intotinyhumansai:mainfrom
jwalin-shah:codex/SYM-212-thread-rpc-query-hooks
May 7, 2026
Merged

SYM-212: add foundational thread RPC query hooks#1272
senamakel merged 2 commits intotinyhumansai:mainfrom
jwalin-shah:codex/SYM-212-thread-rpc-query-hooks

Conversation

@jwalin-shah
Copy link
Copy Markdown
Contributor

@jwalin-shah jwalin-shah commented May 6, 2026

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: 01fb74cfa1b041f3d35766a44531dfbe3ab7105e

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

  • Blocker regression: pnpm --dir app exec vitest run src/hooks/useThreadQueries.test.ts --config test/vitest.config.ts

  • Focused format after blocker patch: pnpm --dir app exec prettier --check src/hooks/useThreadQueries.ts src/hooks/useThreadQueries.test.ts

  • TypeScript compile after blocker patch: pnpm --filter openhuman-app compile

  • 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

Warning

Rate limit exceeded

@jwalin-shah has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 38 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a9f44a9a-219b-4b70-afcc-c1301f168027

📥 Commits

Reviewing files that changed from the base of the PR and between 5f3a969 and 01fb74c.

📒 Files selected for processing (2)
  • app/src/hooks/useThreadQueries.test.ts
  • app/src/hooks/useThreadQueries.ts

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.

@jwalin-shah jwalin-shah marked this pull request as ready for review May 7, 2026 05:46
@jwalin-shah jwalin-shah requested a review from a team May 7, 2026 05:46
@senamakel senamakel merged commit b9c01ca into tinyhumansai:main May 7, 2026
18 of 20 checks passed
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.

3 participants