chore(deps): upgrade the Neo4j Python driver from 6.2.0 to 6.4.1

SA
6h ago
+40-40

Upgrade the Neo4j Python driver from 6.2.0 to 6.4.1 for its connection-pool fixes

This PR upgrades neo4j and neo4j-rust-ext from 6.2.0 to 6.4.1. Infrahub servers and task workers hold many database sessions at once, and versions 6.3.1 and 6.4.0 of the driver fix connection-pool bugs on the path every database query uses.

Jira: INBOX-370

Driver changes between 6.2.0 and 6.4.1

From the driver's 6.x changelog. It marks no change in this range as breaking or as a deprecation.

  • 6.3.1 fixes an application-error path that could release a session's connection to the pool while a Result still held it (neo4j-python-driver#1333). The changelog says this "can lead to protocol errors, data races, and in the worst case reading records from another query."
  • 6.4.0 fixes a race condition in the Bolt connection pool (#1346), and discards broken sockets in more cases before taking them from the pool (#1345).
  • 6.4.1 fixes a regression from 6.4.0 where acquiring a connection from the pool spins actively (#1362). This is why the upgrade does not stop at 6.4.0.
  • The other changes add features Infrahub does not use: Python 3.15 support, Bolt 6.1 with uuid.UUID values, pyarrow 25 support, and a preview client for the HTTP Query API. From 6.3.0, SSL contexts created by the driver log TLS keys when the SSLKEYLOGFILE environment variable is set, as Python's own ssl.create_default_context does.

Changes

  • neo4j 6.2.0 → 6.4.1 and neo4j-rust-ext 6.2.0.0 → 6.4.1.0 in pyproject.toml and uv.lock. No other package changes in uv.lock, and no package is added or removed.
  • backend/tests/component/conftest.py: the neo4j_factory fixture imports the driver's private hydration classes to build fake Node and Relationship objects. 6.4.0 moved them from neo4j._codec.hydration.v1 to neo4j._codec.hydration.bolt.v1 when it added the HTTP Query API. The import path is updated; the class names and method signatures are the same.
  • AGENTS.md: the tech stack line now says driver 6.4.

No changelog fragment: Infrahub's own code and behaviour do not change.

The infrahub.database mypy override stays

The card asked to check whether the arg-type entry in the infrahub.database mypy override is still needed with 6.4.1. It is: without it, mypy reports 13 arg-type errors in backend/infrahub/database/__init__.py on this branch, including the **pool_connection_kwargs passed to AsyncGraphDatabase.driver().

Base branch

This PR targets stable, which pins the same driver version as develop. dev/guidelines/git-workflow.md sends bug fixes for released code to the oldest maintained branch that should ship them, and the change reaches develop through the stable→develop merge.

How this was verified

  • ty check . reported the moved hydration module (unresolved-import in backend/tests/component/conftest.py) after the upgrade, and passes after the import fix.
  • Local checks pass: ruff, ty, mypy (invoke backend.lint), uv lock --check, yamllint, generated-file and schema validation, the frontend lint trio, and 2776 backend unit tests.
  • Component tests against Neo4j (--neo4j, testcontainers):
    • backend/tests/component/core/test_query.py: 12 passed. These include the two tests that use neo4j_factory.
    • backend/tests/component/core and backend/tests/component/database with 4 workers: 2508 passed, 0 failed, 21 skipped, 1 expected failure (test_diff_get_nodes_multiple_changes, marked xfail on stable).
uv run pytest --neo4j backend/tests/component/core/test_query.py

🤖 Generated with Claude Code