fix: keep regex query inputs from crashing graphs - #13155
Conversation
String query inputs that start with an escaped paren were read as a character literal, so journal default queries like Broken references compiled re-pattern as /(/ and took down the whole renderer snapshot. Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
320670d to
6ce3f05
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
Keep invalid renderer resource keys fail-fast. Query SyntaxError now returns an error value so sibling snapshot resources still render. Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The new :error resource-slot decoding drops required slot fields (:basis-rev and :watch), which can break resource ordering and delta/watch handling in frontend.db.subs.
Pull request overview
Prevents renderer snapshot batches from crashing when journal default queries include regex :inputs that begin with an escaped parenthesis, and ensures a single failing renderer resource does not take down sibling resources (e.g., journals) in the same snapshot.
Changes:
- Restricts
query-input-valueparsing to only stringified keywords/numbers/booleans so literal regex strings (e.g."\\(") aren’t reader-coerced into invalid regex patterns. - Wraps renderer resource evaluation so per-resource failures are logged and returned on the wire as
:error, rather than crashing the full snapshot build. - Updates renderer-side snapshot decoding to surface resource failures as
{:status :error}without failing sibling resource subscriptions; adds regression tests for both behaviors.
File summaries
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ce3f05465
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Plugin callers still pass UUIDs, quoted strings, and collections as EDN. Only reject cljs.reader character literals so regex matchers that start with an escaped paren stay intact. Co-authored-by: Tienson Qin <tiensonqin@gmail.com>

Fixes graph open crashes on graphs whose journal default queries use regex
:inputsthat start with an escaped parenthesis.logseq/db-test#1136
Behavior
Opening the attached DB graph showed journals briefly, then the “Something went wrong” recovery screen. The worker died in
:thread-api/get-render-snapshotswithInvalid regular expression: /(/.The graph’s “Broken references” advanced query uses:
query-input-valueparsed that string withcljs.reader/read-string, which treats\(as the character(.re-patternthen compiled/(/and the failed query took down the whole renderer snapshot batch, including block reactions.Change
SyntaxError(for leftover invalid regex) so one query cannot fail sibling resources in the same snapshot. Invalid/unknown resource keys still fail-fast.Tests
:inputsstay strings throughresolve-query-inputsand query render resources.re-patternwith"("does not fail journals in the same snapshot.use-query-resultrethrows worker query syntax errors for the query error boundary.