Joseph Doherty
c30e67a69d
Fix E2E test gaps and add comprehensive E2E + parity test suites
...
- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
2026-03-12 14:09:23 -04:00
Joseph Doherty
bfe7a71fcd
feat(cluster): add implicit route and gateway discovery via INFO gossip
...
Implements ProcessImplicitRoute and ForwardNewRouteInfoToKnownServers on RouteManager,
and ProcessImplicitGateway on GatewayManager, mirroring Go server/route.go and
server/gateway.go INFO gossip-based peer discovery. Adds ConnectUrls to ServerInfo
and introduces GatewayInfo model. 12 new unit tests in ImplicitDiscoveryTests.
2026-02-25 03:05:35 -05:00
Joseph Doherty
79b5f1cc7d
feat: add PROXY protocol parser & SubList Go-parity tests (Task 26)
...
Add ProxyProtocol.cs implementing PROXY v1/v2 header parsing (Go ref:
server/proxy_proto.go). Port 29 PROXY protocol tests and 120 SubList
Go-parity tests covering ReverseMatch, HasInterest, NumInterest,
SubjectsCollide, cache hit rate, empty tokens, and overlapping subs.
Go refs: TestProtoParseProxyV1, TestSublistReverseMatch,
TestSublistHasInterest, TestSublistNumInterest, and 25+ more.
2026-02-24 20:58:23 -05:00
Joseph Doherty
7ffee8741f
feat: phase A foundation test parity — 64 new tests across 11 subsystems
...
Port Go NATS server test behaviors to .NET:
- Client pub/sub (5 tests): simple, no-echo, reply, queue distribution, empty body
- Client UNSUB (4 tests): unsub, auto-unsub max, unsub after auto, disconnect cleanup
- Client headers (3 tests): HPUB/HMSG, server info headers, no-responders 503
- Client lifecycle (3 tests): connect proto, max subscriptions, auth timeout
- Client slow consumer (1 test): pending limit detection and disconnect
- Parser edge cases (3 tests + 2 bug fixes): PUB arg variations, malformed protocol, max control line
- SubList concurrency (13 tests): race on remove/insert/match, large lists, invalid subjects, wildcards
- Server config (4 tests): ephemeral port, server name, name defaults, lame duck
- Route config (3 tests): cluster formation, cross-cluster messaging, reconnect
- Gateway basic (2 tests): cross-cluster forwarding, no echo to origin
- Leaf node basic (2 tests): hub-to-spoke and spoke-to-hub forwarding
- Account import/export (2 tests): stream export/import delivery, isolation
Also fixes NatsParser.ParseSub/ParseUnsub to throw ProtocolViolationException
for short command lines instead of ArgumentOutOfRangeException.
Full suite: 933 passed, 0 failed (up from 869).
2026-02-23 19:26:30 -05:00
Joseph Doherty
2b64d762f6
feat: execute full-repo remaining parity closure plan
2026-02-23 13:08:52 -05:00
Joseph Doherty
8bce096f55
feat: complete final jetstream parity transport and runtime baselines
2026-02-23 11:04:43 -05:00
Joseph Doherty
3fea2da2cf
Fix merge regressions after jetstream parity merge
2026-02-23 08:56:15 -05:00
Joseph Doherty
d9f157d9e4
feat: add client kind command matrix parity
2026-02-23 05:41:42 -05:00
Joseph Doherty
afbbccab82
feat: add JwtAuthenticator with account resolution, revocation, and template expansion
2026-02-23 04:41:01 -05:00
Joseph Doherty
7c324843ff
feat: add per-client trace mode flag with dynamic parser logger
2026-02-23 04:26:15 -05:00
Joseph Doherty
7a897c1087
feat: add MaxSubs enforcement, delivery-time deny filtering, auto-unsub cleanup
2026-02-23 00:53:15 -05:00
Joseph Doherty
e9b6c7fdd3
feat: add protocol tracing (<<- op arg) at LogLevel.Trace
2026-02-23 00:52:00 -05:00
Joseph Doherty
0ec5583422
fix: address code quality review findings for batch 1
...
- SubjectsCollide: split tokens once upfront instead of O(n²) TokenAt calls
- NatsHeaderParser: manual digit accumulation avoids string allocation and overflow
- NatsHeaders: use IReadOnlyDictionary for Headers, immutable Invalid sentinel
- PermissionLruCache: add missing Count property
2026-02-23 00:40:14 -05:00
Joseph Doherty
e87d4c00d9
feat: add NatsHeaderParser for MIME header parsing
2026-02-23 00:33:24 -05:00
Joseph Doherty
61c6b832e5
feat: add MaxPending, WriteDeadline options and error constants
2026-02-22 23:33:49 -05:00
Joseph Doherty
4d89661e79
feat: add monitoring HTTP endpoints and TLS support
...
Monitoring HTTP:
- /varz, /connz, /healthz via Kestrel Minimal API
- Pagination, sorting, subscription details on /connz
- ServerStats atomic counters, CPU/memory sampling
- CLI flags: -m, --http_port, --http_base_path, --https_port
TLS Support:
- 4-mode negotiation: no TLS, required, TLS-first, mixed
- Certificate loading, pinning (SHA-256), client cert verification
- PeekableStream for non-destructive TLS detection
- Token-bucket rate limiter for TLS handshakes
- CLI flags: --tls, --tlscert, --tlskey, --tlscacert, --tlsverify
29 new tests (78 → 107 total), all passing.
# Conflicts:
# src/NATS.Server.Host/Program.cs
# src/NATS.Server/NATS.Server.csproj
# src/NATS.Server/NatsClient.cs
# src/NATS.Server/NatsOptions.cs
# src/NATS.Server/NatsServer.cs
# src/NATS.Server/Protocol/NatsProtocol.cs
# tests/NATS.Server.Tests/ClientTests.cs
2026-02-22 23:13:22 -05:00
Joseph Doherty
11dc5e62f3
feat: add auth fields to ServerInfo and ClientOptions protocol types
2026-02-22 22:19:18 -05:00
Joseph Doherty
ceaafc48d4
feat: add project setup for monitoring and TLS — csproj, config options, ServerInfo TLS fields
...
Add FrameworkReference to Microsoft.AspNetCore.App to enable Kestrel
Minimal APIs for the monitoring HTTP server. Remove the now-redundant
Microsoft.Extensions.Logging.Abstractions PackageReference (it is
included transitively via the framework reference).
Add monitoring config properties (MonitorPort, MonitorHost,
MonitorBasePath, MonitorHttpsPort) and TLS config properties (TlsCert,
TlsKey, TlsCaCert, TlsVerify, TlsHandshakeFirst, etc.) to NatsOptions.
Add TlsRequired, TlsVerify, and TlsAvailable fields to ServerInfo so
the server can advertise TLS capability in the INFO protocol message.
2026-02-22 22:00:42 -05:00
Joseph Doherty
d14d73a7d0
feat: add pedantic subject validation and max payload enforcement on PUB
...
Move max payload validation from the parser to ProcessPubAsync so the
server sends -ERR 'Maximum Payload Violation' and closes the connection
(matching Go reference client.go:2442). In pedantic mode, reject PUB
with wildcard subjects via -ERR 'Invalid Publish Subject' (client.go:2869).
Add disposed guard to SubList.Remove to prevent crash during shutdown.
2026-02-22 21:49:01 -05:00
Joseph Doherty
19e8c65f6d
feat: add -ERR response infrastructure with SendErrAsync and SendErrAndCloseAsync
2026-02-22 21:42:04 -05:00
Joseph Doherty
c78dc67973
feat: implement NATS protocol parser with System.IO.Pipelines
...
Add NatsParser that reads NATS protocol commands from
ReadOnlySequence<byte>. Identifies commands by first 2 bytes using
case-insensitive bit masking. Handles PUB/HPUB payload reading with
stateful _awaitingPayload for split-packet scenarios. Uses Span<Range>
for zero-allocation argument splitting and ParseSize for ASCII decimal
parsing. Includes CommandType enum, ParsedCommand struct, and
ProtocolViolationException.
14 tests covering PING, PONG, CONNECT, INFO, SUB (with/without queue),
UNSUB (with/without max), PUB (with/without reply, zero payload),
HPUB, multiple commands, and case insensitivity.
2026-02-22 20:19:37 -05:00
Joseph Doherty
9e36b7c0fc
feat: add protocol constants, ServerInfo, ClientOptions, and NatsOptions
2026-02-22 20:00:13 -05:00