fix(tests): repair stale mock.patch targets after service refactors #2

Merged
r merged 1 commits from fix/stale-test-patch-targets into main 2026-06-18 02:01:25 +00:00
Owner

Several library tests patched symbols at import paths that no longer
expose them, so they errored (AttributeError) instead of testing anything
— giving false confidence. The underlying code is correct; only the test
patch targets were stale after earlier refactors moved imports
function-local.

  • test_pipeline: patch source modules (library.models.Item,
    llm_manager.models.LLMModel, library.services.parsers.DocumentParser,
    .chunker.ContentTypeChunker, .embedding_client.EmbeddingClient,
    .vision.VisionAnalyzer, .concepts.ConceptExtractor) since pipeline.py
    imports them inside methods. default_storage stays (still module-level).
  • test_search_api: patch library.services.search.SearchService (the view
    imports it function-local).
  • test_tasks: patch library.services.pipeline.EmbeddingPipeline (tasks.py
    imports it function-local).
  • test_search_views_admin_scope: patch library.utils.neo4j_available; the
    guard moved to utils when views._all_library_uids became a thin alias.
  • test_concepts: remove SampleIndexSelectionTests — _select_sample_indices
    was deleted in the document-level concept-extraction refactor (dead test).

Not addressed here: SearchAPIAuthTest / SearchAPIValidationTest return 302
instead of 401/400. Static analysis ruled out routing, middleware, and DRF
config; reproducing needs a running server (DB-backed). Flagged for sandbox
diagnosis — not a stale-patch issue.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Several library tests patched symbols at import paths that no longer expose them, so they errored (AttributeError) instead of testing anything — giving false confidence. The underlying code is correct; only the test patch targets were stale after earlier refactors moved imports function-local. - test_pipeline: patch source modules (library.models.Item, llm_manager.models.LLMModel, library.services.parsers.DocumentParser, .chunker.ContentTypeChunker, .embedding_client.EmbeddingClient, .vision.VisionAnalyzer, .concepts.ConceptExtractor) since pipeline.py imports them inside methods. default_storage stays (still module-level). - test_search_api: patch library.services.search.SearchService (the view imports it function-local). - test_tasks: patch library.services.pipeline.EmbeddingPipeline (tasks.py imports it function-local). - test_search_views_admin_scope: patch library.utils.neo4j_available; the guard moved to utils when views._all_library_uids became a thin alias. - test_concepts: remove SampleIndexSelectionTests — _select_sample_indices was deleted in the document-level concept-extraction refactor (dead test). Not addressed here: SearchAPIAuthTest / SearchAPIValidationTest return 302 instead of 401/400. Static analysis ruled out routing, middleware, and DRF config; reproducing needs a running server (DB-backed). Flagged for sandbox diagnosis — not a stale-patch issue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
r added 1 commit 2026-06-18 02:01:07 +00:00
fix(tests): repair stale mock.patch targets after service refactors
All checks were successful
CVE Scan & Docker Build / security-scan (pull_request) Successful in 5m24s
CVE Scan & Docker Build / build-and-push (pull_request) Successful in 2m58s
539d9b6c34
Several library tests patched symbols at import paths that no longer
expose them, so they errored (AttributeError) instead of testing anything
— giving false confidence. The underlying code is correct; only the test
patch targets were stale after earlier refactors moved imports
function-local.

- test_pipeline: patch source modules (library.models.Item,
  llm_manager.models.LLMModel, library.services.parsers.DocumentParser,
  .chunker.ContentTypeChunker, .embedding_client.EmbeddingClient,
  .vision.VisionAnalyzer, .concepts.ConceptExtractor) since pipeline.py
  imports them inside methods. default_storage stays (still module-level).
- test_search_api: patch library.services.search.SearchService (the view
  imports it function-local).
- test_tasks: patch library.services.pipeline.EmbeddingPipeline (tasks.py
  imports it function-local).
- test_search_views_admin_scope: patch library.utils.neo4j_available; the
  guard moved to utils when views._all_library_uids became a thin alias.
- test_concepts: remove SampleIndexSelectionTests — _select_sample_indices
  was deleted in the document-level concept-extraction refactor (dead test).

Not addressed here: SearchAPIAuthTest / SearchAPIValidationTest return 302
instead of 401/400. Static analysis ruled out routing, middleware, and DRF
config; reproducing needs a running server (DB-backed). Flagged for sandbox
diagnosis — not a stale-patch issue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
r merged commit 70b1fc510b into main 2026-06-18 02:01:25 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: r/mnemosyne#2