From 9b64c605f878eff32e29cc108db360fd64066059 Mon Sep 17 00:00:00 2001 From: Rodin Date: Fri, 15 May 2026 01:36:17 -0700 Subject: [PATCH] fix(#146): reuse resolved doc-map path from early validation in Step 6c Addresses sonnet/gpt NIT: early validateWorkspacePath call at line 176 discarded the resolved path (using _), then Step 6c called it again. Store the resolved path in resolvedDocMapFile and reuse it downstream, eliminating the redundant EvalSymlinks syscall on the happy path. --- cmd/review-bot/main.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/review-bot/main.go b/cmd/review-bot/main.go index 1150453..4097e3b 100644 --- a/cmd/review-bot/main.go +++ b/cmd/review-bot/main.go @@ -174,11 +174,14 @@ func main() { } // Early validation of filesystem-path flags (fail fast before network I/O) + var resolvedDocMapFile string if *docMapFile != "" { - if _, err := validateWorkspacePath(*docMapFile, "doc-map"); err != nil { + resolved, err := validateWorkspacePath(*docMapFile, "doc-map") + if err != nil { slog.Error("invalid doc-map path", "error", err) os.Exit(1) } + resolvedDocMapFile = resolved } // Initialize clients @@ -365,12 +368,7 @@ func main() { // Step 6c: Load path-scoped design docs if doc-map specified designDocs := "" if *docMapFile != "" { - resolvedDocMap, err := validateWorkspacePath(*docMapFile, "doc-map") - if err != nil { - slog.Error("invalid doc-map path", "error", err) - os.Exit(1) - } - docMapCfg, err := review.ParseDocMapConfig(resolvedDocMap) + docMapCfg, err := review.ParseDocMapConfig(resolvedDocMapFile) if err != nil { slog.Error("failed to parse doc-map file", "file", *docMapFile, "error", err) os.Exit(1)