Skip to content

fix: 增加Deepwiki 的一次性链接模式#28

Merged
Alexzjt merged 3 commits into
mainfrom
fix/deepwiki0413
Apr 27, 2026
Merged

fix: 增加Deepwiki 的一次性链接模式#28
Alexzjt merged 3 commits into
mainfrom
fix/deepwiki0413

Conversation

@Alexzjt

@Alexzjt Alexzjt commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the DeepWiki MCP connection logic to support both persistent ('keep-alive') and one-time ('close-after-query') connection modes. It introduces modular helper functions for managing MCP connections and adds comprehensive integration tests for the query functions and repository name mapping. The review feedback highlights two important reliability issues: a potential resource leak in the connection closing logic where the transport might not be closed if the client is null, and a race condition in the global connection teardown that could leave a connection open if it is still being established when the close command is issued.

Comment thread src/utils/deepwiki.ts
Comment thread src/utils/deepwiki.ts
@Alexzjt

Alexzjt commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the DeepWiki MCP connection management to support both persistent and transient connection modes, introducing helper functions for connection lifecycle management. The test suite is also expanded to cover repository name mapping and error handling. Key feedback includes ensuring thorough resource cleanup by explicitly closing the transport even if the client fails to close, adopting standard MCP error handling for tool calls by checking the isError property, and refining test assertions for better validation of failure states.

Comment thread src/utils/deepwiki.ts
Comment thread src/utils/deepwiki.ts
Comment thread __tests__/utils/deepwiki.test.ts Outdated
Comment on lines +88 to +90
expect(
result.documentation === null || typeof result.error === 'string',
).toBe(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这里的测试断言逻辑较为宽松(使用了 ||)。根据 adaptedQueryDeepWiki 的实现,失败时应返回 { documentation: null, error: string }。建议改为更精确的断言,例如分别检查 documentation 是否为 null 以及 error 是否为字符串,以增强测试的有效性。

    expect(result.documentation).toBeNull();
    expect(typeof result.error).toBe('string');

@Alexzjt Alexzjt merged commit 477e8c8 into main Apr 27, 2026
1 check passed
@Alexzjt Alexzjt deleted the fix/deepwiki0413 branch April 27, 2026 03:16
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.

1 participant