Skip to content

Commit ecbe10f

Browse files
authored
Add docstrings and fix pony-lint violations (#18)
Add docstrings to all public methods on close code types (CloseNormal, CloseGoingAway, etc.), close status types (CloseNoStatusReceived, CloseAbnormalClosure, OtherCloseCode), and handshake error types. Fix pony-lint violations: rename files to match principal type naming convention (_mort.pony -> _unreachable.pony, websocket_*.pony -> web_socket_*.pony), fix two lines exceeding 80 columns.
1 parent d7f295b commit ecbe10f

8 files changed

Lines changed: 9 additions & 7 deletions

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ make build-examples ssl=3.0.x # Just examples
1919
Import aliases used consistently across the codebase:
2020
- `use lori = "lori"`
2121
- `use crypto = "ssl/crypto"`
22-
- `use ssl_net = "ssl/net"` (only in `websocket_server.pony`)
22+
- `use ssl_net = "ssl/net"` (only in `web_socket_server.pony`)
2323
- `use "encode/base64"` (unqualified)
2424

2525
## Architecture
@@ -58,13 +58,13 @@ _Handshaking → _Open → _Closing → _Closed
5858
| `_close_status_extractor.pony` | `_CloseStatusExtractor` | Extracts `(CloseStatus, String val)` from raw close frame payload |
5959
| `_utf8_validator.pony` | `_Utf8Validator` | UTF-8 byte sequence validation |
6060
| `_connection_state.pony` | `_ConnectionState` | State machine trait + four state classes |
61-
| `_mort.pony` | `_Unreachable` | Crash-on-bug helper for impossible code paths |
61+
| `_unreachable.pony` | `_Unreachable` | Crash-on-bug helper for impossible code paths |
6262

6363
## Naming Conventions
6464

6565
- `_` prefix on type names = package-private (visible within `mare/` package, not to consumers)
6666
- `_` prefix on members = type-private (only accessible within the defining type)
67-
- File names match the primary type they contain (e.g., `websocket_server.pony` contains `WebSocketServer`)
67+
- File names match the primary type they contain (e.g., `web_socket_server.pony` contains `WebSocketServer`)
6868

6969
## Test Patterns
7070

mare/_test_frame_encoder.pony

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class \nodoc\ iso _TestFrameEncoderPropertyRoundtrip is Property1[USize]
152152

153153
// To parse through _FrameParser, we need to mask the frame
154154
// (client-to-server). Build a masked version.
155-
let mask_key: Array[U8] val = recover val [as U8: 0x37; 0xFA; 0x21; 0x3D] end
155+
let mask_key: Array[U8] val =
156+
recover val [as U8: 0x37; 0xFA; 0x21; 0x3D] end
156157
let masked = _mask_frame(frame, mask_key)?
157158

158159
// Parse
File renamed without changes.

mare/mare.pony

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ Override any of these on your `WebSocketServerActor`:
108108
- `on_open(request)` — connection established
109109
- `on_text_message(data)` — complete text message received
110110
- `on_binary_message(data)` — complete binary message received
111-
- `on_closed(close_status, close_reason)` — connection closed; `close_status`
112-
is a `CloseStatus` indicating why (e.g., `CloseNormal`, `CloseAbnormalClosure`),
113-
`close_reason` is the UTF-8 reason string from the close frame (or empty)
111+
- `on_closed(close_status, close_reason)` — connection closed;
112+
`close_status` is a `CloseStatus` indicating why
113+
(e.g., `CloseNormal`, `CloseAbnormalClosure`), `close_reason` is
114+
the UTF-8 reason string from the close frame (or empty)
114115
- `on_throttled()` / `on_unthrottled()` — backpressure signals
115116
116117
## Sending Messages
File renamed without changes.

0 commit comments

Comments
 (0)