Skip to main content

schema_source_refs

Function schema_source_refs 

Source
pub fn schema_source_refs(cmd_dir: &Path) -> Vec<PathBuf>
Expand description

Every file whose edit could change a command’s --fdl-schema output.

The schema of a cargo entry is compiled from the crate’s Rust sources, so watching only fdl.yml (as this did originally) meant editing a CLI struct left a stale cache with no signal at all: -h kept rendering the previous surface until someone touched the yml or deleted the cache by hand.

Deliberately coarse — every .rs plus Cargo.toml under the command dir, not an attempt to find the files that define the schema. Over-watching costs one extra probe, exactly what editing the yml already costs. Under-watching is the bug being fixed, and a precise scan would reintroduce it the moment a #[derive(FdlArgs)] struct referenced a constant from another module. Measured at 23 files / 0.12 ms for ddp-bench, against a probe that spins a container and runs cargo — the precision is not worth buying.

Scoped to the command’s OWN directory on purpose. Following its dependency crates would invalidate the cache on every edit anywhere in the workspace, which in a repo whose library changes constantly means compiling on nearly every -h — the cost this cache exists to avoid.