From 1ea71a3acbf8ed2c875bf82f37777fa5f17dd026 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 1 Jun 2026 15:00:33 +0000 Subject: [PATCH] =?UTF-8?q?refactor(ara):=20rename=20FirstRunPipeline=20?= =?UTF-8?q?=E2=86=92=20AraFirstRunPipeline=20(PR=20#1139=20review)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligns the composition with its entry point (the `ara_first_run` lambda + `AraFirstRunTriggerBody`): clearer what the file does. - orchestration/first_run_pipeline.py → ara_first_run_pipeline.py - FirstRunPipeline → AraFirstRunPipeline; FirstRunCommand → AraFirstRunCommand - test files renamed to match Co-Authored-By: Claude Opus 4.8 --- applications/ara_first_run/handler.py | 8 ++++---- .../{first_run_pipeline.py => ara_first_run_pipeline.py} | 6 +++--- tests/applications/ara_first_run/test_handler.py | 6 +++--- ...rst_run_pipeline.py => test_ara_first_run_pipeline.py} | 8 ++++---- ...tion.py => test_ara_first_run_pipeline_integration.py} | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) rename orchestration/{first_run_pipeline.py => ara_first_run_pipeline.py} (94%) rename tests/orchestration/{test_first_run_pipeline.py => test_ara_first_run_pipeline.py} (89%) rename tests/orchestration/{test_first_run_pipeline_integration.py => test_ara_first_run_pipeline_integration.py} (98%) diff --git a/applications/ara_first_run/handler.py b/applications/ara_first_run/handler.py index 147bf066..761fd207 100644 --- a/applications/ara_first_run/handler.py +++ b/applications/ara_first_run/handler.py @@ -14,7 +14,7 @@ from domain.property_baseline.rebaseliner import StubRebaseliner from infrastructure.postgres.config import PostgresConfig from infrastructure.postgres.engine import make_engine from orchestration.property_baseline_orchestrator import PropertyBaselineOrchestrator -from orchestration.first_run_pipeline import FirstRunPipeline +from orchestration.ara_first_run_pipeline import AraFirstRunPipeline from orchestration.ingestion_orchestrator import ( EpcFetcher, IngestionOrchestrator, @@ -42,7 +42,7 @@ def _get_engine() -> Engine: class _RunsFirstRun(Protocol): - """The slice of FirstRunPipeline the handler delegates to.""" + """The slice of AraFirstRunPipeline the handler delegates to.""" def run(self, command: AraFirstRunTriggerBody) -> None: ... @@ -63,7 +63,7 @@ def build_first_run_pipeline( epc_fetcher: EpcFetcher, geospatial_repo: GeospatialRepository, solar_fetcher: SolarFetcher, -) -> FirstRunPipeline: +) -> AraFirstRunPipeline: """Compose the real three-stage pipeline on a Unit-of-Work factory. Each stage opens its own unit(s) and commits per batch (ADR-0012); the @@ -71,7 +71,7 @@ def build_first_run_pipeline( their config is not settled — see ``_source_clients_from_env``. Modelling is stubbed (#1136); its Scenario / Materials ports are seams. """ - return FirstRunPipeline( + return AraFirstRunPipeline( ingestion=IngestionOrchestrator( unit_of_work=unit_of_work, epc_fetcher=epc_fetcher, diff --git a/orchestration/first_run_pipeline.py b/orchestration/ara_first_run_pipeline.py similarity index 94% rename from orchestration/first_run_pipeline.py rename to orchestration/ara_first_run_pipeline.py index 6d521a35..ed507d6e 100644 --- a/orchestration/first_run_pipeline.py +++ b/orchestration/ara_first_run_pipeline.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Protocol -class FirstRunCommand(Protocol): +class AraFirstRunCommand(Protocol): """The slice of the trigger the pipeline threads downstream. Only the business fields — UPRNs and Scenario definitions are read from @@ -41,7 +41,7 @@ class ModellingStage(Protocol): def run(self, property_ids: list[int], scenario_ids: list[int]) -> None: ... -class FirstRunPipeline: +class AraFirstRunPipeline: """Composes the First Run stages end-to-end: Ingestion -> Baseline -> Modelling. @@ -64,7 +64,7 @@ class FirstRunPipeline: self._baseline = baseline self._modelling = modelling - def run(self, command: FirstRunCommand) -> None: + def run(self, command: AraFirstRunCommand) -> None: self._ingestion.run(command.property_ids) self._baseline.run(command.property_ids) self._modelling.run(command.property_ids, command.scenario_ids) diff --git a/tests/applications/ara_first_run/test_handler.py b/tests/applications/ara_first_run/test_handler.py index 21e96e3d..c02cc723 100644 --- a/tests/applications/ara_first_run/test_handler.py +++ b/tests/applications/ara_first_run/test_handler.py @@ -7,16 +7,16 @@ from applications.ara_first_run.ara_first_run_trigger_body import ( AraFirstRunTriggerBody, ) from applications.ara_first_run.handler import dispatch_first_run -from orchestration.first_run_pipeline import FirstRunCommand +from orchestration.ara_first_run_pipeline import AraFirstRunCommand class _SpyPipeline: """Records the command it is asked to run, instead of composing stages.""" def __init__(self) -> None: - self.received: Optional[FirstRunCommand] = None + self.received: Optional[AraFirstRunCommand] = None - def run(self, command: FirstRunCommand) -> None: + def run(self, command: AraFirstRunCommand) -> None: self.received = command diff --git a/tests/orchestration/test_first_run_pipeline.py b/tests/orchestration/test_ara_first_run_pipeline.py similarity index 89% rename from tests/orchestration/test_first_run_pipeline.py rename to tests/orchestration/test_ara_first_run_pipeline.py index 705282ee..8d78ff2c 100644 --- a/tests/orchestration/test_first_run_pipeline.py +++ b/tests/orchestration/test_ara_first_run_pipeline.py @@ -2,12 +2,12 @@ from __future__ import annotations from dataclasses import dataclass -from orchestration.first_run_pipeline import FirstRunCommand, FirstRunPipeline +from orchestration.ara_first_run_pipeline import AraFirstRunCommand, AraFirstRunPipeline @dataclass class _FakeCommand: - """A stand-in for AraFirstRunTriggerBody — structurally a FirstRunCommand.""" + """A stand-in for AraFirstRunTriggerBody — structurally a AraFirstRunCommand.""" portfolio_id: int property_ids: list[int] @@ -41,10 +41,10 @@ class _SpyModelling: def test_run_sequences_the_three_stages_threading_only_property_ids() -> None: # Arrange log: list[tuple[object, ...]] = [] - command: FirstRunCommand = _FakeCommand( + command: AraFirstRunCommand = _FakeCommand( portfolio_id=1, property_ids=[10, 11], scenario_ids=[7] ) - pipeline = FirstRunPipeline( + pipeline = AraFirstRunPipeline( ingestion=_SpyIngestion(log), baseline=_SpyBaseline(log), modelling=_SpyModelling(log), diff --git a/tests/orchestration/test_first_run_pipeline_integration.py b/tests/orchestration/test_ara_first_run_pipeline_integration.py similarity index 98% rename from tests/orchestration/test_first_run_pipeline_integration.py rename to tests/orchestration/test_ara_first_run_pipeline_integration.py index 781dcf87..381f3f21 100644 --- a/tests/orchestration/test_first_run_pipeline_integration.py +++ b/tests/orchestration/test_ara_first_run_pipeline_integration.py @@ -26,7 +26,7 @@ from infrastructure.postgres.property_baseline_performance_table import ( from infrastructure.postgres.epc_property_table import EpcPropertyModel from infrastructure.postgres.property_table import PropertyRow from orchestration.property_baseline_orchestrator import PropertyBaselineOrchestrator -from orchestration.first_run_pipeline import FirstRunPipeline +from orchestration.ara_first_run_pipeline import AraFirstRunPipeline from orchestration.ingestion_orchestrator import IngestionOrchestrator from orchestration.modelling_orchestrator import ModellingOrchestrator from repositories.property_baseline.property_baseline_postgres_repository import ( @@ -103,7 +103,7 @@ def test_first_run_baselines_through_repos_and_is_idempotent_on_rerun( def unit_of_work() -> PostgresUnitOfWork: return PostgresUnitOfWork(lambda: Session(db_engine)) - pipeline = FirstRunPipeline( + pipeline = AraFirstRunPipeline( ingestion=IngestionOrchestrator( unit_of_work=unit_of_work, epc_fetcher=_FetcherReturning(_lodged_epc()),