Skip to content

fix: warehouse graceful termination - replace panic with error handling#3

Merged
deepshekhardas merged 1 commit into
masterfrom
fix/pr-6767-warehouse-graceful
May 5, 2026
Merged

fix: warehouse graceful termination - replace panic with error handling#3
deepshekhardas merged 1 commit into
masterfrom
fix/pr-6767-warehouse-graceful

Conversation

@deepshekhardas

@deepshekhardas deepshekhardas commented May 5, 2026

Copy link
Copy Markdown
Owner

This PR addresses PR rudderlabs#6767

Changes:

  • Replace panic with proper error handling in warehouse router
  • Files changed: warehouse/router/identities.go, warehouse/router/state.go
  • 2 files changed, 9 insertions(+), 5 deletions(-)

Summary by cubic

Replaced panics in warehouse routing with error handling and logging so the service fails safely and can terminate gracefully instead of crashing.

  • Bug Fixes
    • warehouse/router/identities.go: log and return on manager init, schema marshal, upload ID scan, and identity population failures (uses r.logger.Errorn with obskit.Error(err)), returning errors or model.Upload{} as appropriate.
    • warehouse/router/state.go: inProgressState now returns an empty string on invalid state instead of panicking.

Written for commit 5dd7b2e. Summary will update on new commits.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="warehouse/router/identities.go">

<violation number="1" location="warehouse/router/identities.go:302">
P1: Returning `model.Upload{}` on setup failures hides the error and allows the identity population flow to continue with an invalid upload (ID 0/empty fields). Propagate an error to the caller and stop processing instead of returning a zero-value upload.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

if err != nil {
panic(err)
r.logger.Errorn("[WH]: Failed to marshal schema for identity upload", obskit.Error(err))
return model.Upload{}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Returning model.Upload{} on setup failures hides the error and allows the identity population flow to continue with an invalid upload (ID 0/empty fields). Propagate an error to the caller and stop processing instead of returning a zero-value upload.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At warehouse/router/identities.go, line 302:

<comment>Returning `model.Upload{}` on setup failures hides the error and allows the identity population flow to continue with an invalid upload (ID 0/empty fields). Propagate an error to the caller and stop processing instead of returning a zero-value upload.</comment>

<file context>
@@ -297,7 +298,8 @@ func (r *Router) initPrePopulateDestIdentitiesUpload(warehouse model.Warehouse)
 	if err != nil {
-		panic(err)
+		r.logger.Errorn("[WH]: Failed to marshal schema for identity upload", obskit.Error(err))
+		return model.Upload{}
 	}
 
</file context>

@deepshekhardas deepshekhardas merged commit b73af25 into master May 5, 2026
15 of 58 checks passed
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