You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
research: 3 conflicting implementations of truthy env-var parsing -- which is canonical? #1798
Noticed while adding FBUILD_DOWNLOAD_MIRROR_FIRST in #1797: fbuild parses
"is this boolean env var on?" three different ways, with observably different
results for the same value, and there is no shared helper to reuse.
1, true, TRUE, yes, YES after trim (so True, on are false)
What it does to real input: FOO=true turns a feature on under the fbuild-cli
and daemon rules and off under the fbuild-paths rule; FOO=no turns it on
under the fbuild-cli rule and off under the other two; FOO=0 (trailing
space) is false everywhere except fbuild-paths, where it is also false but only
because nothing but 1 is true. An operator who learns one fbuild flag's
spelling cannot assume the next one behaves the same.
Deciding which is canonical is a design call (how permissive should a flag be?
should off/no be falsy? should a malformed value fail fast per the "reject
invalid input at the boundary" principle instead of silently meaning false?),
and unifying them is a cross-crate refactor touching fbuild-cli, fbuild-paths, fbuild-daemon and now fbuild-packages-fetch — hence a
research issue rather than an inline winner, per the "conflicting
implementations get a research issue" directive in CLAUDE.md.
New in #1797: mirror_first_requested in crates/fbuild-packages-fetch/src/downloader_mirrors.rs, which follows the is_truthy_env rule (the broadest of the three) and documents that choice at
the function. It should move to whatever this issue picks.
Suggested shape if the answer is "unify": one pub fn env_flag(name: &str) -> bool
in fbuild-core (every crate above already depends on it), one documented truth
table, and a behaviour-preserving-where-possible migration in its own PR,
separate from any feature change.
Activity