Implementation of cli command parameter deprecation#957
Implementation of cli command parameter deprecation#957
Conversation
8b3b405 to
881784b
Compare
There was a problem hiding this comment.
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
deprecatedmetadata block (since/replaced-by/migration) to the CLI reference and schema. - Updated the CLI generator/template to render deprecation warnings into
--helpoutput and to invoke migration hooks. - Introduced a
migrate_journal_partitionmigration 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--helpoutput 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.
881784b to
483151f
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
c8df28a to
7c71d0c
Compare
There was a problem hiding this comment.
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.
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>
…lags Agent-Logs-Url: https://github.com/simplyblock/sbcli/sessions/28456271-261f-4114-9626-af21c11b6437 Co-authored-by: noctarius <1142801+noctarius@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simplyblock/sbcli/sessions/28456271-261f-4114-9626-af21c11b6437 Co-authored-by: noctarius <1142801+noctarius@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simplyblock/sbcli/sessions/28456271-261f-4114-9626-af21c11b6437 Co-authored-by: noctarius <1142801+noctarius@users.noreply.github.com>
Agent-Logs-Url: https://github.com/simplyblock/sbcli/sessions/28456271-261f-4114-9626-af21c11b6437 Co-authored-by: noctarius <1142801+noctarius@users.noreply.github.com>
…s not-provided-explicitly
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| 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) |
| items: | ||
| minItems: 2 |
There was a problem hiding this comment.
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.
| items: | |
| minItems: 2 | |
| minItems: 2 | |
| items: |
This PR implements a standard way to provide deprecation for sbctl command parameters, with the example of
--journal-partition->--enable-journal-device.