Repository navigation
feat(OMN-10559): FakeSecretStore for tests - #1508
Conversation
Adds a deterministic in-memory ProtocolSecretStore implementation for the canonical conftest in omnimarket and other downstream consumers. Dict-backed; constructor takes an optional initial: Mapping[str, str] that is copied (not referenced) so callers can mutate the source after construction without affecting the store. All seven protocol methods are fully implemented: - get_secret returns the stored value or None. - set_secret stores or overwrites; returns True. - delete_secret returns True if removed, False if absent. - list_keys returns sorted keys, optionally prefix-filtered. - health_check returns True until close() is called, then False. - close marks the store closed; timeout_seconds accepted for protocol parity (the close is synchronous and immediate). Packaging: lives at omnibase_infra.test_utils.fake_secret_store. The test_utils package is new in this PR; it is intended to ship in the wheel because consumer test suites import it. Heavyweight fixtures that require infrastructure (Postgres, Kafka) belong in the existing omnibase_infra.testing package instead — test_utils is the lightweight fakes layer. 13 unit tests cover protocol conformance, empty-vs-preloaded construction, the no-aliasing copy semantics, set/delete round-trips, delete-missing returns False, sorted prefix listing, and the health-check-after-close lifecycle. Wave 5 / Epic 2 (OMN-10546). Independent of Task 11 / Task 12.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces ChangesFakeSecretStore Test Utility
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Merge commits are not allowed on this repository
harsh-omni
left a comment
There was a problem hiding this comment.
Looks good. Dict-backed in-memory impl, copy-on-construct so the caller's mapping isn't mutated, all 7 protocol methods, lifecycle assertion (health_check -> False after close()) is a nice touch for testing teardown paths.
13 unit + 1 integration test cover empty init, preload, isolation, round-trip, overwrite, delete hit/miss, prefix list, lifecycle.
Worth noting in the docstring that this isn't thread/async-safe - fine for serial test scenarios but a future caller who tries to share it across asyncio tasks will hit races.
Summary
Adds
FakeSecretStore— a deterministic in-memoryProtocolSecretStorefor use in the canonical test conftest by omnimarket and other downstream consumers.initial: Mapping[str, str]; the mapping is copied, not referenced, so callers may mutate the source after construction without affecting the store.health_checkstarts True and flips to False afterclose()— handy for asserting lifecycle in tests.Packaging note
Lives at
omnibase_infra.test_utils.fake_secret_store. Thetest_utilspackage is new in this PR and is intended to ship in the wheel: consumer test suites import it.This is distinct from the existing
omnibase_infra.testingpackage, which holds heavyweight fixtures (mock registries) —test_utilsis the lightweight-fakes layer.Ticket
Evidence-Source: OCC#741
OMN-10559 (Epic 2 — OMN-10546 — Omnimarket public-shippable plan, Task 13).
dod_evidence
Full receipt logged on the Linear ticket (https://linear.app/omninode/issue/OMN-10559). Highlights:
uv run mypy --strictclean.uv run ruff check+uv run ruff formatclean.--no-verify, no skip tokens.Test plan
uv run pytest tests/unit/test_utils/test_fake_secret_store.py -v(13/13 PASS)uv run mypy src/omnibase_infra/test_utils/ tests/unit/test_utils/ --strict(clean)uv run ruff check src/omnibase_infra/test_utils/ tests/unit/test_utils/(clean)Notes for reviewer
test_utils/is a new package under a different prefix fromsecret_stores/.uv run pytest tests/(full repo suite) locally — exceeds the 10-minute timeout on this hardware. CI runs the full suite.Evidence-Ticket: OMN-10559
Summary by CodeRabbit
New Features
Tests