Skip to content

refactor: change immature_transactions() to return BTreeSet<Txid>#79

Open
xdustinface wants to merge 3 commits intofeat/transaction-record-detailsfrom
feat/immature-txids
Open

refactor: change immature_transactions() to return BTreeSet<Txid>#79
xdustinface wants to merge 3 commits intofeat/transaction-record-detailsfrom
feat/immature-txids

Conversation

@xdustinface
Copy link
Copy Markdown
Owner

@xdustinface xdustinface commented Mar 30, 2026

Summary

  • immature_transactions() renamed to immature_txids() and returns BTreeSet<Txid> instead of Vec<Transaction> — callers only need txid membership
  • All callers updated to use the new method name and return type

Closes #71

…, rebuild `spent_outpoints` from `input_details`
@xdustinface xdustinface added the needs-human Requires human review before merge label Mar 30, 2026
@manki-review
Copy link
Copy Markdown

manki-review Bot commented Mar 30, 2026

Manki — Review complete

✓ Parsed diff — 48 lines
✓ Review — 3 agents · 6 findings
✓ Judge — 3 kept · 3 dropped

Review metadata

Config:

  • Models: reviewer=claude-opus-4-6, judge=claude-opus-4-6
  • Review level: small (auto, 48 lines)
  • Team: Security & Safety, Architecture & Design, Correctness & Logic
  • Memory: disabled
  • Nit handling: issues

Judge decisions:

  • ✓ Kept: "Panic on out-of-bounds index during deserialization" (required, high confidence) — "Merged findings 1 and 6 — same issue. Impact: High (panic/crash loading wallet from disk), Likelihood: Possible (corrupted or tampered serialized data). Two reviewers flagged this independently. The project's CLAUDE.md explicitly states 'Never panic in library code' and deserialization is a system boundary where defensive validation is expected. Using .get() with filter_map is a straightforward fix."
  • ✓ Kept: "Deserialized spent_outpoints may be incomplete vs runtime state" (suggestion, medium confidence) — "Merged findings 2, 3, and 5 — same issue. Impact: Medium-High (stale UTXO could be re-added on rescan), Likelihood: Possible (requires out-of-order block processing followed by serialize/deserialize/rescan). All three reviewers independently flagged this semantic narrowing: at runtime update_utxos inserts ALL inputs into spent_outpoints, but input_details only captures inputs matching a known UTXO. The change is intentional per the acceptance criteria, but the behavioral difference from the runtime invariant deserves at minimum a comment explaining why the deserialized set is intentionally narrower and what trade-offs that entails."
  • ✓ Kept: "Return type diverges from issue acceptance criteria" (nit, high confidence) — "Impact: Low, Likelihood: N/A. BTreeSet is deterministic and consistent with the codebase's use of BTreeMap/BTreeSet. The PR title explicitly says BTreeSet. This is an intentional improvement over the spec — just update the issue text."

Recap:

  • 3 new findings

Timing:

  • Parse: 2.3s
  • Review agents: 64.5s
  • Judge: 65.4s
  • Total: 132.2s

manki-review[bot]
manki-review Bot previously requested changes Mar 30, 2026
Copy link
Copy Markdown

@manki-review manki-review Bot left a comment

Choose a reason for hiding this comment

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

The spent_outpoints deserialization rewrite has two notable issues: an unchecked index access that can panic on corrupted wallet data, and a semantic narrowing of the rebuilt set that all three reviewers independently flagged. The immature_transactions() return type change is clean.

Findings: 3 new

📊 3 findings (1 required, 1 suggestion, 1 nit) · 48 lines · 132s

Review stats
{
  "model": "claude-opus-4-6",
  "reviewTimeMs": 132171,
  "diffLines": 48,
  "diffAdditions": 20,
  "diffDeletions": 28,
  "filesReviewed": 5,
  "agents": [
    "Security & Safety",
    "Architecture & Design",
    "Correctness & Logic"
  ],
  "findingsRaw": 6,
  "findingsKept": 3,
  "findingsDropped": 3,
  "severity": {
    "required": 1,
    "suggestion": 1,
    "nit": 1
  },
  "verdict": "REQUEST_CHANGES",
  "prNumber": 79,
  "commitSha": "0453adac6bef8a7cd88a27a3c67f2a71f5be8fad"
}

Comment thread key-wallet/src/managed_account/mod.rs Outdated
Comment thread key-wallet/src/managed_account/mod.rs
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.50%. Comparing base (24a2f01) to head (0906c21).
⚠️ Report is 8 commits behind head on feat/transaction-record-details.

Files with missing lines Patch % Lines
key-wallet/src/managed_account/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           feat/transaction-record-details      #79      +/-   ##
===================================================================
- Coverage                            67.50%   67.50%   -0.01%     
===================================================================
  Files                                  318      318              
  Lines                                67500    67707     +207     
===================================================================
+ Hits                                 45567    45703     +136     
- Misses                               21933    22004      +71     
Flag Coverage Δ
core 75.21% <ø> (ø)
ffi 35.33% <ø> (-0.54%) ⬇️
rpc 19.92% <ø> (ø)
spv 83.73% <ø> (-0.07%) ⬇️
wallet 68.15% <87.50%> (+0.31%) ⬆️
Files with missing lines Coverage Δ
...-wallet/src/transaction_checking/wallet_checker.rs 97.52% <100.00%> (+0.03%) ⬆️
...allet/managed_wallet_info/wallet_info_interface.rs 76.92% <100.00%> (-1.13%) ⬇️
key-wallet/src/managed_account/mod.rs 55.78% <0.00%> (+0.35%) ⬆️

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ils`

The deserialization used `input_details` (our inputs only) with unchecked
indexing into `transaction.input`, which could panic on corrupted data and
produced an incomplete `spent_outpoints` set. Runtime behavior tracks all
inputs of every recorded transaction, so deserialization must match.
@manki-review
Copy link
Copy Markdown

manki-review Bot commented Mar 31, 2026

Manki — Review complete

✓ Parsed diff — 42 lines
✓ Review — 3 agents · 0 findings
✓ Judge — 0 kept · 0 dropped

Review metadata

Config:

  • Models: reviewer=claude-opus-4-6, judge=claude-opus-4-6
  • Review level: small (auto, 42 lines)
  • Team: Security & Safety, Architecture & Design, Correctness & Logic
  • Memory: disabled
  • Nit handling: issues

Recap:

  • 0 new findings
  • 2 previously flagged

Timing:

  • Parse: 2.5s
  • Review agents: 44.9s
  • Judge: 0.0s
  • Total: 47.3s

@manki-review manki-review Bot dismissed their stale review March 31, 2026 01:28

Superseded by new review

Copy link
Copy Markdown

@manki-review manki-review Bot left a comment

Choose a reason for hiding this comment

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

Review complete.

Findings: 2 previously flagged

📊 0 findings (none) · 42 lines · 47s

Review stats
{
  "model": "claude-opus-4-6",
  "reviewTimeMs": 47337,
  "diffLines": 42,
  "diffAdditions": 16,
  "diffDeletions": 26,
  "filesReviewed": 5,
  "agents": [
    "Security & Safety",
    "Architecture & Design",
    "Correctness & Logic"
  ],
  "findingsRaw": 0,
  "findingsKept": 0,
  "findingsDropped": 0,
  "severity": {
    "required": 0,
    "suggestion": 0,
    "nit": 0
  },
  "verdict": "APPROVE",
  "prNumber": 79,
  "commitSha": "21c58296a3ccd1c9ad0c730b8b7f11ed18bb3e2e"
}

@xdustinface
Copy link
Copy Markdown
Owner Author

@manki review

@manki-review
Copy link
Copy Markdown

manki-review Bot commented Mar 31, 2026

Manki — Review complete

✓ Parsed diff — 42 lines
✓ Review — 3 agents · 6 findings
✓ Judge — 2 kept · 4 dropped

Review metadata

Config:

  • Models: reviewer=claude-sonnet-4-6, judge=claude-opus-4-6
  • Review level: small (auto, 42 lines)
  • Team: Security & Safety, Architecture & Design, Correctness & Logic
  • Memory: disabled
  • Nit handling: issues

Judge decisions:

  • ✓ Kept: "Method name immature_transactions() no longer matches its return type" (suggestion, high confidence) — "Impact: Medium (API discoverability/confusion in a public trait), Likelihood: Probable (every new caller will be misled by the name). This is a library crate with a public trait, so the mismatch is a real ergonomics problem. However, renaming a method across a trait and all impls/callers is a reasonable follow-up, not a blocking defect — downgrading from required to suggestion."
  • ✓ Kept: "Return HashSet<Txid> rather than BTreeSet<Txid> for a pure membership set" (nit, high confidence) — "Impact: Low (negligible performance difference for small sets), Likelihood: N/A. The acceptance criteria says HashSet but BTreeSet is a defensible choice for deterministic ordering. Finding 5 from another reviewer correctly notes BTreeSet gives reproducible iteration. This is a minor deviation from the stated spec, worth noting but not blocking. Merged with Finding 5 (same issue, opposite conclusions) — keeping as nit since the choice is intentional and reasonable."
  • ✗ Dropped: "Coinbase UTXO with no matching TransactionRecord would appear in immature_transactions()" (ignore, high confidence) — "As the reviewer correctly noted, UTXOs and TransactionRecords are created atomically in record_transaction, so this scenario cannot occur in practice. Not a real defect."

Recap:

  • 2 new findings
  • 2 resolved

Timing:

  • Parse: 8.5s
  • Review agents: 75.0s
  • Judge: 18.0s
  • Total: 101.5s

manki-review[bot]
manki-review Bot previously requested changes Mar 31, 2026
Copy link
Copy Markdown

@manki-review manki-review Bot left a comment

Choose a reason for hiding this comment

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

Clean refactor with one notable deviation from the acceptance criteria (BTreeSet vs HashSet) that appears intentional. The method naming mismatch is the most actionable finding — immature_transactions() now returns txids, not transactions.

Findings: 2 new, 2 resolved

📊 2 findings (1 suggestion, 1 nit) · 42 lines · 101s

Review stats
{
  "model": "claude-sonnet-4-6",
  "reviewTimeMs": 101476,
  "diffLines": 42,
  "diffAdditions": 16,
  "diffDeletions": 26,
  "filesReviewed": 5,
  "agents": [
    "Security & Safety",
    "Architecture & Design",
    "Correctness & Logic"
  ],
  "findingsRaw": 6,
  "findingsKept": 2,
  "findingsDropped": 4,
  "severity": {
    "required": 0,
    "suggestion": 1,
    "nit": 1
  },
  "verdict": "REQUEST_CHANGES",
  "prNumber": 79,
  "commitSha": "21c58296a3ccd1c9ad0c730b8b7f11ed18bb3e2e",
  "agentMetrics": [
    {
      "name": "Security & Safety",
      "findingsRaw": 0,
      "findingsKept": 0
    },
    {
      "name": "Architecture & Design",
      "findingsRaw": 2,
      "findingsKept": 2
    },
    {
      "name": "Correctness & Logic",
      "findingsRaw": 1,
      "findingsKept": 0
    }
  ],
  "judgeMetrics": {
    "confidenceDistribution": {
      "high": 3,
      "medium": 0,
      "low": 0
    },
    "severityChanges": 3,
    "mergedDuplicates": 3
  },
  "fileMetrics": {
    "fileTypes": {
      ".rs": 5
    },
    "findingsPerFile": {
      "key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs": 2
    }
  },
  "reviewerModel": "claude-sonnet-4-6",
  "judgeModel": "claude-opus-4-6"
}

Comment thread key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs Outdated
@manki-review
Copy link
Copy Markdown

manki-review Bot commented Mar 31, 2026

Manki — Review complete

✓ Parsed diff — 54 lines
✓ Review — 3 agents · 3 findings
✓ Judge — 3 kept · 0 dropped

Review metadata

Config:

  • Models: reviewer=claude-sonnet-4-6, judge=claude-opus-4-6
  • Review level: small (auto, 54 lines)
  • Team: Security & Safety, Architecture & Design, Correctness & Logic
  • Memory: disabled
  • Nit handling: issues

Judge decisions:

  • ✓ Kept: "PR description claims spent_outpoints rebuild was changed but only a comment was added" (suggestion, medium confidence) — ""
  • ✓ Kept: "Return type is BTreeSet<Txid> but issue acceptance criteria specified HashSet<Txid>" (nit, medium confidence) — ""
  • ✓ Kept: "PR description contradicts implementation for spent_outpoints rebuild" (suggestion, medium confidence) — ""

Recap:

  • 3 new findings
  • 3 resolved

Timing:

  • Parse: 2.0s
  • Review agents: 74.9s
  • Judge: 42.5s
  • Total: 119.4s

@manki-review manki-review Bot dismissed their stale review March 31, 2026 04:58

Superseded by new review

Copy link
Copy Markdown

@manki-review manki-review Bot left a comment

Choose a reason for hiding this comment

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

Review complete.

Findings: 3 new, 3 resolved

📊 3 findings (2 suggestion, 1 nit) · 54 lines · 119s

Review stats
{
  "model": "claude-sonnet-4-6",
  "reviewTimeMs": 119395,
  "diffLines": 54,
  "diffAdditions": 22,
  "diffDeletions": 32,
  "filesReviewed": 5,
  "agents": [
    "Security & Safety",
    "Architecture & Design",
    "Correctness & Logic"
  ],
  "findingsRaw": 3,
  "findingsKept": 3,
  "findingsDropped": 0,
  "severity": {
    "required": 0,
    "suggestion": 2,
    "nit": 1
  },
  "verdict": "APPROVE",
  "prNumber": 79,
  "commitSha": "0906c2116c77e40dff0e9ced89e3cb0e318c2f05",
  "agentMetrics": [
    {
      "name": "Security & Safety",
      "findingsRaw": 0,
      "findingsKept": 0
    },
    {
      "name": "Architecture & Design",
      "findingsRaw": 2,
      "findingsKept": 2
    },
    {
      "name": "Correctness & Logic",
      "findingsRaw": 1,
      "findingsKept": 1
    }
  ],
  "judgeMetrics": {
    "confidenceDistribution": {
      "high": 0,
      "medium": 0,
      "low": 0
    },
    "severityChanges": 0,
    "mergedDuplicates": 0
  },
  "fileMetrics": {
    "fileTypes": {
      ".rs": 5
    },
    "findingsPerFile": {
      "key-wallet/src/managed_account/mod.rs": 2,
      "key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs": 1
    }
  },
  "reviewerModel": "claude-sonnet-4-6",
  "judgeModel": "claude-opus-4-6"
}

Comment thread key-wallet/src/managed_account/mod.rs
Comment thread key-wallet/src/managed_account/mod.rs
@xdustinface
Copy link
Copy Markdown
Owner Author

@manki review

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

Labels

needs-human Requires human review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants