Files
natsdotnet/gaps/misc-uncategorized.md
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

12 KiB

Misc / Uncategorized — Gap Analysis

This file tracks what has and hasn't been ported from Go to .NET for the Misc / Uncategorized module. See stillmissing.md for the full LOC comparison across all modules.

LLM Instructions: How to Analyze This Category

Step 1: Read the Go Reference Files

Read each Go source file listed below. For every file:

  1. Extract all exported types (structs, interfaces, type aliases)
  2. Extract all exported methods on those types (receiver functions)
  3. Extract all exported standalone functions
  4. Note key constants, enums, and protocol states
  5. Note important unexported helpers that implement core logic (functions >20 lines)
  6. Pay attention to concurrency patterns (goroutines, mutexes, channels) — these map to different .NET patterns

Step 2: Read the .NET Implementation Files

Read all .cs files in the .NET directories listed below. For each Go symbol found in Step 1:

  1. Search for a matching type, method, or function in .NET
  2. If found, compare the behavior: does it handle the same edge cases? Same error paths?
  3. If partially implemented, note what's missing
  4. If not found, note it as MISSING

Step 3: Cross-Reference Tests

Compare Go test functions against .NET test methods:

  1. For each Go Test* function, check if a corresponding .NET [Fact] or [Theory] exists
  2. Note which test scenarios are covered and which are missing
  3. Check the parity DB (docs/test_parity.db) for existing mappings:
    sqlite3 docs/test_parity.db "SELECT go_test, dotnet_test, confidence FROM test_mappings tm JOIN go_tests gt ON tm.go_test_id=gt.rowid JOIN dotnet_tests dt ON tm.dotnet_test_id=dt.rowid WHERE gt.go_file LIKE '%PATTERN%'"
    

Step 4: Classify Each Item

Use these status values:

Status Meaning
PORTED Equivalent exists in .NET with matching behavior
PARTIAL .NET implementation exists but is incomplete (missing edge cases, error handling, or features)
MISSING No .NET equivalent found — needs to be ported
NOT_APPLICABLE Go-specific pattern that doesn't apply to .NET (build tags, platform-specific goroutine tricks, etc.)
DEFERRED Intentionally skipped for now (document why)

Step 5: Fill In the Gap Inventory

Add rows to the Gap Inventory table below. Group by Go source file. Include the Go file and line number so a porting LLM can jump directly to the reference implementation.

Key Porting Notes for Misc / Uncategorized

  • This file captures items that don't cleanly fit elsewhere.
  • norace_*_test.go files (12,009 LOC) contain long-running stress/race tests spanning multiple subsystems — map to Stress/ tests in .NET.
  • benchmark_*.go files contain Go benchmarks — may map to [Fact] tests with timing assertions or BenchmarkDotNet.
  • The Go test/ integration directory (35 files, 29,812 LOC) contains end-to-end tests that may overlap with .NET test subdirectories.
  • As items are identified and categorized, move them to the appropriate category file.

Go Reference Files (Source)

  • Files not fitting into other categories
  • Small Go source files that don't belong to a major subsystem
  • Platform-specific stubs or build-tag-only files

Go Reference Files (Tests)

  • golang/nats-server/server/ping_test.go
  • golang/nats-server/server/closed_conns_test.go
  • golang/nats-server/server/norace_1_test.go
  • golang/nats-server/server/norace_2_test.go
  • golang/nats-server/server/benchmark_publish_test.go
  • golang/nats-server/server/core_benchmarks_test.go
  • Various integration tests in golang/nats-server/test/

.NET Implementation Files (Source)

  • Any .NET source files not covered by other category files

.NET Implementation Files (Tests)

  • tests/NATS.Server.Tests/Stress/
  • tests/NATS.Server.Tests/Parity/
  • Other root-level test files

Gap Inventory

Platform-Specific Source Files

Go Symbol Go File:Line Status .NET Equivalent Notes
diskAvailable golang/nats-server/server/disk_avail.go:1 NOT_APPLICABLE N/A Base function; platform implementations below override it
diskAvailable (openbsd) golang/nats-server/server/disk_avail_openbsd.go:23 PARTIAL NatsServer.cs (JetStream disk checking stub) .NET has minimal disk-space checking; full syscall.Statfs equivalent not implemented
diskAvailable (netbsd) golang/nats-server/server/disk_avail_netbsd.go:19 NOT_APPLICABLE N/A NetBSD stub returning default; .NET runs on Windows/.NET platforms only
diskAvailable (solaris) golang/nats-server/server/disk_avail_solaris.go:23 NOT_APPLICABLE N/A Solaris/illumos stub; not supported platform for .NET
diskAvailable (wasm) golang/nats-server/server/disk_avail_wasm.go:18 NOT_APPLICABLE N/A WASM stub; .NET does not compile to WASM for NATS server
diskAvailable (windows) golang/nats-server/server/disk_avail_windows.go:19 PARTIAL NatsServer.cs (JetStream disk checking stub) .NET has minimal implementation; full Windows disk space API not used
SetServiceName golang/nats-server/server/service_windows.go:34 NOT_APPLICABLE src/NATS.Server.Host/Program.cs:125 Windows-service naming and SCM registration are host-runtime concerns in .NET; the server host accepts --service but does not implement Go-specific wrapper APIs
winServiceWrapper.Execute golang/nats-server/server/service_windows.go:64 NOT_APPLICABLE src/NATS.Server.Host/Program.cs:125 Go Windows service wrapper is replaced by .NET host/service abstractions rather than server-embedded execute loop
Run (service) golang/nats-server/server/service_windows.go:115 NOT_APPLICABLE src/NATS.Server.Host/Program.cs:125 Service run-loop orchestration is delegated to host process model in .NET
isWindowsService golang/nats-server/server/service_windows.go:132 NOT_APPLICABLE src/NATS.Server.Host/Program.cs:198 .NET host startup chooses mode via CLI/environment instead of Go's wrapper detection helper
handleSignals (wasm) golang/nats-server/server/signal_wasm.go:18 NOT_APPLICABLE N/A WASM stub; .NET does not target WASM
ProcessSignal (wasm) golang/nats-server/server/signal_wasm.go:22 NOT_APPLICABLE N/A WASM stub; .NET does not target WASM
handleSignals (windows) golang/nats-server/server/signal_windows.go:28 NOT_APPLICABLE src/NATS.Server/NatsServer.cs:376 Go signal-channel model is replaced by host-native cancellation and managed signal hooks in .NET
ProcessSignal (windows) golang/nats-server/server/signal_windows.go:53 NOT_APPLICABLE src/NATS.Server.Host/Program.cs:226 Remote Windows service signal command processing is not part of .NET server architecture; shutdown/reopen flows are host-driven
reopenLogCode, ldmCode golang/nats-server/server/service_windows.go:24-28 NOT_APPLICABLE src/NATS.Server/NatsServer.cs:119 Service command codes are Go SCM-specific; .NET exposes equivalent operations via host callbacks (ReOpenLogFile, graceful shutdown)

Test Files — Miscellaneous

Go Symbol Go File:Line Status .NET Equivalent Notes
TestPing golang/nats-server/server/ping_test.go:34 PORTED tests/NATS.Server.Tests/ServerTests.cs:PingKeepaliveTests Raw socket PING/PONG protocol test ported
DefaultPingOptions golang/nats-server/server/ping_test.go:26 PORTED tests/NATS.Server.Tests/ServerTests.cs:PingKeepaliveTests Test options reflected in C# test setup
TestClosedConnsAccounting golang/nats-server/server/closed_conns_test.go:46 PORTED tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:489 Closed-connection accounting parity covered: single closed client tracking, bounded ring behavior, and required closed-client fields/close-reason coverage.
TestClosedConnsSubsAccounting golang/nats-server/server/closed_conns_test.go:102 PORTED tests/NATS.Server.Tests/Monitoring/MonitorGoParityTests.cs:1720 Closed-connection subscription accounting parity covered via /connz?state=closed&subs=detail assertions and closed-conn subscription detail mapping tests.
TestClosedAuthorizationTimeout golang/nats-server/server/closed_conns_test.go:143 PORTED tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:636 ClosedConns_auth_timeout_close_reason_tracked validates auth-timeout close reason accounting
TestClosedAuthorizationViolation golang/nats-server/server/closed_conns_test.go:164 PORTED tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:680 ClosedConns_auth_violation_close_reason_tracked validates auth-violation close reason accounting
TestClosedUPAuthorizationViolation golang/nats-server/server/closed_conns_test.go:187 PORTED tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:726 Added explicit username/password auth-violation closed-connection parity test covering no-creds and wrong-password failures
TestClosedMaxPayload golang/nats-server/server/closed_conns_test.go:219 PORTED tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:585 ClosedConns_max_payload_close_reason_tracked validates max-payload close reason accounting
TestClosedTLSHandshake golang/nats-server/server/closed_conns_test.go:247 PORTED src/NATS.Server/NatsServer.cs:1666; tests/NATS.Server.Tests/MsgTraceGoParityTests.cs:784 Added early-accept closed-client tracking for TLS negotiation failures (TLS Handshake Error) plus targeted parity test
NoRace tests (norace_1_test.go) golang/nats-server/server/norace_1_test.go:1 PARTIAL tests/NATS.Server.Tests/Stress/ (2,342 LOC vs 8,497 Go LOC) Long-running race/concurrency tests; ~27% mapped to .NET Stress tests
NoRace tests (norace_2_test.go) golang/nats-server/server/norace_2_test.go:1 PARTIAL tests/NATS.Server.Tests/Stress/ Additional race/concurrency scenarios; ~27% coverage in .NET
BenchmarkPublish golang/nats-server/server/benchmark_publish_test.go:1 DEFERRED N/A Go benchmarks not directly portable; .NET uses different perf tooling (BenchmarkDotNet)
CoreBenchmarks golang/nats-server/server/core_benchmarks_test.go:1 DEFERRED N/A Core server benchmarks; .NET performance profiling uses different approach

Integration Tests (test/ directory)

Go Symbol Go File:Line Status .NET Equivalent Notes
test/ping_test.go golang/nats-server/test/ping_test.go:1 PARTIAL tests/NATS.Server.Tests/ServerTests.cs Integration-level ping tests; basic coverage exists in .NET
test/norace_test.go golang/nats-server/test/norace_test.go:1 PARTIAL tests/NATS.Server.Tests/Stress/ Race-condition integration tests; some mapped to Stress tests
Other test/*.go (35 files total) golang/nats-server/test/:1 PARTIAL tests/NATS.Server.Tests/ (spread across multiple categories) Integration tests distributed across functional categories; not all scenarios covered

Keeping This File Updated

After porting work is completed:

  1. Update status: Change MISSING → PORTED or PARTIAL → PORTED for each item completed
  2. Add .NET path: Fill in the ".NET Equivalent" column with the actual file:line
  3. Re-count LOC: Update the LOC numbers in stillmissing.md:
    # Re-count .NET source LOC for this module
    # Various files — re-count as needed
    # Re-count .NET test LOC for this module
    find tests/NATS.Server.Tests/Stress/ tests/NATS.Server.Tests/Parity/ -name '*.cs' -type f -exec cat {} + | wc -l
    
  4. Add a changelog entry below with date and summary of what was ported
  5. Update the parity DB if new test mappings were created:
    sqlite3 docs/test_parity.db "INSERT INTO test_mappings (go_test_id, dotnet_test_id, confidence, notes) VALUES (?, ?, 'manual', 'ported in YYYY-MM-DD session')"
    

Change Log

Date Change By
2026-02-26 Reclassified closed-connection test parity rows to PORTED based on existing focused coverage for closed conn accounting and closed subscription detail endpoints. codex
2026-02-25 Initial gap inventory analysis: 8 platform-specific source files, 14 test symbols, 35 integration tests claude
2026-02-25 File created with LLM analysis instructions auto
2026-02-25 Ported closed-connection parity for username/password auth violations and TLS handshake failures, including early TLS-failure closed-client tracking in accept path codex