Skip to content

feat(config): load config + --explain effective-config dump (phase B5a) - #96

Merged
helly25 merged 1 commit into
mainfrom
feat/config-run-wiring
Jun 23, 2026
Merged

feat(config): load config + --explain effective-config dump (phase B5a)#96
helly25 merged 1 commit into
mainfrom
feat/config-run-wiring

Conversation

@helly25

@helly25 helly25 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

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=FILE selectors from the parsed globals.
  • cli/main.cc: after Parse, builds DiscoveryOptions from the selectors + XFF_CONFIG/XDG_CONFIG_HOME/HOME, runs Discover + ResolveConfig, and on --explain writes 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": --explain is the inspection point (the design-config.md --explain, started early). A follow-up adds an sh_test harness + a binary --explain test; B5b then flips on the prepend, verifiable through --explain.

Tests

Unit: SourceName, ExplainConfig provenance tags, SelectorsFromGlobals extraction/order. Manual binary smoke confirms xff --config=xff --explain shows common:+xff: flags as user and omits the inert find: line. Green on default + --config=clang --config=asan; clang-format + no-em-dash clean.

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
helly25 enabled auto-merge (squash) June 23, 2026 08:41
@helly25
helly25 merged commit c39081a into main Jun 23, 2026
5 checks passed
@helly25
helly25 deleted the feat/config-run-wiring branch June 23, 2026 08:46
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).
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