Repository navigation
feat!: remove allowArbitraryFlags parse override - #432
Merged
Merged
Conversation
Remove the Command.parse() override gated behind allowArbitraryFlags, along with the allowArbitraryFlags instance property and the yargs-parser / yargs-unparser (and @types) dependencies that only it used. The override existed solely to rescue a long-deprecated input style for heroku addons:create — passing arbitrary add-on config flags WITHOUT the '--' end-of-options separator (deprecated in changelog item 2925). The supported '--' syntax does not depend on this code: with 'static strict = false', tokens after '--' already flow into argv for the command to read. The override was also fragile: it round-tripped argv through yargs-parser and yargs-unparser, which coerces types (e.g. 1.20 -> 1.2, --flag=false -> --no-flag) and mangles flag names (camelCase/dot/short-flag expansion), and it was untested in this library. BREAKING CHANGE: Command#allowArbitraryFlags and the result.nonExistentFlags field it produced are removed. Commands that passed arbitrary flags without a '--' separator must now use the '--' end-of-options separator. heroku/cli's addons:create must be updated in the same release to stop setting allowArbitraryFlags and reading nonExistentFlags.
The packed-consumer contract forbade any dependency removal versus the authoritative baseline. Removing the allowArbitraryFlags override dropped yargs-parser and yargs-unparser, tripping that check. Mirror the existing intentionalPackageAdditions / intentionalDependencyChanges pattern with an intentionalPackageRemovals allow-list so the intentional removal passes while unexpected removals still fail.
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
Removes the
Command.parse()override gated behindallowArbitraryFlags, theallowArbitraryFlagsinstance property, the now-unusedCLIErrorimport, and theyargs-parser/yargs-unparser(+@types) dependencies that only it used.The override existed solely to rescue a long-deprecated input style for
heroku addons:create— passing arbitrary add-on config flags without the--end-of-options separator (deprecated in changelog item 2925). The supported--syntax does not depend on this code: withstatic strict = false, tokens after--already flow intoargvfor the command to read via its ownparseConfig().It was also fragile and untested in this library: it round-tripped
argvthroughyargs-parser→yargs-unparser, which coerces types (e.g.1.20→1.2,--flag=false→--no-flag) and mangles flag names (camelCase/dot/short-flag expansion).A sweep of all local Heroku repos and bundled plugins found exactly one consumer:
heroku/cli'saddons:create.Type of Change
Breaking Changes (major semver update)
!after your change type to denote a change that breaks current behaviorfeat!—Command#allowArbitraryFlagsand theresult.nonExistentFlagsfield it produced are removed from the published type. Commands that passed arbitrary flags without a--separator must now use the--end-of-options separator.Important
Coordinated change required.
heroku/cli'saddons:createmust be updated in the same release to stop settingallowArbitraryFlagsand readingnonExistentFlags, and to drop its deprecated-syntax test case. Its existingparseConfig(argv)already handles the supported--tokens, so command behavior is unchanged. This PR targets thev14.0.0branch (unreleased).Testing
Notes: This is a library change with no runnable command of its own, so manual verification is done through its one consumer,
heroku/cli'saddons:create. Link this branch into a localheroku/clicheckout first:Then run the commands below from the
clicheckout with./bin/run.js.Steps:
--syntax still passes config through — run against an app you control:./bin/run.js addons:create heroku-postgresql:essential-0 -a <your-app> -- --fork <SOURCE_DB_URL_OR_NAME>→ the add-on provisions and the
--forkconfig reaches the provider; no parse error and no deprecation warning.--:./bin/run.js addons:create heroku-postgresql:essential-0 -a <your-app> --fork <SOURCE_DB_URL_OR_NAME>→ the CLI now exits with a
Nonexistent flag: --forkerror, instead of the old "deprecated syntax" warning + silently working. (This error happens before any API call, so no add-on is created.)./bin/run.js addons:create heroku-redis:mini -a <your-app>provisions normally.CI also runs the full lint/build/unit suite on this branch.
Related Issues
GitHub issue: N/A
GUS work item: W-24461070