Skip to content

test(ledger): guard the accepted filter of the bootstrap pending count - #30

Merged
Mathis (echobt) merged 1 commit into
mainfrom
test/bootstrap-pending-filter
Oct 21, 2026
Merged

Mathis (echobt) merged 1 commit into
mainfrom
test/bootstrap-pending-filter

Conversation

@echobt

@echobt Mathis (echobt) commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Why

Lens review of #27 found a surviving mutant: removing accepted IS NULL from the pending-reservation count in production_bootstrap left all tests green.

What

One test, test_bootstrap_ignores_accepted_shadow_reservation: an accepted reservation row plus a cap that exactly fits the bootstrap. The bootstrap must be accepted. Tests only, nothing under src/.

Evidence

  • pytest tests/ledger/test_production_bootstrap_v2.py: 16 passed.
  • Mutant (filter removed from escrow_v2.py): 1 failed, the new test; 15 passed.
  • ruff check and ruff format: clean.

Risk / rollback

Tests only. The missed case fails closed (refuses a bootstrap, never over-issues). Revert the merge.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected issuance-cap handling during bootstrap so accepted reservations are not counted twice.
    • Exact-fit bootstraps can now issue the intended 30,000 units while maintaining conservation.

production_bootstrap counts pending shadow reservations against the
issuance cap with `accepted IS NULL`. An accepted reservation is already
in balances().issued, so dropping the filter double counts it and refuses
a bootstrap that exactly fits the cap. Lens found no test failed when the
filter was removed. Add one with an accepted reservation at an exact fit;
it fails with the filter removed. Tests only, nothing under src/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6a9c0016-18d0-4436-b357-39296907475a
📥 Commits

Reviewing files that changed from the base of the PR and between 9da3b7f and 65f0a18.

📒 Files selected for processing: 1
  • tests/ledger/test_production_bootstrap_v2.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The test helper now supports accepted shadow reservations. A new test verifies that production bootstrap issues 30,000 conserved units when an accepted reservation is present and the issuance cap is 30,000.

Changes: Production bootstrap test coverage

Layer / File(s) Summary
Accepted reservation fixture and test
tests/ledger/test_production_bootstrap_v2.py
The helper can serialize an accepted reservation. The new test checks that bootstrap issues 30,000 conserved units under a 30,000-unit cap.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 65f0a

The test-only change is mergeable with normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies a ledger test that guards the accepted-reservation filter in the bootstrap pending count. It matches the main change.
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.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@echobt
Mathis (echobt) merged commit 95aa675 into main Oct 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant