Skip to content

fix(3197): fix youki version command Part of Enhancing Compatibility with runc#3200

Merged
utam0k merged 4 commits intoyouki-dev:mainfrom
tommady:close-issue-3197
Aug 25, 2025
Merged

fix(3197): fix youki version command Part of Enhancing Compatibility with runc#3200
utam0k merged 4 commits intoyouki-dev:mainfrom
tommady:close-issue-3197

Conversation

@tommady
Copy link
Collaborator

@tommady tommady commented Jul 20, 2025

Description

Fix Youki version command
This is Part of Enhancing Compatibility with runc

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)
./target/debug/youki -v                                                                                                                                  
youki version: 0.5.4                                                                                                                                          
commit: 0.5.4-81806f8a9175bbed7cb176cb66f527ff89a187ac    

Related Issues

Fixes #3197

Additional Context

@utam0k utam0k requested a review from Copilot July 21, 2025 04:19
Copy link
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

This PR fixes the youki version command to enhance compatibility with runc by updating the version output format and command-line interface behavior. The changes ensure that youki -v or youki --version produces output in a Moby-compatible format.

  • Modified CLI argument parsing to handle version flag separately instead of using a macro
  • Updated version output format to match Moby/runc compatibility requirements
  • Changed subcommand handling to be optional and display help when no subcommand is provided

Reviewed Changes

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

File Description
crates/youki/src/main.rs Updated CLI parsing to add explicit version flag handling and made subcommands optional
crates/youki/src/commands/info.rs Modified version output format to be Moby-compatible


#[clap(subcommand)]
subcmd: SubCommand,
subcmd: Option<SubCommand>,
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

Making subcmd optional changes the CLI behavior significantly. Consider if this is the intended breaking change, as users who previously relied on subcommands being required may experience different behavior.

Suggested change
subcmd: Option<SubCommand>,
subcmd: SubCommand,

Copilot uses AI. Check for mistakes.
}
None => Opts::command()
.print_help()
.map_err(|e| anyhow::anyhow!(":{e}")),
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

The error message format ":{e}" has an unusual leading colon. Consider using a more descriptive format like "Failed to print help: {e}".

Suggested change
.map_err(|e| anyhow::anyhow!(":{e}")),
.map_err(|e| anyhow::anyhow!("Failed to print help: {e}")),

Copilot uses AI. Check for mistakes.
@utam0k
Copy link
Member

utam0k commented Jul 21, 2025

@saku3 May I ask you to review this P?

@saku3
Copy link
Member

saku3 commented Jul 21, 2025

Sure!

Some(SubCommand::Completion(completion)) => {
commands::completion::completion(completion, &mut app)
}
None => Opts::command()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
None => Opts::command()
None => app.print_help().map_err(|e| anyhow::anyhow!(":{e}"))

Signed-off-by: tommady <[email protected]>
@saku3
Copy link
Member

saku3 commented Jul 26, 2025

Thanks. I think this modification looks good.

@utam0k
Copy link
Member

utam0k commented Aug 5, 2025

Could you add the tests to keep this compatibility with runc?

Signed-off-by: tommady <[email protected]>
@tommady
Copy link
Collaborator Author

tommady commented Aug 6, 2025

Could you add the tests to keep this compatibility with runc?

sorry I am not quite sure how, could you guide me?

I thought the issue's goal is to let youki accept -v instead of -V

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Aug 7, 2025

sorry I am not quite sure how, could you guide me?
I thought the issue's goal is to let youki accept -v instead of -V

Hey, so that is correct, utam0k is asking to add test, so we can be safe against regression with this. The test for this would be running youki with -v . So in the test we can run the youki with -v flag and make sure that it does not error, and if we want the o/p in a certain format, we can also check that. Currently the best place for this kind of test would be in the e2e tests, but this seems a bit out-of-context for that (e2e are focused on behavioral , this seems more like an interface test) . Maybe for now we can have a simple sh script like what we have for rootless podman test, and check in that?

Also do should we support -V as well for backward compatibility?
Can you add a comment in code for why we set disable_version_flag=true ?

Thanks :)

@tommady
Copy link
Collaborator Author

tommady commented Aug 7, 2025

sorry I am not quite sure how, could you guide me?

I thought the issue's goal is to let youki accept -v instead of -V

Hey, so that is correct, utam0k is asking to add test, so we can be safe against regression with this. The test for this would be running youki with -v . So in the test we can run the youki with -v flag and make sure that it does not error, and if we want the o/p in a certain format, we can also check that. Currently the best place for this kind of test would be in the e2e tests, but this seems a bit out-of-context for that (e2e are focused on behavioral , this seems more like an interface test) . Maybe for now we can have a simple sh script like what we have for rootless podman test, and check in that?

Also do should we support -V as well for backward compatibility?

Can you add a comment in code for why we set disable_version_flag=true ?

Thanks :)

I think you’ve highlighted two key points:
1. Should we maintain backward compatibility?
2. What should the testing strategy be?

These two directly affect your suggestions:
1. For e2e, shell script, and interface tests, they all rely on exact output matching. Without that, we lack a clear criterion for validation. However, I believe that level of thoroughness goes beyond the scope of this issue.
2. Regarding the disable_version_flag=true comment—whether or not we add it depends on the decision about backward compatibility.
• If we decide to support backward compatibility, the comment might not be necessary.
• If we don’t, this becomes a breaking change and should be mentioned in the release notes.
• Also, since it’s a Clap-only argument, I assumed it was already documented sufficiently.

In any case, I think we should keep this PR simple and focused, as requested by the original issue.

@utam0k
Copy link
Member

utam0k commented Aug 10, 2025

  1. Should we maintain backward compatibility?

In my opinion, we don't need backward compatibility in this case. Not many people currently depend on this behavior.

  1. What should the testing strategy be?

After reading YJDoc's comments, I reconsidered. I don't think it's necessary to test using new methods. I vote against no testing.

@tommady
Copy link
Collaborator Author

tommady commented Aug 11, 2025

  1. Should we maintain backward compatibility?

In my opinion, we don't need backward compatibility in this case. Not many people currently depend on this behavior.

  1. What should the testing strategy be?

After reading YJDoc's comments, I reconsidered. I don't think it's necessary to test using new methods. I vote against no testing.

Do you think the manual test is OK for you?

@utam0k
Copy link
Member

utam0k commented Aug 11, 2025

Do you think the manual test is OK for you?

Yes, I think, but wait for @YJDoc2

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Aug 16, 2025

Hey, I'm also fine with manual test for this.

@utam0k utam0k merged commit 8bd3f38 into youki-dev:main Aug 25, 2025
30 checks passed
@github-actions github-actions bot mentioned this pull request Aug 25, 2025
@tommady tommady deleted the close-issue-3197 branch August 26, 2025 04:12
sat0ken pushed a commit to sat0ken/youki that referenced this pull request Mar 17, 2026
…with runc (youki-dev#3200)

* fix(3197): fix youki version command Part of Enhancing Compatibility with runc

Signed-off-by: tommady <[email protected]>

* fix copilot review on print help suggestion

Signed-off-by: tommady <[email protected]>

* address command

Signed-off-by: tommady <[email protected]>

* address comment

Signed-off-by: tommady <[email protected]>

---------

Signed-off-by: tommady <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

youki version command

5 participants