feat: show repartitioning info in validate-restore report#43
feat: show repartitioning info in validate-restore report#43thomasdudek wants to merge 2 commits intoosodevops:mainfrom
Conversation
5b574cd to
9c8ec36
Compare
Display auto-repartitioning details (strategy, source/target partition counts) in the dry-run validation report when repartitioning is configured for a topic. Also rewrites the CLI report printer to use dynamic box width with proper alignment. - Add DryRunRepartitioningInfo struct to manifest types - Populate repartitioning info from restore config in dry_run() - Implement Display for RepartitioningStrategy - Rewrite print_validation_report with dynamic-width box rendering Co-authored-by: Claude <noreply@anthropic.com>
9c8ec36 to
884ef22
Compare
sionsmith
left a comment
There was a problem hiding this comment.
Review: Looks good — approve with minor suggestions
Build verification ✅
cargo build— passescargo test— 89 tests passcargo clippy— clean
What works well ✅
-
Repartitioning info in dry-run — clean addition.
DryRunRepartitioningInfostruct is well-placed,serde(skip_serializing_if)keeps JSON output clean, and theDisplayimpl onRepartitioningStrategyis reusable. -
Dynamic box width — big improvement over the old hardcoded-width approach, which had visible alignment issues (the original
║lines didn't even align — compare the header/separator widths in the old code). The new code sizes the box to content correctly. -
Repartitioning config lookup is correct — uses
get(&target_topic)which matches the config convention (keyed by target topic name perconfig.rs:642). -
#[non_exhaustive]onDryRunTopicReport— good forward-thinking. Since the only construction site is withinkafka-backup-core(same crate), this has no current impact but protects against downstream breakage if the struct gains more fields. -
Correct mapping of source_partitions — uses
topic_backup.partitions.len()(actual source partition count from the backup manifest) rather than a config value.
Minor suggestions (non-blocking)
-
\x01sentinel for centered lines — using a control character as an in-band signal works but is unconventional. A small enum likeenum Line { Centered(String), Left(String) }or aVec<(String, bool)>would be more self-documenting. Not a blocker since it's confined to one function. -
Unicode display width —
chars().count()counts code points, not terminal display columns. Characters like✓,✗,⚠may render as 1 or 2 columns wide depending on the terminal, causing slight box misalignment. A crate likeunicode-widthwould fix this, but it's a pre-existing issue from the old code and only cosmetic. Not worth adding a dependency for. -
Empty separator lines in topics section —
lines.push(String::new())at line 107 renders as a blank row inside the box (║ ║). This is fine aesthetically but slightly unusual. Consider if a visual separator like"─".repeat(...)or just omitting it would look better.
No issues found ✅
No bugs, no correctness problems, no breaking changes. Clean feature addition.
sionsmith
left a comment
There was a problem hiding this comment.
CI failure: #[non_exhaustive] breaks semver check
The Detect Breaking Changes check is failing because #[non_exhaustive] was added to DryRunTopicReport. cargo-semver-checks correctly flags this — adding #[non_exhaustive] to a previously exhaustive public struct is a breaking change (it prevents struct literal construction from outside the crate).
--- failure struct_marked_non_exhaustive: struct marked #[non_exhaustive] ---
struct DryRunTopicReport in manifest.rs:843
Fix
Remove #[non_exhaustive] from DryRunTopicReport in crates/kafka-backup-core/src/manifest.rs:842:
/// Per-topic dry-run report
#[derive(Debug, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
pub struct DryRunTopicReport {It's not needed here — the new repartitioning: Option<DryRunRepartitioningInfo> field already handles forward compatibility naturally (None default, serde skips on serialization). Everything else in the PR looks good.
Changing review from approve to request-changes since CI is blocked on this.
|
Thanks for the thorough review! Addressed suggestions
Empty separator lines — Replaced Unicode display width — Acknowledged as a pre-existing cosmetic issue. Agreed it's not worth adding a dependency for. Regarding
|
|
Thanks for addressing the The Detect Breaking Changes check is still failing though — |
Address PR review feedback: - Replace control character sentinel with a self-documenting BoxLine enum (Left, Centered, Separator variants) - Replace empty line between topics with a visual ─ separator line - Only show separator between topics, not before the first one Co-authored-by: Claude <noreply@anthropic.com>
7225e52 to
9bf2f9f
Compare
I removed it, but like mentioned in the comment above, this unfortunately brings up an other semver issue: this at least is equal to the one you've had in your feature PR https://github.com/osodevops/kafka-backup/actions/runs/22666759032/job/65700335839#step:4:74 |
Display auto-repartitioning details (strategy, source/target partition counts) in the dry-run validation report when repartitioning is configured for a topic. Also rewrites the CLI report printer to use dynamic box width with proper alignment.