Add SQLite seeding and mock-aware filtering#93
Merged
sarroutbi merged 2 commits intoMay 13, 2026
Conversation
Move seed alert generation into a shared `seed_alerts()` function used by both InMemory and SQLite repositories. Add `seed_if_empty()` to the AlertRepository trait so the SQLite backend auto-seeds on first run when mock mode is enabled. Add a `mock` boolean flag to the Alert model and SQLite schema so mock alerts are only returned when `seed_mock_data` is active. Thread an `include_mock` parameter through `list()` and `summary()` trait methods, with filtering in both InMemory and SQLite implementations. Wire `seed_mock_data` through the Settings API so the frontend can toggle mock mode at runtime via PUT /api/settings/keylime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
4b39a92 to
f354a7d
Compare
Serialize resolve_config_path_from_env and resolve_config_path_empty_env with a shared Mutex to prevent concurrent set_var/remove_var calls from racing when Cargo runs tests in parallel. Also move remove_var before assertions so the env is cleaned up even on test failure. Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move seed alert generation into a shared
seed_alerts()function used by both InMemory and SQLite repositories. Addseed_if_empty()to the AlertRepository trait so the SQLite backend auto-seeds on first run when mock mode is enabled.Add a
mockboolean flag to the Alert model and SQLite schema so mock alerts are only returned whenseed_mock_datais active. Thread aninclude_mockparameter throughlist()andsummary()trait methods, with filtering in both InMemory and SQLite implementations.Wire
seed_mock_datathrough the Settings API so the frontend can toggle mock mode at runtime via PUT /api/settings/keylime.