Skip to content

relayburn-sdk: collapse analyze/compare_archive.rs into compare.rs#349

Merged
willwashburn merged 1 commit intomainfrom
rust-compare-archive-collapse
May 7, 2026
Merged

relayburn-sdk: collapse analyze/compare_archive.rs into compare.rs#349
willwashburn merged 1 commit intomainfrom
rust-compare-archive-collapse

Conversation

@willwashburn
Copy link
Copy Markdown
Member

Summary

Collapse analyze/compare_archive.rs into analyze/compare.rs. The module was a 5-line wrapper around Ledger::query_turns + build_compare_table with ~700 lines of fixture/helper boilerplate; consolidating drops a maintenance surface that documented itself as redundant.

  • Move compare_from_archive + CompareFromArchiveResult into analyze/compare.rs.
  • Replace nine mostly-redundant tests with one focused round-trip smoke test (the per-feature filter tests duplicated coverage already in build_compare_table's own tests and the ledger's query tests).
  • Keep the public compare_from_archive / CompareFromArchiveResult re-exports from relayburn_sdk::analyze — SDK surface unchanged.

Net: +83 / -758 LOC.

Closes #347.

Test plan

  • cargo build --workspace --all-targets clean
  • cargo test --workspace passes (all suites green)
  • cargo clippy --workspace --all-targets warning count unchanged (22 → 22 vs main)
  • No SDK surface change — compare_from_archive still exported from relayburn_sdk::analyze::compare_from_archive and via relayburn_sdk::CompareFromArchiveResult

🤖 Generated with Claude Code

)

The module was a 5-line wrapper around `Ledger::query_turns` +
`build_compare_table` plus ~700 lines of fixture/helper boilerplate to
test what is fundamentally a delegation. Most tests duplicated coverage
already provided by `build_compare_table`'s own tests
(`groups_unclassified_turns_under_unclassified`, the model-filter cases,
the min-sample flagging, etc.) or by the ledger's query tests
(since/project/session filters).

Move `compare_from_archive` + `CompareFromArchiveResult` into
`compare.rs` next to `build_compare_table`; replace the nine
mostly-redundant tests with one focused round-trip smoke test that
appends turns to a real ledger and verifies the wrapper produces the
expected shape. SDK surface unchanged — `compare_from_archive` and
`CompareFromArchiveResult` still re-exported from `relayburn_sdk::analyze`.

Closes #347.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c271a84a-bd41-41a8-8288-0a164873e141

📥 Commits

Reviewing files that changed from the base of the PR and between c871a04 and 438c85a.

📒 Files selected for processing (3)
  • crates/relayburn-sdk/src/analyze.rs
  • crates/relayburn-sdk/src/analyze/compare.rs
  • crates/relayburn-sdk/src/analyze/compare_archive.rs
💤 Files with no reviewable changes (1)
  • crates/relayburn-sdk/src/analyze/compare_archive.rs

📝 Walkthrough

Walkthrough

This PR consolidates comparison functionality by moving compare_from_archive and CompareFromArchiveResult from a separate compare_archive.rs module into the main compare.rs file. The public API facade in analyze.rs is updated to re-export from the consolidated location, and the now-empty compare_archive.rs module is deleted.

Changes

Module Consolidation

Layer / File(s) Summary
Core Implementation
crates/relayburn-sdk/src/analyze/compare.rs
Imports Ledger and Query types; adds compare_from_archive() function and CompareFromArchiveResult struct to query turns from a ledger and build comparison tables.
Public API
crates/relayburn-sdk/src/analyze.rs
Declares pub mod compare; and adjusts re-exports to include compare_from_archive, CompareFromArchiveResult, and related symbols from the compare module instead of the old compare_archive module.
Tests & Cleanup
crates/relayburn-sdk/src/analyze/compare.rs
Adds ledger round-trip integration test that writes synthetic TurnRecords, runs compare_from_archive, and asserts on table structure and analyzed_turns metrics.
Module Removal
crates/relayburn-sdk/src/analyze/compare_archive.rs
File deleted; 753 lines of fixture boilerplate and test helpers consolidated into the main compare.rs module.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • AgentWorkforce/burn#314: Extends the SDK's compare API surface by re-exporting the consolidated compare_from_archive and supporting symbols from the compare module, enabling downstream CLI integration.

Poem

🐰 Files merge like burrows, neat and small,
One module now contains it all,
No ledger left behind to roam,
The compare code has found its home!
🏡✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'relayburn-sdk: collapse analyze/compare_archive.rs into compare.rs' accurately summarizes the primary change—consolidating two modules.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for consolidation, what was moved, test strategy, and verifying SDK surface preservation.
Linked Issues check ✅ Passed The PR fully addresses issue #347 objectives: compare_from_archive and CompareFromArchiveResult moved to compare.rs, redundant tests replaced with focused round-trip test, public re-exports maintained in analyze.rs.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to the stated objectives—module consolidation, test simplification, and re-export management with no extraneous modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rust-compare-archive-collapse

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

@willwashburn willwashburn merged commit a9cb84f into main May 7, 2026
8 checks passed
@willwashburn willwashburn deleted the rust-compare-archive-collapse branch May 7, 2026 03:50
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.

Rust hygiene: collapse compare_archive.rs into compare.rs

1 participant