feat(config): load config + --explain effective-config dump (phase B5a) - #96
Merged
Conversation
Fifth slice of the config loader (#58), per docs/design-config.md, phase B5a (load + --explain; the prepend that applies config to the run is B5b). - config.{h,cc}: SourceName(Source) and ExplainConfig(resolved, cli_globals) render the effective configuration - each resolved flag tagged with its provenance (system/user/project), then the CLI globals (cli), in application order. - loader.{h,cc}: SelectorsFromGlobals(globals) extracts the --no-config / --config=NAME / --xffrc=FILE selectors from the parsed globals. - cli/main.cc: after Parse, builds DiscoveryOptions from the selectors + the XFF_CONFIG/XDG_CONFIG_HOME/HOME env, runs Discover + ResolveConfig, and on --explain writes the effective config to stdout and exits 0. Find behaviour is UNCHANGED (no prepend yet) - safe. --explain makes the loader testable at the binary level (a follow-up adds an sh_test harness + a binary --explain test). Unit tests cover SourceName, ExplainConfig, SelectorsFromGlobals. Verified manually: 'xff --config=xff --explain' with an XFF_CONFIG of common:/xff:/find: lines shows the common + xff: flags as user provenance and omits the inert find: line. Green on default + clang-asan.
helly25
enabled auto-merge (squash)
June 23, 2026 08:41
helly25
added a commit
that referenced
this pull request
Jul 2, 2026
…204) The --help "Expression:" section was an unreadable run-on paragraph. Replace it with a scannable grouped overview -- Name/path, Type/size, Time, Owner/perm, Content, Operators, Actions, a few primaries each -- that points at `--help=expressions` for the full annotated list and `--help=NAME` for one entry. Add `--help=expressions`: the Tests/Actions/Operators vocabulary with one-line summaries, without the whole-run global flags (the full index `--help=list` still shows globals + expressions). Factored the shared grouping into AppendExpressions so the index and the expressions view stay in lock-step with registry::All(). Tests: help_render_test asserts --help=expressions lists every primary grouped and omits the globals' "Traversal:" header; help_topic_test.sh drives --help=expressions; help_test.sh asserts the usage overview shows a group label and points at --help=expressions. bazel test //... green (35 tests).
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.
Fifth slice of the config loader (#58), per
docs/design-config.md. Phase B5a: load +--explain; the prepend that applies config to the run is B5b.What
config.{h,cc}:SourceName(Source)+ExplainConfig(resolved, cli_globals)render the effective configuration - each resolved flag tagged with provenance (system/user/project), then the CLI globals (cli), in application order.loader.{h,cc}:SelectorsFromGlobals(globals)extracts the--no-config/--config=NAME/--xffrc=FILEselectors from the parsed globals.cli/main.cc: afterParse, buildsDiscoveryOptionsfrom the selectors +XFF_CONFIG/XDG_CONFIG_HOME/HOME, runsDiscover+ResolveConfig, and on--explainwrites the effective config to stdout and exits 0. Find behaviour is unchanged (no prepend yet) - safe to merge.This answers "make config testable at the binary level":
--explainis the inspection point (the design-config.md--explain, started early). A follow-up adds ansh_testharness + a binary--explaintest; B5b then flips on the prepend, verifiable through--explain.Tests
Unit:
SourceName,ExplainConfigprovenance tags,SelectorsFromGlobalsextraction/order. Manual binary smoke confirmsxff --config=xff --explainshowscommon:+xff:flags asuserand omits the inertfind:line. Green on default +--config=clang --config=asan; clang-format + no-em-dash clean.