6.3 KiB
6.3 KiB
Full-Repo Remaining Parity Design
Date: 2026-02-23
Status: Approved
Scope: Close all remaining Baseline / N / Stub rows in differences.md using strict behavioral parity criteria with test-backed evidence.
1. Architecture and Scope Boundary
Parity control model
Parity closure in this cycle uses a row-level truth matrix with three independent states per unresolved row:
- Behavior
- Go-contract behavior is implemented (not just helper hooks or placeholders).
- Tests
- Contract-positive and negative/edge tests exist and fail if behavior regresses to baseline.
- Docs
differences.mdrow status matches verified behavior/test state.
Rows move to Y only when Behavior + Tests + Docs are all complete.
Execution ordering
- Core protocol, transport, and sublist semantics.
- Auth and monitoring rows.
- JetStream runtime policy semantics.
- JetStream storage, RAFT, and JetStream clustering semantics.
- Documentation and evidence synchronization.
Scope note
This cycle intentionally covers full-repo unresolved rows, not JetStream-only, because remaining JetStream closure depends on transport/protocol/subscription/runtime correctness and docs currently contain summary/table inconsistencies.
2. Component Plan
A. Protocol and transport parity
Primary files:
src/NATS.Server/NatsServer.cssrc/NATS.Server/NatsClient.cssrc/NATS.Server/Protocol/NatsParser.cssrc/NATS.Server/Protocol/ClientCommandMatrix.cssrc/NATS.Server/Routes/RouteConnection.cssrc/NATS.Server/Routes/RouteManager.cssrc/NATS.Server/Gateways/GatewayConnection.cssrc/NATS.Server/Gateways/GatewayManager.cssrc/NATS.Server/LeafNodes/LeafConnection.cssrc/NATS.Server/LeafNodes/LeafNodeManager.cs
Target rows:
- Inter-server op semantics and routing contracts still marked baseline or missing.
- Gateway/leaf advanced semantics beyond handshake-level support.
- Route/gateway/leaf account-aware interest and delivery behavior.
B. SubList and subscription parity
Primary files:
src/NATS.Server/Subscriptions/SubList.cssrc/NATS.Server/Subscriptions/RemoteSubscription.cssrc/NATS.Server/Subscriptions/Subscription.cs
Target rows:
- Notification/interest-change hooks.
- Local/remote filtering and queue-weight behavior.
MatchBytesand cache/fanout parity behavior.
C. Auth and monitoring parity
Primary files:
src/NATS.Server/Auth/*src/NATS.Server/Monitoring/ConnzHandler.cssrc/NATS.Server/Monitoring/VarzHandler.cssrc/NATS.Server/Monitoring/*response models
Target rows:
- Missing auth extension points (custom/external/proxy).
- Remaining
connz/varzfilters and fields.
D. JetStream runtime parity
Primary files:
src/NATS.Server/JetStream/StreamManager.cssrc/NATS.Server/JetStream/ConsumerManager.cssrc/NATS.Server/JetStream/Consumers/*src/NATS.Server/JetStream/Publish/*src/NATS.Server/JetStream/Api/Handlers/*src/NATS.Server/JetStream/Validation/JetStreamConfigValidator.cs
Target rows:
- Stream retention/maxage/maxmsgsper/maxmsgsize and stream feature toggles.
- Consumer ack/backoff/delivery/replay/flow/rate semantics.
- Mirror/source advanced behavior and cross-account semantics.
E. Storage, RAFT, and JetStream cluster parity
Primary files:
src/NATS.Server/JetStream/Storage/*src/NATS.Server/Raft/*src/NATS.Server/JetStream/Cluster/*src/NATS.Server/NatsServer.csintegration points
Target rows:
- FileStore behavior gaps (layout/index/ttl/compression/encryption).
- RAFT behavior gaps (heartbeat/next-index/snapshot transfer/membership/transport semantics).
- JetStream meta-group and replica-group behavioral gaps.
F. Evidence and documentation parity
Primary files:
differences.mddocs/plans/2026-02-23-jetstream-remaining-parity-map.mddocs/plans/2026-02-23-jetstream-remaining-parity-verification.md
Target:
- Remove summary/table drift and keep row status tied to behavior and tests.
3. Data Flow and Behavioral Contracts
- Truth-matrix contract
- Every unresolved row is tracked as Behavior/Test/Docs until closure.
- Summary statements never override unresolved table rows.
- Transport contract
- Inter-server propagation preserves account scope and message semantics end-to-end.
- Remote delivery resolves against correct account state, not global-only shortcuts.
- Gateway reply remap and leaf loop markers stay transparent to client-visible semantics.
- SubList contract
- Local interest and remote interest behavior are explicitly separated and account-aware.
- Queue weights and remote subscriptions influence deterministic routing decisions.
- Cache and match behavior remain correct under concurrent mutate/read operations.
- Auth and monitoring contract
- New auth extension points must preserve existing permission and revocation safety.
connz/varzparity fields reflect live data and match expected filter/sort semantics.
- JetStream runtime contract
- Stream policy semantics are enforced in runtime operations, not only parse-time.
- Consumer state transitions are deterministic across pull/push and redelivery flows.
- Mirror/source behavior includes mapping and cross-account rules.
- Storage/RAFT/cluster contract
- Store recovery and TTL/index semantics are deterministic.
- RAFT behavior is consensus-driven (not placeholder-only hooks).
- JetStream cluster governance behavior depends on effective state transitions.
4. Error Handling, Test Strategy, and Completion Criteria
Error handling
- Preserve protocol-specific and JetStream-specific error contracts.
- Fail closed on remap/loop/account-authorization anomalies.
- Avoid partial state mutation on cross-node failures.
Test strategy
- Each unresolved row gets positive + negative/edge coverage.
- Multi-node/network semantics require integration tests, not helper-only tests.
- Parity closure tests must inspect unresolved row status and supporting evidence, not only summary text.
Completion criteria
- All in-scope unresolved rows are either:
- moved to
Ywith evidence, or - explicitly blocked with concrete technical rationale and failing evidence.
- Focused suites pass for protocol/transport/sublist/auth/monitoring/jetstream/raft layers.
- Full suite passes:
dotnet test -v minimal
differences.md, parity map, and verification report are synchronized to actual behavior and tests.