GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(e2e): parity test leaks NEO4J_URI/USERNAME/PASSWORD into the pytest process environment · Issue #1854 · CodeGraphContext/CodeGraphContext

test(e2e): parity test leaks NEO4J_URI/USERNAME/PASSWORD into the pytest process environment #1854

New issue
Copy link
New issue
Copy link
Open
Open
test(e2e): parity test leaks NEO4J_URI/USERNAME/PASSWORD into the pytest process environment#1854
Copy link

Description

@mollyjester
mollyjester
opened on Oct 22, 2026
Issue body actions

Problem

tests/e2e/test_verify_databases_parity.py::_run_database_parity_e2e sets the Neo4j credentials in the pytest process's environment and never restores them (lines 264-266 on main 1b595a6):

os.environ.setdefault('NEO4J_URI', 'bolt://localhost:7687')
os.environ.setdefault('NEO4J_USERNAME', 'neo4j')
os.environ.setdefault('NEO4J_PASSWORD', '12345678')

(Line 88 assigns NEO4J_PASSWORD = '12345678' too, but inside the indexing subprocess script, where it is harmless.)

Every test that runs later in the same pytest process therefore sees a "configured" Neo4j. core._is_neo4j_configured() checks only that these three variables are set, so it flips to True, and that feeds get_database_manager()'s implicit selection.

Repro on main 1b595a6, without changing code. A small driver runs the parity test through pytest.main() and then reads the environment. NEO4J_URI points at a closed port, so the Neo4j leg skips without touching a server:

# leak_probe.py, run from the repo root with PYTHONPATH=.:src
import os, pytest
keys = ("NEO4J_URI", "NEO4J_USERNAME", "NEO4J_PASSWORD")
print("BEFORE", {k: os.environ.get(k) for k in keys})
pytest.main(["-q", "tests/e2e/test_verify_databases_parity.py"])
print("AFTER", {k: os.environ.get(k) for k in keys})
from codegraphcontext.core import _is_neo4j_configured
print("_is_neo4j_configured()", _is_neo4j_configured())
$ env -u NEO4J_USERNAME -u NEO4J_PASSWORD NEO4J_URI=bolt://127.0.0.1:1 python leak_probe.py
BEFORE {'NEO4J_URI': 'bolt://127.0.0.1:1', 'NEO4J_USERNAME': None, 'NEO4J_PASSWORD': None}
1 skipped in 270.20s
AFTER {'NEO4J_URI': 'bolt://127.0.0.1:1', 'NEO4J_USERNAME': 'neo4j', 'NEO4J_PASSWORD': '12345678'}
_is_neo4j_configured() True

With NEO4J_URI unset as well, all three variables leak, including bolt://localhost:7687.

Impact

  • Order-dependent test environment. tests/e2e sorts before tests/integration and tests/unit. So in ./tests/run_tests.sh all / pytest tests/, every integration and unit test after the parity test runs with fake Neo4j credentials in os.environ. Tests that read these variables include tests/unit/core/test_database.py, tests/unit/cli/test_bug001_config_override.py, tests/unit/cli/test_setup_wizard_credentials.py and tests/integration/cli/test_cli_commands.py. Most of them patch the environment themselves, which is why nothing visibly fails on main today. Any new test that relies on "Neo4j not configured" will pass alone and fail in the full run.
  • Default backend selection. With the variables set, get_database_manager()'s implicit path counts Neo4j as configured for the rest of the session.
  • A downstream fork hit this as an order-dependency trap: tests that pass in isolation but behave differently after the e2e directory.

Proposed fix

Scope the variables to the test: take pytest's monkeypatch fixture (monkeypatch.setenv) or save and restore os.environ around _run_database_parity_e2e, and pass the credentials to the indexing subprocess through its env= argument instead of the parent's environment. No fix exists in a downstream fork yet. This is reported as a gap, not a finished patch.

Related

  • test(e2e): run the LadybugDB probe in a subprocess in the parity test #1853: same test file, the other process-hygiene problem (the in-process LadybugDB probe aborts combined runs). This issue is the remaining half.
  • ci: add cross-OS E2E tests and gracefully skip missing backends #1635 (the parity test skips missing drivers) and fix(core): treat LadybugDB as available only when its native engine loads (#1731) #1737/ci: test (windows-latest) is permanently red on main — ladybug C-API shared lib unavailable on Windows runners #1731 (LadybugDB native probe): same file, related only.

Activity

  1. github-project-automation
    added this to CGC Progress Boardand CodeGraphContext Roadmapon Oct 22, 2026
  2. github-project-automation
    moved this to Backlog tasks in CGC Progress Boardon Oct 22, 2026
  3. github-actions commented on Oct 22, 2026

    @github-actions
    github-actionsBot
    on Oct 22, 2026 – with GitHub Actions
    Contributor
    More actions

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • CGC Progress Board
      Status
      Backlog tasks
      Show more project fields
    • CodeGraphContext Roadmap
      Status
      No status
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.