Skip to content

fix: preserve object storage secret keys in table output - #944

Open
pcbeingused333 wants to merge 2 commits into
linode:devfrom
pcbeingused333:fix/object-storage-key-truncation
Open

pcbeingused333 wants to merge 2 commits into
linode:devfrom
pcbeingused333:fix/object-storage-key-truncation

Conversation

@pcbeingused333

Copy link
Copy Markdown

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 and ASCII table 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 that secret_key is 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.py

The 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).

@pcbeingused333
pcbeingused333 requested review from a team as code owners November 9, 2026 01:41
@pcbeingused333
pcbeingused333 requested review from mawilk90 and zliang-akamai and removed request for a team November 9, 2026 01:41
@zliang-akamai
zliang-akamai requested a max review from Copilot November 11, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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-create overrides 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

Comment thread linodecli/overrides.py
Comment on lines +62 to +71
@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

This branch has not been deployed

No deployments
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.

[Bug]: object-storage keys-create not displaying keys on small terminals

2 participants