Skip to content

(feat): API handlers directly query database for read operations#779

Open
AS1100K wants to merge 9 commits intostjude-rust-labs:mainfrom
as1100k-forks:issue-578
Open

(feat): API handlers directly query database for read operations#779
AS1100K wants to merge 9 commits intostjude-rust-labs:mainfrom
as1100k-forks:issue-578

Conversation

@AS1100K
Copy link
Copy Markdown
Contributor

@AS1100K AS1100K commented Mar 29, 2026

Fixes #578

This PR updates the v1 API read handlers (runs/sessions/tasks) to query the Database directly via AppState instead of going through the RunManager command channel.

Read-only query logic has been moved into system::v1::exec::queries so it can be shared without coupling the API layer to the run manager service.

No functional behavior changes are intended; responses, filtering, and pagination should remain the same.

Before submitting this PR, please make sure:

For external contributors:

  • You have read the contributing guide in its entirety.
  • You have not used AI on any parts of this pull request.
  • You have added a few sentences describing the PR here.
  • Your code builds clean without any errors or warnings.

For all contributors:

  • You have added tests (when appropriate).
  • You have added an entry in the CHANGELOG (when appropriate).
  • You have updated the README or other documentation to account for these changes (when appropriate).
  • You have made a PR to the next branch in the sprocket.bio repository (when appropriate).

For PRs containing lint rule changes:

  • You have updated any and all effected entries within RULES.md.
  • You have added a test case in crates/wdl-lint/tests/lints that covers every
    possible diagnostic emitted for the rule within the file where the rule
    is implemented.

AS1100K added 8 commits March 29, 2026 22:57
Remove the DbHandle wrapper and pass Arc<dyn Database> into AppState.
Prune several unused RunManager commands and their unimplemented match
arms/imports. Add a custom Debug impl for AppState.
Replace passing the raw query.limit Option with the resolved
limit wrapped in Some(...) for runs, sessions, tasks and task logs
calls so the query helpers always receive a concrete limit value.
Also add a doc comment for AppState.db and a docstring for list_runs
@AS1100K AS1100K marked this pull request as ready for review April 2, 2026 08:18
@AS1100K AS1100K requested a review from a team as a code owner April 2, 2026 08:18
@AS1100K AS1100K requested a review from claymcleod April 2, 2026 08:18
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.

Consider having API handlers directly query database for read operations

1 participant