Skip to content

Consistent custom attributes for HELLO + separate tests set #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

vovchisko
Copy link
Contributor

@vovchisko vovchisko commented Jun 20, 2025

Description, Motivation and Context

This PR implements consistent custom attributes validation across all WAMP message types according to WAMP specification 3.1. Previously, the HELLO message used helloCustomDetails, which accepted any attributes without validation, while other messages used _extractCustomOptions with proper regex validation (^_[a-z0-9_]{3,}$).

Bugfix

  • Fixed missing retain option on publish.

The change ensures all WAMP message types follow the same validation pattern for custom attributes, improving consistency and spec compliance.

What is the current behavior?

  • HELLO.Details accepts any custom attributes without validation via helloCustomDetails
  • Other message types (SUBSCRIBE.Options, PUBLISH.Options, CALL.Options, etc.) use _extractCustomOptions with proper regex validation
  • Inconsistent behavior across message types for custom attributes handling

What is the new behavior?

  • All WAMP message types now use consistent _extractCustomOptions validation
  • HELLO.Details now properly validates custom attributes using the same ^_[a-z0-9_]{3,}$ pattern
  • Invalid custom attributes are silently filtered out (not passed to router)
  • Comprehensive test suite added covering all 16 WAMP message types

What kind of change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no new functionality, only code improvements)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • Overall test coverage is not decreased.
  • All new and existing tests passed.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@vovchisko vovchisko marked this pull request as ready for review June 20, 2025 13:45
it("SUBSCRIBE.Options - supports custom attributes", async function () {
await wampy.connect();

const customOptions = {
Copy link
Owner

Choose a reason for hiding this comment

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

Okay. Thnx for removing some AI-garbage....
But I still don't see how customOptions are tested....
If they are not passed or are not correctly processed - then there will be no data-matching and default response for msg type will be returned. That's it. Where does the actual test happen?

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.

2 participants