Skip to content

docs,fix: overhaul README and docs for Python 3.11-3.13, prune deps, and harden config/runtime defaults - #67

Open
TrezorHannes wants to merge 1 commit into
mainfrom
docs/repo-overhaul
Open

TrezorHannes wants to merge 1 commit into
mainfrom
docs/repo-overhaul

Conversation

@TrezorHannes

Copy link
Copy Markdown
Owner

Summary

Overhauls README.md, secondary documentation, configuration templates, dependency hygiene, and fresh-clone runtime safety across the repository:

  1. README.md Overhaul (Python 3.11 / 3.12 / 3.13):

    • Updates system requirements and badges to Python 3.11 | 3.12 | 3.13.
    • Corrects script descriptions against actual behavior (lncli addinvoice in Magma/magma_sale_process.py, 0_fee.txt charge-lnd export in LNDg/channel_fee-pull.py, PostgreSQL CLI summary in LNDg/offline_summary.py, non-broadcasting command builder in Other/lnd_utxo_consolidator.py).
    • Adds links to sub-guides (Magma/magma_sale.md, Other/fee_adjuster.md, Other/swap_out-loop.md, Peerswap/README.md) and automated systemd timer installer scripts (Other/install_fee_adjuster_service.sh, LNBits/install_pocketmoney_service.sh).
    • Documents all four configuration templates (config.ini.example, Magma/magma_config.ini.example, feeConfig.json.example, wallets.json.example) and requirements-dev.txt test/coverage commands.
  2. requirements.txt Pruning:

    • Removes configparser==7.3.0 (configparser is part of the Python 3 standard library).
    • Removes telebot>=0.0.5 (pyTelegramBotAPI>=4.37.1 already provides import telebot; PyPI telebot is an unused third-party router package).
  3. Configuration & URL Normalization Fixes (config.ini.example, LNBits/pocketmoney.py, Other/fee_adjuster.py, LNDg/amboss_pull.py):

    • Fixes the double /api/v1/api/v1 URL bug in config.ini.example (base_url = https://yourdomain.com) and adds normalize_lnbits_base_url() + fail-closed validate_runtime_config() in LNBits/pocketmoney.py.
    • Adds missing charge_lnd_path under [paths] (with ~ expansion and fallback in fee_adjuster.py and amboss_pull.py) and optional [database] settings for LNDg/offline_summary.py.
    • Converts tracked Magma/magma_config.ini to Magma/magma_config.ini.example + .gitignore entry so local Magma offer edits do not dirty git status or conflict on git pull.
  4. Fresh-Clone Directory Safety & Import Hygiene:

    • Ensures logs/, data/, and charge-lnd output directories are created via os.makedirs(..., exist_ok=True) across LNBits/pocketmoney.py, Other/fee_adjuster.py, Other/rebalance_guard.py, LNDg/*, and Peerswap/*.
    • Removes the duplicate module-level get_lbtc_balance() subprocess call on import in Peerswap/ps_peers.py.
  5. Secondary Docs & Policy Deduplication:

    • Removes the redundant .github/SECURITY.md symlink/duplicate (retaining canonical root SECURITY.md).
    • Renames Magma/magma_sale.MD to Magma/magma_sale.md and updates venv, requirements.txt, and /processmagmaorders instructions.
    • Aligns .agents/agents.md, Other/fee_adjuster.md, and Peerswap/README.md with current modules, config paths, and test suite.

Verification & Code Review Gate

  • pytest tests/ -v --cov=LNDg --cov=Magma --cov=Other --cov=Peerswap --cov=LNBits: 147 passed (coverage increased from 28% to 30%, with new regression coverage in tests/test_repo_hygiene.py).
  • Greptile is not activated on this repository (not_connected); code review runs via TunnelSentinel (/provide-codereview) and self-review.

@TrezorHannes TrezorHannes added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request dependencies Pull requests that update a dependency file python Pull requests that update python code labels Oct 28, 2026
@TrezorHannes TrezorHannes self-assigned this Oct 28, 2026
@tunnelsentinel

Copy link
Copy Markdown

🛡️⚡ TunnelSentinel Code Review

Verdict: COMMENT (LGTM. High-Risk Tier: a maintainer merges) | Confidence: 5/5 | Risk Tier: HIGH
"Zero leaks. Fail-closed verification."


Latest commit: 773f67a | Status: success | Reviewed: 2026-10-28 22:54 UTC

Executive Summary

  • Risk Tier: HIGH (prod_lines_changed=106, net_lines_changed=1093, files=26, prod_files=18).
  • Verdict: Clean pass (5/5 confidence). Zero P0/P1/P2/P3 findings identified.

Verification & Edge-Case Analysis

  1. LNbits URL Normalization & Fail-Closed Runtime Config (LNBits/pocketmoney.py, config.ini.example):
    • Verified normalize_lnbits_base_url() strips trailing slashes and /api/v1 suffixes so all 4 LNbits REST calls (/api/v1/rate/..., /api/v1/payments, /api/v1/wallet) never double /api/v1/api/v1 regardless of whether an existing config.ini includes /api/v1.
    • Verified validate_runtime_config() fails closed at main() startup when base_url, admin_key, lnbits_bot_token (requiring : separator), or telegram_user_id is missing.
  2. Path Expansion, Directory Creation & Import Safety (Other/fee_adjuster.py, LNDg/*, Peerswap/*):
    • Verified os.path.expanduser() and os.makedirs(..., exist_ok=True) on charge_lnd_path in Other/fee_adjuster.py and LNDg/amboss_pull.py, plus logs/ and output directory creation across all scripts for fresh clones.
    • Verified removal of the duplicate top-level get_lbtc_balance() call in Peerswap/ps_peers.py eliminates import-time subprocess execution while preserving lbtc_balance = get_lbtc_balance() inside main().
  3. Dependency & Config Template Hygiene (requirements.txt, Magma/magma_config.ini.example, .gitignore):
    • Verified removal of stdlib configparser==7.3.0 and shadowed telebot>=0.0.5 from requirements.txt while retaining pyTelegramBotAPI>=4.37.1 and hardened TLS pins.
    • Verified Magma/magma_config.ini is moved to Magma/magma_config.ini.example and added to .gitignore.
  4. Test Suite & Documentation Links (tests/test_repo_hygiene.py, README.md, Magma/magma_sale.md, Other/fee_adjuster.md):
    • Executed full local test suite with branch coverage (pytest tests/ -v --cov=LNDg --cov=Magma --cov=Other --cov=Peerswap --cov=LNBits --cov-branch): 147 passed in 2.43s.

Review history

  • 773f67a: COMMENT (LGTM. High-Risk Tier: a maintainer merges), 5/5, HIGH risk, status success, 2026-10-28 22:54 UTC

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

Labels

bug Something isn't working dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant