feat(parsing): advance to next phase when status is inferring#384
feat(parsing): advance to next phase when status is inferring#384shmbhvi101 wants to merge 2 commits into
Conversation
WalkthroughIntroduces a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@services/BranchAndRepositoryService.ts`:
- Around line 343-352: The current early return when
shouldAdvanceToNextStep(parsingStatus) is true causes the poller to stop on
INFERRING; change the logic in the block that calls setChatStep and
setParsingStatus so it only returns/terminates when parsingStatus ===
ParsingStatusEnum.READY (i.e., allow INFERRING to continue polling), and update
the other analogous block (the one around the later return) the same way;
reference setChatStep, setParsingStatus, shouldAdvanceToNextStep, and
ParsingStatusEnum so you only short-circuit for READY and let pollParsingStatus
continue monitoring for later READY/ERROR transitions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b8cf2490-9c98-4fdd-9c42-cc18782d8fad
📒 Files selected for processing (1)
services/BranchAndRepositoryService.ts
|
Cloud Run service deployed: https://pr-fix-inf-status-cj6r7x3fpa-uc.a.run.app |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
services/BranchAndRepositoryService.ts (1)
343-355: Extract the duplicated transition block.The same
setChatStep/setParsingStatussequence now exists in two places. Pulling it into one helper will keep the pre-loop and in-loop paths from drifting again.♻️ Suggested cleanup
const shouldAdvanceToNextStep = (status: string) => status === ParsingStatusEnum.INFERRING || status === ParsingStatusEnum.READY; + + const applyTransition = (status: string) => { + if (!shouldAdvanceToNextStep(status)) return false; + + setChatStep?.(2); + setParsingStatus( + status === ParsingStatusEnum.READY + ? ParsingStatusEnum.READY + : getStatusMessage(status) + ); + + return status === ParsingStatusEnum.READY; + }; - if (shouldAdvanceToNextStep(parsingStatus)) { - if (setChatStep) { - setChatStep(2); - } - setParsingStatus( - parsingStatus === ParsingStatusEnum.READY - ? ParsingStatusEnum.READY - : getStatusMessage(parsingStatus) - ); - if (parsingStatus === ParsingStatusEnum.READY) { - return; - } - } + if (applyTransition(parsingStatus)) return; @@ - if (shouldAdvanceToNextStep(parsingStatus)) { - if (setChatStep) { - setChatStep(2); - } - setParsingStatus( - parsingStatus === ParsingStatusEnum.READY - ? ParsingStatusEnum.READY - : getStatusMessage(parsingStatus) - ); - if (parsingStatus === ParsingStatusEnum.READY) { - return; - } - } + if (applyTransition(parsingStatus)) return;Also applies to: 361-372
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@services/BranchAndRepositoryService.ts` around lines 343 - 355, There is a duplicated transition block that updates chat step and parsing status in two places; create a helper function (e.g., applyParsingTransition or updateChatAndParsingStatus) that accepts parsingStatus and setChatStep/setParsingStatus callbacks and encapsulates the logic currently in the block (calls setChatStep(2) if provided, then sets parsing status to READY or getStatusMessage(parsingStatus), and returns early if parsingStatus === ParsingStatusEnum.READY). Replace the two occurrences (the block inside shouldAdvanceToNextStep handling and the similar block at lines ~361-372) with calls to this helper to avoid drift and keep behavior centralized.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@services/BranchAndRepositoryService.ts`:
- Around line 343-355: There is a duplicated transition block that updates chat
step and parsing status in two places; create a helper function (e.g.,
applyParsingTransition or updateChatAndParsingStatus) that accepts parsingStatus
and setChatStep/setParsingStatus callbacks and encapsulates the logic currently
in the block (calls setChatStep(2) if provided, then sets parsing status to
READY or getStatusMessage(parsingStatus), and returns early if parsingStatus ===
ParsingStatusEnum.READY). Replace the two occurrences (the block inside
shouldAdvanceToNextStep handling and the similar block at lines ~361-372) with
calls to this helper to avoid drift and keep behavior centralized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8694164f-dabe-48a6-b523-32d7042ccd87
📒 Files selected for processing (1)
services/BranchAndRepositoryService.ts
|
Cloud Run service deployed: https://pr-fix-inf-status-cj6r7x3fpa-uc.a.run.app |
Advance to next phase when status is either "inferring" or "Ready"
Summary by CodeRabbit