feat(config): project .xffrc ancestor cascade per search root (config phase E2a) - #112
Merged
Conversation
… 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.
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.
Config phase E2a: project
.xffrcancestor cascadeGeneralizes the project layer from the single cwd
.xffrcto the gitignore-style ancestor cascade the design specifies (design-config.md L56-58): for each search root, every.xffrcfrom 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
DiscoveryOptionsgainsroots(absolute search-root dirs);mainresolvescommand.rootsto absolute dirs (a regular file -> its parent; cwd when none) viastd::filesystembefore discovery.Discoverwalks 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--explainsource trace.Deferred (TODO.md)
Per-entry subtree scoping for
.xffrcfiles 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_testbashtest: a.xffrcat a parent dir applies to a subdir search root, surfacing with project provenance in--explain.bazel test //...green in both--config=clangand--config=clang --config=asan. clang-format + em-dash clean.Completes the config system (#58): phases B-E all shipped.