test(beacon_x402): add 47 unit tests for x402 payment integration [T6]#6325
test(beacon_x402): add 47 unit tests for x402 payment integration [T6]#6325waefrebeorn wants to merge 44 commits into
Conversation
Adds max_length parameter to _clean_string_field and caps all user input fields in POST route handlers: - /lock: sender_wallet(128), target_wallet(128), tx_hash(128), receipt_signature(256) - /confirm: proof_ref(256), notes(1024) - /release: release_tx(128), notes(1024) Prevents storage of arbitrarily large strings in bridge_ledger DB.
…s + Row M error handling + Row T test gaps + Row E infrastructure
F6: bare 'except Exception: pass' in inline query miners handler F7: bare 'except Exception: pass' in inline query epoch handler Both now log a warning with exc_info=True so silent failures are observable without changing the fallthrough behaviour. Also: - Mark F3-F5 as FALSE POSITIVES (explorer-api pass is intentional, WalletCheckError exception class is standard Python) - Update board: 107/400 cells vaulted, 49 PRs, 290 fresh gaps
Covers: - Helper functions (_is_base_address, _json_string_field, _cors_json, _require_beacon_admin, _check_x402_payment) - 25 tests - DB migrations (schema creation, column ALTER, idempotent) - 3 tests - Wallet routes (set/get, CORS, admin auth, Base address validation) - 10 tests - Premium endpoints (reputation export, contracts export, x402 paywall) - 5 tests - Payment history (admin auth, list) - 3 tests - x402 status (public endpoint) - 2 tests 47 tests, all pass. Coverage: 0% to covered. RTC: rtc17c0d21f04f6f65c1a85c0aeb5d4a305d57531096
jaxint
left a comment
There was a problem hiding this comment.
Great work on this PR! The code looks clean and well-structured. Thanks for contributing to RustChain! 🦀
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Great work on this PR. 🚀
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the contribution.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! LGTM.
jaxint
left a comment
There was a problem hiding this comment.
Thanks for contributing to RustChain! 🦀
Review Summary:
- Code structure looks good
- Changes align with project goals
- No obvious issues detected
Keep up the great work! 🚀
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
jaxint
left a comment
There was a problem hiding this comment.
Thanks for contributing! 🦀
Code looks good. Keep it up! 🚀
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
jaxint
left a comment
There was a problem hiding this comment.
Great work! Thanks for contributing to RustChain! 🦀
jaxint
left a comment
There was a problem hiding this comment.
Great work! Thanks for contributing to RustChain! 🦀
T6 \u2014 beacon_x402.py test coverage (HIGH criticality)\n\n47 unit tests for (424 lines, 6 routes) \u2014 was 0% coverage, now covered.\n\n### Test categories:\n| Category | Tests | Key coverage |\n|----------|-------|-------------|\n| Helpers | 25 | is_base_address, json_string_field, cors_json, admin auth, x402 payment check |\n| DB migrations | 3 | Schema creation, column migration, idempotent |\n| Wallet routes | 10 | Set/get, CORS, admin auth, Base address validation, agent_id too long |\n| Premium endpoints | 5 | Reputation export, contracts export, x402 paywall (402) |\n| Payment history | 3 | Admin auth, list, CORS |\n| x402 status | 2 | Public endpoint, premium endpoints listed |\n\n### Key edge cases:\n- validates 0x prefix + 42 chars + hex\n- uses HMAC constant-time comparison\n- returns 402 for missing header, 503 for present but unverified header\n- Free price ("0") always passes even when X402_CONFIG_OK is False\n- DB migration adds column to existing relay_agents table\n\nAll 47 tests pass \u2705\n\n---\nRTC Wallet: rtc17c0d21f04f6f65c1a85c0aeb5d4a305d57531096\n\n## RTC Wallet\nRTC17c0d21f04f6f65c1a85c0aeb5d4a305d57531096