From f9b582dcca4c62ed64d60bf194a9a4f17e9efb49 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 28 Feb 2026 06:05:06 -0500 Subject: [PATCH] feat(batch1): add init parity hooks for ciphers and constants --- .../Auth/CipherSuites.cs | 10 +++++ .../ZB.MOM.NatsNet.Server/ServerConstants.cs | 9 +++++ .../Auth/CipherSuitesTests.cs | 13 ++++++ .../ServerTests.cs | 11 ++++++ porting.db | Bin 6352896 -> 6352896 bytes reports/current.md | 8 ++-- reports/report_eed6169.md | 37 ++++++++++++++++++ 7 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 reports/report_eed6169.md diff --git a/dotnet/src/ZB.MOM.NatsNet.Server/Auth/CipherSuites.cs b/dotnet/src/ZB.MOM.NatsNet.Server/Auth/CipherSuites.cs index 1d05c3c..4a24ea6 100644 --- a/dotnet/src/ZB.MOM.NatsNet.Server/Auth/CipherSuites.cs +++ b/dotnet/src/ZB.MOM.NatsNet.Server/Auth/CipherSuites.cs @@ -56,6 +56,16 @@ public static class CipherSuites CipherMapById = byId; } + /// + /// Compatibility init hook for PortTracker parity with Go init(). + /// Safe and idempotent. + /// + public static void Init() + { + _ = CipherMap; + _ = CipherMapById; + } + /// /// Returns the default set of TLS 1.2 cipher suites. /// .NET manages cipher suite selection at the OS/SChannel/OpenSSL level; diff --git a/dotnet/src/ZB.MOM.NatsNet.Server/ServerConstants.cs b/dotnet/src/ZB.MOM.NatsNet.Server/ServerConstants.cs index 5243955..77b55ab 100644 --- a/dotnet/src/ZB.MOM.NatsNet.Server/ServerConstants.cs +++ b/dotnet/src/ZB.MOM.NatsNet.Server/ServerConstants.cs @@ -214,6 +214,15 @@ public static class ServerConstants GitCommit = string.Empty; } + /// + /// Compatibility init hook for PortTracker parity with Go init(). + /// Safe and idempotent. + /// + public static void Init() + { + _ = GitCommit; + } + /// /// Truncates a VCS revision string to 7 characters for display. /// Mirrors formatRevision in const.go. diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/CipherSuitesTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/CipherSuitesTests.cs index ba577f3..fdad2a5 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/CipherSuitesTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Auth/CipherSuitesTests.cs @@ -24,6 +24,19 @@ namespace ZB.MOM.NatsNet.Server.Tests.Auth; /// public class CipherSuitesTests { + [Fact] + public void Init_CalledMultipleTimes_RemainsIdempotent() + { + var beforeCount = CipherSuites.CipherMap.Count; + var beforeByIdCount = CipherSuites.CipherMapById.Count; + + CipherSuites.Init(); + CipherSuites.Init(); + + CipherSuites.CipherMap.Count.ShouldBe(beforeCount); + CipherSuites.CipherMapById.Count.ShouldBe(beforeByIdCount); + } + [Fact] public void CipherMap_ContainsTls13Suites() { diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ServerTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ServerTests.cs index 5f36584..2e4ca56 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ServerTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ServerTests.cs @@ -32,6 +32,17 @@ namespace ZB.MOM.NatsNet.Server.Tests; /// public sealed class ServerTests { + [Fact] + public void Init_CalledMultipleTimes_RemainsIdempotent() + { + var before = ServerConstants.GitCommit; + + ServerConstants.Init(); + ServerConstants.Init(); + + ServerConstants.GitCommit.ShouldBe(before); + } + // ========================================================================= // TestSemanticVersion — Test ID 2866 // Validates that ServerConstants.Version matches semver format. diff --git a/porting.db b/porting.db index dbd9e94ad4b29b3e223d2882de1babe55bc28e87..7d41894cac4b1c73719af51bd140f39e9e9e74e2 100644 GIT binary patch delta 1296 zcmciCUuaWT90%~6lcZ_Wn|tfp#;$GZt=4U^O_SVoT}|ia|LXixTmNkSY1iB4)?Su> zy}41!#+o3QK@bEVjt?UC!9OTSErSD+hoWyj2$MY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..3c033fb 100644 --- a/reports/current.md +++ b/reports/current.md @@ -1,6 +1,6 @@ # NATS .NET Porting Status Report -Generated: 2026-02-28 10:54:55 UTC +Generated: 2026-02-28 11:05:07 UTC ## Modules (12 total) @@ -12,10 +12,10 @@ Generated: 2026-02-28 10:54:55 UTC | Status | Count | |--------|-------| -| deferred | 2377 | +| deferred | 2375 | | n_a | 24 | | stub | 1 | -| verified | 1271 | +| verified | 1273 | ## Unit Tests (3257 total) @@ -34,4 +34,4 @@ Generated: 2026-02-28 10:54:55 UTC ## Overall Progress -**2473/6942 items complete (35.6%)** +**2475/6942 items complete (35.7%)** diff --git a/reports/report_eed6169.md b/reports/report_eed6169.md new file mode 100644 index 0000000..3c033fb --- /dev/null +++ b/reports/report_eed6169.md @@ -0,0 +1,37 @@ +# NATS .NET Porting Status Report + +Generated: 2026-02-28 11:05:07 UTC + +## Modules (12 total) + +| Status | Count | +|--------|-------| +| verified | 12 | + +## Features (3673 total) + +| Status | Count | +|--------|-------| +| deferred | 2375 | +| n_a | 24 | +| stub | 1 | +| verified | 1273 | + +## Unit Tests (3257 total) + +| Status | Count | +|--------|-------| +| deferred | 2091 | +| n_a | 187 | +| verified | 979 | + +## Library Mappings (36 total) + +| Status | Count | +|--------|-------| +| mapped | 36 | + + +## Overall Progress + +**2475/6942 items complete (35.7%)**