chore: extract shared service methods into SQLiteStore (AC-480)#591
Merged
jayscambler merged 2 commits intomainfrom Mar 31, 2026
Merged
chore: extract shared service methods into SQLiteStore (AC-480)#591jayscambler merged 2 commits intomainfrom
jayscambler merged 2 commits intomainfrom
Conversation
Added list_runs(), run_status(), list_solved() to SQLiteStore so CLI, MCP tools, and HTTP endpoints delegate instead of duplicating raw SQL queries. Consumers updated: - cli.py: list_runs command now uses store.list_runs() - mcp/knowledge_tools.py: list_runs() delegates to store - server/app.py: list_runs() and run_status() delegate to store - server/cockpit_api.py: list_runs() uses store.list_runs() TDD: Added test_service_layer.py with 7 tests for the new methods. 7 files changed, 114 insertions, 33 deletions
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.
Summary
Added
list_runs(),run_status(), andlist_solved()service methods toSQLiteStore, then updated 4 consumers to delegate instead of duplicating raw SQL.Problem
The same "list recent runs" SQL query was duplicated in 4 places:
cli.py—list_runscommandmcp/knowledge_tools.py—list_runs()toolserver/cockpit_api.py—/api/runsendpointserver/app.py— WebSocket dashboard endpointEach had slightly different
LIMITvalues and column selections but identical intent.Changes
New service methods on SQLiteStore
Updated consumers
cli.py:store.list_runs(limit=20)replaces raw SQLmcp/knowledge_tools.py:ctx.sqlite.list_runs(limit=20)replaces raw SQLserver/app.py:store.list_runs(limit=50)andstore.run_status(run_id)replace raw SQLserver/cockpit_api.py:store.list_runs(limit=50)replaces raw SQL (enrichment loop kept)TDD
Added
test_service_layer.pywith 7 tests covering empty, populated, and limit scenarios.Verification
ruff check src— all checks passedmypy src— zero errorspytest tests/— all tests passIssue
Partially resolves AC-480