Where: faircode/strategies.py:97-102 (strategy_features).
The gap:
def strategy_features(strategy: str, core: list, proxies: list, protected: list) -> list:
if strategy == "baseline":
return list(dict.fromkeys(core + proxies + protected))
if strategy == "unawareness":
return list(dict.fromkeys(core + proxies))
return list(core) # unawareness_proxy_removal, in_processing, post_processing
The final return list(core) is a bare else in practice - it's meant to handle exactly the three strategies named in its comment, but any unrecognized string (a typo like "in_procesing") silently falls into the same branch instead of raising.
Repro:
>>> from faircode.strategies import strategy_features
>>> strategy_features("in_procesing", ["a"], ["b"], ["c"]) # typo'd
['a']
No error - returns exactly the same result as a genuinely recognized "core-only" strategy.
Why it matters: faircode/benchmark.py only ever iterates the fixed STRATEGIES tuple today, so this isn't reachable through the CLI/normal benchmark run - but strategy_features is a public-enough function (imported directly, no leading underscore) that anyone calling it from a notebook, script, or future extension gets a silent wrong-but-plausible answer for a typo'd strategy name instead of an error. tests/test_strategies.py has no "unknown strategy" test.
Suggested fix: add an explicit else: raise ValueError(f"unknown strategy: {strategy!r}") instead of the bare fallback.
Where:
faircode/strategies.py:97-102(strategy_features).The gap:
The final
return list(core)is a bareelsein practice - it's meant to handle exactly the three strategies named in its comment, but any unrecognized string (a typo like"in_procesing") silently falls into the same branch instead of raising.Repro:
No error - returns exactly the same result as a genuinely recognized "core-only" strategy.
Why it matters:
faircode/benchmark.pyonly ever iterates the fixedSTRATEGIEStuple today, so this isn't reachable through the CLI/normal benchmark run - butstrategy_featuresis a public-enough function (imported directly, no leading underscore) that anyone calling it from a notebook, script, or future extension gets a silent wrong-but-plausible answer for a typo'd strategy name instead of an error.tests/test_strategies.pyhas no "unknown strategy" test.Suggested fix: add an explicit
else: raise ValueError(f"unknown strategy: {strategy!r}")instead of the bare fallback.