Skip to content

feat(BA-6890): add kernel scheduling-history repository search scope#12868

Draft
jopemachine wants to merge 1 commit into
feat/BA-6889-kernel-history-conditions-ordersfrom
feat/BA-6890-kernel-history-repository-scope
Draft

feat(BA-6890): add kernel scheduling-history repository search scope#12868
jopemachine wants to merge 1 commit into
feat/BA-6889-kernel-history-conditions-ordersfrom
feat/BA-6890-kernel-history-repository-scope

Conversation

@jopemachine

@jopemachine jopemachine commented Jul 15, 2026

Copy link
Copy Markdown
Member

📚 Stacked PRs

Merge in order, bottom-up. Each PR is based on the one above it, so its diff shows only its own layer.

What

KernelSchedulingHistorySearchScope plus the scoped repository read path (search_kernel_scoped_history on the repository and db_source).

Why this scope is shaped differently

The session / deployment / route scopes each carry one required entity id. A kernel query is scoped by:

  • session_id — all of that session's kernels, or
  • kernel_id — one kernel, or
  • both — intersected.

to_condition() filters on each axis given and ANDs them; existence_checks covers the corresponding SessionRow / KernelRow.

At least one axis is required. An empty scope would silently degenerate into an unscoped, system-wide search — exactly what a scoped search exists to prevent — so it raises EmptyKernelSchedulingHistoryScope. The shared DTO validates this too (#12869); the scope defends it again because the scope is what the repository actually trusts, and it is reachable from GraphQL (BA-6883) as well as REST.

Review notes

  • search_kernel_scoped_history differs from the existing unscoped method by exactly one argument: scopes=[scope] on execute_batch_querier.
  • Tests cover each axis combination, the intersection, existence checks, and the empty-scope rejection. tests/AGENTS.md names "empty scope → error" as a canonical case to cover.

The service actions that build this scope are #12869.

🤖 Generated with Claude Code

an empty scope would degenerate into an unscoped (admin) search.
"""

session_id: UUID | None = None

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SessionID

session_id: UUID | None = None
"""Restrict to the kernels of this session."""

kernel_id: UUID | None = None

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

KernelID

Add KernelSchedulingHistorySearchScope and the scoped repository read path.

Unlike the session/deployment/route scopes, which each carry one required
entity id, a kernel query is scoped by session_id (all of a session's
kernels), kernel_id, or both. to_condition() filters on each axis given and
intersects when both are; existence_checks covers the corresponding session
and kernel rows.

At least one axis is required: an empty scope would silently degenerate into
an unscoped, system-wide search, so it raises EmptyKernelSchedulingHistoryScope.
The shared DTO validates this too (BA-6891); the scope defends it again
because it is what the repository actually trusts.

search_kernel_scoped_history mirrors the existing unscoped method, differing
only in passing the scope to execute_batch_querier.

The service actions that build this scope land in BA-6891.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine
jopemachine force-pushed the feat/BA-6890-kernel-history-repository-scope branch from 3cda92e to d384322 Compare July 15, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant