Skip to content

fix(pgvector): resolve F401 unused import for psycopg - #366

Merged
himanshu231204 merged 1 commit into
OpenAgentHQ:mainfrom
devhub02:fix/pgvector-f401-unused-import
Sep 2, 2026
Merged

fix(pgvector): resolve F401 unused import for psycopg#366
himanshu231204 merged 1 commit into
OpenAgentHQ:mainfrom
devhub02:fix/pgvector-f401-unused-import

Conversation

@devhub02

@devhub02 devhub02 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes F401 lint error in pgvector.py where psycopg was imported but unused.

Changes

  • Replace direct import psycopg with importlib.util.find_spec("psycopg") check (ruff's recommended approach for F401)
  • Add ValueError handling for mocked modules in tests (where psycopg is patched into sys.modules)

Testing

  • ruff check openagent_eval/providers/retrievers/pgvector.py - All checks pass
  • pytest tests/unit/test_providers/test_pgvector_retriever.py -v - All 4 tests pass

Related

Fixes #306

Replace direct import with importlib.util.find_spec() check as recommended by ruff.
Add ValueError handling for mocked modules in tests.

@graphify-labs graphify-labs 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.

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

Replaces the import-based psycopg availability check in PGVectorRetriever.__init__ with importlib.util.find_spec, so the missing-dependency ImportError fires without actually importing the module. Swallows the ValueError find_spec raises for modules mocked into sys.modules, letting tests patch psycopg without tripping the check.

No blocking issues surfaced. 6 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 17 functions depend on the 12 functions this change touches.

Health — grade A; no new coupling hotspots.

Verification — 17 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 17 function(s) in the blast radius were not formally verified this run

@himanshu231204
himanshu231204 merged commit 8f73c8c into OpenAgentHQ:main Sep 2, 2026
12 checks passed
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🎉 Congratulations @devhub02!

Your pull request has been successfully merged into main. 🚀

Thank you for contributing to OpenAgentHQ and helping improve the project.

We truly appreciate your contribution and hope to see you back with more amazing PRs!

Happy Open Sourcing! ❤️

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.

Fix F401: Remove unused psycopg import in pgvector retriever

2 participants