From 1cd2964501acd5c0bc736323f09205d272664f09 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Thu, 17 Sep 2026 20:35:04 -0400 Subject: [PATCH] perf(mobile): build the two projected git enums once, not per parse (#21311) `readProjectedConflictOperation` and `readProjectedCompareStatus` constructed a `z.enum` on every call, so every `git.status` and `git.branchCompare` reply paid the constructor. Hoisted to module constants; the git-status payload schema reuses the same instance. Behaviour is unchanged: same arms, same fallbacks, identical reader output on all eleven recorded matrix cases. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- mobile/src/session/diff-review-reply-schema.ts | 5 ++++- mobile/src/source-control/git-status-reply-schema.ts | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mobile/src/session/diff-review-reply-schema.ts b/mobile/src/session/diff-review-reply-schema.ts index b35da5da76b..b875df72b05 100644 --- a/mobile/src/session/diff-review-reply-schema.ts +++ b/mobile/src/session/diff-review-reply-schema.ts @@ -27,6 +27,9 @@ const GIT_BRANCH_COMPARE_STATUS = [ type GitBranchCompareStatus = (typeof GIT_BRANCH_COMPARE_STATUS)[number] +// Built once: readProjectedCompareStatus runs on every reply. +const gitBranchCompareStatusSchema = z.enum(GIT_BRANCH_COMPARE_STATUS) + /** * One committed change. * @@ -101,7 +104,7 @@ export const branchCompareProjectionSchema: z.ZodType