Skip to content

Fix completions to obey customized profile directories - #883

Open
Speedy1894 wants to merge 2 commits into
redhat-performance:masterfrom
Speedy1894:completion-differing-profiles
Open

Fix completions to obey customized profile directories#883
Speedy1894 wants to merge 2 commits into
redhat-performance:masterfrom
Speedy1894:completion-differing-profiles

Conversation

@Speedy1894

@Speedy1894 Speedy1894 commented Aug 22, 2026

Copy link
Copy Markdown

Instead of only the old directories, /usr/lib/tuned/profiles,/etc/tuned/profiles, use the profile_dir option in the configuration file (the default being the old constant value) or /usr/lib/tuned,/etc/tuned if on a version of tuned that doesn't support it.

Fixes #881

Each subcommand and its corresponding options can be completed. This includes tuning profiles, but does not include devices, instances, or plugins.

It took a while to figure out that `-A '-*'` is needed for the first invocation of `_arguments` to prevent collisions between the different levels of arguments.

Signed-off-by: Speedy1894 <speedy1894@duck.com>
Instead of only the old directories, `/usr/lib/tuned/profiles,/etc/tuned/profiles`, use the `profile_dir` option in the configuration file (the default being the old constant value) or `/usr/lib/tuned,/etc/tuned` if on a version of `tuned` that doesn't support it.

Fixes redhat-performance#881

Signed-off-by: Speedy1894 <speedy1894@duck.com>
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ff30a84-0820-4f5f-9fd0-73f1641e1f86

📥 Commits

Reviewing files that changed from the base of the PR and between a4907c9 and 38243d1.

📒 Files selected for processing (5)
  • Makefile
  • tuned-adm.bash
  • tuned-adm.zsh
  • tuned.spec
  • tuned.zsh

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added Zsh tab-completion support for tuned and tuned-adm.
    • Completions include available profiles, commands, options, and log levels.
    • Profile suggestions adapt to the installed Tuned version and configured profile locations.
  • Installation
    • Zsh completion files are now included in release packages and installed automatically in the system completion directory.

Walkthrough

Adds Zsh completion support for tuned and tuned-adm. Completion discovers profiles from Tuned versions and optional configuration. Build and package installation now include the Zsh completion scripts.

Changes

Zsh completion support

Layer / File(s) Summary
Profile discovery across shells
tuned-adm.bash, tuned-adm.zsh, tuned.zsh
Completion helpers select profile directories based on the Tuned version and optional profile_dirs configuration. Bash profile completion uses the shared helper.
Zsh command completion
tuned-adm.zsh, tuned.zsh
Zsh definitions add global options, subcommands, argument specifications, log-level values, and dynamic profile completion.
Archive and package installation
Makefile, tuned.spec
Release archives and the main package include both Zsh completion files. Installation places them in the system Zsh completion directory.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 38243

The completion changes introduce no actionable merge-blocking risk based on the available evidence and are merge-ready after normal checks and review.

Suggested reviewers: yarda

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant Zsh
  participant TunedConfig
  participant ProfileDirectories
  Developer->>Zsh: request tuned completion
  Zsh->>TunedConfig: read profile_dirs when supported
  Zsh->>ProfileDirectories: list available profiles
  ProfileDirectories-->>Zsh: return profile names
  Zsh-->>Developer: show command and profile completions
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (2 skipped: 2 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the primary change to make completion profile discovery respect customized profile directories.
Description check ✅ Passed The description explains the profile directory fallback behavior and links the change to issue #881.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Speedy1894 Speedy1894 changed the title completion differing profiles Fix completions to obey customized profile directories Aug 22, 2026
@Speedy1894

Speedy1894 commented Aug 22, 2026

Copy link
Copy Markdown
Author

(The completion-adding commit is here because that branch is a parent of this one — sorry if I should've put the second commit on top of it)

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.

Completion scripts should obey the default or customized profile directory

1 participant