Skip to content

fix: audit MCP tools — bug fixes, new tools, tests & coverage#49

Open
valdo404 wants to merge 4 commits intomainfrom
fix/mcp-tools-audit
Open

fix: audit MCP tools — bug fixes, new tools, tests & coverage#49
valdo404 wants to merge 4 commits intomainfrom
fix/mcp-tools-audit

Conversation

@valdo404
Copy link
Copy Markdown
Owner

Summary

  • 10 bug fixes across 9 tool files (bounds checks, input validation, resource leaks, JSON escaping)
  • 2 new MCP tools: document_diff (closes Feat: build a get diff tool. #46) and comment_resolve
  • 30 new tests: 10 for bug fixes, 20 for RevisionTools (track changes, accept/reject, WAL persistence, undo/redo)
  • Coverage script: unified scripts/coverage.sh for .NET (coverlet) and Rust (tarpaulin)

Test plan

  • All 456 tests passing (dotnet test tests/DocxMcp.Tests/)
  • Build succeeds (dotnet build)
  • Run bash scripts/coverage.sh to verify coverage reporting

Closes #46

🤖 Generated with Claude Code

Laurent Valdes and others added 4 commits February 20, 2026 00:44
- PatchTool: RemoveColumn bounds check + empty runs cleanup after cross-run replace
- CommentTools DateTime.TryParse moved to Phase 2 commit (same file)
- HistoryTools: auto-save condition fix (3 places) + limit clamped to [1,100]
- DocumentTools: force LocalFile source type for local paths in document_save
- ElementTools: consistent EscapeJson usage in RemoveTableColumn
- ExportTools: PDF temp file leak fix in finally block
- QueryTool: [*] wildcard single element now returns pagination envelope
- CountTool: throw instead of returning JSON error for missing body
- ReadHeadingContentTool: heading_level validated to [1,9]
- ConnectionTools: page_size clamped to [1,100]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
document_diff (closes #46):
- New DiffTool.cs wrapping existing LCS-based DiffEngine
- Compare two WAL positions, or baseline vs current state
- SessionManager.GetBytesAtPosition() for read-only doc reconstruction

comment_resolve:
- Mark comments as resolved/re-opened via OOXML CommentsExPart
- CommentHelper: ResolveComment, IsCommentResolved using w15:commentEx
- comment_list now includes "resolved" field per comment
- WAL replay support (resolve_comment op)

Also includes CommentTools DateTime.TryParse fix from audit Phase 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 bug fix tests (10, distributed into existing files):
- TableModificationTests: 4 tests (RemoveColumn bounds, cross-run cleanup)
- QueryPaginationTests: 1 test (wildcard single element envelope)
- ReadHeadingContentTests: 3 tests (heading_level validation)
- UndoRedoTests: 2 tests (history limit clamping)

Phase 3 RevisionTests (20 new tests):
- track_changes_enable: enable, disable, idempotent
- revision_list: empty, insertions, filter by author/type, pagination
- revision_accept/reject: inserted/deleted runs, not found errors
- WAL persistence: accept/reject/track_changes survive restart
- Undo/Redo: accept undo, reject undo, accept undo redo

Also adds coverlet.collector for code coverage support.

Total: 456 tests passing (426 existing + 30 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: build a get diff tool.

1 participant