Files
neuron-tai/.scratch/alpha-hardening/issues/19-doc-cryptography-test-env.md
Dobromir Popov 9abe83b5f4 feat(alpha): complete hardening backlog
Complete the alpha-hardening Ralph task set, including tracker billing/accounting guards, validator fraud-audit primitives, wallet binding proof support, documentation runbooks, and updated tests.

Verification: .venv/bin/python -m compileall -q packages tests; .venv/bin/python -m pytest -q --tb=short (313 passed, 3 skipped, 1 failed: tests/test_mining_cli.py::test_legacy_start_without_port_uses_next_available_port because meshnet-node pid 1263451 is already listening on port 7000).
2026-07-05 21:47:23 +03:00

2.8 KiB

Status: done

19 — DOC: Cryptography dependency + test environment note

What to build

Document and verify test/dev environment setup for wallet crypto paths. packages/node/meshnet_node/wallet.py uses cryptography; failures occur when .venv lacks deps. cryptography>=41 is already declared in packages/node/pyproject.toml, so this issue should focus on documenting the editable-install path and only add root/dev extras if tests still import the node wallet without installing the node package.

Code refs:

  • packages/node/pyproject.tomlcryptography>=41 (verify declared)
  • packages/node/meshnet_node/wallet.py
  • Handoff: tests fail without cryptography, openai, langchain in .venv

Acceptance criteria

  • Confirm cryptography>=41 remains in node package deps; add to root/dev extras only if tests import wallet without node install
  • Add short Test environment section to docs/dev/test-env.md (or CONTRIBUTING.md if created): use .venv/Scripts/python.exe, pip install -e packages/node ..., optional dep skips
  • Note which tests require optional deps (--ignore=test_openai_gateway,...)
  • No unrelated production code changes

Blocked by

None

Resolution

  • packages/node/pyproject.toml already declared cryptography>=41 — no change needed.
  • conftest.py adds every packages/* dir to sys.path, so first-party imports (e.g. meshnet_node.wallet) resolve without an editable install of that package — but third-party deps like cryptography still must be installed separately. Added cryptography>=41 to the root pyproject.toml dev extra so pip install -e ".[dev]" alone covers the wallet tests (test_node_startup.py, test_wallet_binding_proof.py, test_devnet_treasury.py, etc.) without requiring a full packages/node install (which would otherwise pull in torch/transformers/accelerate/bitsandbytes).
  • Added docs/dev/test-env.md with setup instructions (Linux + Windows .venv\Scripts\python.exe), and a note on optional-dependency tests: test_real_model_backend.py / test_devnet_treasury.py use pytest.importorskip and skip cleanly; test_openai_gateway.py hard-imports openai/langchain_openai with no skip guard (both already in the dev extra) — documented the --ignore=tests/test_openai_gateway.py fallback for minimal installs.
  • Full suite: 311 passed, 3 skipped, 3 pre-existing failures unrelated to this issue (test_billing_ledger.py::test_proxy_chat_splits_payout_by_tracker_assigned_route_span, test_forfeiture_penalty.py::test_probation_earns_nothing_then_earning_begins, test_mining_cli.py::test_legacy_start_without_port_uses_next_available_port — port-in-use env artifact). Wallet-specific tests (test_wallet_binding_proof.py, test_node_startup.py, test_devnet_treasury.py): 50 passed, 2 skipped.