fix(feature-flags): bare flags default to true, robust coercion, drop wrapper

Address code review feedback:
- _coerce_flag_value: wrap coercion in try/except (ValueError, TypeError)
  and log a warning instead of crashing startup on malformed values.
- _parse_cli_feature_flags: bare --feature-flag KEY (no '=') now defaults
  to 'true' so registered bool flags work as toggles.
- Remove the get_cli_feature_flag_registry() wrapper; export and use
  CLI_FEATURE_FLAG_REGISTRY directly in main.py and tests.

Add tests for coercion-failure fallback and bare-flag default behavior.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019deba2-bfe2-7118-913c-562beee48972
This commit is contained in:
Jedrzej Kosinski
2026-05-03 04:49:22 -07:00
parent 393248c8fa
commit d187c3510e
3 changed files with 45 additions and 19 deletions

View File

@@ -5,8 +5,8 @@ from comfy.cli_args import args
if args.list_feature_flags:
import json
from comfy_api.feature_flags import get_cli_feature_flag_registry
print(json.dumps(get_cli_feature_flag_registry(), indent=2)) # noqa: T201
from comfy_api.feature_flags import CLI_FEATURE_FLAG_REGISTRY
print(json.dumps(CLI_FEATURE_FLAG_REGISTRY, indent=2)) # noqa: T201
raise SystemExit(0)
import os