# Batch 20 Accounts Resolvers Implementation Plan

> **For Codex:** REQUIRED SUB-SKILL: Use `executeplan` to implement this plan task-by-task.

**Goal:** Port and verify Batch 20 (`Accounts Resolvers`) by implementing 38 resolver/account features from `server/accounts.go` and validating 98 mapped tests without introducing stubs.

**Architecture:** Implement in existing account/resolver files (`AccountResolver.cs`, `NatsServer.Accounts.cs`, `Account.cs`, `AccountTypes.cs`) in two feature groups (19 IDs each), then verify/port mapped tests in class-based waves. Status changes are evidence-driven and chunked to max 15 IDs per update.

**Tech Stack:** .NET 10, C# latest, xUnit 3, Shouldly, NSubstitute, PortTracker CLI, SQLite (`porting.db`)

**Design doc:** `docs/plans/2026-02-27-batch-20-accounts-resolvers-design.md`

---

## Batch 20 Scope

- Batch ID: `20`
- Name: `Accounts Resolvers`
- Dependency: batch `19`
- Go source: `golang/nats-server/server/accounts.go`
- Features: `38`
- Tests: `98`

Primary source files:

- `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountResolver.cs`
- `dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs`
- `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs`
- `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs`

Primary mapped test files:

- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsConsumerTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamEngineTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/EventsHandlerTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttExternalTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamBatchingTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamFileStoreTests.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests1.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs`
- `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsServerTests.Impltests.cs`

---

## MANDATORY VERIFICATION PROTOCOL

> **NON-NEGOTIABLE:** Every feature and test in Batch 20 must follow this protocol.

### Per-Feature Verification Loop (REQUIRED for every feature ID)

1. Read feature metadata and Go source before editing:
   ```bash
   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
   ```
2. Implement C# behavior in mapped file/class/method (no placeholders).
3. Build immediately:
   ```bash
   dotnet build dotnet/
   ```
4. Run smallest related test filter immediately (class-level minimum):
   ```bash
   dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
     --filter "FullyQualifiedName~<RelatedClassName>"
   ```
5. Only after green build + related tests: add feature ID to group `complete` candidate list.
6. If failing, fix before starting the next feature ID.

### Stub Detection Check (REQUIRED after every feature group and test class)

Run on **touched files** and fail the task if new stub hits are introduced:

```bash
# Forbidden tokens and TODO markers
rg -n "(NotImplementedException|TODO|PLACEHOLDER|throw new Exception\(\"TODO\"\))" \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountResolver.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs \
  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/*.Impltests.cs

# Empty method-body detector
rg -n "^\s*(public|internal|private|protected)\s+[^=;]+\)\s*\{\s*\}$" \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountResolver.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs
```

If any new violations appear, remove/fix them or defer the blocked ID with reason. Do not continue.

### Build Gate (REQUIRED after each feature group)

```bash
dotnet build dotnet/
```

`Build succeeded` is required before any group IDs move to `complete` or `verified`.

### Test Gate (REQUIRED before setting any feature to `verified`)

All related mapped tests for that feature group must pass:

```bash
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.JwtProcessorTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.ConfigReloaderTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.EventsHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.MonitoringHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.NatsConsumerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.JetStreamEngineTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.ConcurrencyTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.Mqtt"
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.JetStreamBatchingTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.JetStreamFileStoreTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.NatsServerTests"
```

No feature ID may be set to `verified` until mapped tests are passing or explicitly deferred with reason.

### Status Update Protocol (REQUIRED)

- Maximum `15` IDs per `feature batch-update` or `test batch-update` command.
- Allowed status flow only: `deferred/not_started -> stub -> complete -> verified`.
- Each status update chunk requires evidence captured in notes/log:
  - successful build summary
  - successful related test summary
  - clean stub-scan outcome for touched files
- Never bulk-update across unrelated groups/classes in one command.

### Checkpoint Protocol Between Tasks (REQUIRED)

After every implementation/testing task before starting next task:

1. Full build:
   ```bash
   dotnet build dotnet/
   ```
2. Full unit test run:
   ```bash
   dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
   ```
3. Commit checkpoint:
   ```bash
   git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts \
     dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs \
     dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog \
     porting.db
   git commit -m "<task-specific message>"
   ```

---

## ANTI-STUB GUARDRAILS (NON-NEGOTIABLE)

### Forbidden Patterns

The following patterns are forbidden in any completed Batch 20 feature or test:

- `throw new NotImplementedException()`
- Empty method bodies for mapped feature methods (`{ }`)
- `// TODO` or `// PLACEHOLDER` inside newly implemented feature/test bodies
- Placeholder pass assertions (`Assert.True(true)`, equivalent always-pass checks)
- Fake behavior returns (`return null;`, `return string.Empty;`, `return 0;`, `return false;`) where Go behavior is non-trivial
- Tests with no real Arrange/Act/Assert against production code

### Hard Limits

- Max `~20` features per implementation group (this plan uses 19 + 19).
- Max `15` IDs per any status-update command.
- Max one feature group in active status transition at a time.
- No feature may reach `verified` while its mapped tests are still stubbed/unverified without explicit deferred reason.
- Mandatory checkpoint commit after every task.

### If You Get Stuck (REQUIRED BEHAVIOR)

1. Stop work on the blocked ID immediately.
2. Remove any partial placeholder code for that ID.
3. Keep or set status to `deferred` with explicit reason:
   ```bash
   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
   ```
4. Continue with the next unblocked ID.
5. Do not create stubs to preserve momentum.

---

## Feature Groups (Max ~20)

### Group 1 (19 Features)

`150,183,197,208,209,215,250,251,252,253,258,259,260,261,306,307,310,316,318`

### Group 2 (19 Features)

`319,320,326,327,328,330,331,334,335,336,337,338,339,341,343,345,346,347,349`

---

## Test Waves (98 Total)

### Wave 1 (18 tests)

- Account: `86,87,105,108`
- JWT: `1819,1821,1823,1825,1830,1831,1841,1849,1894`
- Events: `307,346,347`
- Monitoring: `2125,2141`

### Wave 2 (40 tests)

- Config reload: `2721,2722,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2741,2742,2743,2744,2745,2746,2750,2752,2753,2754,2761,2767,2768,2769,2770,2771,2773,2775,2776,2779,2781,2793`

### Wave 3 (40 tests)

- NatsConsumer: `1238,1254,1296,1300,1305,1307,1322,1324,1329,1331,1351,1354,1360,1375,1377,1378`
- JetStreamEngine: `1566,1578,1579,1679,1680,1698,1705,1706,1712,1729,1730,1738`
- Concurrency: `2379,2386,2444,2445,2500`
- MQTT/Gateway/Other: `2169,2184,2262,683,723,493,2893`

---

## 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-20-accounts-resolvers-design.md`

**Step 1: Confirm dependency and scope**

```bash
dotnet run --project tools/NatsNet.PortTracker -- batch list --db porting.db
dotnet run --project tools/NatsNet.PortTracker -- batch show 20 --db porting.db
dotnet run --project tools/NatsNet.PortTracker -- report summary --db porting.db
```

Expected: Batch 20 depends on Batch 19 and remains pending or ready.

**Step 2: Start the batch**

```bash
dotnet run --project tools/NatsNet.PortTracker -- batch start 20 --db porting.db
```

Expected: batch status becomes `in_progress`.

**Step 3: Baseline verification**

```bash
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
```

Expected: baseline output captured before edits.

**Step 4: Commit checkpoint**

```bash
git add porting.db
git commit -m "chore(batch20): start accounts resolvers batch"
```

---

## Task 2: Implement Feature Group 1 (19 IDs)

**Files:**
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs`

**Step 1: Move Group 1 to `stub` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "150,183,197,208,209,215,250,251,252,253,258,259,260,261,306" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "307,310,316,318" --set-status stub --db porting.db --execute
```

**Step 2: Execute per-feature verification loop for all 19 IDs**

For each ID: `feature show` -> read Go range -> implement -> build -> run related tests.

**Step 3: Group build + focused tests**

```bash
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.JwtProcessorTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.EventsHandlerTests"
```

**Step 4: Run stub detection check**

Use the mandatory stub-scan commands.

**Step 5: Move Group 1 to `complete` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "150,183,197,208,209,215,250,251,252,253,258,259,260,261,306" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "307,310,316,318" --set-status complete --db porting.db --execute
```

**Step 6: Checkpoint protocol + commit**

```bash
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountTypes.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs \
  porting.db
git commit -m "feat(batch20): implement resolver/latency/account refresh group"
```

---

## Task 3: Implement Feature Group 2 (19 IDs)

**Files:**
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountResolver.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs`

**Step 1: Move Group 2 to `stub` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "319,320,326,327,328,330,331,334,335,336,337,338,339,341,343" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "345,346,347,349" --set-status stub --db porting.db --execute
```

**Step 2: Execute per-feature verification loop for all 19 IDs**

For each ID: `feature show` -> Go source -> implement -> build -> targeted tests.

**Step 3: Group build + focused tests**

```bash
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.ConfigReloaderTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.MonitoringHandlerTests"
```

**Step 4: Run stub detection check**

Use the mandatory stub-scan commands.

**Step 5: Move Group 2 to `complete` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "319,320,326,327,328,330,331,334,335,336,337,338,339,341,343" --set-status complete --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "345,346,347,349" --set-status complete --db porting.db --execute
```

**Step 6: Checkpoint protocol + commit**

```bash
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/src/ZB.MOM.NatsNet.Server/Accounts/AccountResolver.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/NatsServer.Accounts.cs \
  dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs \
  porting.db
git commit -m "feat(batch20): implement resolver backends and operator helper paths"
```

---

## Task 4: Port and Verify Test Wave 1 (18 IDs)

**Files:**
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/AccountTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/EventsHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs`

**Step 1: Move Wave 1 IDs to `stub` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "86,87,105,108,1819,1821,1823,1825,1830,1831,1841,1849,1894,307,346" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "347,2125,2141" --set-status stub --db porting.db --execute
```

**Step 2: Per-test loop for each ID**

For each test ID: `test show` -> read Go test range -> port behavior -> run single test -> verify `Passed: 1`.

**Step 3: Class-level gates**

```bash
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.JwtProcessorTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.EventsHandlerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.MonitoringHandlerTests"
```

**Step 4: Stub scan + move Wave 1 to `verified`**

```bash
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "86,87,105,108,1819,1821,1823,1825,1830,1831,1841,1849,1894,307,346" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "347,2125,2141" --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

```bash
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(batch20): verify account jwt events monitoring mapped tests"
```

---

## Task 5: Port and Verify Test Wave 2 (Config Reload, 40 IDs)

**Files:**
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`

**Step 1: Move Wave 2 IDs to `stub` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "2721,2722,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "2737,2738,2739,2741,2742,2743,2744,2745,2746,2750,2752,2753,2754,2761,2767" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "2768,2769,2770,2771,2773,2775,2776,2779,2781,2793" --set-status stub --db porting.db --execute
```

**Step 2: Port in sub-batches of ~10 tests**

For each sub-batch: port tests -> run single-test checks -> run full class filter.

**Step 3: Class gate**

```bash
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.ConfigReloaderTests"
```

Expected: all 40 mapped IDs passing.

**Step 4: Stub scan + move Wave 2 IDs to `verified` in same 3 chunks**

Run the same ID chunks with `--set-status verified`.

**Step 5: Checkpoint protocol + commit**

```bash
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
git add dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs porting.db
git commit -m "test(batch20): verify config reload mapped tests"
```

---

## Task 6: Port and Verify Test Wave 3 (40 IDs)

**Files:**
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsConsumerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamEngineTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests1.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttExternalTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/GatewayHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamBatchingTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamFileStoreTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/NatsServerTests.Impltests.cs`

**Step 1: Move Wave 3 IDs to `stub` in max-15 chunks**

```bash
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "1238,1254,1296,1300,1305,1307,1322,1324,1329,1331,1351,1354,1360,1375,1377" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "1378,1566,1578,1579,1679,1680,1698,1705,1706,1712,1729,1730,1738,2379,2386" --set-status stub --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- test batch-update --ids "2444,2445,2500,2169,2184,2262,683,723,493,2893" --set-status stub --db porting.db --execute
```

**Step 2: Port and verify per class**

Run single-test loops and then class filters for each touched class.

**Step 3: Class gates**

```bash
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.NatsConsumerTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.JetStreamEngineTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.ConcurrencyTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.Mqtt"
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.JetStreamBatchingTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.JetStreamFileStoreTests"
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --filter "FullyQualifiedName~ImplBacklog.NatsServerTests"
```

**Step 4: Stub scan + move Wave 3 IDs to `verified` in same 3 chunks**

Run the same ID chunks with `--set-status verified`.

**Step 5: Checkpoint protocol + commit**

```bash
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(batch20): verify jetstream mqtt concurrency and misc mapped tests"
```

---

## Task 7: Final Feature Verification, Batch Completion, and Report

**Files:**
- Modify: `porting.db`
- Generate: `reports/current.md` (via report script)

**Step 1: Promote feature groups from `complete` to `verified` in max-15 chunks**

Group 1:

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "150,183,197,208,209,215,250,251,252,253,258,259,260,261,306" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "307,310,316,318" --set-status verified --db porting.db --execute
```

Group 2:

```bash
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "319,320,326,327,328,330,331,334,335,336,337,338,339,341,343" --set-status verified --db porting.db --execute
dotnet run --project tools/NatsNet.PortTracker -- feature batch-update --ids "345,346,347,349" --set-status verified --db porting.db --execute
```

**Step 2: Final full gates**

```bash
dotnet build dotnet/
dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/
dotnet run --project tools/NatsNet.PortTracker -- batch show 20 --db porting.db
dotnet run --project tools/NatsNet.PortTracker -- batch complete 20 --db porting.db
```

Expected: batch completion succeeds (or explicit list of blocked IDs).

**Step 3: Dependency/report update and commit**

```bash
dotnet run --project tools/NatsNet.PortTracker -- dependency ready --db porting.db
./reports/generate-report.sh
git add porting.db reports/
git commit -m "chore(batch20): complete accounts resolvers batch"
```

---

## Evidence Checklist (Use Before Every Status Update)

1. Feature/test IDs updated are listed explicitly (<=15 per command).
2. Build output captured and green.
3. Related test output captured and green.
4. Stub scan re-run and no new violations in touched files.
5. Any blocked IDs are deferred with explicit reason (no placeholders).
