Skip to content

test: split ledger reconciliation coverage#421

Closed
alan747271363-art wants to merge 1 commit into
ramimbo:mainfrom
alan747271363-art:codex/split-ledger-tests
Closed

test: split ledger reconciliation coverage#421
alan747271363-art wants to merge 1 commit into
ramimbo:mainfrom
alan747271363-art:codex/split-ledger-tests

Conversation

@alan747271363-art
Copy link
Copy Markdown
Contributor

@alan747271363-art alan747271363-art commented May 26, 2026

Summary

  • Bounty MRWK bounty: split oversized test modules #410
  • Move payout reconciliation and duplicate accepted source URL tests out of tests/test_ledger.py into focused tests/test_ledger_reconciliation.py.
  • Preserve the original assertions and test intent for accepted payout reconciliation, missing/mismatched/duplicate payment evidence, legacy proof source handling, and duplicate source URL grouping.
  • Keep this scoped to test organization only; no application behavior changes.

Evidence

Preflight: Bounty #410 is open on the public MRWK API with max_awards=3 and awards_remaining=3. Existing claims #415 and #416 target different modules/sections (tests/test_security.py URL validation and tests/test_api_mcp.py bounty API routes), so this is a distinct split from tests/test_ledger.py.

Validation

  • .\.venv\Scripts\python.exe -m pytest tests/test_ledger.py tests/test_ledger_reconciliation.py -q -> 30 passed
  • .\.venv\Scripts\python.exe -m pytest -q -> 399 passed
  • .\.venv\Scripts\python.exe -m ruff check tests/test_ledger.py tests/test_ledger_reconciliation.py -> passed
  • .\.venv\Scripts\python.exe -m ruff format --check tests/test_ledger.py tests/test_ledger_reconciliation.py -> passed
  • .\.venv\Scripts\python.exe -m mypy app -> passed
  • .\.venv\Scripts\python.exe scripts\docs_smoke.py -> docs smoke ok
  • git diff --check

Summary by CodeRabbit

  • Tests
    • Reorganized ledger reconciliation tests into a dedicated test file for improved maintainability and clarity.

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: e4275666-feff-44d9-b121-e7fe8ede3f19

📥 Commits

Reviewing files that changed from the base of the PR and between 5439fb0 and 39b0371.

📒 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

This PR reorganizes reconciliation test coverage by moving eight reconciliation-focused test functions and associated imports from tests/test_ledger.py to a new dedicated module tests/test_ledger_reconciliation.py. The general ledger test file retains bounty validation and schema integrity checks.

Changes

Test Reorganization

Layer / File(s) Summary
Remove reconciliation tests from test_ledger.py
tests/test_ledger.py
Import statements for reconciliation symbols and canonical_json are removed; eight reconciliation-focused test functions (test_reconcile_accepted_payouts_* variants and test_duplicate_accepted_source_urls_groups_distinct_accepted_submissions) are deleted from the module.
Reconciliation test suite in test_ledger_reconciliation.py
tests/test_ledger_reconciliation.py
New module imports SQLAlchemy, database helpers, reconciliation/ledger service functions, and ORM models. Adds eight integration tests covering: already-paid submissions, missing payments, legacy proof matching, legacy source mismatches, explicit submission link validation, duplicate and mismatched payment evidence (with hash-chain and supply-conservation verification), and canonical source URL grouping across distinct bounties.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ramimbo/mergework#304: The newly added reconciliation test cases directly target the reconciliation behavior introduced in app/ledger/reconciliation.py.
  • ramimbo/mergework#297: This PR relocates the existing reconciliation tests, which correspond to the duplicate_accepted_source_urls and reconciliation-focused logic added in #297.
  • ramimbo/mergework#294: Reorganizes reconcile_accepted_payouts test scenarios that validate the same payout-reconciliation logic exposed via /api/v1/reconciliation/payouts.

Suggested labels

mrwk:accepted, mrwk:paid

Suggested reviewers

  • Karry2019web
🚥 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 'test: split ledger reconciliation coverage' accurately and concisely describes the main change: reorganizing reconciliation-focused tests into a dedicated file.
Description check ✅ Passed The description includes summary, evidence of bounty/claims, and comprehensive validation results covering ruff, mypy, pytest, and docs checks; all critical elements are present.
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

@akmhatey-ai akmhatey-ai 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 #421 at head 39b03715c9539e72a291efc5d0c1ffb89fd6a6d8 against Bounty #410 and earlier PR #420.

Verdict: blocker / duplicate scope.

Evidence:

  • PR #421 has the same Git tree as PR #420: 3e10dee36d98a68eae0c52df9c967d877dec4662.
  • git diff --quiet origin/pr/420..origin/pr/421 exits 0, so there is no file-level diff between the two PR heads.
  • Both PRs make the same test-only split: tests/test_ledger.py loses 440 lines and tests/test_ledger_reconciliation.py gains 455 lines.
  • Both PRs claim the same #410 ledger payout reconciliation split, but #420 was opened first and already has a #410 claim plus a #404 review claim.

Recommendation: do not treat #421 as a distinct #410 contribution unless maintainers intentionally prefer it over #420. The code shape itself is fine, but it does not add new scope beyond the earlier identical PR.

@ramimbo
Copy link
Copy Markdown
Owner

ramimbo commented May 26, 2026

Closing as duplicate. #420 was the earlier PR with the same ledger-reconciliation test split, merged, and was paid for #410. This branch adds no distinct accepted work.

@ramimbo ramimbo added duplicate This issue or pull request already exists mrwk:rejected Submission rejected labels May 26, 2026
@ramimbo ramimbo closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists mrwk:rejected Submission rejected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants