| id | 2606241814 |
|---|---|
| title | Add unit tests for lsp/rename dispatch helpers and workspace adapter methods |
| status | ✅ |
| model | sonnet |
| summary | Add TestServer_PrepareRenameAt, TestServer_RenameHeading, TestServer_RenameLinkRef, TestLspRenameWorkspace_Resolve, and "// no test by design" exemption comments for two trivial lspRenameWorkspace one-liners in internal/lsp/rename.go. |
Audit 2026-06-24 (range: 09f22d3..3d35b77) flagged test debt in internal/lsp/rename.go.
Plans 2606240212 and 2606240214 closed the gaps.
Four functions have no dedicated tests. Three are
*Server dispatch helpers; one is an adapter:
(s *Server) prepareRenameAt— dispatches on the locate result to callheadingPrepareRange,refDefPrepareRange, orrefUsePrepareRange.(s *Server) renameHeading— builds anlspRenameWorkspace, callsrename.Heading, converts the result to LSP changes.(s *Server) renameLinkRef— callsrename.LinkRef, converts the result to LSP changes.lspRenameWorkspace.Resolve— looks up a file in the open-document buffer or falls back to disk.lspRenameWorkspace.IncomingAnchorEdgesand.Files— trivial one-liner delegations that need "// no test by design" exemption comments.
Every function in internal/lsp/rename.go must
have a named unit test. Trivial one-liners need
"// no test by design" instead. See Tests doc
§"every function has a dedicated unit test"
and §"Exemptions".
- Add
TestServer_PrepareRenameAtin a new or existing*_test.goininternal/lsp/. Drive it with an in-memory server and synthetic source; cover the heading, refDef, refUse, and prose-only cases. - Add
TestServer_RenameHeadingcovering the happy path (workspace with one cross-file anchor edge) and the collision / invalid-slug error paths. - Add
TestServer_RenameLinkRefcovering the happy path and the empty-label / collision error paths. - Add
TestLspRenameWorkspace_Resolvecovering the open-document (buffer) path and the disk-fallback path. UsesafeBufferor similar for the writer. - Add "// no test by design" comments to
lspRenameWorkspace.IncomingAnchorEdgesandlspRenameWorkspace.Filesinrename.go. - Run
go test ./internal/lsp/...— green. - Run
mdsmith check .— 0 failures.
-
TestServer_PrepareRenameAtexists and passes. -
TestServer_RenameHeadingexists and passes. -
TestServer_RenameLinkRefexists and passes. -
TestLspRenameWorkspace_Resolveexists and passes. -
IncomingAnchorEdgesandFilescarry "// no test by design" comments. -
go test ./internal/lsp/...— green. -
go test ./...— green. -
mdsmith check .— 0 failures.