feat: implement NOOP command handling and state tracking#7
Merged
Aravinda-HWK merged 1 commit intomainfrom Oct 3, 2025
Merged
Conversation
- Added handleNoop function to manage NOOP command responses based on client state. - Updated ClientState struct to track last message and recent counts. - Enhanced CI workflow to include specific tests for NOOP command. - Created comprehensive tests for NOOP command scenarios, including authenticated and unauthenticated states.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements the NOOP command handling and state tracking for an IMAP server implementation, allowing clients to check for mailbox updates and maintain connection activity.
- Adds complete NOOP command handler with proper RFC 3501 compliance
- Introduces mailbox state tracking fields to monitor message counts and recent messages
- Creates comprehensive test suite covering all NOOP command scenarios and edge cases
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/server/noop_test.go | Comprehensive test suite for NOOP command with 355 lines covering authentication states, response formats, concurrency, and RFC compliance |
| internal/server/testing.go | Exposes HandleNoop method for testing |
| internal/server/handlers.go | Implements complete handleNoop function with mailbox state checking and untagged response generation |
| internal/server/fetch.go | Initializes state tracking fields during SELECT command |
| internal/server/connection.go | Updates NOOP command routing to use new handler instead of simple response |
| internal/models/state.go | Adds LastMessageCount and LastRecentCount fields to ClientState struct |
| Makefile | Adds NOOP-specific test targets and improves help documentation |
| .github/workflows/ci.yml | Updates CI workflow to include NOOP command tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Aravinda-HWK
added a commit
that referenced
this pull request
Oct 11, 2025
- Added handleNoop function to manage NOOP command responses based on client state. - Updated ClientState struct to track last message and recent counts. - Enhanced CI workflow to include specific tests for NOOP command. - Created comprehensive tests for NOOP command scenarios, including authenticated and unauthenticated states.
Aravinda-HWK
added a commit
that referenced
this pull request
Oct 11, 2025
* fix: revert Go version to 1.25 in go.mod * feat: add Dockerfile for building and running the IMAP server * refactor: improve database initialization and handling of sample emails * refactor: clarify comments and update build command in Dockerfile * feat: implement new SQLite IMAP server with simplified connection handling * feat: add SQLite database initialization with sample data insertion * feat: add ClientState struct for managing IMAP client state * feat: implement client handling logic for IMAP server connections * feat: implement IMAP server fetch, select, search, and status handling * feat: implement IMAP server handlers for capability, login, list, logout, and UID commands * feat: add STARTTLS support to IMAP server and update capabilities * feat: enhance login handling with external authentication and improved error responses * feat: update login handling to use email instead of username * fix: update database path in IMAP server initialization * fix: update login response to reflect username usage instead of email * refactor: remove test mail insertion logic from InitDB function * refactor: remove unused imports from sqlite.go * feat: implement IDLE command for real-time mailbox updates * feat: add configuration loading from YAML file * feat: load email domain from configuration file in handleLogin * feat: add YAML dependency for configuration management * feat: load TLS certificate paths from configuration file * fix: expose both IMAP and secure IMAP ports in Dockerfile * feat: implement SSL connection handling for IMAP server * feat: enhance FETCH command response with additional attributes * feat: add support for sequence ranges in FETCH command * feat: enhance response logging to mask full message bodies * feat: enhance UID FETCH command to support BODY.PEEK[] in response * docs: update README to clarify server implementation and usage instructions * fix: enable CGO in Dockerfile for proper SQLite support * feat: add issue and pull request templates for better contribution guidelines * fix: update issue template contact links for clarity and completeness * fix: correct about text for Discussions link in issue template * fix: remove obsolete issue template configuration file * Add security policy documentation * feat: add security policy and PGP public key documentation * fix: update PGP public key link in security policy documentation * Delete .github/SECURITY.md * fix: correct PGP public key link in security policy documentation * feat: add initial README documentation for Silver Go IMAP Server * fix: remove unnecessary quotes from issue template fields in YAML files * fix: add quotes around title in issue template YAML files * feat: add contributing guidelines to the documentation * Include Apache License 2.0 Added Apache License 2.0 to the project. * Add LICENSE file * Add Contributor Covenant Code of Conduct This document outlines the Contributor Covenant Code of Conduct, establishing guidelines for community behavior, enforcement responsibilities, and consequences for violations. * feat: add GitHub Actions workflow for publishing Docker images * feat: add GitHub Actions workflow for publishing Docker images * fix: update Docker image name in workflow and clarify permissions * fix: update Docker image name to a specific repository in workflow * fix: update Docker image name to match the correct repository * fix: update workflow to trigger on release branch and use GITHUB_REF_NAME for versioning * fix: update workflow to trigger on main branch instead of release * 1 feature separate imap server into standalone service (#2) * fix: improve pull request template formatting and clarity * fix: remove indirect comments from go.mod and add missing dependency in go.sum * fix: update Docker run command in README for improved clarity and functionality * fix: refactor LoadConfig to handle multiple paths and improve error logging * feat: add .gitignore to exclude configuration and data directories * feat: add GitHub Actions workflow for publishing Docker images on release * docs: update README for improved clarity and structure * fix: update TLS certificate paths to use static locations instead of config * Update .github/pull_request_template.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update internal/server/handlers.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add CI workflow for testing and building application This CI workflow includes jobs for testing, linting, security scanning, building the application, and running integration tests. * Simplify CI workflow by removing redundant steps Removed various steps related to formatting, testing, coverage, linting, security scanning, and integration testing from the CI workflow. * 4 task write test for capabilities command (#5) * feat: enhance IMAP server capabilities and add authentication handling * feat: add Makefile for Go IMAP server testing with various test targets * fix: add certs directory to .gitignore * feat: implement comprehensive testing for IMAP server capabilities and handlers * feat: add CI workflow for automated testing of Go code * Modify CI to run capability tests only Updated CI workflow to run capability tests instead of all tests. * Change capability test command to use make * fix: update capability test command to include GOFLAGS * refactor: simplify capability test commands by removing GOFLAGS and adding exact token matching * feat: implement NOOP command handling and state tracking (#7) - Added handleNoop function to manage NOOP command responses based on client state. - Updated ClientState struct to track last message and recent counts. - Enhanced CI workflow to include specific tests for NOOP command. - Created comprehensive tests for NOOP command scenarios, including authenticated and unauthenticated states. * feat: add LOGOUT command handling and tests (#8) * feat: implement APPEND command handling and tests (#10) * feat: enhance user table management and metadata tracking in database (#12) * feat: implement AUTHENTICATE command handling with base64 support and tests (#10) (#14) - Added AUTHENTICATE command handling in handlers.go with support for PLAIN mechanism. - Implemented base64 encoding/decoding for credentials. - Added tests for AUTHENTICATE command in authenticate_test.go covering various scenarios including TLS checks, case insensitivity, and malformed data. - Updated Makefile and README.md to include new test commands and descriptions. - Enhanced CI workflow to include tests for AUTHENTICATE command. * 13 bug mails are not visible in apple mail mua (#15) * feat: implement AUTHENTICATE command handling with base64 support and tests (#10) - Added AUTHENTICATE command handling in handlers.go with support for PLAIN mechanism. - Implemented base64 encoding/decoding for credentials. - Added tests for AUTHENTICATE command in authenticate_test.go covering various scenarios including TLS checks, case insensitivity, and malformed data. - Updated Makefile and README.md to include new test commands and descriptions. - Enhanced CI workflow to include tests for AUTHENTICATE command. * feat: enhance UID handling for FETCH and STORE commands with support for comma-separated sequences * 13 bug mails are not visible in apple mail mua (#16) * feat: implement AUTHENTICATE command handling with base64 support and tests (#10) - Added AUTHENTICATE command handling in handlers.go with support for PLAIN mechanism. - Implemented base64 encoding/decoding for credentials. - Added tests for AUTHENTICATE command in authenticate_test.go covering various scenarios including TLS checks, case insensitivity, and malformed data. - Updated Makefile and README.md to include new test commands and descriptions. - Enhanced CI workflow to include tests for AUTHENTICATE command. * feat: enhance UID handling for FETCH and STORE commands with support for comma-separated sequences * feat: optimize BODY.PEEK and BODY response handling in UID FETCH command * 13 bug mails are not visible in apple mail mua (#17) * feat: implement AUTHENTICATE command handling with base64 support and tests (#10) - Added AUTHENTICATE command handling in handlers.go with support for PLAIN mechanism. - Implemented base64 encoding/decoding for credentials. - Added tests for AUTHENTICATE command in authenticate_test.go covering various scenarios including TLS checks, case insensitivity, and malformed data. - Updated Makefile and README.md to include new test commands and descriptions. - Enhanced CI workflow to include tests for AUTHENTICATE command. * feat: enhance UID handling for FETCH and STORE commands with support for comma-separated sequences * feat: optimize BODY.PEEK and BODY response handling in UID FETCH command * feat: enhance BODY.PEEK handling to support specific header fields extraction * Update feature.yaml for feature request template * Fix bug report title formatting (#19) * Fix bug report title formatting * fix: update task title formatting by adding a space * Implement STARTTLS command handling and associated tests (#22) * Refactor authentication responses to comply with RFC 3501, changing BAD to NO for failures and enhancing response messages for clarity. Add tests for authentication cancellation and response formats. (#23) * Add LOGIN command handling and tests, enforcing TLS requirement per RFC 3501 (#24) * Enhance FETCH command handling to support additional header formats and improve body retrieval logic. Update response formatting for RFC822 and BODY commands. (#26) * 25 bug mails can not be read from thunderbird (#27) * Enhance FETCH command handling to support additional header formats and improve body retrieval logic. Update response formatting for RFC822 and BODY commands. * Refactor FETCH and UID FETCH command handling to separate literal data storage and improve response formatting for header fields. Ensure compliance with requested formats. * 25 bug mails can not be read from thunderbird (#28) * Enhance FETCH command handling to support additional header formats and improve body retrieval logic. Update response formatting for RFC822 and BODY commands. * Refactor FETCH and UID FETCH command handling to separate literal data storage and improve response formatting for header fields. Ensure compliance with requested formats. * Implement code changes to enhance functionality and improve performance * 25 bug mails can not be read from thunderbird (#29) * Enhance FETCH command handling to support additional header formats and improve body retrieval logic. Update response formatting for RFC822 and BODY commands. * Refactor FETCH and UID FETCH command handling to separate literal data storage and improve response formatting for header fields. Ensure compliance with requested formats. * Implement code changes to enhance functionality and improve performance * Add LSUB command handling to return subscribed folders * 25 bug mails can not be read from thunderbird (#30) * Enhance FETCH command handling to support additional header formats and improve body retrieval logic. Update response formatting for RFC822 and BODY commands. * Refactor FETCH and UID FETCH command handling to separate literal data storage and improve response formatting for header fields. Ensure compliance with requested formats. * Implement code changes to enhance functionality and improve performance * Add LSUB command handling to return subscribed folders * Enhance date formatting in handleFetch and update capabilities in authenticateUser * 31 task check the select functionality and write the test cases for that (#32) * Add SELECT and EXAMINE command handling with tests for unseen messages * Implement EXAMINE command handling and tests for RFC 3501 compliance * 33 task implement create command and write the test cases for that (#34) * refactor: update project references from Silver Go IMAP to Kestrel * feat: implement CREATE command for mailbox management and add related tests * fix: update references from Kestrel to Raven in documentation and configuration * fix: ensure CI workflow triggers on push to main branch * 35 task implement the delete command and write the tes cases for that (#36) * task remove push trigger from CI workflow * feat: implement DELETE command functionality with tests * refactor: clean up pull request template by removing unnecessary lines * Update internal/db/sqlite.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * task implement RENAME command and add corresponding test cases (#38) * Document configuration file and its fields Added configuration file section with example and field descriptions. * task implement SUBSCRIBE and UNSUBSCRIBE commands with corresponding database support and tests (#41) * task implement unsubscribe command with validation checks and corresponding test cases (#42) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
This PR is for implementing the "NOOP" command and the test cases for test it.
🔍 Changes Made
Added handleNoop function to manage NOOP command responses based on client state.
Updated ClientState struct to track last message and recent counts.
Enhanced CI workflow to include specific tests for the NOOP command.
Created comprehensive tests for NOOP command scenarios, including authenticated and unauthenticated states.
✅ Checklist (Email System)
LOGIN,CAPABILITY,LIST,SELECT,FETCH,LOGOUT).🧪 Testing Instructions
You can read the README.md file in the test folder to run the test files.
📷 Screenshots / Logs (if applicable)
N/A
N/A