Skip to content

Few more fixes by Claude#1188

Merged
vojtechtrefny merged 3 commits intostoraged-project:masterfrom
vojtechtrefny:master_claude-fixes-3
Mar 26, 2026
Merged

Few more fixes by Claude#1188
vojtechtrefny merged 3 commits intostoraged-project:masterfrom
vojtechtrefny:master_claude-fixes-3

Conversation

@vojtechtrefny
Copy link
Copy Markdown
Member

@vojtechtrefny vojtechtrefny commented Mar 25, 2026

Looks like we might have finally fixed all (or at least most of) the issues

Summary by CodeRabbit

  • Bug Fixes

    • Fixed incorrect region filtering in namespace listing when specifying a region name, ensuring proper namespace inclusion/exclusion.
  • Chores

    • Updated swap technology mode constants for improved API consistency.
    • Corrected partition UUID test assertions for better test accuracy.

vojtechtrefny and others added 3 commits March 25, 2026 13:04
BD_SWAP_TECH_MODE_SET_UUID had the same value (1 << 3) as
BD_SWAP_TECH_MODE_SET_LABEL making it impossible to distinguish
between label and UUID capability checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The region filter was comparing bus_name against the region device
name instead of region_name, so filtering by region never worked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test for setting UUID on MSDOS partition table was calling
part_set_part_name instead of part_set_part_uuid. The test passed
because MSDOS doesn't support partition names either, but it
wasn't actually testing UUID functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

The PR makes three distinct changes: (1) Updates the bitmask value for BD_SWAP_TECH_MODE_SET_UUID in swap API files, separating it from the label flag; (2) Fixes region filtering logic in NVDIMM namespace listing; (3) Corrects a test case for partition UUID operations.

Changes

Cohort / File(s) Summary
Swap Technology Mode Bitmask Updates
src/lib/plugin_apis/swap.api, src/plugins/swap.h
Changed BD_SWAP_TECH_MODE_SET_UUID constant value from 1 << 3 to 1 << 4, separating it from BD_SWAP_TECH_MODE_SET_LABEL which retains 1 << 3. This affects how mode flags are composed and interpreted by callers.
NVDIMM Region Filtering Fix
src/plugins/nvdimm.c
Fixed region-filtering condition in bd_nvdimm_list_namespaces to compare the provided region_name argument against ndctl_region_get_devname(region) instead of incorrectly comparing bus_name.
Partition UUID Test Correction
tests/part_test.py
Updated test assertion comment from "no name" to "no uuid" and replaced the function call inside assertRaises(GLib.GError) from part_set_part_name to part_set_part_uuid to align with the UUID test scenario.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "Few more fixes by Claude" is vague and generic, using non-descriptive language that fails to convey what specific changes were made in the changeset. Revise the title to reflect the main fixes included: consider something like "Fix enum collision in BDSwapTechMode and region filtering in nvdimm" to be more descriptive of the actual changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/plugins/swap.h`:
- Around line 29-30: The enum renumbering changed public ABI: restore the
original bit values for BD_SWAP_TECH_MODE_SET_LABEL and
BD_SWAP_TECH_MODE_SET_UUID in swap.h so existing binaries continue to pass the
same integer flags to bd_swap_is_tech_avail(); do not change assigned bit-shifts
for BDSwapTechMode values, or if you must change them, add a compatibility layer
that accepts the old bit values and maps them to the new ones and update the
SONAME/soversion (and document the incompatibility in release notes) so callers
are not silently misinterpreted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 022bdc7b-82f4-432f-bf02-17736c7fa18d

📥 Commits

Reviewing files that changed from the base of the PR and between ef1c698 and a4cdb58.

📒 Files selected for processing (4)
  • src/lib/plugin_apis/swap.api
  • src/plugins/nvdimm.c
  • src/plugins/swap.h
  • tests/part_test.py

Comment on lines 29 to +30
BD_SWAP_TECH_MODE_SET_LABEL = 1 << 3,
BD_SWAP_TECH_MODE_SET_UUID = 1 << 3,
BD_SWAP_TECH_MODE_SET_UUID = 1 << 4,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== References to the public flag and ABI boundary =="
rg -n -C2 '\b(BDSwapTechMode|BD_SWAP_TECH_MODE_SET_UUID|bd_swap_is_tech_avail\s*\()' .

echo
echo "== Build/install/versioning metadata =="
rg -n -C2 'swap\.h|swap\.api|install_headers|gnome\.generate_gir|soversion|version-info|LT_VERSION|current:revision:age' \
  -g 'meson.build' -g 'configure.ac' -g 'Makefile.am' -g '*.pc.in' -g '*.map' -g '*.symbols' -g '*.gir' .

Repository: storaged-project/libblockdev

Length of output: 15170


This enum renumbering breaks the public ABI.

swap.h is installed as public API (Makefile.am:175), and BDSwapTechMode values are compiled directly into client binaries. Renumbering BD_SWAP_TECH_MODE_SET_UUID from 1 << 3 to 1 << 4 means old clients will pass 1 << 3 to bd_swap_is_tech_avail(), which the updated library now silently interprets as BD_SWAP_TECH_MODE_SET_LABEL. This corrupts the operation without error. Pair this with a soversion bump (currently -version-info 3:0:0) and/or a compatibility release note.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/plugins/swap.h` around lines 29 - 30, The enum renumbering changed public
ABI: restore the original bit values for BD_SWAP_TECH_MODE_SET_LABEL and
BD_SWAP_TECH_MODE_SET_UUID in swap.h so existing binaries continue to pass the
same integer flags to bd_swap_is_tech_avail(); do not change assigned bit-shifts
for BDSwapTechMode values, or if you must change them, add a compatibility layer
that accepts the old bit values and maps them to the new ones and update the
SONAME/soversion (and document the incompatibility in release notes) so callers
are not silently misinterpreted.

@vojtechtrefny vojtechtrefny merged commit 9a82a23 into storaged-project:master Mar 26, 2026
50 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.

2 participants