Skip to content

feat(OMN-10559): FakeSecretStore for tests - #1508

Merged
jonahgabriel merged 3 commits into
mainfrom
jonah/omn-10559-fake-secret-store
May 6, 2026
Merged

jonahgabriel merged 3 commits into
mainfrom
jonah/omn-10559-fake-secret-store

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented May 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds FakeSecretStore — a deterministic in-memory ProtocolSecretStore for use in the canonical test conftest by omnimarket and other downstream consumers.

  • Dict-backed, fully-implements all 7 protocol methods.
  • Constructor takes an optional initial: Mapping[str, str]; the mapping is copied, not referenced, so callers may mutate the source after construction without affecting the store.
  • health_check starts True and flips to False after close() — handy for asserting lifecycle in tests.

Packaging note

Lives at omnibase_infra.test_utils.fake_secret_store. The test_utils package 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.testing package, which holds heavyweight fixtures (mock registries) — test_utils is 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:

  • 13 unit tests PASS in 0.39s.
  • uv run mypy --strict clean.
  • uv run ruff check + uv run ruff format clean.
  • SPDX headers present.
  • No --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)
  • CI: full repo suite via GitHub Actions

Notes for reviewer

Evidence-Ticket: OMN-10559

Summary by CodeRabbit

  • New Features

    • Added FakeSecretStore test utility with in-memory secret storage supporting get, set, delete, list, and health check operations for testing.
  • Tests

    • Added comprehensive unit and integration tests validating FakeSecretStore initialization, data handling, operations, and lifecycle management including close behavior.

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.
@coderabbitai

coderabbitai Bot commented May 5, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7902d3c9-8e1c-4b7c-b2eb-c62f20c9c5db

📥 Commits

Reviewing files that changed from the base of the PR and between c8f2383 and 7a6b8df.

📒 Files selected for processing (5)
  • src/omnibase_infra/test_utils/__init__.py
  • src/omnibase_infra/test_utils/fake_secret_store.py
  • tests/integration/test_fake_secret_store_integration.py
  • tests/unit/test_utils/__init__.py
  • tests/unit/test_utils/test_fake_secret_store.py

📝 Walkthrough

Walkthrough

This PR introduces FakeSecretStore, an in-memory, deterministic test utility that implements a secret store protocol. It provides get, set, delete, list, health check, and close operations with optional initial data preloading. The implementation is packaged for export and backed by comprehensive unit and integration tests.

Changes

FakeSecretStore Test Utility

Layer / File(s) Summary
Core Implementation
src/omnibase_infra/test_utils/fake_secret_store.py
Introduces FakeSecretStore class with async methods for secret CRUD operations, prefix-filtered listing, health checks, and lifecycle management backed by an internal dictionary.
Module Packaging
src/omnibase_infra/test_utils/__init__.py
Exposes FakeSecretStore via __all__ for downstream test imports.
Test Infrastructure
tests/unit/test_utils/__init__.py
Adds module header and docstring to test utilities package.
Unit Tests
tests/unit/test_utils/test_fake_secret_store.py
Covers protocol adherence, empty and preloaded initialization, set/get round-trips, overwrites, deletion semantics, prefix filtering in list operations, health checks, and close behavior across 13 test functions.
Integration Test
tests/integration/test_fake_secret_store_integration.py
Validates the full lifecycle: initialization with preloaded data, health checks, CRUD operations, deletion verification, and post-close health check failure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A store so fake, yet true in heart,
With secrets tucked in memory's part!
List them, set them, watch them go—
When health checks fail, we'll surely know. 🔐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a FakeSecretStore utility for use in tests. It is specific and directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-10559-fake-secret-store

Comment @coderabbitai help to get the list of available commands and usage tips.

@jonahgabriel
jonahgabriel enabled auto-merge May 5, 2026 21:58
auto-merge was automatically disabled May 6, 2026 20:53

Merge commits are not allowed on this repository

@harsh-omni harsh-omni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jonahgabriel
jonahgabriel merged commit cea5c3e into main May 6, 2026
61 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-10559-fake-secret-store branch May 6, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants