Skip to content

[CI] Add ty coverage to tests#1021

Open
o-love wants to merge 5 commits intomainfrom
expand-ty-tests
Open

[CI] Add ty coverage to tests#1021
o-love wants to merge 5 commits intomainfrom
expand-ty-tests

Conversation

@o-love
Copy link
Contributor

@o-love o-love commented Feb 2, 2026

Improve test integrity by expanding ty to cover the tests directory

@o-love o-love self-assigned this Feb 2, 2026
@o-love o-love requested a review from Copilot February 2, 2026 19:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands type checking coverage by adding ty (type checker) to the tests directory. The changes modernize test code to satisfy strict type checking requirements while maintaining functional equivalence.

Changes:

  • Updated test files to use explicit type annotations and type-safe patterns
  • Replaced Pydantic model direct instantiation with model_validate() calls
  • Added runtime type assertions and casts to clarify variable types
  • Modified mock objects to satisfy type checker requirements

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/workflows/lint.yml Extended ty check to include tests directory
tests/memmachine/server/test_middleware.py Added cast for middleware type compatibility
tests/memmachine/server/api_v2/test_spec.py Replaced direct Pydantic instantiation with model_validate
tests/memmachine/server/api_v2/test_router.py Added type casts and updated model instantiation
tests/memmachine/server/api_v2/test_mcp.py Updated SearchResult instantiation
tests/memmachine/server/api_v2/test_config_service.py Replaced spec constructors with model_validate
tests/memmachine/semantic_memory/test_semantic_session_manager.py Added assertions and list conversions for async generators
tests/memmachine/semantic_memory/test_semantic_model.py Added assertion for citations field
tests/memmachine/semantic_memory/test_semantic_memory_integration.py Added cast for ResourceManager and list conversion
tests/memmachine/semantic_memory/test_semantic_llm.py Updated type annotations for mock fixtures
tests/memmachine/semantic_memory/test_semantic_ingestion.py Added SemanticCommandType enum usage and casts
tests/memmachine/semantic_memory/storage/test_semantic_storage.py Added type annotations and assertions
tests/memmachine/semantic_memory/storage/alembic_pg/test_sqlalchemy_vs_alembic.py Added string conversions and improved index handling
tests/memmachine/semantic_memory/storage/alembic_pg/test_set_id_migration.py Added assertion for module file path
tests/memmachine/semantic_memory/mock_semantic_memory_objects.py Updated type signatures to match base class
tests/memmachine/semantic_memory/conftest.py Fixed parameter name typo
tests/memmachine/rest_client/test_memory.py Added type ignore comments and casts
tests/memmachine/rest_client/test_langgraph.py Updated function call signatures
tests/memmachine/rest_client/test_config.py Updated spec instantiation
tests/memmachine/rest_client/test_client.py Added casts for session mocking
tests/memmachine/main/test_memmachine_mock.py Added properties to DummySessionData
tests/memmachine/main/test_memmachine_integration.py Added session_key property and list conversion
tests/memmachine/main/test_memachine.py Added assertions and list conversions
tests/memmachine/installation/test_memmachine_configure.py Extracted environment to local variable
tests/memmachine/installation/test_configuration_wizard.py Added assertions for optional fields
tests/memmachine/episodic_memory/test_episodic_memory_manager.py Removed unused global declaration
tests/memmachine/episodic_memory/test_episodic_memory.py Updated Episode creation with type annotation
tests/memmachine/episodic_memory/short_term_memory/test_short_term_memory.py Fixed parameter names and type annotations
tests/memmachine/episodic_memory/long_term_memory/test_long_term_memory.py Fixed metadata field names and removed duplicate parameter
tests/memmachine/episodic_memory/declarative_memory/test_declarative_memory.py Removed duplicate parameter
tests/memmachine/common/test_utils.py Added type ignore comment
tests/memmachine/common/session_manager/test_session_manager.py Removed unused global declaration
tests/memmachine/common/resource_manager/test_reranker_manager.py Implemented complete FakeEmbedder and added casts
tests/memmachine/common/resource_manager/test_database_manager.py Added casts for internal method mocking
tests/memmachine/common/language_model/test_openai_responses_language_model.py Added httpx.Request for APITimeoutError
tests/memmachine/common/language_model/test_openai_chat_completions_language_model.py Replaced mock tool call with proper factory function
tests/memmachine/common/episode_store/test_episode_storage.py Added JsonValue type and assertions
tests/memmachine/common/episode_store/test_count_caching_episode_storage.py Updated to use EpisodeEntry
tests/memmachine/common/configuration/test_semantic_conf.py Added type annotation
tests/memmachine/common/configuration/test_reranker_conf.py Simplified configuration dict structure
tests/memmachine/common/configuration/test_mixin_confs.py Added assertions for optional credentials
tests/memmachine/common/configuration/test_language_model_conf.py Added type annotations
tests/memmachine/common/configuration/test_episodic_config.py Added assertion
tests/memmachine/common/configuration/test_embedder_conf.py Simplified OpenAI embedder instantiation
tests/memmachine/common/configuration/test_configuration.py Added assertions
src/memmachine/semantic_memory/storage/storage_base.py Added backend_name class attribute

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@sscargal sscargal left a comment

Choose a reason for hiding this comment

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

Please resolve the ruff check failures for a few of the unit tests. Thanks.

@o-love o-love requested a review from sscargal February 3, 2026 17:23
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this in here?

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.

4 participants