refactor(envvars): centralize BMAD_LOOP_* env reads into a registry (#246)#269
Conversation
…246) F-9b of #246: the three runtime override vars were read inline via `os.environ.get(...)` at five scattered call sites, leaving them undiscoverable and undocumented. - New `bmad_loop.envvars`: named constants + typed readers for `BMAD_LOOP_SESSION_TIMEOUT_S` (-> float | None), `BMAD_LOOP_MUX_BACKEND` and `BMAD_LOOP_PROCESS_HOST` (-> str | None). Pure stdlib (imports only `os`), so any module can depend on it without a cycle. - Route engine._session_timeout_s, adapters.multiplexer.{backend_forced, _select}, cli._mux_set, and process_host.get_process_host through the readers. `session_timeout_s()` absorbs the parse+validate (unparseable / non-positive -> None -> caller's default); the two string readers return the value verbatim so truthiness/name-resolution semantics are byte-identical. Dropped the now-unused `import os` from engine and multiplexer. - README gains an "Environment variables" reference table; CHANGELOG note. Semantics unchanged — the env-var tests (backend registry, process host, stories-e2e timeout seam) pass untouched.
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The env-var registry PR from #246 (folded item F-9b). The three
BMAD_LOOP_*runtime override knobs were read inline viaos.environ.get(...)at five scattered call sites, which left them undiscoverable and undocumented. This gives them one home and one operator-facing table. No behavior changes.What changed
src/bmad_loop/envvars.py— named constants + typed readers:session_timeout_s() -> float | None— absorbs the parse + validation (unparseable / non-positive →None, so a fat-fingered value can't silently shorten a run).mux_backend() -> str | Noneandprocess_host() -> str | None— return the value verbatim (callers test truthiness and resolve the name), so forced-selection semantics stay byte-identical.os), so any module can depend on it without a cycle.engine._session_timeout_s,adapters.multiplexer.{backend_forced, _select},cli._mux_set,process_host.get_process_host. Dropped the now-unusedimport osfromengine.pyandmultiplexer.py.BMAD_LOOP_UNITY_*/BMAD_LOOP_ENGINE_*plugin set is pointed at the game-engine guide. Terse CHANGELOG line under Unreleased → Added.Verification
test_backend_registry,test_process_host,test_external_backends,test_stories_e2e'sBMAD_LOOP_SESSION_TIMEOUT_Sseam) pass untouched.trunk checkclean;uvx pyright@1.1.411(basic gate now coversenvvars.py) → 0 errors.test_module_skills_syncfailures are the pre-existing local-only drift (gitignored.agents/.claudeinstall copies atmodule_version 0.8.1vs canonical0.9.0), unrelated to this PR and absent on a fresh CI checkout.Completes the F-9b half of #246 (the lint-alignment half shipped in #267); closes #246.