Skip to content

Conversation

Microchesst
Copy link
Contributor

@Microchesst Microchesst commented Jun 16, 2025

Title

Refactor: Pipeline modules integration - Modular architecture for concurrent executions connected to #1235

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Security patch
  • UI/UX improvement

Description

This PR refactors the entire pipeline execution into a modular architecture to improve maintainability and prepare the foundation for concurrent digital twin executions.

Key Changes:

  • Created 3 new focused modules in /model/backend/gitlab/execution/:

    • logFetching.ts - Log fetching and processing utilities
    • pipelineCore.ts - Core pipeline timing and utilities
    • statusChecking.ts - Status validation and mapping
  • Refactored existing pipeline files to use new modules:

    • pipelineUtils.ts - Updated to import from new modules, cleaner UI state management
    • pipelineChecks.ts - Now uses statusChecking.ts and pipelineCore.ts functions
    • pipelineHandler.ts - Updated imports and integration with new architecture
    • LogDialog.tsx - Updated to work with new module structure
  • Updated all imports across the codebase to use new module locations

  • Preserved all utility functions needed for future concurrent executions feature

  • Maintained clean architecture with business logic in /model and UI logic in /preview

What was refactored:

  • Before: Mixed concerns across pipelineUtils.ts, pipelineChecks.ts, pipelineHandler.ts
  • After: Clean separation - core logic in /model, UI logic in /preview, focused responsibilities

Impact

Dependencies:

  • No new dependencies added
  • All existing dependencies maintained

Breaking Changes:

  • None - all imports updated

Additional Information

Future Work:
This refactoring prepares for concurrent digital twin executions. The utility functions in logFetching.ts (like validateLogs, combineLogs, countSuccessfulJobs) are specifically preserved for the concurrent executions feature.

Architecture Notes:

  • Business logic moved to /model/backend/gitlab/execution/
  • UI logic remains in /preview/route/digitaltwins/execute/
  • Clean separation of concerns maintained
  • All functions are pure and stateless where possible

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have added tests for all the new code and any changes made to existing code.
  • I have made corresponding changes to the documentation.

Copy link

codecov bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 96.89441% with 5 lines in your changes missing coverage. Please review.

Project coverage is 92.39%. Comparing base (664266b) to head (604caf0).
Report is 2 commits behind head on feature/distributed-demo.

Files with missing lines Patch % Lines
.../src/model/backend/gitlab/execution/logFetching.ts 96.29% 2 Missing ⚠️
...review/route/digitaltwins/execute/pipelineUtils.ts 33.33% 2 Missing ⚠️
...eview/route/digitaltwins/execute/pipelineChecks.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/distributed-demo    #1272      +/-   ##
============================================================
+ Coverage                     92.08%   92.39%   +0.30%     
============================================================
  Files                            92       96       +4     
  Lines                          2526     2655     +129     
  Branches                        406      464      +58     
============================================================
+ Hits                           2326     2453     +127     
- Misses                          197      199       +2     
  Partials                          3        3              
Files with missing lines Coverage Δ
client/src/model/backend/gitlab/constants.ts 100.00% <100.00%> (ø)
...src/model/backend/gitlab/execution/pipelineCore.ts 100.00% <100.00%> (ø)
...c/model/backend/gitlab/execution/statusChecking.ts 100.00% <100.00%> (ø)
...src/model/backend/gitlab/types/executionHistory.ts 100.00% <100.00%> (ø)
...eview/route/digitaltwins/execute/pipelineChecks.ts 97.82% <90.90%> (-2.18%) ⬇️
.../src/model/backend/gitlab/execution/logFetching.ts 96.29% <96.29%> (ø)
...review/route/digitaltwins/execute/pipelineUtils.ts 93.75% <33.33%> (-0.13%) ⬇️
Components Coverage Δ
Website 92.39% <96.89%> (+0.30%) ⬆️
Lib Microservice ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the pipeline utilities into three focused modules to improve maintainability and lay the groundwork for concurrent digital twin executions. Key changes include splitting log fetching, core timing, and status checking functionalities into separate modules and updating related tests and UI integrations accordingly.

  • Created new modules (logFetching.ts, pipelineCore.ts, statusChecking.ts) in /model/backend/gitlab/execution.
  • Refactored existing files to use the new modules and updated corresponding tests.
  • Updated polling and status handling functions in the UI integration.

Reviewed Changes

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

Show a summary per file
File Description
client/test/unit/model/backend/gitlab/execution/statusChecking.test.ts Added tests for new status checking functions
client/test/unit/model/backend/gitlab/execution/pipelineCore.test.ts Added tests for pipeline core utilities
client/test/unit/model/backend/gitlab/execution/logFetching.test.ts Added tests for log fetching functions
client/test/preview/unit/routes/digitaltwins/execute/PipelineUtils.test.ts Updated test import for fetchJobLogs
client/test/preview/unit/routes/digitaltwins/execute/PipelineChecks.test.ts Updated tests to use functions from pipelineCore
client/test/preview/integration/route/digitaltwins/execute/PipelineUtils.test.tsx Updated integration tests to use new fetchJobLogs
client/test/preview/integration/route/digitaltwins/execute/PipelineChecks.test.tsx Updated integration tests to use pipelineCore functions
client/src/preview/route/digitaltwins/execute/pipelineUtils.ts Refactored to wrap new logFetching module
client/src/preview/route/digitaltwins/execute/pipelineChecks.ts Updated status checking and polling using new modules
client/src/model/backend/gitlab/types/executionHistory.ts Added and updated types for execution history
client/src/model/backend/gitlab/execution/statusChecking.ts Introduced status mapping and checking utilities
client/src/model/backend/gitlab/execution/pipelineCore.ts Introduced core pipeline functions for delay, timeout, and polling
client/src/model/backend/gitlab/execution/logFetching.ts Extracted log fetching functionality and related helpers
client/src/model/backend/gitlab/constants.ts Added a polling interval constant

Copy link

@prasadtalasila
Copy link
Contributor

@Microchesst please refer to the comments made in this PR

prasadtalasila added a commit that referenced this pull request Jun 20, 2025
Moves the pipeline execution files into the stable codebase and 
prepares it to run multiple executions

---------
Co-authored-by: Microchesst <[email protected]>
Co-authored-by: Marcus Jensen <[email protected]>
Co-authored-by: Copilot <[email protected]>
@prasadtalasila
Copy link
Contributor

merged via PR #1277

@github-project-automation github-project-automation bot moved this from In progress to Done in Digital Twin as a Service Jun 20, 2025
atomicgamedeveloper pushed a commit to atomicgamedeveloper/DTaaS that referenced this pull request Jul 14, 2025
 and INTO-CPS-Association#1277)

Moves the pipeline execution files into the stable codebase and 
prepares it to run multiple executions

---------
Co-authored-by: Microchesst <[email protected]>
Co-authored-by: Marcus Jensen <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants