Skip to content

fix: Reject duplicate handler names at registration - #234

Open
RaphaelFakhri wants to merge 1 commit into
restatedev:mainfrom
RaphaelFakhri:fix/duplicate-handler-name
Open

RaphaelFakhri wants to merge 1 commit into
restatedev:mainfrom
RaphaelFakhri:fix/duplicate-handler-name

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Reject duplicate handler names at registration

Fixes #10

Registering two handlers with the same name on a Service, VirtualObject or Workflow silently replaced the first handler with the second. The decorator now raises a ValueError when a handler with the same name is already registered, which surfaces the mistake when the module is imported.

The error message follows the one Endpoint.bind raises for duplicate service names, for example Handler greet already exists in Greeter.

Testing

tests/duplicate_handlers.py covers Service, VirtualObject and Workflow, including a workflow main handler and a shared handler that use the same name.

PYTHONPATH=python python -m pytest tests/duplicate_handlers.py

The tests fail without the change (DID NOT RAISE ValueError, 3 failed) and pass with it (3 passed).

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@RaphaelFakhri

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@RaphaelFakhri

Copy link
Copy Markdown
Author

recheck

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.

Registering two handlers with same name should fail at startup

1 participant