Joseph Doherty
5a22fd3213
feat: add JetStream cluster stream replication and placement tests (Go parity)
...
Adds 97 tests across two new files covering stream replication semantics
(R1/R3 creation, replica group size, publish preservation, state accuracy,
purge, update, delete, max limits, subjects, wildcards, storage type) and
placement semantics (replica caps at cluster size, various cluster sizes,
concurrent creation, stepdown resilience, long names, re-create after delete).
2026-02-24 07:53:28 -05:00
Joseph Doherty
4fa0be2281
feat: add JetStreamClusterFixture for multi-node cluster tests (Go parity)
...
Adds a unified JetStreamClusterFixture consolidating the capabilities of all 7
per-suite fixtures (ClusterFormationFixture, ClusterStreamFixture, LeaderFailoverFixture, etc.)
into a single reusable helper for Tasks 6-10. Includes new Go-parity helpers
(WaitOnStreamLeaderAsync, WaitOnConsumerLeaderAsync, GetConsumerLeaderId,
StepDownMetaLeader, SimulateNodeRestart, RemoveNode) matching jetstream_helpers_test.go.
27 smoke tests verify all capabilities pass.
2026-02-24 07:36:32 -05:00
Joseph Doherty
543b791cb5
feat: port remaining JetStream core tests from Go (edge cases, preconditions, direct get)
...
Adds 110 new tests across 5 files covering gaps identified from Go's jetstream_test.go:
- JetStreamStreamEdgeCaseTests (29 tests): max msgs/bytes enforcement, discard
old/new policies, max msg size, max msgs per subject, sealed/deny-delete/deny-purge
config, work queue and interest retention, state tracking, CRUD edges.
- JetStreamConsumerDeliveryEdgeTests (25 tests): AckProcessor unit tests (register,
drop, ack floor, expiry, redelivery), push consumer heartbeat/flow-control frames,
pull fetch no-wait, batch limit, filter delivery, wildcard filter, ack explicit
pending tracking, ack-all clearing, work queue pull consumer.
- JetStreamPublishPreconditionTests (21 tests): expected-last-seq match/mismatch,
duplicate window dedup acceptance/rejection, window expiry allows re-publish,
PublishPreconditions unit tests (IsDuplicate, Record, TrimOlderThan,
CheckExpectedLastSeq), pub ack stream/seq fields, sequential writes enforcement.
- JetStreamAccountLimitTests (17 tests): max streams per account (1/3/unlimited),
slot freed on delete, Account.TryReserveStream/ReleaseStream unit tests,
JetStreamStreamCount tracking, account info stream/consumer counts, stream names
sorted, consumer names list, error code 10027 on limit exceeded.
- JetStreamDirectGetTests (18 tests): direct get by sequence (first/middle/last),
subject preservation, non-existent sequence error, empty stream error, zero seq
error, multiple independent retrieves, STREAM.MSG.GET API, get-after-delete,
get-after-purge, memory storage, backend type reporting, consistency between
direct get and stream msg get.
Go reference: golang/nats-server/server/jetstream_test.go
2026-02-24 06:47:17 -05:00
Joseph Doherty
3e972f217e
feat: add FileStore 6-way permutation tests (Go testFileStoreAllPermutations parity)
...
Port 20 tests across the {NoCipher, ChaCha, Aes} x {NoCompression, S2Compression}
matrix from Go's testFileStoreAllPermutations (filestore_test.go:55), yielding 120
total Theory executions in FileStorePermutationTests.cs.
Also fix PushFrame.Subject property missing compilation error that was blocking
the test build (JetStreamConsumerDeliveryEdgeTests.cs:119).
Tests covered (each runs 6x):
Store_and_load_basic TestFileStoreBasics:86
Store_multiple_messages_load_by_sequence TestFileStoreBasics:86
LoadLastBySubject_returns_most_recent_for_subject
Remove_single_message_updates_state TestFileStoreBasics:129
Purge_clears_all_messages TestFileStorePurge:710
TrimToMaxMessages_enforces_limit TestFileStoreMsgLimitBug:518
Block_rotation_when_exceeding_block_size TestFileStoreAndRetrieveMultiBlock:1527
GetState_returns_correct_counts TestFileStoreBasics:104
Snapshot_and_restore_round_trip TestFileStoreSnapshot:1799
ListAsync_returns_ordered_messages TestFileStoreTimeStamps:683
MaxAge_prunes_expired_messages TestFileStoreAgeLimit:616
Recovery_after_reopen_preserves_messages TestFileStoreBasicWriteMsgsAndRestore:181
Large_payload_store_and_load 64 KiB random payload variant
Multiple_subjects_filter_by_subject TestFileStoreBasics multi-subject
Sequential_writes_maintain_ordering TestFileStoreSelectNextFirst:304
Store_creates_files_on_disk disk-presence variant
Write_and_read_same_block TestFileStoreWriteAndReadSameBlock:1510
Stored_messages_have_non_decreasing_timestamps TestFileStoreTimeStamps:683
Remove_out_of_order_collapses_first_seq TestFileStoreCollapseDmap:1561
Snapshot_after_removes_preserves_remaining TestFileStoreSnapshot:1904
2026-02-24 06:43:48 -05:00
Joseph Doherty
9cc9888bb4
feat: add S2 compression and AEAD encryption for FileStore (Go parity)
...
Replace Deflate+XOR with IronSnappy S2 block compression and ChaCha20-Poly1305 / AES-256-GCM
AEAD encryption, matching golang/nats-server/server/filestore.go. Introduces FSV2 envelope
format alongside existing FSV1 for backward compatibility. Adds 55 new tests across
S2CodecTests, AeadEncryptorTests, and FileStoreV2Tests covering all 6 cipher×compression
permutations, tamper detection, and legacy format round-trips.
2026-02-24 06:29:34 -05:00
Joseph Doherty
2c9683e7aa
feat: upgrade JetStreamService to lifecycle orchestrator
...
Implements enableJetStream() semantics from golang/nats-server/server/jetstream.go:414-523.
- JetStreamService.StartAsync(): validates config, creates store directory
(including nested paths via Directory.CreateDirectory), registers all
$JS.API.> subjects, logs startup stats; idempotent on double-start
- JetStreamService.DisposeAsync(): clears registered subjects, marks not running
- New properties: RegisteredApiSubjects, MaxStreams, MaxConsumers, MaxMemory, MaxStore
- JetStreamOptions: adds MaxStreams and MaxConsumers limits (0 = unlimited)
- FileStoreConfig: removes duplicate StoreCipher/StoreCompression enum declarations
now that AeadEncryptor.cs owns them; updates defaults to NoCipher/NoCompression
- FileStoreOptions/FileStore: align enum member names with AeadEncryptor.cs
(NoCipher, NoCompression, S2Compression) to fix cross-task naming conflict
- 13 new tests in JetStreamServiceOrchestrationTests covering all lifecycle paths
2026-02-24 06:03:46 -05:00
Joseph Doherty
3ff801865a
feat: Waves 3-5 — FileStore, RAFT, JetStream clustering, and concurrency tests
...
Add comprehensive Go-parity test coverage across 3 subsystems:
- FileStore: basic CRUD, limits, purge, recovery, subjects, encryption,
compression, MemStore (161 tests, 24 skipped for not-yet-implemented)
- RAFT: core types, wire format, election, log replication, snapshots
(95 tests)
- JetStream Clustering: meta controller, stream/consumer replica groups,
concurrency stress tests (90 tests)
Total: ~346 new test annotations across 17 files (+7,557 lines)
Full suite: 2,606 passing, 0 failures, 27 skipped
2026-02-23 22:55:41 -05:00
Joseph Doherty
f1353868af
feat: Wave 6 batch 2 — accounts/auth, gateways, routes, JetStream API, JetStream cluster tests
...
Add comprehensive Go-parity test coverage across 5 subsystems:
- Accounts/Auth: isolation, import/export, auth mechanisms, permissions (82 tests)
- Gateways: connection, forwarding, interest mode, config (106 tests)
- Routes: connection, subscription, forwarding, config validation (78 tests)
- JetStream API: stream/consumer CRUD, pub/sub, features, admin (234 tests)
- JetStream Cluster: streams, consumers, failover, meta (108 tests)
Total: ~608 new test annotations across 22 files (+13,844 lines)
All tests pass individually; suite total: 2,283 passing, 3 skipped
2026-02-23 22:35:06 -05:00
Joseph Doherty
921554f410
feat: define StreamStore/ConsumerStore interfaces from Go store.go
...
Port IStreamStore, IConsumerStore, StoreMsg, StreamState, SimpleState,
ConsumerState, FileStoreConfig, StoreCipher, StoreCompression types.
Rename Models.StreamState → ApiStreamState to avoid namespace conflict.
2026-02-23 21:06:16 -05:00
Joseph Doherty
61b1a00800
feat: phase C jetstream depth test parity — 34 new tests across 7 subsystems
...
Stream lifecycle, publish/ack, consumer delivery, retention policy,
API endpoints, cluster formation, and leader failover tests ported
from Go nats-server reference. 1006 total tests passing.
2026-02-23 19:55:31 -05:00
Joseph Doherty
28d379e6b7
feat: phase B distributed substrate test parity — 39 new tests across 5 subsystems
...
FileStore basics (4), MemStore/retention (10), RAFT election/append (16),
config reload parity (3), monitoring endpoints varz/connz/healthz (6).
972 total tests passing, 0 failures.
2026-02-23 19:41:30 -05:00
Joseph Doherty
081ff1b0db
docs: synchronize strict full go parity evidence and status
2026-02-23 15:03:35 -05:00
Joseph Doherty
148ff9ebb6
feat: implement jetstream governance runtime parity semantics
2026-02-23 14:54:30 -05:00
Joseph Doherty
56177a7099
feat: enforce filestore durability and recovery invariants
2026-02-23 14:51:30 -05:00
Joseph Doherty
3896512f84
feat: complete jetstream mirror source strict runtime parity
2026-02-23 14:50:18 -05:00
Joseph Doherty
7bea35aaa8
feat: harden jetstream consumer state machine parity
2026-02-23 14:48:47 -05:00
Joseph Doherty
cdde3c7a1d
feat: implement strict retention runtime parity for jetstream
2026-02-23 14:47:24 -05:00
Joseph Doherty
377ad4a299
feat: complete jetstream deep operational parity closure
2026-02-23 13:43:14 -05:00
Joseph Doherty
2b64d762f6
feat: execute full-repo remaining parity closure plan
2026-02-23 13:08:52 -05:00