Skip to content

Commit 4a2a859

Browse files
committed
fix: self-review findings from Phase 10a branch (test naming, stale doc comment)
- Renamed the multi-message test to stop claiming order verification it can't actually prove (PersistedMessageIds has no content/role correlation); documented what it does verify. - Fixed INamsClient's top-of-interface doc comment, stale since Phase 9 and now doubly wrong: it still said "4 operations" and called SearchMessagesAsync "dropped" even though this branch is exactly the trigger that comment named for adding it. Re-verified: 11/11 live tests still green, full unit suite green.
1 parent af0dd20 commit 4a2a859

3 files changed

Lines changed: 33 additions & 9 deletions

File tree

docs/reviews/NAMS_Phase10a_SearchMessagesAndPayloadTests_PlanningAndImplementationPlan.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,36 @@ test's assertions, rather than assuming what "should" happen:
4040
"non-text" payload category, interpreted as structured/code-like text (there's no binary/attachment
4141
concept anywhere in `NamsMessageToPersist`, so "non-text" can't mean literal binary).
4242

43-
## 3. Verification
43+
## 3. Self-review findings and fixes
44+
45+
2 parallel reviewers (correctness/test-soundness + combined cross-file/conventions):
46+
47+
- **Test over-claiming its name** (correctness angle): `PersistTurnAsync_MultipleMessagesInOneTurn_PersistsAllInOrder`
48+
asserted only a bare count (4 IDs), never actually verifying order -- `NamsPersistenceResult.PersistedMessageIds`
49+
has no content/role correlation, and NAMS's own bulk-response ordering guarantee (if any) isn't independently
50+
confirmed, so nothing in this test could prove ordering even if it tried. Renamed to
51+
`...PersistsAllFour` and added a doc comment stating exactly what is and isn't proven, rather than building a
52+
shakier ordering-verification mechanism to match an overclaimed name.
53+
- **Stale interface doc comment** (cross-file angle): `INamsClient.cs`'s top-of-interface comment still said
54+
"covers only the 4 operations" and called `SearchMessagesAsync` "dropped" -- both wrong after this branch
55+
(and already wrong before it, post-Phase-9's `ListEntitiesAsync`). This branch is exactly the "add it once
56+
verified live" trigger that comment itself named, so fixed it here rather than leaving it stale again.
57+
58+
Re-verified after fixes: 11/11 live tests still green.
59+
60+
## 4. Verification
4461

4562
- `dotnet build AgentMemory.slnx -c Release` -- 0 warnings, 0 errors.
4663
- `dotnet test tests/AgentMemory.Tests.Unit` -- full suite green, +1 new unit test (`SearchMessagesAsync`
4764
client test) plus 5 test-fake updates (every `INamsClient` implementer needed the new method).
4865
- `dotnet test tests/AgentMemory.Tests.Integration --filter "...NamsLiveConnectivityTests"` -- **11/11 live**
4966
(7 previous + 4 new), ~7s total, against the real NAMS SaaS.
5067

51-
## 4. Definition of done
68+
## 5. Definition of done
5269

5370
- [x] `SearchMessagesAsync` added to `INamsClient`/`Neo4jNamsClientAdapter`, instrumented (Phase 9 metrics,
5471
operation name `search_messages` matching the plan's own span-name anticipation), unit tested.
5572
- [x] 4 payload edge-case live tests added, each verified against real live behavior first.
5673
- [x] Full unit + live suites green.
57-
- [ ] Self-reviewed, PR opened, CI green, merged to `main`.
74+
- [x] Self-reviewed and fixes applied.
75+
- [ ] PR opened, CI green, merged to `main`.

src/AgentMemory.Nams/Client/INamsClient.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ namespace AgentMemory.Nams.Client;
77
/// NAMS SDK type directly -- everything crossing that boundary is contained inside <c>AgentMemory.Nams</c> behind
88
/// this interface (engineering plan §7 Phase 2, "Rule").
99
///
10-
/// Deliberately covers only the 4 operations confirmed against the pinned OpenAPI snapshot
11-
/// (<c>docs/reviews/nams-openapi-snapshot-2026-07-17.json</c>). A 5th method the engineering plan's own example
12-
/// included -- <c>SearchMessagesAsync</c> -- is dropped: the plan's own text already flags it as unconfirmed (no
13-
/// distinct search/query REST operation is documented), and building against a guessed endpoint shape would be
14-
/// worse than not building it. Add it once verified against a live sandbox (<c>strategy/NAMS/Neo4j_Questions.md</c>).
10+
/// Started (Phase 2) with only the 4 operations confirmed against the pinned OpenAPI snapshot
11+
/// (<c>docs/reviews/nams-openapi-snapshot-2026-07-17.json</c>); a 5th method the plan's own example included --
12+
/// <c>SearchMessagesAsync</c> -- was deliberately dropped at the time as unconfirmed. Both that method and
13+
/// <see cref="ListEntitiesAsync"/> (Phase 9) have since been confirmed against the live NAMS SaaS and added --
14+
/// see each method's own doc comment for when/why.
1515
/// </summary>
1616
internal interface INamsClient
1717
{

tests/AgentMemory.Tests.Integration/Nams/NamsLiveConnectivityTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,14 @@ public async Task PersistTurnAsync_LargeMessage_PersistsSuccessfully_AndEventual
274274
found.Should().BeTrue("a 5,000-character message (within the default recall budget) should round-trip through NAMS");
275275
}
276276

277+
/// <summary>
278+
/// Deliberately does NOT assert message ordering -- <see cref="NamsPersistenceResult.PersistedMessageIds"/>
279+
/// is a bare <c>IReadOnlyList&lt;string&gt;</c> with no content/role correlation, and NAMS's own bulk-add
280+
/// response ordering guarantee (if any) isn't independently confirmed, so this can only prove all 4
281+
/// messages in one turn reach NAMS via the one bulk call, not that they arrive in submission order.
282+
/// </summary>
277283
[LiveNamsFact]
278-
public async Task PersistTurnAsync_MultipleMessagesInOneTurn_PersistsAllInOrder()
284+
public async Task PersistTurnAsync_MultipleMessagesInOneTurn_PersistsAllFour()
279285
{
280286
var services = _fixture.Services!;
281287
var resolver = services.GetRequiredService<INamsConversationResolver>();

0 commit comments

Comments
 (0)