Skip to content

Warn about config-local setting overrides - #811

Merged
helly25 merged 1 commit into
mainfrom
config/reject-duplicate-settings
Sep 11, 2026
Merged

helly25 merged 1 commit into
mainfrom
config/reject-duplicate-settings

Conversation

@helly25

@helly25 helly25 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Warn when one logical configuration section overrides its own setting, while preserving the existing last-value-wins result. This catches likely copy/paste leftovers without interfering with deliberate command-line overrides, config-tier precedence, expression repetition, or options that accumulate.

AG;DR

  • Add registry-backed repetition semantics for every global option:
    • overriding settings use the default last-value-wins behavior;
    • accumulating settings such as --exclude, --summary, and --config stack without a notice;
    • keyed settings such as --define=NAME=VALUE and inline --pack-option=NAME=VALUE accumulate different names but report a repeated name.
  • Add LookupGlobalArgument to canonicalize full valued, aliased, sign-suffixed, attached-short, and compatibility spellings to their global registry entry; make IsKnownGlobal use that same lookup.
  • Inspect automatic system and user config plus explicitly selected xffrc files, grouping repeated physical lines by their logical selector section.
  • Treat positive and negative forms, and canonical names and aliases, as one overriding setting.
  • Respect primary arity, variadic command argument runs, and --, so expression matchers/actions and their arguments are never mistaken for global settings.
  • Emit a warning for a section-local override and retain both values in resolution order, preserving the established last-value-wins behavior.
  • Do not inspect command-line repetition. Overrides between config sections, files, tiers, and the CLI remain intentional precedence boundaries.
  • Keep structurally unique config-only policy controls under their existing hard-error validator.
  • Document the diagnostic in generated config help and regenerate XFF.md.
  • Update the 0.4.0 changelog for this diagnostic and add the previously omitted compare-path-encoding and mixed-policy-class fixes found by auditing every commit since v0.3.7.
  • Address CI clang-tidy's hicpp-use-emplace finding in the keyed-setting test.

Validation:

  • bazel test //... --config=clang
  • bazel test //xff/cli:config_validation_test //xff/cli:globals_test //xff/cli:explain_test //xff/cli:xff_markdown_test --config=xff_docs --config=clang
  • bazel test //xff/cli:config_validation_test --config=clang after the clang-tidy fix
  • focused pre-commit checks for all changed files
  • git diff --check
  • Clang-tidy is intentionally left to CI because the current local machine configuration cannot sustain it.

@helly25
helly25 force-pushed the config/reject-duplicate-settings branch from aea0626 to 93fafb5 Compare September 11, 2026 13:53
@helly25
helly25 merged commit ae803eb into main Sep 11, 2026
15 checks passed
@helly25
helly25 deleted the config/reject-duplicate-settings branch September 11, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant