Skip to content

test(auto_epoch_settler): 18 unit tests covering all functions [T1]#6316

Open
waefrebeorn wants to merge 41 commits into
Scottcjn:mainfrom
waefrebeorn:test-auto-epoch-settler
Open

test(auto_epoch_settler): 18 unit tests covering all functions [T1]#6316
waefrebeorn wants to merge 41 commits into
Scottcjn:mainfrom
waefrebeorn:test-auto-epoch-settler

Conversation

@waefrebeorn
Copy link
Copy Markdown

Summary

Adds 18 comprehensive unit tests for node/auto_epoch_settler.py, which previously had ZERO test coverage.

Coverage

Function Tests Scenarios
get_current_slot 4 API success, API error, network exception, missing epoch key
get_current_epoch_from_db 4 Happy path, empty DB, connection exception, NULL result
get_unsettled_epochs 6 Some unsettled, all settled, API fallback, no data, DB exception, current epoch exclusion
settle_epoch_via_api 4 Success, rejected, HTTP error, network exception

18 passed, 0 failed.

RTC Wallet for bounty: RTC17c0d21f04f6f65c1a85c0aeb5d4a305d57531096

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
…debase scan

- Vaulted: A1-A14, B1-B5, C1-C16, D1, A15-A41, S1-S19, M1-M9 (47 PRs)
- Added Row F (Form-not-function): 85 stub/form gaps from codebase scan
- Added Row T (Test coverage): 85 untested files mapped
- Added Rows M, S, D, E, H for remaining 72 cells
- README: added bounty badge + Bounty Bug Hunt section
- Total target: 400 cells (103 vaulted + 297 active)
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
Tests for:
- get_current_slot: API success, error, exception, missing key
- get_current_epoch_from_db: happy path, empty DB, exception, NULL result
- get_unsettled_epochs: some unsettled, all settled, fallback to API,
  no slot/epoch, DB exception, current epoch exclusion
- settle_epoch_via_api: success, rejected, HTTP error, network error

18 tests, 0 failed.
@github-actions github-actions Bot added documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related api API endpoint related tests Test suite changes size/L PR: 201-500 lines labels May 25, 2026
waefrebeorn added a commit to waefrebeorn/Rustchain that referenced this pull request May 25, 2026
Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work on this PR. 🚀

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

Labels

api API endpoint related BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) documentation Improvements or additions to documentation node Node server related size/L PR: 201-500 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants