fix(search): oversized thread queries no longer crash clients - #6633
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
ApprovabilityVerdict: Approved 12faef0 This is a straightforward defensive bug fix that prevents client crashes from invalid search queries. The change switches from throwing exceptions to gracefully returning empty results for malformed inputs, with comprehensive test coverage added. You can customize Macroscope's approvability policy. Learn more. |
CDVolvik
left a comment
There was a problem hiding this comment.
threadSearch.test.ts: 6/6. Keys at 200 chars still search; 201 and malformed JSON return empty and do not call getSearchAtom.
Schema.fromJsonString + decodeUnknownOption replaces JSON.parse that could throw into the atom. That is the crash. MERGEABLE.
- Corrige backend salvo diretamente que ocultava seu ambiente T3 Connect (pingdotgg#7086), ajustando `environmentSections` e o `useConnectionController` - Corrige queries de busca de thread grandes demais que derrubavam os clients (pingdotgg#6633), em `threadSearch` no `client-runtime` - Adiciona cobertura de testes para os dois casos: `environmentSections.test.ts`, `threadSearch.test.ts` e `DesktopClientSettings.test.ts` - 2 commits do upstream, 6 arquivos alterados (+114/-15), sem conflitos com as modificações do fork Sync automatico t3code-sync em 2026-08-22T00:08:13-03:00
## What's Changed * fix(search): oversized thread queries no longer crash clients by @Lucenx9 in pingdotgg/t3code#6633 * fix(mobile): stop a directly-saved backend from hiding its T3 Connect environment by @Rishet11 in pingdotgg/t3code#7086 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260822.1155...v0.0.34-nightly.20260822.1156 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260822.1156
…tgg#6633) Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
…tgg#6633) Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
What Changed
Thread content search could throw in web and mobile when a query exceeded the 200-character contract limit because the shared atom decoded its cache key synchronously.
Search keys are now decoded safely from JSON at the shared client-runtime boundary. Out-of-contract or malformed keys return an empty content-search state without issuing environment requests, while valid queries and local title matching continue unchanged. Boundary tests cover maximum-length normalization, oversized queries, and malformed JSON.
Why
A long query typed into the command palette or mobile thread search could abort client rendering. Treating out-of-contract content searches as empty keeps both clients usable and preserves the server's existing bounded-query contract.
Checklist
Created with gpt-5.6-sol using the Codex harness in T3 Code.
Note
Fix oversized or malformed thread search keys to return empty state instead of crashing
ThreadSearchKeyschema in threadSearch.ts now decodes viaSchema.decodeUnknownOption, returningNoneon invalid input instead of throwing.createThreadSearchResultsAtomFamilyreturns{ matches: [], isLoading: false }immediately when the key parses toNone, skipping any search invocation.Macroscope summarized 12faef0.
Note
Low Risk
Localized defensive change in shared search state with tests; no auth, data, or API contract changes beyond avoiding client crashes.
Overview
Thread content search in client-runtime no longer throws when a cache key is out of contract or malformed.
threadSearch.tsdecodes search keys withSchema.fromJsonStringanddecodeUnknownOptioninstead ofJSON.parseplus synchronous decode. Keys that fail validation (e.g. query over the 200-character limit) or invalid JSON yield{ matches: [], isLoading: false }and do not call per-environment search atoms.threadSearch.test.tsadds coverage for max-length valid keys (including trimmed whitespace) and for over-length and malformed keys asserting zero search invocations.Reviewed by Cursor Bugbot for commit 12faef0. Bugbot is set up for automated code reviews on this repo. Configure here.