Follow-up to #330 (merged in #366).
Symptom
After #366 the auto_fixable flag on add-to-config actions for duplicate-export findings is computed via FallowConfig::find_config_path(root).is_some() (see crates/cli/src/report/json.rs:89,303). That walks UP from root and returns the first config in the project tree.
The lookup does not consult an explicit --config <path> the caller passed on the CLI. So when the user runs:
fallow dead-code --root . --config /tmp/external.json --format json
and there is NO .fallowrc.* / fallow.toml anywhere in root's ancestor chain, the analysis emits auto_fixable: false even though the user has a perfectly usable config supplied explicitly. An agent gating on auto_fixable: true before invoking fallow fix --config /tmp/external.json --yes will skip the fix that would have succeeded.
Why this didn't ship in #330
Fix surface is small (4 production call sites in audit.rs, combined.rs, programmatic.rs, print_json) but the blast radius hits ~30 in-file test call sites of build_json because the cleanest signature change adds an Option<&Path> parameter. The bug surface is also narrow: requires --config pointing outside the project's ancestor chain AND an agent that gates on auto_fixable rather than just attempting the fix.
Suggested fix
Two options, roughly equal cost:
- Add
source_path: Option<PathBuf> to ResolvedConfig (set by load_config_for_analysis in crates/cli/src/runtime_support.rs) and consult it inside build_json / print_grouped_json. Cleanest architecturally; touches the config struct and one runtime-support function.
- New 4-arg variant
build_json_with_config(..., explicit_config: Option<&Path>), keep build_json as a 3-arg wrapper for backward compat. No struct change, but two public functions.
Either way the config_fixable computation becomes:
let config_fixable = explicit_config.is_some_and(Path::exists)
|| FallowConfig::find_config_path(root).is_some();
Acceptance
Out of scope
Follow-up to #330 (merged in #366).
Symptom
After #366 the
auto_fixableflag onadd-to-configactions forduplicate-exportfindings is computed viaFallowConfig::find_config_path(root).is_some()(seecrates/cli/src/report/json.rs:89,303). That walks UP fromrootand returns the first config in the project tree.The lookup does not consult an explicit
--config <path>the caller passed on the CLI. So when the user runs:fallow dead-code --root . --config /tmp/external.json --format jsonand there is NO
.fallowrc.*/fallow.tomlanywhere in root's ancestor chain, the analysis emitsauto_fixable: falseeven though the user has a perfectly usable config supplied explicitly. An agent gating onauto_fixable: truebefore invokingfallow fix --config /tmp/external.json --yeswill skip the fix that would have succeeded.Why this didn't ship in #330
Fix surface is small (4 production call sites in
audit.rs,combined.rs,programmatic.rs,print_json) but the blast radius hits ~30 in-file test call sites ofbuild_jsonbecause the cleanest signature change adds anOption<&Path>parameter. The bug surface is also narrow: requires--configpointing outside the project's ancestor chain AND an agent that gates onauto_fixablerather than just attempting the fix.Suggested fix
Two options, roughly equal cost:
source_path: Option<PathBuf>toResolvedConfig(set byload_config_for_analysisincrates/cli/src/runtime_support.rs) and consult it insidebuild_json/print_grouped_json. Cleanest architecturally; touches the config struct and one runtime-support function.build_json_with_config(..., explicit_config: Option<&Path>), keepbuild_jsonas a 3-arg wrapper for backward compat. No struct change, but two public functions.Either way the
config_fixablecomputation becomes:Acceptance
auto_fixablereflects an explicit--config <path>when the supplied path exists, even iffind_config_path(root)would returnNone.Some(&existing_external_config)→auto_fixable: trueon the duplicate-export action.Noneor a non-existent explicit path →auto_fixable: false.Out of scope
health/dupes/auditaction builders (they don't currently emitadd-to-configfor config-writable issue types).package.json#fallow(intentionally not supported per Auto-fixable add-to-config writer for ignoreExports (follow-up to #322) #330).