Skip to main content

resolve_project_entry

Function resolve_project_entry 

Source
pub fn resolve_project_entry(
    project_root: &Path,
    relative: &str,
    kind: EntryKind,
) -> ResolvedConfig
Expand description

Resolve one project-scoped configuration entry across SEARCH_ROOTS.

Why: the single entry point #5426 replaces every hard-coded .claude/ join with. Centralising it is what makes the precedence testable in one place and makes “a clean project with only .trusty-code/ works” true everywhere at once rather than per call site. What: walks SEARCH_ROOTS in order and returns the first candidate that exists AND can be opened. A candidate that exists but cannot be opened is SKIPPED, recorded in ResolvedConfig::unreadable, and logged at warn with the path tried — falling through to the next root rather than failing the run, because a harness that refuses to start over an unreadable optional config is worse than one that starts with less config and says so. When no candidate is usable, the returned path is <project_root>/.trusty-code/<rel> with source ConfigSource::Default: callers that need existence check for it themselves, and every WRITE goes to the native path regardless. Test: paths::tests::precedence_prefers_trusty_code_over_claude, paths::tests::falls_back_to_claude_when_trusty_code_absent, paths::tests::default_source_when_nothing_exists, paths::tests::unreadable_native_dir_falls_back_and_is_reported.