Skip to content

fix(cli): deprecate the ignored --io-yaml option on 'm alora add-readme' - #1865

Open
Seyamalam wants to merge 1 commit into
generative-computing:mainfrom
Seyamalam:fix/1860-deprecate-add-readme-io-yaml
Open

Seyamalam wants to merge 1 commit into
generative-computing:mainfrom
Seyamalam:fix/1860-deprecate-add-readme-io-yaml

Conversation

@Seyamalam

Copy link
Copy Markdown
Contributor

Pull Request

Thanks for sending a pull request! Please make sure you read the contributing guidelines.

Issue

Fixes #1860

Description

m alora add-readme declared --io-yaml and documented it, but never read the value — generate_readme has no parameter for it, so the README was identical with or without the flag and a non-existent path was accepted silently.

This takes the deprecation route from the issue (option 2): the option still parses so scripts that followed the published examples keep working, but the help text and docstring mark it deprecated, and passing a value prints a stderr warning that it is ignored and will be removed in a future release. The --io-yaml flag is also dropped from the two add-readme examples in docs/examples/aLora/README.md (the upload --intrinsic examples keep it — that command consumes the file).

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

The option was declared and documented but never read: the generated
README is identical with or without it, and a non-existent path was
silently accepted. Deprecate it rather than remove it so scripts that
followed the published examples keep working: the help text and
docstring now mark it deprecated, and passing a value prints a warning
that it is ignored and will be removed in a future release. The flag is
also dropped from the add-readme examples in docs/examples/aLora/README.md.

Fixes generative-computing#1860

Assisted-by: Devin
Signed-off-by: Seyamalam <[email protected]>

@planetf1 planetf1 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.

Approving. This is the right size for #1860: the examples and CLI reference told people to pass a flag that did nothing, and now they don't, while existing scripts keep working.

I ran the real CLI with the Hub and README generator stubbed. --io-yaml /definitely/not/here.yaml exits 0 and prints the warning before generation starts, and without the flag there's no warning. Help text and docstring agree. The upload --intrinsic examples correctly keep --io-yaml. test/cli/test_alora_upload.py passes with huggingface_hub installed (9 passed). I also disabled the warning locally and the new test failed, so it does check the warning.

Two optional test additions, neither needed to merge:

  1. The test calls alora_add_readme(...) directly, so it doesn't check that the flag still parses. If someone later removed the typer.Option, it would still pass while m alora add-readme --io-yaml x started failing with "No such option". A CliRunner invocation would cover that.
  2. Nothing checks that the warning is absent when the flag isn't passed, so an unconditional warning would also pass. One capsys assertion on the io_yaml=None case would cover it.

Smaller: the new strings use an em dash, which the other help text in this file doesn't, and the test sits in a file whose docstring is about token lookup.

Separately, the generated README still doesn't use the adapter's real contract. The template calls get_io_contract(name), which falls back to a permissive contract for adapters outside the catalogue. I've opened #1866 to build the README from the real io.yaml, so this PR can stay a consistency fix.

@planetf1

Copy link
Copy Markdown
Contributor

Have just kicked off the workflows. Let me know if you want to make any further changes - optional. If not, I can merge.

@ajbozarth ajbozarth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some feedback from Claude: LGTM, and I agree with the follow-up review's optional test suggestions. One small optional nit inline.



def test_add_readme_io_yaml_warns_it_is_ignored(monkeypatch, capsys):
"""--io-yaml is deprecated in add-readme: it warns and is not forwarded (#1860)."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit (optional): drop the (#1860) from the docstring. None of the other tests here cite an issue, and the PR already records the link.

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: m alora add-readme accepts --io-yaml but never uses it

3 participants