Generated design docs and implementation plans via Codex for: - Batch 13: FileStore Read/Query - Batch 14: FileStore Write/Lifecycle - Batch 15: MsgBlock + ConsumerFileStore - Batch 18: Server Core - Batch 19: Accounts Core - Batch 20: Accounts Resolvers - Batch 21: Events + MsgTrace - Batch 22: Monitoring All plans include mandatory verification protocol and anti-stub guardrails. Updated batches.md with file paths and planned status.
21 KiB
Batch 19 Accounts Core Implementation Plan
For Codex: REQUIRED SUB-SKILL: Use
executeplanto implement this plan task-by-task.
Goal: Port and verify Batch 19 (Accounts Core) by implementing 92 Account features from server/accounts.go and porting 9 mapped tests without introducing stubs.
Architecture: Implement missing Batch 19 behavior directly in Account.cs in five feature groups (max 20 each), preserve existing lock/state patterns, and harden the 9 mapped backlog tests into real behavioral tests. Promote IDs through stub -> complete -> verified only with captured build/test evidence.
Tech Stack: .NET 10, C# latest, xUnit 3, Shouldly, NSubstitute, PortTracker CLI, SQLite (porting.db)
Design doc: docs/plans/2026-02-27-batch-19-accounts-core-design.md
Batch 19 Scope
- Batch ID:
19 - Name:
Accounts Core - Dependencies: batches
16,18 - Go source:
golang/nats-server/server/accounts.go - Feature count:
92 - Test count:
9
Primary .NET files expected:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.csdotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs(only if needed by real behavior)dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.csdotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.csdotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.csdotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs
MANDATORY VERIFICATION PROTOCOL
NON-NEGOTIABLE: Every feature and test in this batch must follow this protocol.
Per-Feature Verification Loop (REQUIRED for each feature ID)
- Read feature metadata and Go source range:
dotnet run --project tools/NatsNet.PortTracker -- feature show <feature_id> --db porting.db sed -n '<start_line>,<end_line>p' golang/nats-server/server/accounts.go - Implement the mapped C# method in
Account.cs(or supporting type inAccountTypes.csif strictly required). - Build immediately:
dotnet build dotnet/ - Run related tests immediately (smallest relevant filter first):
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~AccountTests" - If green, record feature ID in the current "complete-candidate" list.
- If red, fix before touching next feature ID.
Stub Detection Check (REQUIRED after each feature group and test class)
Run scan before status updates:
rg -n "(NotImplementedException|TODO|PLACEHOLDER|throw new Exception\\(\"TODO\"\\))" \
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs \
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs \
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs \
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs \
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs \
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs
rg -n "^\\s*(public|internal|private)\\s+.*\\)\\s*\\{\\s*\\}$" \
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs
Any new match in touched code must be fixed or explicitly deferred in PortTracker. No status promotion with unresolved stub hits.
Build Gate (REQUIRED after each feature group)
dotnet build dotnet/
Build succeeded is required before moving any group IDs to complete or verified.
Test Gate (REQUIRED before any feature ID is set to verified)
All related tests must pass:
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.AccountTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.ImplBacklog.AccountTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.ImplBacklog.GatewayHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.ImplBacklog.LeafNodeHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.ImplBacklog.MessageTracerTests"
Do not mark features verified until the 9 mapped Batch 19 tests are real and passing.
Status Update Protocol (REQUIRED)
- Max
15IDs perfeature batch-updateortest batch-updatecall. - Required sequence:
not_started/deferred -> stubwhen you begin active work.stub -> completeonly after per-feature loop + group build/test pass.complete -> verifiedonly after full test gate and evidence capture.
- Evidence required for each update chunk:
- last successful build output summary
- last related test output summary
- stub scan output (
0unresolved matches for touched code)
Checkpoint Protocol Between Tasks (REQUIRED)
At end of each task group (before starting next):
- Run full build:
dotnet build dotnet/ - Run unit tests:
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ - Commit checkpoint:
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog porting.db git commit -m "<task-specific message>" - Continue only if build green and no new failing tests.
ANTI-STUB GUARDRAILS (NON-NEGOTIABLE)
Forbidden Patterns
These patterns are forbidden in completed Batch 19 features/tests:
throw new NotImplementedException()- Empty method bodies (
{ }) for mapped feature methods - Placeholder tests that only assert constants unrelated to Account behavior
Assert.True(true)or equivalent always-pass assertion// TODOor// PLACEHOLDERin newly ported feature/test bodies- Returning hardcoded defaults (
false,null,0,string.Empty) where Go behavior is non-trivial
Hard Limits
- Maximum
20features per implementation task group. - Maximum
15IDs per status update call. - One feature group at a time; no parallel status promotion.
- No
verifiedstatus updates while any mapped Batch 19 test ID remains deferred/stub without explicit blocker reason.
If You Get Stuck
- Stop the current feature/test ID immediately.
- Revert any partial placeholder code for that ID.
- Keep or set status to
deferredwith explicit reason:dotnet run --project tools/NatsNet.PortTracker -- feature update <id> --status deferred --override "blocked: <specific reason>" --db porting.db dotnet run --project tools/NatsNet.PortTracker -- test update <id> --status deferred --override "blocked: <specific reason>" --db porting.db - Move to the next unblocked ID.
- Never introduce stubs just to keep momentum.
Feature Group Map (Max 20 per Task)
Group 1 (17 IDs): Trace, Counters, Interest, Leaf Cluster, Base Service Exports
152,153,154,170,176,189,190,192,193,194,198,199,200,201,202,203,204
Group 2 (20 IDs): Latency Send Paths, Service Import Cycle Checks, Pending Counters
210,211,212,213,214,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230
Group 3 (20 IDs): Service Import Mutation, Reverse Reply Map, Internal Subs, Response Processing
231,232,233,234,235,236,237,238,239,240,241,243,244,245,246,247,248,249,254,255
Group 4 (20 IDs): Reply Generation, Thresholds, Resp Imports, Stream Import/Export Wiring
257,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,280,281,282,283
Group 5 (15 IDs): Activation/Issuer/Auth Tail
284,286,287,294,295,301,302,303,304,305,311,312,313,314,315
Task 1: Preflight and Batch Start
Files:
- Read:
docs/standards/dotnet-standards.md - Read:
golang/nats-server/server/accounts.go - Read:
docs/plans/2026-02-27-batch-19-accounts-core-design.md
Step 1: Validate dependencies and batch status
dotnet run --project tools/NatsNet.PortTracker -- batch show 19 --db porting.db
dotnet run --project tools/NatsNet.PortTracker -- batch list --db porting.db
Expected: Batch 19 shown with dependencies 16,18.
Step 2: Start the batch
dotnet run --project tools/NatsNet.PortTracker -- batch start 19 --db porting.db
Expected: batch moves to in_progress (or clear dependency failure if blocked).
Step 3: Baseline build and tests
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
Expected: capture baseline pass/fail before edits.
Step 4: Commit checkpoint
git add porting.db
git commit -m "chore(batch19): start accounts core batch"
Task 2: Implement Group 1 Features (17 IDs)
Files:
- Modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs - Optional modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Accounts/AccountTests.cs
Step 1: Mark Group 1 as stub in max-15 chunks
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "152,153,154,170,176,189,190,192,193,194,198,199,200,201,202" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "203,204" --set-status stub --db porting.db --execute
Step 2: Run per-feature loop for all 17 IDs
For each ID: feature show -> read Go lines -> implement C# -> dotnet build -> run related tests.
Step 3: Group gate
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.AccountTests"
Step 4: Stub detection scan
Run the required scan commands from the mandatory protocol.
Step 5: Mark Group 1 as complete in max-15 chunks
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "152,153,154,170,176,189,190,192,193,194,198,199,200,201,202" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "203,204" --set-status complete --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts porting.db
git commit -m "feat(batch19): implement account trace/counter/export core methods"
Task 3: Implement Group 2 Features (20 IDs)
Files:
- Modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs - Optional modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/Accounts/AccountTests.cs
Step 1: Mark Group 2 as stub in max-15 chunks
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "210,211,212,213,214,216,217,218,219,220,221,222,223,224,225" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "226,227,228,229,230" --set-status stub --db porting.db --execute
Step 2: Run per-feature loop for all 20 IDs
Implement and verify each ID individually.
Step 3: Group gate
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.AccountTests"
Step 4: Stub detection scan
Run required scan commands.
Step 5: Mark Group 2 as complete
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "210,211,212,213,214,216,217,218,219,220,221,222,223,224,225" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "226,227,228,229,230" --set-status complete --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts porting.db
git commit -m "feat(batch19): implement account latency and import-cycle methods"
Task 4: Implement Group 3 Features (20 IDs)
Files:
- Modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs - Optional modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs
Step 1: Mark Group 3 as stub in max-15 chunks
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "231,232,233,234,235,236,237,238,239,240,241,243,244,245,246" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "247,248,249,254,255" --set-status stub --db porting.db --execute
Step 2: Run per-feature loop for all 20 IDs
Implement and verify each ID individually.
Step 3: Group gate
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.AccountTests"
Step 4: Stub detection scan
Run required scan commands.
Step 5: Mark Group 3 as complete
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "231,232,233,234,235,236,237,238,239,240,241,243,244,245,246" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "247,248,249,254,255" --set-status complete --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts porting.db
git commit -m "feat(batch19): implement service import maps and response subscription methods"
Task 5: Implement Group 4 Features (20 IDs)
Files:
- Modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs - Optional modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs
Step 1: Mark Group 4 as stub in max-15 chunks
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "257,262,263,264,265,266,267,268,269,270,271,272,273,274,275" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "276,280,281,282,283" --set-status stub --db porting.db --execute
Step 2: Run per-feature loop for all 20 IDs
Implement and verify each ID individually.
Step 3: Group gate
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.AccountTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.GatewayHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.LeafNodeHandlerTests"
Step 4: Stub detection scan
Run required scan commands.
Step 5: Mark Group 4 as complete
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "257,262,263,264,265,266,267,268,269,270,271,272,273,274,275" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "276,280,281,282,283" --set-status complete --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts porting.db
git commit -m "feat(batch19): implement service reply and stream import/export methods"
Task 6: Implement Group 5 Features (15 IDs)
Files:
- Modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs - Optional modify:
dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs - Related tests:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs
Step 1: Mark Group 5 as stub
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "284,286,287,294,295,301,302,303,304,305,311,312,313,314,315" --set-status stub --db porting.db --execute
Step 2: Run per-feature loop for all 15 IDs
Implement and verify each ID individually.
Step 3: Group gate
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.MessageTracerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ZB.MOM.NatsNet.Server.Tests.AccountTests"
Step 4: Stub detection scan
Run required scan commands.
Step 5: Mark Group 5 as complete
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "284,286,287,294,295,301,302,303,304,305,311,312,313,314,315" --set-status complete --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts porting.db
git commit -m "feat(batch19): implement activation, issuer, and external auth account methods"
Task 7: Port and Verify Batch 19 Tests (9 IDs)
Files:
- Modify:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs(IDs81,82,95) - Modify:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs(IDs658,666) - Modify:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs(IDs1935,1952,1955) - Modify:
dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MessageTracerTests.Impltests.cs(ID2359)
Step 1: Mark test IDs as stub
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "81,82,95,658,666,1935,1952,1955,2359" --set-status stub --db porting.db --execute
Step 2: Per-test loop for all 9 IDs
For each test ID: test show -> read Go test -> port C# method -> run single-test filter -> capture pass.
Step 3: Run class-level test gates
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.AccountTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.GatewayHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.LeafNodeHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.MessageTracerTests"
Step 4: Run stub detection scan on touched test files
Run required scan commands.
Step 5: Mark tests as verified
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "81,82,95,658,666,1935,1952,1955,2359" --set-status verified --db porting.db --execute
Step 6: Checkpoint
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog porting.db
git commit -m "test(batch19): port accounts core mapped tests"
Task 8: Promote Features to Verified and Complete Batch 19
Files:
- Modify:
porting.db
Step 1: Re-run full build and all related test gates
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
Step 2: Promote Group 1 and Group 2 features to verified (max-15 chunks)
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "152,153,154,170,176,189,190,192,193,194,198,199,200,201,202" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "203,204,210,211,212,213,214,216,217,218,219,220,221,222,223" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "224,225,226,227,228,229,230" --set-status verified --db porting.db --execute
Step 3: Promote Group 3 and Group 4 features to verified (max-15 chunks)
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "231,232,233,234,235,236,237,238,239,240,241,243,244,245,246" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "247,248,249,254,255,257,262,263,264,265,266,267,268,269,270" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "271,272,273,274,275,276,280,281,282,283" --set-status verified --db porting.db --execute
Step 4: Promote Group 5 features to verified
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "284,286,287,294,295,301,302,303,304,305,311,312,313,314,315" --set-status verified --db porting.db --execute
Step 5: Final batch complete validation
dotnet run --project tools/NatsNet.PortTracker -- batch complete 19 --db porting.db
dotnet run --project tools/NatsNet.PortTracker -- report summary --db porting.db
Step 6: Final checkpoint commit
git add porting.db dotnet/src/ZB.MOM.NatsNet.Server/Accounts dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog
git commit -m "feat(batch19): complete and verify accounts core"