Skip to content

Add SQLite seeding and mock-aware filtering#93

Merged
sarroutbi merged 2 commits into
keylime-webtool:mainfrom
sarroutbi:extract-seed-alerts-for-sqlite
May 13, 2026
Merged

Add SQLite seeding and mock-aware filtering#93
sarroutbi merged 2 commits into
keylime-webtool:mainfrom
sarroutbi:extract-seed-alerts-for-sqlite

Conversation

@sarroutbi
Copy link
Copy Markdown
Contributor

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.

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>
@sarroutbi sarroutbi force-pushed the extract-seed-alerts-for-sqlite branch from 4b39a92 to f354a7d Compare May 13, 2026 12:28
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>
@sarroutbi sarroutbi merged commit 51fa599 into keylime-webtool:main May 13, 2026
12 checks passed
@sarroutbi sarroutbi deleted the extract-seed-alerts-for-sqlite branch May 13, 2026 12:53
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.

1 participant