Repository navigation
fix: preserve object storage secret keys in table output - #944
pcbeingused33 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Markdown output still truncates the one-time object-storage secret key in narrow terminals because it lacks a truncation-disabling override.
1 open issue
What changed in this PR
This PR addresses #825 by preserving one-time Object Storage secret keys in table and ASCII table output, using the CLI’s existing nontruncating renderer.
Changes:
- Adds
keys-createoverrides that fold long values instead of truncating them. - Adds narrow-terminal tests for complete creation output and unchanged listing behavior.
- Documents the action-specific output behavior.
| File | Description |
|---|---|
tests/unit/test_overrides.py |
Tests key creation and listing output at 28 columns in both table modes. |
linodecli/overrides.py |
Disables truncation for object-storage keys-create in table and ASCII table modes. |
AGENTS.md |
Documents preservation of the one-time secret key. |
Review effort: Max
| @output_override("object-storage", "keys-create", OutputMode.ascii_table) | ||
| def handle_object_storage_keys_create_ascii( | ||
| operation, output_handler, json_data | ||
| ) -> bool: | ||
| # pylint: disable=unused-argument | ||
| """ | ||
| Preserve the complete secret key in ASCII table output as well. | ||
| """ | ||
| output_handler.disable_truncation = True | ||
| return True |
There was a problem hiding this comment.
Added the OutputMode.markdown override and extended the narrow-terminal test to cover it. The AGENTS.md note was removed rather than updated, per review.
This comment was drafted with Claude Code.
|
Friendly ping: could someone take a look at this when there's time? I'm happy to adjust anything. Thanks! |
| - `linodecli/configuration/` owns config loading, interactive configuration, OAuth token flow, env token handling, and API URL overrides. | ||
| - `linodecli/plugins/` contains hand-written commands outside the generated OpenAPI surface. If you add or change a plugin, read `linodecli/plugins/README.md` for the `call(args, context)` interface and third-party `PLUGIN_NAME` requirement. | ||
| - If you touch `linodecli/baked/*.py`, read `linodecli/baked/AGENTS.md` first. Key constraint: baked model state must stay pickle-safe. | ||
| - The table and ASCII table output overrides for `object-storage keys-create` disable truncation so the one-time secret key is displayed in full. |
There was a problem hiding this comment.
IMO it does not match here. Code Map documents rather repository structure than command-specific behavior
There was a problem hiding this comment.
Agreed, removed the note from the Code Map.
This comment was drafted with Claude Code.
Also drop the AGENTS.md Code Map note, as requested in review. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Fixes #825
📝 Description
What does this PR do and why is this change necessary?
The default table renderer uses ellipsis when a value exceeds the terminal width. For
object-storage keys-create, this can discard part of the secret key that is only returned at creation time.Add action-specific table, ASCII table and Markdown output overrides that enable the existing nontruncating renderer. Long keys fold across lines, preserving every character. Other actions retain their existing output behavior.
✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
Run
linode-cli object-storage keys-create --label <label>in a narrow terminal and check thatsecret_keyis shown in full, folded across lines.How do I run the relevant unit/integration tests?
LINODE_CLI_TEST_MODE=1 XDG_CONFIG_HOME=$(mktemp -d) pytest tests/unit/test_overrides.py tests/unit/test_output.pyThe tests render through the response dispatch at a terminal width of 28 columns, checking complete key creation output and unchanged truncation for key listing. No live API call was made.
This change was prepared with AI assistance (Codex).