Skip to content

Conversation

atomicgamedeveloper
Copy link
Contributor

@atomicgamedeveloper atomicgamedeveloper commented Sep 19, 2025

Pull Request Template

Title

Finalize Implementation of Concurrent Digital Twin Execution with IndexedDB Integration

Type of Change

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

Description

This PR finalizes the implementation of the concurrent execution for Digital Twins with IndexedDB integration. Users can now start multiple executions of the same Digital Twin simultaneously, with execution history persisted in the browser's IndexedDB. The implementation includes a new execution history data model, IndexedDB service, and UI components to display and manage execution history.

New is that it merges recent changes of the up-coming version 0.8 of DTaaS such as settings menu and new interface design.

Working on Testing

  • Added unit tests for the IndexedDB service and Redux store
  • Manually tested concurrent execution functionality
  • Verified persistence of execution history across browser sessions
  • Fixed existing tests to accommodate the new functionality

Impact

  • Improves user experience by allowing multiple executions to run in parallel
  • Adds local persistence of execution history using IndexedDB
  • Enhances the UI with execution history list and status indicators

Additional Information

This PR builds on top of #1235 by Microchesst.

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 Sep 19, 2025

Codecov Report

❌ Patch coverage is 83.64905% with 164 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.05%. Comparing base (6802dbd) to head (3049e79).

Files with missing lines Patch % Lines
...del/backend/gitlab/state/executionHistory.slice.ts 73.33% 36 Missing ⚠️
client/src/services/ExecutionStatusService.ts 13.15% 33 Missing ⚠️
client/src/database/digitalTwins.ts 84.00% 20 Missing ⚠️
...e/digitaltwins/execution/executionStatusManager.ts 77.21% 18 Missing ⚠️
.../digitaltwins/execution/executionStatusHandlers.ts 71.18% 17 Missing ⚠️
.../src/model/backend/gitlab/execution/logFetching.ts 71.05% 11 Missing ⚠️
client/src/model/backend/LogDialog.tsx 78.37% 8 Missing ⚠️
.../src/components/execution/ExecutionHistoryList.tsx 93.69% 7 Missing ⚠️
client/src/model/backend/digitalTwin.ts 91.80% 5 Missing ⚠️
...preview/route/digitaltwins/manage/DeleteDialog.tsx 87.50% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/distributed-demo    #1328      +/-   ##
============================================================
- Coverage                     95.72%   88.05%   -7.67%     
============================================================
  Files                           103      128      +25     
  Lines                          2875     3734     +859     
  Branches                        483      604     +121     
============================================================
+ Hits                           2752     3288     +536     
- Misses                          120      443     +323     
  Partials                          3        3              
Files with missing lines Coverage Δ
client/src/components/asset/HistoryButton.tsx 100.00% <100.00%> (ø)
client/src/database/types.ts 100.00% <100.00%> (ø)
client/src/model/backend/DTAssets.ts 76.76% <ø> (ø)
client/src/model/backend/fileHandler.ts 91.02% <ø> (ø)
...odel/backend/gitlab/digitalTwinConfig/constants.ts 100.00% <100.00%> (ø)
...c/model/backend/gitlab/execution/statusChecking.ts 100.00% <100.00%> (ø)
...rc/model/backend/gitlab/state/digitalTwin.slice.ts 100.00% <ø> (ø)
...t/src/model/backend/interfaces/sharedInterfaces.ts 100.00% <ø> (ø)
client/src/model/backend/libraryAsset.ts 95.74% <100.00%> (ø)
client/src/model/backend/libraryManager.ts 100.00% <ø> (ø)
... and 38 more

... and 15 files with indirect coverage changes

Components Coverage Δ
Website 92.08% <83.64%> (-3.64%) ⬇️
Lib Microservice 2.95% <ø> (∅)
🚀 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

sonarqubecloud bot commented Oct 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
4.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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

Finalizes the implementation of concurrent Digital Twin execution with IndexedDB integration for local persistence. Users can now start multiple executions simultaneously, view execution history, and manage executions through new UI components. This builds on version 0.8 changes including settings menu and interface design updates.

Key Changes

  • Adds IndexedDB service for execution history persistence
  • Implements concurrent execution support with execution status tracking
  • Adds new execution history UI components with log viewing capabilities

Reviewed Changes

Copilot reviewed 120 out of 125 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
servers/lib/test/integration/files.service.integration.spec.ts Removes afterEach hook to fix test configuration
client/test/unit/route/digitaltwins/execution/ExecutionUIHandlers.test.ts Adds comprehensive tests for execution UI handlers
client/test/unit/route/digitaltwins/execution/ExecutionStatusManager.test.ts Updates import paths and adds type safety improvements
client/test/unit/route/digitaltwins/execution/ExecutionButtonHandlers.test.ts Updates imports and adds execution ID parameter support
client/test/unit/model/backend/gitlab/execution/statusChecking.test.ts Comments out null/undefined parameter tests
client/test/unit/model/backend/gitlab/execution/logFetching.test.ts Removes null project ID test case
client/test/unit/database/digitalTwins.test.ts Adds comprehensive IndexedDB service tests
client/test/unit/components/PrivateRoute.test.tsx Adds mocks for new execution history components
client/test/preview/unit/util/*.test.ts Updates import paths from preview/util to model/backend
client/test/unit/components/execution/ExecutionHistoryList.test.tsx Adds comprehensive tests for execution history UI component
client/test/unit/components/asset/*.test.tsx Updates component tests for new execution history functionality
client/test/preview/unit/store/executionHistory.slice.test.ts Adds comprehensive Redux slice tests
client/test/preview/unit/store/Store.test.ts Updates for new Redux state structure
client/test/preview/unit/routes/digitaltwins/manage/*.test.tsx Updates for new adapter pattern
client/test/preview/unit/routes/digitaltwins/execute/*.test.tsx Updates imports and adds execution history tests
client/test/preview/integration/**/*.test.tsx Updates integration tests for new execution patterns
client/test/e2e/tests/*.test.ts Adds end-to-end tests for concurrent execution
client/src/util/digitalTwinAdapter.ts Adds adapter pattern for bridging Redux state and business logic
client/src/store/store.ts Adds execution history slice to Redux store
client/src/store/snackbar.slice.ts Simplifies snackbar hide logic
client/src/store/selectors/*.ts Adds selectors for execution history and digital twin state
client/src/route/digitaltwins/Snackbar.tsx Updates import path for snackbar slice
client/src/preview/store/cart.slice.ts Updates import path for LibraryAsset
Comments suppressed due to low confidence (2)

servers/lib/test/integration/files.service.integration.spec.ts:1

  • The removal of afterEach hook may cause test isolation issues if mocks are not properly reset between tests. Consider adding this back or ensuring mock cleanup is handled elsewhere.
import { describe, it, expect, jest } from '@jest/globals';

client/test/unit/model/backend/gitlab/execution/logFetching.test.ts:1

  • Removing the null projectId test case reduces coverage for error handling scenarios. This test case helps ensure the function gracefully handles missing project IDs.
import {

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ignoredActions: [
'digitalTwin/setDigitalTwin',
'assets/setAsset',
'assets/setAsset',
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The 'assets/setAsset' action is duplicated in the ignoredActions array. Remove the duplicate entry.

Suggested change
'assets/setAsset',

Copilot uses AI. Check for mistakes.

Comment on lines +6 to +12

if (typeof globalThis.structuredClone !== 'function') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
globalThis.structuredClone = (obj: any): any =>
JSON.parse(JSON.stringify(obj));
}

Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The structuredClone polyfill implementation may not handle all edge cases that the native implementation does (e.g., circular references, complex objects). Consider using a more robust polyfill library or documenting the limitations.

Suggested change
if (typeof globalThis.structuredClone !== 'function') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
globalThis.structuredClone = (obj: any): any =>
JSON.parse(JSON.stringify(obj));
}
import structuredClonePolyfill from '@ungap/structured-clone';
if (typeof globalThis.structuredClone !== 'function') {
globalThis.structuredClone = structuredClonePolyfill;
}

Copilot uses AI. Check for mistakes.

@prasadtalasila
Copy link
Contributor

@atomicgamedeveloper please add the following lines at the end of .gitignore file (this file exists at the top-level of the project)


.qlty
!.qlty/qlty.toml

Copy link
Contributor

@prasadtalasila prasadtalasila left a comment

Choose a reason for hiding this comment

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

@atomicgamedeveloper thanks for the huge PR. Please see the comments. General suggestions.

  1. Please remove relative paths in imports.
  2. Where possible, move code to model/. For example, new code added in util can probably go into model/util.

thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

This file can be moved out of preview/...

Copy link
Contributor

Choose a reason for hiding this comment

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

please move the react components to src/components/...

Copy link
Contributor

Choose a reason for hiding this comment

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

you mentioned about SnackBar component being used in other pages. Can this component be moved to src/components/?

case 'success':
executionStatus = ExecutionStatus.COMPLETED;
break;
return ExecutionStatus.COMPLETED;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change would give linting error of too many return statements.

}
export const getStatusDescription = (status: string): string => {
switch (status.toLowerCase()) {
case 'success':
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to avoid too many return statements?

* Interface for execution history operations
* Abstracts away the underlying storage implementation
*/
export interface IExecutionHistory {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this interface be moved to model/backend/interfaces/execution.ts?

/**
* Represents the schema for the IndexedDB database
*/
export interface IndexedDBSchema {
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not seem to have been used anywhere.

@@ -0,0 +1,59 @@
import DigitalTwin from 'model/backend/digitalTwin';
import { DigitalTwinData } from 'model/backend/gitlab/state/digitalTwin.slice';
import { initDigitalTwin } from 'preview/util/init';
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the dependency to preview code. Also this code can be placed in model/util directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

can this go into model/backend/state?

Copy link
Contributor

Choose a reason for hiding this comment

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

this can probably go into model/util/

@prasadtalasila
Copy link
Contributor

This PR resolves issue #1232 and #1314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants