Make Ambient Inputs Explicit
BOUNDARY-MAKE-AMBIENT-INPUTS-EXPLICIT
Summary
Pass time, randomness, environment, locale, terminal size, network clients, and process state through visible inputs when they affect behavior. Injecting only the relevant ambient values improves tests and portability without spreading oversized context objects.
Rule
Make ambient inputs explicit.
Why
Time, randomness, environment variables, current directories, locale, terminal size, network clients, and process state can change behavior without appearing in function signatures. Making them explicit improves tests and shows callers what influences the result.
Helps
- Makes nondeterminism injectable and reduces hidden dependencies.
Limits
Do not pass huge context objects everywhere. Inject the specific ambient input where tests, portability, or reader understanding needs control.
Agent Instruction
Make ambient inputs explicit because time, randomness, environment variables, current directories,
locale, terminal size, network clients, and process state can change behavior without appearing in
function signatures.Mechanisms
Supported by clock and RNG traits, config structs, explicit environment readers, terminal-size parameters, temp directories, and deterministic tests.