Skip to content

fix: resolve local dev mode crashes (Firebase mock + wrong parsing endpoint)#417

Open
sharwariakre wants to merge 2 commits into
potpie-ai:mainfrom
sharwariakre:fix/local-dev-mode-crashes
Open

fix: resolve local dev mode crashes (Firebase mock + wrong parsing endpoint)#417
sharwariakre wants to merge 2 commits into
potpie-ai:mainfrom
sharwariakre:fix/local-dev-mode-crashes

Conversation

@sharwariakre

@sharwariakre sharwariakre commented May 19, 2026

Copy link
Copy Markdown

Summary

Two bugs that affect every contributor running locally without Firebase credentials.

Bug 1: Firebase _stopProactiveRefresh crash on page reload

File: configs/Firebase-config.ts, lib/utils.ts

When running in mock Firebase mode (no NEXT_PUBLIC_FIREBASE_API_KEY set), the app crashes on page reload with:

TypeError: auth.currentUser._stopProactiveRefresh is not a function

Root cause: getAuth() uses indexedDBLocalPersistence by default. On reload, Firebase restores the previously persisted mock user from IndexedDB and calls _stopProactiveRefresh() on the plain JSON object, which does not have that method.

Fix: Switch to initializeAuth(firebase_app, { persistence: inMemoryPersistence }) so Firebase never writes or restores auth state from IndexedDB. Also added _stopProactiveRefresh and _startProactiveRefresh stubs to generateMockUser() as a secondary guard.


Bug 2: Parsing status always returns 404

File: services/BranchAndRepositoryService.ts

After submitting a repo for parsing, the status never updates — the request silently fails with a 404.

Root cause: checkParsingStatus() was calling /api/v1/check-status which does not exist. The correct backend route is /api/v1/parsing-status.

Fix: Updated the endpoint to match the actual backend route.


Note

QuestionSection.tsx has a pre-existing TypeScript error unrelated to this fix — the build was already failing on main before these changes.

Test plan

  • Run locally without any Firebase env vars set
  • Reload the page — no _stopProactiveRefresh crash in console
  • Submit a repo for parsing and confirm status updates correctly

Summary by CodeRabbit

  • Bug Fixes
    • Resolved Firebase authentication initialization issues in development environment
    • Updated parsing status endpoint for improved backend communication

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@sharwariakre has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 12 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37dd7151-138d-45c5-96a8-caa75638b079

📥 Commits

Reviewing files that changed from the base of the PR and between e7928c1 and 2e0da87.

📒 Files selected for processing (2)
  • lib/utils.ts
  • services/BranchAndRepositoryService.ts

Walkthrough

This PR updates Firebase mock authentication to use in-memory persistence and extends the mock user object with required SDK methods, while also remapping the parsing status service endpoint from /api/v1/check-status to /api/v1/parsing-status.

Changes

Firebase Mock Auth and Service Endpoint

Layer / File(s) Summary
Firebase mock auth with in-memory persistence
configs/Firebase-config.ts, lib/utils.ts
Firebase auth imports gain initializeAuth and inMemoryPersistence. Mock auth initializes with in-memory persistence and descriptive comments. Mock user object gains _stopProactiveRefresh and _startProactiveRefresh methods to prevent missing property errors in SDK interactions.
Parsing status endpoint update
services/BranchAndRepositoryService.ts
checkParsingStatus POST request endpoint changes from /api/v1/check-status to /api/v1/parsing-status; payload and error handling unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • potpie-ai/potpie-ui#285: Both PRs modify services/BranchAndRepositoryService.checkParsingStatus—this PR changes the endpoint path while that PR updates payload and signature to support optional commitId.

Suggested reviewers

  • ASCE-D

Poem

🐰 Firebase mocks now rest in peace,
With in-memory stores—no storage release,
Mock methods stand guard, refresh held tight,
And endpoints align for parsing's flight! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes both main changes: fixing local dev mode crashes caused by Firebase mock initialization and a wrong parsing endpoint.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant