Skip to content

fix(cli): pass --root and --node on to the decomposedfs metadata subcommands - #4087

Open
asaah262 wants to merge 1 commit into
opencloud-eu:mainfrom
asaah262:fix/4083-decomposedfs-metadata-flags
Open

asaah262 wants to merge 1 commit into
opencloud-eu:mainfrom
asaah262:fix/4083-decomposedfs-metadata-flags

Conversation

@asaah262

Copy link
Copy Markdown
Contributor

Description

opencloud decomposedfs metadata dump|get|set rejected --root and --node with unknown flag, so the commands couldn't be used at all. The flags are now persistent flags of metadata, so the subcommands inherit them.

  • --root and --node are defined with PersistentFlags() and marked required with MarkPersistentFlagRequired(), instead of Flags() / MarkFlagRequired(), which only applied to metadata itself.
  • New test TestMetadataCommands runs dump, get and set with the flags after and before the subcommand, with the short flags -r / -n, and without --root or --node.

Related Issue

Motivation and Context

The commands broke with the migration from urfave/cli to cobra in 56324ca: urfave/cli let subcommands read the flags of their parent, cobra's Flags() doesn't. See #4083 for the details.

How Has This Been Tested?

  • test environment: macOS, Go tests and the built opencloud binary
  • go test -race ./opencloud/pkg/command/: the 15 new cases fail without the fix (unknown flag: --root) and pass with it
  • built binary on a small decomposed storage with one node: dump prints its metadata, get -a user.demo prints one attribute, set changes it
  • without --root: required flag(s) "root" not set

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the code, the tests and this description; I reviewed and adjusted them.

…ommands

Assisted-by: Claude Code:claude-opus-5-5
@codacy-production

codacy-production Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity

Metric Results
Complexity 10

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.05% coverage variation

Metric Results
Coverage variation ✅ +0.05% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (43211c1) 94312 28356 30.07%
Head commit (4f92565) 94313 (+1) 28403 (+47) 30.12% (+0.05%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4087) 5 5 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@asaah262
asaah262 requested a review from pbleser-oc November 20, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: opencloud decomposedfs metadata dump|get|set reject --root and --node

1 participant