fix(cli): exit non-zero from unimplemented commands - #390
Open
kayemkim wants to merge 2 commits into
Open
Conversation
validate, convert, plugin install and plugin remove printed "not yet implemented" to stdout and returned nil, so they exited 0 while doing nothing. In a pipeline such as `ossie validate model.yaml && deploy` that reads as a pass. Each stub now returns an error naming the command, which cobra reports on stderr and main turns into exit 1. Usage is silenced since the arguments were not the problem. Generated-by: Claude Code
The convert case leaves --from and --input set on the shared rootCmd, so a later test running convert without flags would skip the required flag check. Generated-by: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On main,
ossie validateprintsnot yet implementedand exits 0, and so doconvert,plugin installandplugin remove:In a CI step like
ossie validate model.yaml && deploythat is indistinguishable from a pass. #266 reports it forvalidate, and #345 lists all four stubs in its closing note as a likely separate issue.Each stub now returns an error naming the command, which cobra prints on stderr and
mainturns into exit 1:Usage is silenced on this path since the arguments were not the problem;
--helpand-hstill print help and exit 0. The test drives the four invocations throughrootCmd.Execute(), which is whatmainmaps to the exit code, and fails on current main.This overlaps with #349 in two places: the
runPluginInstallbody, and three cases in itsTestArgumentValidation(plugin install foo,plugin install --all,convert --from x --input y) that expect no error and would now get the not-implemented one. Both are mine, so whichever lands second I will rebase, flipping those three to expect the error.Related Issues
Addresses the first item of #266 and the closing note in #345.
Checklist
Specification
core-spec/and follow the existing structureOntology
ontology/are consistent with spec changesConverters
converters/is updated to reflect spec or ontology changesValidation
validation/are updated if the spec changedDocumentation
docs/is updated to reflect any user-facing changesCONTRIBUTING.mdis updated if the contribution process changedExamples
examples/are added or updated for any new spec constructs or converter supportTests
pytest/ CI green)Compliance