|
| 1 | +# NAMS Phase 10 — Live Scenario Expansion — Planning and Implementation Plan |
| 2 | + |
| 3 | +**Prepared:** 2026-07-17 |
| 4 | +**Branch:** `nams/phase10-expansion` |
| 5 | +**Purpose:** Expands live-integration coverage from the earlier live-validation branch's 3 scenarios toward |
| 6 | +the engineering plan's own "mandatory scenario matrix" (§7 Phase 10). Not an attempt at all 18 matrix areas |
| 7 | +in one PR -- see §2 for what's covered elsewhere already, and §3 for what's explicitly deferred. |
| 8 | + |
| 9 | +## 1. What this adds |
| 10 | + |
| 11 | +4 new tests in `tests/AgentMemory.Tests.Integration/Nams/NamsLiveConnectivityTests.cs`, all run against the |
| 12 | +real NAMS SaaS (`agent-memory-dotnet-dev` workspace): |
| 13 | + |
| 14 | +- **`ResolveAsync_SameIdentityResolvedConcurrently_ReconcilesToOneConversation`** (matrix: Conversation -> |
| 15 | + concurrent create) -- resolves the SAME identity twice concurrently; asserts both calls agree on one |
| 16 | + conversation ID and exactly one of the two actually created it. Phase 3's `KeyedAsyncLock` reconciliation |
| 17 | + was unit-tested against a fake client; this is the first time it's proven against the real API's actual |
| 18 | + concurrent-create race behavior. |
| 19 | +- **`PersistTurnAsync_TwoConcurrentUsers_DoNotCrossContaminateChatHistory`** (matrix: Concurrency -> parallel |
| 20 | + turns, different users) -- two different identities' conversations, persisted concurrently, each recalling |
| 21 | + only its own marker text, never the other's. Deliberately scoped to the **chat-history/recent-message |
| 22 | + tier** (conversation-scoped), not entity extraction -- the `AgentMemory.Sample.NamsAgent` README already |
| 23 | + documents that NAMS's entity search is workspace-wide, not conversation-scoped, as a separate, known |
| 24 | + characteristic; this test doesn't re-litigate that, it confirms the tier that IS properly isolated. |
| 25 | +- **`RecallAsync_CancelledBeforeTheHttpRoundTripCompletes_PropagatesOperationCanceledException`** (matrix: |
| 26 | + Cancellation -> during request) -- cancels 1ms after issuing a live recall call; confirms cancellation |
| 27 | + propagates as `OperationCanceledException` against the real service, not just the fake-handler-backed unit |
| 28 | + tests. |
| 29 | +- **`PersistTurnAsync_UnicodeAndEmojiContent_RoundTripsByteForByte`** (matrix: Payload -> Unicode) -- |
| 30 | + persists Japanese text + an emoji + accented characters, confirms it recalls back byte-for-byte. |
| 31 | + |
| 32 | +## 2. Already covered elsewhere (not duplicated here) |
| 33 | + |
| 34 | +- **Identity** (missing/valid), **Conversation** (create/reuse), **Recall** (empty/normal), **Persistence** |
| 35 | + (success) -- the original 3 live tests (this session's earlier live-validation branch). |
| 36 | +- **Service failure** (401/403/404/429/500/502, malformed JSON) -- `NamsClientExceptionMapperTests.cs`, |
| 37 | + already comprehensive via HTTP-simulation (a real network call can't deterministically produce a 500 from |
| 38 | + the live service on demand; simulation is the correct tool here, not live). |
| 39 | +- **Rate limit** (retry, `Retry-After`), **Cancellation** (before request, during retry delay) -- |
| 40 | + `NamsRetryPolicyTests.cs`, HTTP-simulation. |
| 41 | +- **Observability** (expected metrics, no secrets/PII) -- Phase 9, just merged. |
| 42 | +- **Eventual consistency** (immediate absence, bounded poll, completion) -- the original 3 live tests' |
| 43 | + bounded-poll pattern, now also exercised implicitly by this PR's new tests. |
| 44 | +- **Security** (prompt injection, delimiter forgery, wrong user/workspace) -- these are properties of the |
| 45 | + MAF-layer mapping/gating logic (`NamsMafTypeMapper`, Phase 6), already unit-tested there; they're not |
| 46 | + live-NAMS-specific behavior to re-verify against the real service. |
| 47 | + |
| 48 | +## 3. Explicitly deferred |
| 49 | + |
| 50 | +- **Multi-instance mapping** (separate resolver processes, crash reconciliation) -- needs actual |
| 51 | + multi-process orchestration, a bigger investment than fits this increment. |
| 52 | +- **Session restore as an asserted integration test** (vs. the `NamsAgent` sample's informal demonstration) |
| 53 | + -- real value, but a distinct piece of work (building a live MAF-agent test harness), left for later. |
| 54 | +- **DNS/TLS failure simulation** -- not practically triggerable against a real external service on demand. |
| 55 | +- **MCP separation, Tools** -- N/A, Phase 8 not built yet (next in this session's queue). |
| 56 | +- **Data lifecycle** (conversation deletion, export) -- needs live testing of destructive operations and/or |
| 57 | + an organizational decision; `INamsClient` doesn't even expose a delete operation yet. |
| 58 | +- **Payload: empty / max size / multi-message / non-text** -- Unicode was judged the highest-value single |
| 59 | + addition for this pass; the rest are reasonable follow-ups, not done here. |
| 60 | + |
| 61 | +## 4. Verification |
| 62 | + |
| 63 | +- `dotnet build AgentMemory.slnx -c Release` -- 0 warnings, 0 errors. |
| 64 | +- `dotnet test tests/AgentMemory.Tests.Integration --filter "FullyQualifiedName~Nams.NamsLiveConnectivityTests"` |
| 65 | + -- **7/7 live, ~7s total** (3 original + 4 new). |
| 66 | +- `dotnet test tests/AgentMemory.Tests.Unit` -- full suite green, unaffected (no unit-level changes this |
| 67 | + phase). |
| 68 | + |
| 69 | +## 5. Definition of done |
| 70 | + |
| 71 | +- [x] 4 new live scenarios added and passing against the real NAMS SaaS. |
| 72 | +- [x] Coverage overlap and deferred scope explicitly documented (no silent gaps). |
| 73 | +- [ ] Self-reviewed, PR opened, CI green (live tests report Skipped there, as established), merged to `main`. |
0 commit comments