feat(BA-6581): wire IdleCheckerRepository into idle-check reconciler source#12398
feat(BA-6581): wire IdleCheckerRepository into idle-check reconciler source#12398seedspirit wants to merge 3 commits into
Conversation
…source Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tainer Construct it in an IdleCheckerRepositories container and pass it through OrchestrationInput like the other repositories, instead of building it inline in the orchestration composer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces the placeholder idle-check reconciler source with a real data path. It introduces an IdleCheckerRepository (backed by a new IdleCheckerDBSource) that fetches a normalized IdleCheckSnapshot — sessions, their applicable scopes (resource group / project / domain), scope→checker bindings, and typed checker specs — and wires this repository through the orchestration DI and the reconciler stage factory so IdleCheckSource.fetch_reconcile_info returns the snapshot instead of an empty placeholder. It also makes IdleCheckerSpecABC.load dispatch by checker_type into concrete (currently field-less) spec classes that land their fields in follow-up stories. The change is read-only; the handler/applier remain placeholders.
Changes:
- New
idle_checkerrepository layer (repository,repositories,db_source, resulttypes) producingIdleCheckSnapshot, plus newScopeType/ScopeRef/IdleCheckSessionViewdata types. - DI wiring of
idle_checker_repositorythroughRepositories, both orchestration composers, sokovan input, and the reconciler stage factory, withIdleCheckReconcileInfoswitched fromsession_idstosnapshot. IdleCheckerSpecABC.loadnow dispatches onchecker_typetoSessionLifetimeSpec/NetworkTimeoutSpec/UtilizationSpec.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
repositories/idle_checker/db_source/db_source.py |
New DB reads assembling the normalized snapshot (joins + correlated enabled-binding filter). |
repositories/idle_checker/repository.py |
Thin repository delegating to the db_source. |
repositories/idle_checker/repositories.py |
IdleCheckerRepositories container following the per-entity wrapper convention. |
repositories/idle_checker/types.py |
IdleCheckerRef, IdleCheckerBindingRef, IdleCheckSnapshot result types. |
repositories/repositories.py |
Registers idle_checker in the aggregate Repositories. |
data/idle_checker/types.py |
Adds ScopeType, ScopeRef, IdleCheckSessionView. |
models/idle_checker/spec.py |
load discriminated dispatch + concrete spec subclasses. |
sokovan/idle_check/source.py |
Injects repository; fetches real snapshot. |
sokovan/idle_check/types.py |
IdleCheckReconcileInfo carries snapshot; entity_ids derives from it. |
sokovan/stages/idle_check.py |
build_idle_check_stage now takes the repository. |
sokovan/stages/factory.py |
Threads idle_checker_repository into stage assembly. |
dependencies/orchestration/composer.py, dependencies/orchestration/sokovan.py, dependencies/composer.py |
DI plumbing of the new repository. |
tests/.../idle_check/test_source.py, test_stage.py, dependencies/orchestration/test_sokovan.py, test_composer.py |
Update/add tests for the new repository argument and source behavior. |
changes/12398.feature.md |
Changelog entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def fetch_idle_check_snapshot( | ||
| self, session_statuses: Collection[SessionStatus] | ||
| ) -> IdleCheckSnapshot: | ||
| """Fetch sessions and scope-bound idle checkers without expanding to session-checker rows.""" |
Summary
IdleCheckerRepository(with its DB source and result types) that fetches a normalizedIdleCheckSnapshotof sessions, their applicable scopes, scope→checker bindings, and typed checker specs.IdleCheckSourcefetches real data instead of returning a placeholder.IdleCheckerSpecABC.loaddispatch bychecker_typeto concreteSessionLifetimeSpec/NetworkTimeoutSpec/UtilizationSpecspecs (fields land with the checker-logic stories).ScopeType,ScopeRef, andIdleCheckSessionViewdata types.Test plan
pants teston changed targets (test_source, test_stage, test_sokovan, test_composer) — passing locally via pre-push hookResolves BA-6581