Avoid redundant deep decode in targeted thread detail hydration#2035
Avoid redundant deep decode in targeted thread detail hydration#2035r1sk01 wants to merge 1 commit intopingdotgg:mainfrom
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com>
|
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 Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 Performance optimization that moves string normalization (trimming) from a final deep decode step to row-level schema transforms, eliminating redundant validation. The change is mechanical with no new behavior, and includes a test verifying the trimming works correctly. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Moves the contract-critical trimmed-string normalisation for targeted thread detail loading into the projection row decoders and removes the final deep
OrchestrationThreaddecode fromgetThreadDetailById().Adds a regression test covering targeted thread detail hydration from padded projection rows to confirm the returned thread detail is still normalised.
Why
Remote thread loading was stalling on very large threads because
subscribeThreadwaits forgetThreadDetailById()to finish hydrating the full thread before sending the first snapshot, and that path was deep-decoding the entire assembled thread again.This keeps the fix server-side and narrowly scoped. It preserves the public thread shape while removing redundant work from the hot path that large remote threads hit.
Checklist
Note
Medium Risk
Changes the decoding/normalization path for
getThreadDetailById, which could affect returned thread detail fields if any projection rows contain unexpected whitespace/nulls. Scoped to snapshot-query hydration and covered by a regression test, so risk is moderate.Overview
Speeds up targeted thread detail hydration by removing the final deep
OrchestrationThreaddecode inProjectionSnapshotQuery.getThreadDetailById, returning the assembled thread object directly.Moves contract-level trimming/normalization into the projection row decoders by decoding thread
title/branch/worktreePath, activitykind/summary, and sessionproviderName/lastErrorasTrimmedNonEmptyString(orNullOr), and adds a test ensuring padded DB values are returned normalized.Reviewed by Cursor Bugbot for commit 05f7106. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Remove redundant deep decode in
getThreadDetailByIdand normalize thread field trimmingtitleviaTrimmedNonEmptyString,branch/worktreePathas nullable trimmed strings, andactivity.kind/activity.summary/session.providerName/session.lastErrortrimmed at decode time.decodeThreadstep ingetThreadDetailById, which previously re-decoded the fully assembledOrchestrationThreadobject; the method now returnsOption.some(thread)directly with asatisfiestype assertion.getThreadDetailById.toPersistenceDecodeErrorat the thread assembly step will no longer occur; validation is now enforced earlier at the row-schema level.Macroscope summarized 05f7106.