Add a comprehensive test suite for the Web Completion API endpoint #20677

Closed
opened 2026-02-21 20:08:25 -05:00 by yindo · 1 comment
Owner

Originally created by @jworth008 on GitHub (Nov 28, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

While contributing to the Dify project, I noticed that the Web Completion API endpoint (/web/completion-messages) - a critical endpoint responsible for text generation in completion-mode applications - lacks comprehensive unit test coverage.

The Challenge:

  • The completion API endpoint handles complex request validation with multiple parameters (inputs, query, files, response_mode, retriever_from)
  • Without proper test coverage, refactoring or bug fixes risk introducing regressions
  • The endpoint is used extensively by end-users for text generation applications
  • Current test suite has excellent coverage for many services (AppGenerateService, FeedbackService, DatasetService) but the web completion API controller is missing dedicated tests

Why This Matters:

  • The completion API is a core user-facing feature - bugs here directly impact UX
  • The endpoint has multiple code paths (blocking vs streaming, with/without files, various error scenarios)
  • Error handling for edge cases (missing parameters, invalid app modes, provider errors) needs validation
  • Following the project's TDD principles, critical API endpoints should have comprehensive test coverage

2. Additional context or comments

Benefits:

  1. Regression Prevention: Catch bugs before they reach production
  2. Refactoring Confidence: Enable safe code improvements
  3. Documentation: Tests serve as living documentation of expected API behavior
  4. Consistency: Aligns with existing test coverage standards in the project
  5. CI/CD Ready: Fast, isolated tests perfect for automated pipelines

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @jworth008 on GitHub (Nov 28, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. While contributing to the Dify project, I noticed that the **Web Completion API endpoint** (`/web/completion-messages`) - a critical endpoint responsible for text generation in completion-mode applications - lacks comprehensive unit test coverage. **The Challenge:** - The completion API endpoint handles complex request validation with multiple parameters (inputs, query, files, response_mode, retriever_from) - Without proper test coverage, refactoring or bug fixes risk introducing regressions - The endpoint is used extensively by end-users for text generation applications - Current test suite has excellent coverage for many services (AppGenerateService, FeedbackService, DatasetService) but the web completion API controller is missing dedicated tests **Why This Matters:** - The completion API is a core user-facing feature - bugs here directly impact UX - The endpoint has multiple code paths (blocking vs streaming, with/without files, various error scenarios) - Error handling for edge cases (missing parameters, invalid app modes, provider errors) needs validation - Following the project's TDD principles, critical API endpoints should have comprehensive test coverage ### 2. Additional context or comments **Benefits:** 1. **Regression Prevention**: Catch bugs before they reach production 2. **Refactoring Confidence**: Enable safe code improvements 3. **Documentation**: Tests serve as living documentation of expected API behavior 4. **Consistency**: Aligns with existing test coverage standards in the project 5. **CI/CD Ready**: Fast, isolated tests perfect for automated pipelines ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 20:08:25 -05:00
yindo closed this issue 2026-02-21 20:08:25 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 29, 2025):

Hi, @hsparks-codes. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding a comprehensive test suite for the Web Completion API endpoint (/web/completion-messages).
  • Highlighted the absence of dedicated unit tests for this important user-facing feature.
  • Emphasized the need for thorough testing to prevent regressions, ensure robust error handling, and support safe refactoring.
  • Offered to contribute to implementing these tests.
  • No further activity or comments have been made on this issue.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of Dify by commenting here.
  • If I don’t hear back within 15 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Dec 29, 2025): Hi, @hsparks-codes. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding a comprehensive test suite for the Web Completion API endpoint (/web/completion-messages). - Highlighted the absence of dedicated unit tests for this important user-facing feature. - Emphasized the need for thorough testing to prevent regressions, ensure robust error handling, and support safe refactoring. - Offered to contribute to implementing these tests. - No further activity or comments have been made on this issue. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of Dify by commenting here. - If I don’t hear back within 15 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20677