Repository navigation
feat(OMN-10773): atomic env file writer for interactive onboarding config output - #1550
Conversation
…nfig output - write_env_file(env_dict, target_path): reads existing file, merges (preserve keys not in env_dict, overwrite keys that are), writes atomically via tmp+rename - Returns merged content as string for dry-run display without writing - Uses Path.replace() / Path.unlink() (PTH105/PTH108 compliant) - 8 unit tests: new file, merge, overwrite, atomic (no tmp leftover), roundtrip, empty dict, home-dir safety assertion, return type check
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
# Conflicts: # src/omnibase_infra/onboarding/config_writer.py # tests/unit/onboarding/test_config_writer.py
… override (#2705) * feat(OMN-15789): EventBusKafka.subscribe(auto_offset_reset=) per-call override Adds an optional auto_offset_reset kwarg to EventBusKafka.subscribe(), threaded through to _start_consumer_for_topic_unlocked's new auto_offset_reset_override parameter. None (the default, every pre-existing call site) preserves current behavior exactly -- falls back to self._config.auto_offset_reset. Each (topic, group_id) pair already gets its own dedicated AIOKafkaConsumer, so the override is scoped to exactly the one consumer a given subscribe() call creates. This is the real_broker-side half of the event_bus_substrate fixture's fidelity contract (OMN-15789, omnibase_core PR #1550, merged): the fixture's real_broker leg needs the same per-call auto_offset_reset surface EventBusSemanticFake (omnibase_core) already exposes, so a single EventBusKafka instance can be reused across earliest/latest test legs instead of needing a separate instance per offset policy. New unit test proves the override threads through correctly (and that a None override is not silently widened to a truthy value): test_subscribe_threads_auto_offset_reset_override_to_consumer_start. Landed as its own PR (split from the fixture/conftest/exemplar-test half, which imports omnibase_core.event_bus.testing.* -- unreleased on PyPI as of this commit; omnibase_infra pins omnibase-core from PyPI only, OMN-14628 pure-PyPI seam, no git-rev override) so this independently-useful, independently-CI-green production change is not blocked on that release. The fixture-consuming half is prepared on this same branch's follow-up commit, held pending the release. Evidence-Ticket: OMN-15789 * fix(OMN-15789): update fake_start test doubles for auto_offset_reset_override kwarg The governed impacted-test selector (pre-push) caught a real regression in 5d55a94: four TestKafkaEventBusSubscribe tests hand-roll a fake_start(topic, group_id) async double patched over _start_consumer_for_topic_unlocked, and the new auto_offset_reset_override keyword-only parameter broke their fixed signature (TypeError: unexpected keyword argument). Widens every fake_start/fake_start_unlocked double in this file to accept the new kwarg. 121/121 passed in tests/unit/event_bus/test_kafka_event_bus.py after the fix; 2984/2984 passed across tests/unit/event_bus/+adapters/+backends/+services/. Evidence-Ticket: OMN-15789
OMN-10773
Implements the config writer for the interactive onboarding executor (Task 6 of the interactive onboarding executor plan). Separated from the executor so file writes are an explicit outer action, never triggered implicitly.
Changes
config_writer.py—write_env_file(env_dict, target_path): reads existing file, merges (preserves keys not in env_dict, overwrites keys that are), writes atomically via tmp+rename usingPath.replace()(PTH105-clean). Returns merged content as string for dry-run display without writing.Design note
write_env_filenever decides whether to write — it only writes when called. The handler/CLI outer layer controls thedry_runflag (Task 7). This function is a pure effect: call it when you mean to write.dod_evidence
uv run pytest tests/unit/onboarding/test_config_writer.py)uv run mypy src/omnibase_infra/onboarding/config_writer.py --strict— cleanpre-commit run --all-files— all hooks passingtmp_path;test_no_writes_under_real_homeexplicitly asserts~/.omnibase/.envmtime unchangedEvidence-Source: 43a688815172db3797bae4ae01ff47c4d9ef3b12
Evidence-Ticket: OMN-10773