# Batch 6 (Opts Package-Level Functions) Implementation Plan

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

**Goal:** Implement and verify Batch 6 option/package-level behavior from `server/opts.go` (`67` features, `18` tests) with evidence-backed status updates and zero stubs.

**Architecture:** Execute four bounded feature groups (<=20 features each) in source-order, then port mapped tests in three class-based groups. Every feature follows a strict read-Go -> implement-C# -> build -> related-test loop. Promote to `verified` only when related mapped tests are green; otherwise keep `complete`/`deferred` with explicit evidence.

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

**Design doc:** `docs/plans/2026-02-27-batch-6-opts-package-level-functions-design.md`

---

## Batch 6 Working Set

Batch facts:

- Batch ID: `6`
- Features: `67`
- Tests: `18`
- Depends on: `Batch 4`
- Go file: `golang/nats-server/server/opts.go`

Feature groups (max <=20):

- **F1 Core config entry + cluster/gateway parse (16):** `2502,2504,2505,2506,2507,2508,2509,2515,2516,2517,2519,2520,2521,2522,2523,2524`
- **F2 JetStream + leaf/gateway/TLS helpers (14):** `2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538`
- **F3 Account + authorization parsing (17):** `2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555`
- **F4 Permission/TLS/websocket/MQTT/CLI configure (20):** `2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2580`

Test groups:

- **T1 Options/reload/JWT wiring (4):** `1832,2586,2587,2766`
- **T2 Leaf/route/websocket TLS behavior (8):** `1918,1919,1929,1942,1950,2817,2821,3109`
- **T3 Monitoring + MQTT TLS behavior (6):** `2108,2113,2114,2115,2166,2178`

Environment note:

- `dotnet` is not on PATH in this workspace; use `/usr/local/share/dotnet/dotnet`.

---

## MANDATORY VERIFICATION PROTOCOL

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

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

1. Read tracker mapping and Go location:
   ```bash
   /usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- feature show <id> --db porting.db
   ```
2. Read exact Go implementation lines in `golang/nats-server/server/opts.go`.
3. Write only that feature behavior in .NET (`ServerOptions`).
4. Build immediately:
   ```bash
   /usr/local/share/dotnet/dotnet build dotnet/
   ```
5. Run related tests (focused filter for impacted classes).
6. Add feature ID to verified-candidate list only after build + related tests pass.

### Per-Test Verification Loop (REQUIRED for each test ID)

1. Read mapping + Go test lines:
   ```bash
   /usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- test show <id> --db porting.db
   ```
2. Replace placeholder ImplBacklog body with real Arrange/Act/Assert behavior.
3. Run exact test method and confirm discovery + pass:
   ```bash
   /usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
     --filter "FullyQualifiedName~<ExactTestMethod>" --verbosity normal
   ```
4. Add test ID to verified-candidate list only after focused pass.

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

Run all three checks before any status promotion:

```bash
# 1) Stub markers in touched source/test files
grep -n -E "(NotImplementedException|TODO|PLACEHOLDER|throw new Exception\\(\"not implemented\"\\))" \
  dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions*.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/*.cs

# 2) Empty method bodies in changed C# files
for f in $(git diff --name-only -- '*.cs'); do
  grep -n -E "^\s*(public|private|internal|protected).*\)\s*\{\s*\}\s*$" "$f";
done

# 3) Placeholder impl-backlog anti-patterns
grep -n -E "\".*ShouldSucceed\"\.ShouldContain\(\"Should\"\)|goFile\.ShouldStartWith\(\"server/\"\)" \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs \
  dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs
```

Any match blocks promotion until fixed or explicitly deferred with reason.

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

```bash
/usr/local/share/dotnet/dotnet build dotnet/
```

Rule: zero build errors required after each group.

### Test Gate (REQUIRED before marking features `verified`)

For the active feature group, all related mapped test classes must pass with `Failed: 0`.

Suggested related test commands:

```bash
# F1
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~ServerOptionsTests|FullyQualifiedName~ConfigReloaderTests" --verbosity normal

# F2
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~LeafNodeHandlerTests|FullyQualifiedName~RouteHandlerTests|FullyQualifiedName~WebSocketHandlerTests|FullyQualifiedName~MonitoringHandlerTests|FullyQualifiedName~MqttHandlerTests|FullyQualifiedName~JwtProcessorTests" --verbosity normal

# F3
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~JwtProcessorTests|FullyQualifiedName~ServerOptionsTests|FullyQualifiedName~ConfigReloaderTests" --verbosity normal

# F4
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~ServerOptionsTests|FullyQualifiedName~ConfigReloaderTests|FullyQualifiedName~JwtProcessorTests|FullyQualifiedName~LeafNodeHandlerTests|FullyQualifiedName~RouteHandlerTests|FullyQualifiedName~WebSocketHandlerTests|FullyQualifiedName~MonitoringHandlerTests|FullyQualifiedName~MqttHandlerTests" --verbosity normal
```

Rule: do not set features to `verified` until their related mapped tests pass.

### Status Update Protocol (REQUIRED)

- Max `15` IDs per `feature batch-update` or `test batch-update`.
- Required progression:
  - Features: `deferred/not_started -> stub -> complete -> verified`
  - Tests: `deferred/not_started -> stub -> verified` (or remain `deferred` with reason)
- Evidence required per update chunk:
  - feature/test IDs covered
  - build gate output
  - related test output
  - stub scan output

Command templates:

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "<max15ids>" --set-status <stub|complete|verified> --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "<max15ids>" --set-status <stub|verified> --db porting.db --execute
```

If audit disagrees:

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature update <id> --status <status> --db porting.db --override "verification evidence: <reason>"
```

### Checkpoint Protocol Between Tasks (REQUIRED)

After each task, before starting the next:

1. Full build:
   ```bash
   /usr/local/share/dotnet/dotnet build dotnet/
   ```
2. Full unit tests:
   ```bash
   /usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --verbosity normal
   ```
3. Record pass/fail totals.
4. Commit completed slice (including `porting.db`) before continuing.

---

## ANTI-STUB GUARDRAILS

### Forbidden Patterns

Do not introduce any of the following in Batch 6 scope:

- `throw new NotImplementedException(...)`
- Empty feature bodies (`{ }`) for mapped methods
- `TODO`, `PLACEHOLDER`, or fake "implement later" comments
- Placeholder test checks like method-name string assertions (`"...ShouldSucceed".ShouldContain("Should")`)
- Tests that only validate `goFile` string literals or constants unrelated to behavior
- Trivial pass assertions (`Assert.True(true)`, `Assert.Pass()`)

### Hard Limits

- Max `20` features per implementation group
- Max `15` IDs per status update command
- Max `1` feature-group promotion cycle at a time (no cross-group bulk verify)
- Mandatory build gate after every feature group
- Mandatory related test gate before `verified` feature status
- Mandatory checkpoint commit between tasks

### If You Get Stuck (REQUIRED BEHAVIOR)

Do not stub and do not fake-pass:

1. Keep blocked item as `deferred`.
2. Record concrete reason with `--override`.
3. Move to next unblocked item.

Commands:

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature update <id> --status deferred --db porting.db \
  --override "blocked: <specific dependency/runtime reason>"

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test update <id> --status deferred --db porting.db \
  --override "blocked: <specific dependency/runtime reason>"
```

---

### Task 1: Preflight and Batch Start

**Files:**

- Modify: `porting.db`

**Step 1: Verify dependency batch is complete before starting Batch 6**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- batch show 4 --db porting.db
```

**Step 2: Start Batch 6**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- batch start 6 --db porting.db
```

**Step 3: Mark F1 as `stub` in <=15 ID chunks**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2502,2504,2505,2506,2507,2508,2509,2515,2516,2517,2519,2520,2521,2522,2523" \
  --set-status stub --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2524" --set-status stub --db porting.db --execute
```

**Step 4: Checkpoint protocol + commit**

---

### Task 2: Implement Feature Group F1 (Core Config + Cluster/Gateway Parse)

**Files:**

- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions.Methods.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions.cs` (if new fields/properties are required for parity)
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: For each F1 feature ID, run the Per-Feature Verification Loop**

**Step 2: Run F1 stub checks + build gate + F1 related test gate**

**Step 3: Promote F1 to `complete` in <=15 chunks**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2502,2504,2505,2506,2507,2508,2509,2515,2516,2517,2519,2520,2521,2522,2523" \
  --set-status complete --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2524" --set-status complete --db porting.db --execute
```

**Step 4: Promote F1 to `verified` only if F1 related tests are all passing**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2502,2504,2505,2506,2507,2508,2509,2515,2516,2517,2519,2520,2521,2522,2523" \
  --set-status verified --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2524" --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

---

### Task 3: Implement Feature Group F2 (JetStream + Leaf/TLS Helpers)

**Files:**

- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions.Methods.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptionTypes.cs` (if parity requires shape updates)
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark F2 as `stub`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538" \
  --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Feature Verification Loop for each F2 ID**

**Step 3: Run F2 stub checks + build gate + F2 related test gate**

**Step 4: Promote F2 to `complete` then `verified`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538" \
  --set-status complete --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538" \
  --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

---

### Task 4: Implement Feature Group F3 (Accounts + Authorization Parsing)

**Files:**

- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions.Methods.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/Account.cs` (only if Batch 6 parser parity requires adjustments)
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark F3 as `stub` (<=15 chunks)**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553" \
  --set-status stub --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2554,2555" --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Feature Verification Loop for each F3 ID**

**Step 3: Run F3 stub checks + build gate + F3 related test gate**

**Step 4: Promote F3 to `complete` (<=15 chunks)**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553" \
  --set-status complete --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2554,2555" --set-status complete --db porting.db --execute
```

**Step 5: Promote F3 to `verified` only if related tests are passing**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553" \
  --set-status verified --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2554,2555" --set-status verified --db porting.db --execute
```

**Step 6: Checkpoint protocol + commit**

---

### Task 5: Implement Feature Group F4 (Permissions/TLS/Websocket/MQTT/ConfigureOptions)

**Files:**

- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptions.Methods.cs`
- Modify: `dotnet/src/ZB.MOM.NatsNet.Server/ServerOptionTypes.cs` (if needed for TLS/permission parity)
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs`
- Test: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark F4 as `stub` (<=15 chunks)**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570" \
  --set-status stub --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2571,2572,2573,2574,2580" --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Feature Verification Loop for each F4 ID**

**Step 3: Run F4 stub checks + build gate + F4 related test gate**

**Step 4: Promote F4 to `complete` (<=15 chunks)**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570" \
  --set-status complete --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2571,2572,2573,2574,2580" --set-status complete --db porting.db --execute
```

**Step 5: Promote F4 to `verified` only when related tests pass**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570" \
  --set-status verified --db porting.db --execute

/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  feature batch-update --ids "2571,2572,2573,2574,2580" --set-status verified --db porting.db --execute
```

**Step 6: Checkpoint protocol + commit**

---

### Task 6: Port Test Group T1 (Options/Reload/JWT Wiring)

**Files:**

- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ServerOptionsTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConfigReloaderTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JwtProcessorTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark T1 tests as `stub`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "1832,2586,2587,2766" --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Test Verification Loop for each T1 ID**

**Step 3: Run class-level T1 gate**

```bash
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~ServerOptionsTests|FullyQualifiedName~ConfigReloaderTests|FullyQualifiedName~JwtProcessorTests" --verbosity normal
```

**Step 4: Promote T1 tests to `verified`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "1832,2586,2587,2766" --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

---

### Task 7: Port Test Group T2 (Leaf/Route/WebSocket TLS Behavior)

**Files:**

- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/LeafNodeHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/RouteHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/WebSocketHandlerTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark T2 tests as `stub`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "1918,1919,1929,1942,1950,2817,2821,3109" --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Test Verification Loop for each T2 ID**

**Step 3: Run class-level T2 gate**

```bash
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~LeafNodeHandlerTests|FullyQualifiedName~RouteHandlerTests|FullyQualifiedName~WebSocketHandlerTests" --verbosity normal
```

**Step 4: Promote T2 tests to `verified`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "1918,1919,1929,1942,1950,2817,2821,3109" --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

---

### Task 8: Port Test Group T3 (Monitoring + MQTT TLS Behavior)

**Files:**

- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.Impltests.cs`
- Modify: `dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MqttHandlerTests.Impltests.cs`
- Modify: `porting.db`

**Step 1: Mark T3 tests as `stub`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "2108,2113,2114,2115,2166,2178" --set-status stub --db porting.db --execute
```

**Step 2: Execute Per-Test Verification Loop for each T3 ID**

**Step 3: Run class-level T3 gate**

```bash
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ \
  --filter "FullyQualifiedName~MonitoringHandlerTests|FullyQualifiedName~MqttHandlerTests" --verbosity normal
```

**Step 4: Promote T3 tests to `verified`**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- \
  test batch-update --ids "2108,2113,2114,2115,2166,2178" --set-status verified --db porting.db --execute
```

**Step 5: Checkpoint protocol + commit**

---

### Task 9: Final Batch 6 Closure

**Files:**

- Modify: `porting.db`
- Optional: `reports/current.md`

**Step 1: Final verification gates**

```bash
/usr/local/share/dotnet/dotnet build dotnet/
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ --verbosity normal
/usr/local/share/dotnet/dotnet test dotnet/tests/ZB.MOM.NatsNet.Server.IntegrationTests/ --verbosity normal
```

**Step 2: Validate batch state and complete**

```bash
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- batch show 6 --db porting.db
/usr/local/share/dotnet/dotnet run --project tools/NatsNet.PortTracker -- batch complete 6 --db porting.db
```

**Step 3: Generate report**

```bash
./reports/generate-report.sh
```

**Step 4: Final checkpoint commit**

```bash
git add dotnet/src/ZB.MOM.NatsNet.Server dotnet/tests/ZB.MOM.NatsNet.Server.Tests porting.db reports/current.md
git commit -m "feat(batch6): implement opts package-level functions and mapped tests with verification evidence"
```
