Skip to content

Implementation of cli command parameter deprecation#957

Open
noctarius wants to merge 11 commits intomainfrom
deprecated-parameters
Open

Implementation of cli command parameter deprecation#957
noctarius wants to merge 11 commits intomainfrom
deprecated-parameters

Conversation

@noctarius
Copy link
Copy Markdown
Collaborator

This PR implements a standard way to provide deprecation for sbctl command parameters, with the example of --journal-partition -> --enable-journal-device.

@noctarius noctarius self-assigned this Apr 13, 2026
Copilot AI review requested due to automatic review settings April 13, 2026 15:04
@noctarius noctarius force-pushed the deprecated-parameters branch 3 times, most recently from 8b3b405 to 881784b Compare April 13, 2026 15:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a structured deprecation mechanism for sbctl CLI parameters (warning text + optional runtime migration), demonstrated by deprecating --journal-partition in favor of --enable-journal-device.

Changes:

  • Added a deprecated metadata block (since/replaced-by/migration) to the CLI reference and schema.
  • Updated the CLI generator/template to render deprecation warnings into --help output and to invoke migration hooks.
  • Introduced a migrate_journal_partition migration and simplified journal partition selection logic.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
simplyblock_cli/scripts/cli-wrapper.jinja2 Injects deprecation warning into help text and emits per-parameter migration hook calls.
simplyblock_cli/scripts/cli-wrapper-gen.py Adds apply_deprecated_warning Jinja filter and registers it with the generator environment.
simplyblock_cli/clibase.py Simplifies journal partition selection and adds migrate_journal_partition migration function.
simplyblock_cli/cli.py Regenerated CLI with updated help text and migration hook invocation.
simplyblock_cli/cli-reference.yaml Adds deprecated metadata for --journal-partition and adjusts various help strings.
simplyblock_cli/cli-reference-schema.yaml Extends schema to allow deprecated metadata on arguments/parameters.
Comments suppressed due to low confidence (2)

simplyblock_cli/cli.py:779

  • Help text has an unmatched opening parenthesis: Migration deadline in seconds (0 = no deadline... is missing a closing ) (and likely should end with a period). This affects --help output readability.
        argument = subcommand.add_argument('--deadline', help='Migration deadline in seconds (0 = no deadline. Default: `14400`.', type=int, default=14400, dest='deadline_seconds')

simplyblock_cli/cli-reference.yaml:1966

  • Help text has an unmatched opening parenthesis: Migration deadline in seconds (0 = no deadline... is missing a closing ) (and likely should end with a period). This will propagate into the generated CLI help output.
            help: "Migration deadline in seconds (0 = no deadline. Default: `14400`."

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread simplyblock_cli/clibase.py Outdated
Comment thread simplyblock_cli/scripts/cli-wrapper.jinja2 Outdated
Comment thread simplyblock_cli/cli.py Outdated
Comment thread simplyblock_cli/cli.py
Comment thread simplyblock_cli/cli-reference.yaml
Comment thread simplyblock_cli/cli-reference-schema.yaml Outdated
@noctarius noctarius force-pushed the deprecated-parameters branch from 881784b to 483151f Compare April 13, 2026 15:19
noctarius and others added 3 commits April 20, 2026 09:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread simplyblock_cli/cli-reference-schema.yaml Outdated
Comment thread simplyblock_cli/clibase.py Outdated
Comment thread simplyblock_cli/scripts/cli-wrapper.jinja2
Comment thread simplyblock_cli/scripts/cli-wrapper.jinja2 Outdated
Comment thread simplyblock_cli/scripts/cli-wrapper-gen.py
noctarius and others added 3 commits April 20, 2026 10:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@simplyblock simplyblock deleted a comment from Copilot AI Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if not found:
raise ValueError(f"replaced-by parameter '{replaced_by}' not found in parameters")

item.pop("default", None)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

validate_deprecated_parameters() unconditionally removes default from every deprecated parameter (item.pop("default", None)). This changes CLI semantics for deprecated options that are intended to remain functional without a migration/replacement (or where the handler code still relies on the deprecated option’s default), because argparse will now yield None instead of the previous default when the user does not pass the flag. Consider only stripping default when a migration hook is configured (and/or when replaced-by is present), or alternatively enforce via schema/validation that deprecated parameters must define a replacement+migration so dropping defaults can’t silently change behavior.

Suggested change
item.pop("default", None)
# Only strip the default when the deprecated parameter has a
# defined replacement. Deprecated parameters without a
# replacement must keep their defaults to avoid changing CLI
# behavior for callers that do not pass the option.
item.pop("default", None)

Copilot uses AI. Check for mistakes.
Comment on lines +301 to +302
items:
minItems: 2
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

In the JSON schema for choices, minItems: 2 is currently nested under items. In JSON Schema, minItems applies to the array itself, so this placement won’t enforce a minimum number of choices. Move minItems to be a sibling of items within choices so the constraint matches the description.

Suggested change
items:
minItems: 2
minItems: 2
items:

Copilot uses AI. Check for mistakes.
Comment thread simplyblock_cli/clibase.py
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.

3 participants