Skip to content

fix/9.1: Add shared Relay frame types#6

Merged
detain merged 1 commit into
masterfrom
fix/9.1-shared-relay-types
May 24, 2026
Merged

fix/9.1: Add shared Relay frame types#6
detain merged 1 commit into
masterfrom
fix/9.1-shared-relay-types

Conversation

@detain
Copy link
Copy Markdown
Owner

@detain detain commented May 24, 2026

Summary

Add shared relay wire protocol types in Phlix\Shared\Relay\ namespace for the multiplexed WebSocket relay protocol (Section 9.1 Phase 1).

Changes

New files in src/Relay/

  • RelayFrameType.php — PHP 8.3 backed enum with 8 frame type constants:

    • HELLO (0x01), HELLO_ACK (0x02), CLIENT_CONNECT (0x03), CLIENT_DISCONNECT (0x04)
    • DATA (0x05), HEARTBEAT (0x06), DISCONNECTED (0x07), ERROR (0x08)
    • Includes fromValue(), isValid(), and label() methods
  • RelayWireCodecInterface.php — interface for encode/decode operations:

    • encode(RelayFrameType, int seq, string payload): string
    • encodeHello(string enrollmentJwt, string serverId): string (JSON text)
    • encodeHelloAck(string relaySessionId, string tunnelId): string (JSON text)
    • decode(string bytes): ?RelayFrame
  • RelayFrame.php — immutable value object:

    • type (RelayFrameType), seq (int), payload (string)
    • Type-check helper methods: isData(), isHeartbeat(), isClientConnect(), etc.

Updated files

  • src/Version.php — bump to 0.5.0
  • CHANGELOG.md — add 0.5.0 entry
  • tests/Relay/RelayFrameTypeTest.php — 47 tests for enum cases and helper methods
  • tests/Relay/RelayFrameTest.php — tests for value object properties and type-check methods

Verification

  • PHPStan level 9: ✅ green on new files
  • Psalm: ✅ no errors on new files
  • PHPCS PSR-12: ✅ clean on new files
  • PHPUnit: ✅ 47 tests, 80 assertions

Related

  • Plan: phlix-hub/docs/ws-multiplexer-plan.md (Section 9.1 Phase 1)
  • Requires: detain/phlix-server PR fix/9.1-server-relay-wiring to consume these types

…, RelayFrame)

Add Phlix\Shared\Relay\ namespace with the shared relay wire protocol types:

- RelayFrameType: PHP 8.3 backed enum with 8 frame type constants
  (HELLO=0x01 through ERROR=0x08) for the multiplexed WS relay protocol
- RelayWireCodecInterface: interface for encode/decode operations on relay frames
- RelayFrame: immutable value object representing a relay frame

Bump version to 0.5.0 and update CHANGELOG.

Tests:
- RelayFrameTypeTest: 47 tests covering all enum cases, fromValue, isValid, label
- RelayFrameTest: tests for value object properties and type-check methods

Refs: phlix-hub/docs/ws-multiplexer-plan.md Section 9.1 Phase 1
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@detain detain merged commit be8fc05 into master May 24, 2026
5 of 7 checks passed
@detain detain deleted the fix/9.1-shared-relay-types branch May 24, 2026 22:18
@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 22 medium · 23 minor

Alerts:
⚠ 45 issues (≤ 0 issues of at least minor severity)

Results:
45 new issues

Category Results
BestPractice 21 medium
CodeStyle 23 minor
Complexity 1 medium

View in Codacy

🟢 Metrics 38 complexity · 0 duplication

Metric Results
Complexity 38
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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