Conversation
Mpdreamz
left a comment
There was a problem hiding this comment.
I am not sure about this one.
If command line conflicts with config we should make this an error.
In my head someone will only call this manually with commandline flags on rare occasions. They should not be able to create bundles that conflict with the config IMO
I agree that the command-line invocations will hopefully become rare and for the automated scenarios we want teams to set their options in the configuration file for consistency. I think there's still a use case for creating one-off bundles, however (even if just for testing purposes as I was doing). I don't think it's good practice to require them to update the (shared) configuration file just to accomplish their exceptional goals. |
Summary
While testing #2773 I discovered that the
bundle.resolvein the changelog configuration file was overruling thedocs-builder changelog bundlecommand option--no-resolve.This PR fixes that behaviour so that the command options have precedence over the config options.
Steps to test
I tested this PR against files in elastic/kibana#250840
bundle.resolvesetting. For example:--no-resolveoption. For example:Before this PR, the command-line option was ignored and the bundle was created with resolved details, for example:
With this PR fix, the command line option is heeded. For example:
Implemention details
src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.csBundleChangelogsArguments.Resolve:bool→bool?sonull(unspecified),true(--resolve), andfalse(--no-resolve) are all distinguishable.ApplyConfigDefaults:input.Resolve || config.Bundle.Resolve→input.Resolve ?? config.Bundle.Resolve— uses??so an explicitfalsefrom the CLI is never overridden by the config.BuildBundlecall site:input.Resolve→input.Resolve ?? false— safe fallback when no config and no CLI flag.src/tooling/docs-builder/Commands/ChangelogCommand.csResolve = shouldResolve ?? false→Resolve = shouldResolve— preservesnull(unspecified) soApplyConfigDefaultscan apply the config value when the user doesn't pass either--resolveor--no-resolve.tests/Elastic.Changelog.Tests/Changelogs/BundleChangelogsTests.csBundleChangelogs_WithExplicitResolveFalse_OverridesConfigResolveTrue: setsresolve: truein config, passesResolve = falseto the service, and asserts the bundle contains only a file reference (not inlined content).Generative AI disclosure
Tool(s) and model(s) used: composer-1.5, claude-4.6-sonnet-medium