From 485c7b0c2e359f588164db5218e0f63a8ed0d380 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 27 Feb 2026 05:34:31 -0500 Subject: [PATCH] docs: add unit test audit extension design --- .../2026-02-27-unit-test-audit-design.md | 63 +++++++++++++++++++ reports/current.md | 2 +- reports/report_9e2d763.md | 37 +++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 docs/plans/2026-02-27-unit-test-audit-design.md create mode 100644 reports/report_9e2d763.md diff --git a/docs/plans/2026-02-27-unit-test-audit-design.md b/docs/plans/2026-02-27-unit-test-audit-design.md new file mode 100644 index 0000000..074e2dc --- /dev/null +++ b/docs/plans/2026-02-27-unit-test-audit-design.md @@ -0,0 +1,63 @@ +# Unit Test Audit Extension Design + +## Goal + +Extend the PortTracker `audit` command to classify unit tests (not just features) by inspecting .NET test source code with Roslyn. + +## Architecture + +Parameterize the existing audit pipeline (`AuditCommand` + `SourceIndexer` + `FeatureClassifier`) to support both `features` and `unit_tests` tables. No new files — the same indexer and classifier logic applies to test methods. + +## CLI Interface + +``` +dotnet run -- audit --type features|tests|all [--source ] [--module ] [--execute] +``` + +| Flag | Default (features) | Default (tests) | +|------|-------------------|-----------------| +| `--type` | `features` | — | +| `--source` | `dotnet/src/ZB.MOM.NatsNet.Server` | `dotnet/tests/ZB.MOM.NatsNet.Server.Tests` | +| `--output` | `reports/audit-results.csv` | `reports/audit-results-tests.csv` | + +- `--type all` runs both sequentially. +- `--source` override works for either type. + +## Changes Required + +### AuditCommand.cs + +1. Add `--type` option with values `features`, `tests`, `all`. +2. Thread an `AuditTarget` (table name + default source + default output + display label) through `RunAudit` and `ApplyUpdates`. +3. `--type all` calls `RunAudit` twice with different targets. +4. `ApplyUpdates` uses the target's table name in UPDATE SQL. + +### FeatureClassifier.cs + +No changes. Same N/A lookup and classification logic applies to unit tests. + +### SourceIndexer.cs + +No changes. Already generic — just pass a different directory path. + +## Pre-audit DB Reset + +Before running the test audit, manually reset deferred tests to `unknown`: + +```sql +sqlite3 porting.db "UPDATE unit_tests SET status = 'unknown' WHERE status = 'deferred';" +``` + +## Execution Sequence + +1. Reset deferred tests: `sqlite3 porting.db "UPDATE unit_tests SET status = 'unknown' WHERE status = 'deferred';"` +2. Run audit: `dotnet run -- audit --type tests --db porting.db --execute` +3. Verify results and generate report. + +## Classification Behavior for Tests + +Same priority as features: +1. **N/A**: Go method matches logging/signal patterns → `n_a` +2. **Method found**: Test class + method exists in test project → `verified` or `stub` +3. **Class exists, method missing**: → `deferred` ("method not found") +4. **Class not found**: → `deferred` ("class not found") diff --git a/reports/current.md b/reports/current.md index 188e0ac..0dddfe2 100644 --- a/reports/current.md +++ b/reports/current.md @@ -1,6 +1,6 @@ # NATS .NET Porting Status Report -Generated: 2026-02-27 10:27:48 UTC +Generated: 2026-02-27 10:34:31 UTC ## Modules (12 total) diff --git a/reports/report_9e2d763.md b/reports/report_9e2d763.md new file mode 100644 index 0000000..0dddfe2 --- /dev/null +++ b/reports/report_9e2d763.md @@ -0,0 +1,37 @@ +# NATS .NET Porting Status Report + +Generated: 2026-02-27 10:34:31 UTC + +## Modules (12 total) + +| Status | Count | +|--------|-------| +| verified | 12 | + +## Features (3673 total) + +| Status | Count | +|--------|-------| +| deferred | 2500 | +| n_a | 18 | +| stub | 168 | +| verified | 987 | + +## Unit Tests (3257 total) + +| Status | Count | +|--------|-------| +| deferred | 2680 | +| n_a | 187 | +| verified | 390 | + +## Library Mappings (36 total) + +| Status | Count | +|--------|-------| +| mapped | 36 | + + +## Overall Progress + +**1594/6942 items complete (23.0%)**