test: add strict nats capability inventory guardrail

This commit is contained in:
Joseph Doherty
2026-02-23 14:32:55 -05:00
parent f76b599e2d
commit ec373d36f6
3 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# NATS Strict Full Go Parity Map
| Capability | Behavior | Tests | Docs |
| --- | --- | --- | --- |
| Strict capability inventory guardrail | done | done | closed |
| Account-scoped remote delivery | open | open | open |
| Idempotent inter-server interest propagation | open | open | open |
| Gateway reply remap and leaf loop-marker transparency | open | open | open |
| MQTT packet-level parser and writer | open | open | open |
| MQTT session and QoS acknowledgement runtime | open | open | open |
| MQTT auth/TLS/keepalive integration | open | open | open |
| JetStream retention runtime semantics | open | open | open |
| JetStream consumer ack/backoff/replay/flow state machine | open | open | open |
| JetStream mirror/source runtime semantics | open | open | open |
| FileStore durable invariants and recovery contract | open | open | open |
| RAFT quorum/next-index/snapshot/membership semantics | open | open | open |
| JetStream meta/replica governance contracts | open | open | open |
| Runtime profiling and config option drift closure | open | open | open |
| Differences and parity-map synchronization | open | open | open |

View File

@@ -0,0 +1,52 @@
namespace NATS.Server.Tests.Parity;
public sealed record CapabilityRow(string Capability, string Behavior, string Tests, string Docs);
public sealed class NatsCapabilityInventoryReport
{
public NatsCapabilityInventoryReport(IReadOnlyList<CapabilityRow> rows)
{
Rows = rows;
}
public IReadOnlyList<CapabilityRow> Rows { get; }
public IReadOnlyList<CapabilityRow> InvalidRows => Rows
.Where(r => !IsDone(r.Behavior) && IsClosed(r.Docs))
.Concat(Rows.Where(r => !IsDone(r.Tests) && IsClosed(r.Docs)))
.Distinct()
.ToArray();
private static bool IsDone(string status) => string.Equals(status, "done", StringComparison.OrdinalIgnoreCase);
private static bool IsClosed(string status) => string.Equals(status, "closed", StringComparison.OrdinalIgnoreCase);
}
public static class NatsCapabilityInventory
{
public static NatsCapabilityInventoryReport Load(string relativePath)
{
var repositoryRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));
var mapPath = Path.Combine(repositoryRoot, relativePath);
File.Exists(mapPath).ShouldBeTrue();
var rows = new List<CapabilityRow>();
foreach (var rawLine in File.ReadLines(mapPath))
{
var line = rawLine.Trim();
if (!line.StartsWith("|", StringComparison.Ordinal) || line.Contains("---", StringComparison.Ordinal))
continue;
var cells = line.Trim('|').Split('|').Select(static c => c.Trim()).ToArray();
if (cells.Length < 4 || string.Equals(cells[0], "Capability", StringComparison.OrdinalIgnoreCase))
continue;
rows.Add(new CapabilityRow(
cells[0],
cells[1],
cells[2],
cells[3]));
}
return new NatsCapabilityInventoryReport(rows);
}
}

View File

@@ -0,0 +1,12 @@
namespace NATS.Server.Tests.Parity;
public class NatsStrictCapabilityInventoryTests
{
[Fact]
public void Strict_capability_inventory_has_no_open_items_marked_done_without_behavior_and_tests()
{
var report = NatsCapabilityInventory.Load(
"docs/plans/2026-02-23-nats-strict-full-go-parity-map.md");
report.InvalidRows.ShouldBeEmpty();
}
}