@@ -327,6 +327,24 @@ func TestWorkflowsRegistration(t *testing.T) {
327327 RegisterWorkflow (freshCtx , simpleWorkflow , WithWorkflowName ("custom-workflow" ))
328328 })
329329
330+ t .Run ("DifferentWorkflowsSameCustomName" , func (t * testing.T ) {
331+ // Create a fresh DBOS context for this test
332+ freshCtx := setupDBOS (t , false , false ) // Don't check for leaks and don't reset DB
333+
334+ // First registration with custom name should work
335+ RegisterWorkflow (freshCtx , simpleWorkflow , WithWorkflowName ("same-name" ))
336+
337+ // Second registration of different workflow with same custom name should panic with ConflictingRegistrationError
338+ defer func () {
339+ r := recover ()
340+ require .NotNil (t , r , "expected panic from registering different workflows with same custom name but got none" )
341+ dbosErr , ok := r .(* DBOSError )
342+ require .True (t , ok , "expected panic to be *DBOSError, got %T" , r )
343+ assert .Equal (t , ConflictingRegistrationError , dbosErr .Code )
344+ }()
345+ RegisterWorkflow (freshCtx , simpleWorkflowError , WithWorkflowName ("same-name" ))
346+ })
347+
330348 t .Run ("RegisterAfterLaunchPanics" , func (t * testing.T ) {
331349 // Create a fresh DBOS context for this test
332350 freshCtx := setupDBOS (t , false , false ) // Don't check for leaks and don't reset DB
0 commit comments