Skip to content

feat(config): project .xffrc ancestor cascade per search root (config phase E2a) - #112

Merged
helly25 merged 1 commit into
mainfrom
feat/project-cascade
Jun 24, 2026
Merged

feat(config): project .xffrc ancestor cascade per search root (config phase E2a)#112
helly25 merged 1 commit into
mainfrom
feat/project-cascade

Conversation

@helly25

@helly25 helly25 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Config phase E2a: project .xffrc ancestor cascade

Generalizes the project layer from the single cwd .xffrc to the gitignore-style ancestor cascade the design specifies (design-config.md L56-58): for each search root, every .xffrc from the filesystem root down to the root's directory contributes, shallowest first (deeper overrides), deduped across roots. The whole layer stays untrusted and policy-gated.

What

  • DiscoveryOptions gains roots (absolute search-root dirs); main resolves command.roots to absolute dirs (a regular file -> its parent; cwd when none) via std::filesystem before discovery.
  • Discover walks each root's ancestor chain (AncestorDirs: /a/b/c -> {/, /a, /a/b, /a/b/c}), reads <dir>/.xffrc, appends to the project layer, and records each path in the --explain source trace.

Deferred (TODO.md)

Per-entry subtree scoping for .xffrc files below a root (config varying mid-walk - an architectural change on the traversal hot path). The ancestor cascade covers the common "repo + parents" case; the deeper scoping waits for a real need.

Test

  • loader_test: reads the root dir's .xffrc; ancestors shallowest-first with deeper override; shared ancestors across roots read once; the source trace records the full chain with found/absent.
  • explain_test bashtest: a .xffrc at a parent dir applies to a subdir search root, surfacing with project provenance in --explain.

bazel test //... green in both --config=clang and --config=clang --config=asan. clang-format + em-dash clean.

Completes the config system (#58): phases B-E all shipped.

… phase E2a)

Generalize the project layer from the single cwd .xffrc to the gitignore-style
ancestor cascade the design specifies: for each search root, every .xffrc from the
filesystem root down to the root's directory contributes, shallowest first (deeper
overrides), deduped across roots. The whole layer stays untrusted and policy-gated.

- DiscoveryOptions gains `roots` (absolute search-root dirs); main resolves
  command.roots to absolute dirs (a file -> its parent; cwd when none) via
  std::filesystem before discovery.
- Discover walks each root's ancestor chain (AncestorDirs), reading <dir>/.xffrc,
  appending to the project layer and recording each in the --explain source trace.

Per-entry subtree scoping for .xffrc files BELOW a root (config varying mid-walk,
an architectural change on the traversal hot path) is deferred - recorded in
TODO.md. The ancestor cascade covers the common "repo + parents" case.

Tests: loader_test (root-dir .xffrc; ancestors shallowest-first with deeper
override; shared ancestors read once; the source trace records the chain),
explain_test bashtest (a parent-dir .xffrc applies to a subdir search root with
project provenance). Green in both configs; clang-format + em-dash clean.

Completes the config system (#58): phases B-E all shipped.
@helly25
helly25 merged commit 9bb42d3 into main Jun 24, 2026
5 checks passed
@helly25
helly25 deleted the feat/project-cascade branch June 24, 2026 07:25
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