Skip to content

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

Merged
HyeockJinKim merged 1 commit into
mainfrom
feat/BA-6890-kernel-history-repository-scope
Jul 20, 2026
Merged

feat(BA-6890): add kernel scheduling-history repository search scope#12868
HyeockJinKim merged 1 commit into
mainfrom
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

Comment thread src/ai/backend/manager/repositories/scheduling_history/types.py Outdated
Comment thread src/ai/backend/manager/repositories/scheduling_history/types.py Outdated
@jopemachine
jopemachine force-pushed the feat/BA-6890-kernel-history-repository-scope branch 2 times, most recently from d384322 to 05a2d77 Compare July 20, 2026 03:19
Base automatically changed from feat/BA-6889-kernel-history-conditions-orders to main July 20, 2026 04:15
@jopemachine
jopemachine force-pushed the feat/BA-6890-kernel-history-repository-scope branch from 05a2d77 to d7b27fc Compare July 20, 2026 04:22
@jopemachine
jopemachine marked this pull request as ready for review July 20, 2026 04:30
@jopemachine
jopemachine requested a review from a team as a code owner July 20, 2026 04:30
Copilot AI review requested due to automatic review settings July 20, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds scoped kernel scheduling-history repository searches by session ID, kernel ID, or both.

Changes:

  • Adds scope validation, query conditions, and existence checks.
  • Adds repository and database search paths.
  • Adds scope-focused tests and a changelog entry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
changes/12868.feature.md Documents the repository scope feature.
src/ai/backend/manager/errors/kernel.py Adds the empty-scope error.
src/ai/backend/manager/repositories/scheduling_history/__init__.py Exports the new scope.
src/ai/backend/manager/repositories/scheduling_history/types.py Defines scope filtering and validation.
src/ai/backend/manager/repositories/scheduling_history/repository.py Exposes scoped kernel-history search.
src/ai/backend/manager/repositories/scheduling_history/db_source/db_source.py Executes the scoped database query.
tests/unit/manager/repositories/scheduling_history/test_kernel_scheduling_history_scope.py Tests scope construction and conditions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jopemachine
jopemachine force-pushed the feat/BA-6890-kernel-history-repository-scope branch 2 times, most recently from 7b9fa27 to 8332a48 Compare July 20, 2026 04:42
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 8332a48 to c04a047 Compare July 20, 2026 04:47
@HyeockJinKim
HyeockJinKim enabled auto-merge (squash) July 20, 2026 04:52
@HyeockJinKim
HyeockJinKim merged commit ceb6096 into main Jul 20, 2026
31 of 33 checks passed
@HyeockJinKim
HyeockJinKim deleted the feat/BA-6890-kernel-history-repository-scope branch July 20, 2026 04:52
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.

3 participants