Skip to content

test(BA-6953): add component tests for the kernel scheduling-history REST v2 endpoints#12997

Draft
jopemachine wants to merge 3 commits into
feat/BA-6893-kernel-history-sdk-clifrom
feat/BA-6953-kernel-history-component-tests
Draft

test(BA-6953): add component tests for the kernel scheduling-history REST v2 endpoints#12997
jopemachine wants to merge 3 commits into
feat/BA-6893-kernel-history-sdk-clifrom
feat/BA-6953-kernel-history-component-tests

Conversation

@jopemachine

@jopemachine jopemachine commented Jul 21, 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.

Resolves #12994 (BA-6953)

Summary

  • Eight component tests driving both kernel routes through V2SchedulingHistoryClient against a real aiohttp server and DB: /kernels/admin/search and /kernels/scoped/search. The layers below are unit-tested, but nothing exercised the HTTP boundary for these two.
  • Covers what tests/component/AGENTS.md scopes to this layer — routing, the auth middleware on each route, and request/response serialization — rather than re-testing filter semantics that tests/unit already owns.
  • The directory conftest previously registered only the v1 route tree; it now mounts the v2 sub-registry too, so both suites share one server. The pre-existing v1 tests still pass unchanged.
  • kernel_scheduling_history has no writer yet (BA-6852), so the fixture seeds history rows directly, alongside the real kernels / sessions rows the scoped endpoint's existence check needs.

Unlike the existing v1 tests in this directory, which assert only that the response shape is valid against an empty table, these seed data and assert on actual rows — two kernels under one session, three history rows on one and one on the other, so scoping is observable rather than vacuous.

Writing them caught two things that unit tests had not: from_status / to_status must be valid KernelSchedulingPhase members (a "PENDING" seed produced a 500), and SessionRow requires domain_id alongside domain_name.

Test plan

  • tests/component/scheduling_history/test_kernel_history_v2.py — 8 passed
  • Whole directory including the pre-existing v1 suite — 20 passed
  • ruff check / ruff format clean
  • BUILD already present in the directory; no new test directory added

🤖 Generated with Claude Code

jopemachine and others added 3 commits July 21, 2026 16:27
Add the kernel slice of the Strawberry scheduling-history schema, mirroring the
session, deployment, and route slices:

- `adminKernelSchedulingHistories` — super-admin, system-wide
- `kernelScopedSchedulingHistories` — scoped to one kernel via `KernelScope`

The node exposes `kernel` and `session` back-references through the existing
data loaders, and `resolve_nodes` is backed by a new `kernel_history_loader`
over `batch_load_kernel_histories_by_ids`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mmands

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…REST v2 endpoints

Drive both kernel routes through the v2 SDK against a real aiohttp server and DB,
covering routing, the auth middleware on each route, and request/response
serialization. The layers below are unit-tested, but nothing exercised the HTTP
boundary for these two routes.

The directory conftest previously registered only the v1 route tree; it now mounts
the v2 sub-registry as well, so both suites share one server. `kernel_scheduling_history`
has no writer yet (BA-6852), so the fixture seeds rows directly, alongside real kernel
rows the scoped endpoint's existence check needs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant