Repository navigation
Conversation
…cord A stored record that fails the schema is skipped on read and written back verbatim on every save (#4885). Pin the consequence through the protocol: the read tools do not show it, the delete tools report it as not found, the add tools refuse it as missing, create_entities under its name stores a second record beside it, and an invalid relation record matches no delete_relations call and outlives the entities it names. Closes #5541 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 9 | 0 | 1 | 0 |
| Head | 9 | 0 | 1 | 0 |
Updated by this run for fb2dae753cb772dbba8840fd9e9dbdafd2b0ce55.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for this test-only change.
No open issues 🎉
What changed in this PR
Adds characterization tests for #5541, documenting through assertions that schema-invalid records preserved by #4885 cannot be removed or repaired through the memory server’s existing tools. No production behavior changes.
Changes:
- Adds eight protocol-level cases covering all nine tools through an SDK client.
- Checks tool responses and exact file contents, including same-name entity creation and cascading deletion.
- Uses isolated temporary files and suppresses expected error logs.
| File | Description |
|---|---|
src/memory/__tests__/invalid-record-removal.test.ts |
Pins invalid records’ invisibility to tools and preservation across writes. |
Review effort: Balanced
|
Copilot round 1: clean. The review reported no findings and no suppressed comments, so the loop ends here on the first clean round. Nothing was pushed after |
Closes #5541
Description
Adds one test file,
src/memory/__tests__/invalid-record-removal.test.ts, that pins what a stored record failing the schema costs once it is in the memory file. #4885 made the server skip such a line on read and write it back verbatim on every save;persistence.test.tsandknowledge-graph.test.tsalready pin those two facts, and only for acreate_entitieswrite. Nothing pinned the consequence: the record is out of every tool's reach.Eight cases, each driven through an SDK
Clientover the in-memory transport and asserting on the tool result and the file's exact bytes, from a file seeded with two valid entities, one valid relation, an entity record with noentityTypeand a relation record with norelationType:read_graph,search_nodes,open_nodesdelete_entitiesDeleted 0 of 1 entities. Not found: Broken; the line survives it and a later unrelated writedelete_observationsDeleted 0 of 1 observations. Entities not found: Broken; file unchangedadd_observationsEntity with name Broken not found; file unchangedcreate_relationsEntity with name Broken not found; file unchangedcreate_entitiesdelete_relationsrelationTypeis an input validation error) and matches no calldelete_entities(cascade)The issue proposed a single case calling
KnowledgeGraphManagerdirectly, added toknowledge-graph.test.ts. This differs in two ways, on purpose:delete_entitiesalone. That turned up thecreate_entitiesbehavior above, which the issue did not describe.The tests take no position on whether a remediation tool should exist. They state today's contract, and a change that adds one changes these assertions visibly.
Server Details
Motivation and Context
#5541. The preservation behavior from #4885 is deliberate; its consequence was unpinned and undocumented. The README's silence on it is filed separately as #5609 rather than widened into this PR.
How Has This Been Tested?
No client-observable surface changes, so this carries a targeted probe rather than client evidence.
npm test -w src/memory -- __tests__/invalid-record-removal.test.ts: 8 passed.saveGraphchanged to drop the unreadable lines instead of writing them back (the pre-memory: unreadable lines are deleted by the next write (regression from #4717, unreleased) #4885 behavior, and what any tool that removed them would look like on disk), 5 of the 8 cases fail: every case in which a save happens. The 3 that still pass are the ones in which nothing is written (the read tools, and the two add tools that throw before saving). The change was reverted;src/memory/index.tsis untouched in this PR.npm run local:gateexited 0, including the memory coverage stage and the interface diff ("No interface changes detected", 9 tools and 1 resource on both sides).Breaking Changes
None.
Types of changes
None of the four: a test-only chore.
Checklist
npm run changeset) if this changes what a TypeScript server publishes (not applicable: nothing published changes)Additional context
The test file opens with a purpose header giving the reasoning for the protocol-level harness. It uses
__tests__/helpers.tsunchanged and an OS temp directory per test.🤖 Generated with Claude Code