Skip to content

test: split ledger reconciliation coverage#420

Merged
ramimbo merged 1 commit into
ramimbo:mainfrom
carpedkm:codex/ledger-reconciliation-tests-410
May 26, 2026
Merged

test: split ledger reconciliation coverage#420
ramimbo merged 1 commit into
ramimbo:mainfrom
carpedkm:codex/ledger-reconciliation-tests-410

Conversation

@carpedkm
Copy link
Copy Markdown

@carpedkm carpedkm commented May 26, 2026

Bounty #410

Summary:

  • Split the payout reconciliation test group out of tests/test_ledger.py into tests/test_ledger_reconciliation.py.
  • Preserve the moved test names, assertions, and behavior.
  • Keep the change test-only; no application code changes.

Scope distinction:

  • Existing MRWK bounty: split oversized test modules #410 submissions split tests/test_api_mcp.py bounty API route tests and tests/test_security.py URL validation tests.
  • This PR is a separate coherent split from tests/test_ledger.py covering payout reconciliation and duplicate accepted source URL behavior.

Validation:

  • python -m pytest tests/test_ledger_reconciliation.py tests/test_ledger.py -q -> 30 passed
  • python -m pytest -q -> 399 passed
  • python -m ruff check tests/test_ledger.py tests/test_ledger_reconciliation.py -> all checks passed
  • python -m ruff format --check tests/test_ledger.py tests/test_ledger_reconciliation.py -> 2 files already formatted
  • git diff --check -> clean

Expected PR size: 2 test files.

Summary by CodeRabbit

  • Tests
    • Reorganized ledger reconciliation test suite structure for improved code organization and maintainability.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 16d540b6-be97-4a47-a59d-725c86a925ad

📥 Commits

Reviewing files that changed from the base of the PR and between 5439fb0 and 47fc2cd.

📒 Files selected for processing (2)
  • tests/test_ledger.py
  • tests/test_ledger_reconciliation.py
💤 Files with no reviewable changes (1)
  • tests/test_ledger.py

📝 Walkthrough

Walkthrough

Tests covering ledger reconciliation behavior—including payouts, missing payments, legacy proof matching, duplicate evidence, and source URL grouping—are moved from tests/test_ledger.py into a new dedicated module tests/test_ledger_reconciliation.py with associated import updates.

Changes

Reconciliation Test Reorganization

Layer / File(s) Summary
Test cleanup in test_ledger.py
tests/test_ledger.py
Imports are updated to remove reconciliation-related symbols, and the reconciliation test block is deleted, allowing bounty validation tests to follow directly.
Reconciliation test suite
tests/test_ledger_reconciliation.py
New module containing eight reconciliation tests covering accepted payout status (paid, missing, mismatched), legacy proof source URL matching and mismatch handling, explicit submission link validation, duplicate and conflicting payment evidence, and duplicate source URL canonicalization with hash-chain and supply-conservation verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ramimbo/mergework#304: Moves reconcile_accepted_payouts and duplicate_accepted_source_urls tests from test_ledger.py to test_ledger_reconciliation.py, aligning with the source-URL matching and legacy-proof functionality introduced in that PR.
  • ramimbo/mergework#294: Both PRs involve reconcile_accepted_payouts reconciliation logic for missing and duplicate evidence scenarios, with the retrieved PR exposing these via admin API while this PR reorganizes and extends test coverage.

Suggested labels

mrwk:accepted, mrwk:paid

Suggested reviewers

  • weilixiong
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: moving reconciliation-related tests from test_ledger.py into a new dedicated file test_ledger_reconciliation.py.
Description check ✅ Passed The description covers the bounty reference, summary of changes, scope distinction, and comprehensive validation results, following the template structure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@bitdamii bitdamii left a comment

Choose a reason for hiding this comment

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

Reviewed PR #420 at head 47fc2cde0ab59668ce12fae1c449ae8fea0e00c1 against Bounty #410 and current origin/main.

Verdict: no blockers found.

What I checked:

  • The diff is test-only after refreshing origin/main: it moves payout reconciliation and duplicate accepted source URL tests from tests/test_ledger.py into tests/test_ledger_reconciliation.py.
  • The moved tests preserve the original reconciliation assertions for paid submissions, missing payments, legacy proof source URLs, explicit submission mismatches, duplicate proof evidence, mismatched proof evidence, and duplicate accepted source URL grouping.
  • tests/test_ledger.py drops the now-unused reconciliation imports, while tests/test_ledger_reconciliation.py imports the reconciliation helpers directly.
  • The PR is distinct from the other #410 splits: #416 covers bounty API route tests and #415 covers security URL validation tests; #420 covers ledger reconciliation tests.
  • PR status is open/CLEAN, GitHub quality check is successful, and CodeRabbit reported no actionable comments.

Local validation:

  • uv run --extra dev python -m pytest tests/test_ledger_reconciliation.py tests/test_ledger.py -q -> 30 passed.
  • uv run --extra dev ruff check tests/test_ledger.py tests/test_ledger_reconciliation.py -> passed.
  • uv run --extra dev ruff format --check tests/test_ledger.py tests/test_ledger_reconciliation.py -> passed.
  • uv run --extra dev python -m mypy app -> success.
  • git diff --check origin/main...HEAD -> clean.

No application-code behavior changes were introduced by this PR, and the extracted tests still exercise the same ledger reconciliation behavior.

@ramimbo ramimbo merged commit b931f3b into ramimbo:main May 26, 2026
2 checks passed
@ramimbo ramimbo added mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants