- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1
 
feat(workers): add Redmine integration and update Docker configuration #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Updated the base image for the Temporal Dockerfile to version 1.27.2. - Changed database configuration in `docker-compose.yml` to use `postgres12` and added a new environment variable for visibility database. - Introduced a new Dockerfile for the Temporal worker, defining multi-stage builds for development and production environments. - Enhanced healthcheck command in the Temporal Dockerfile for improved service monitoring. - Added error handling in the main worker script to ensure unhandled errors are logged. These changes improve the setup and configuration of the Temporal service and its workers, enhancing reliability and maintainability.
…tests - Extracted error handling logic into a separate function `handleRunError` for better modularity and reusability. - Updated the main script to use the new error handling function. - Added unit tests for `handleRunError` to ensure proper logging and exit behavior on unhandled errors. These changes improve the robustness of error handling in the application and enhance test coverage for critical functionality.
- Modified ESLint rules to allow console error logging while maintaining warnings for other console methods. - Refactored test imports for better organization and clarity. - Enhanced the `handleRunError` test to ensure proper error logging and process exit behavior, improving test reliability. These changes improve code quality and testing practices, ensuring better adherence to ESLint rules and more robust error handling tests.
- Removed unnecessary installation of netcat from the Dockerfile for all stages. - Streamlined the build process by eliminating redundant commands, focusing on npm installations. These changes enhance the efficiency of the Dockerfile, reducing build time and complexity.
feat(dependencies): update package dependencies and TypeScript configuration - Added new dependencies: `@temporalio/client`, `@temporalio/worker`, `mysql2`, and `zod` to `package.json`. - Updated `@types/node` version to `22.15.21` for improved type definitions. - Adjusted `tsconfig.json` to change the `rootDir` to `..` and include TypeScript files from the `../common` directory. These changes enhance the project's dependency management and TypeScript configuration, ensuring compatibility with the latest packages and improving code organization.
- Introduced `DefaultLogger` for consistent error logging in the main worker script. - Updated `handleRunError` to utilize the logger for error messages and added a delay before exiting the process. - Refactored the `run` function to simplify its return statement. - Enhanced unit tests to verify the new logging behavior and ensure proper process exit. These changes improve the clarity and reliability of error handling in the application, ensuring that errors are logged consistently and the process exits gracefully.
- Removed commented-out code related to timer behavior in the `handleRunError` tests. - Improved clarity and focus of the tests by eliminating unnecessary comments. These changes enhance the readability and maintainability of the test suite, ensuring that the tests are concise and relevant.
… workflow - Changed the dependency installation command from `npm ci` to `npm install` in the code quality workflow for better compatibility with the project setup. - This adjustment ensures that the workflow installs the latest dependencies as specified in `package.json`, improving the reliability of the build process.
- Added `@temporalio/activity`, `@temporalio/workflow`, and `source-map-support` to both `package.json` and `package-lock.json`. - Updated the versioning for existing Temporal dependencies to ensure compatibility. These changes enhance the project's functionality by integrating additional Temporal features and improving error stack trace support.
…pendencies - Added new dependencies including `@emnapi/core`, `@emnapi/runtime`, and various `@esbuild` modules to `package-lock.json`. - Updated existing dependencies such as `@grpc/grpc-js` and `minimatch` to newer versions. - Removed outdated dependencies and ensured compatibility with the latest package versions. These changes enhance the project's dependency management, ensuring that the application utilizes the latest features and improvements from the updated packages.
- Introduced utility functions for environment validation and error logging in the new `utils.ts` file. - Updated the main worker script to validate environment variables at startup and improved error handling with consistent logging. - Refactored the `run` function to establish a connection and handle errors more gracefully. - Adjusted Vitest configuration to lower coverage thresholds for better test management. - Added new tests for the `weeklyFinancialReportsWorkflow` and improved existing tests for error handling. These changes enhance the worker's reliability and maintainability by ensuring proper environment validation and consistent error logging.
….ts and weeklyFinancialReports.test.ts - Reordered imports in `index.test.ts` for consistency and clarity. - Enhanced the formatting of the `logSpy` mock implementation for better readability. - Updated error handling tests in `weeklyFinancialReports.test.ts` to improve clarity and maintainability. - Ensured that the tests are concise and focused on their intended functionality. These changes enhance the overall structure and readability of the test suite, making it easier to understand and maintain.
…ling - Updated the `weeklyFinancialReportsWorkflow` to accept a customizable period parameter, enhancing flexibility. - Introduced a new `fetchFinancialData` function to encapsulate financial data retrieval logic, improving code organization. - Enhanced error handling in the main worker script by simplifying the error handling function call. - Refactored the validation schema in `worker.ts` to use optional environment variables for better configuration management. These changes enhance the maintainability and usability of the financial reporting workflow, allowing for more dynamic data handling and improved error management.
…s test - Modified the test for the `weeklyFinancialReportsWorkflow` to reflect the correct report string for a custom period. - Removed the custom report title expectation and replaced it with the default 'Weekly Financial Report' to ensure accurate test validation. These changes enhance the accuracy of the test suite by aligning expectations with the actual output of the workflow.
- Introduced a new `Redmine` class for managing database connections and fetching project units from Redmine. - Added `package.json` and `package-lock.json` for the common worker module, including necessary dependencies. - Updated `docker-compose.yml` to include environment variables for Temporal CLI configuration. - Created new activities and workflows for handling weekly financial reports, integrating Redmine data retrieval. - Enhanced error handling and logging in the workflow to improve debugging and maintainability. These changes enhance the integration with Redmine, allowing for better data management and reporting capabilities within the worker framework.
| 
          
 Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the  You can disable this status message by setting the  Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit: 
 SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
 Other keywords and placeholders
 CodeRabbit Configuration File (
 | 
    
          
🔍 Vulnerabilities of 
 | 
    
| digest | sha256:b1f11cee35b6fb63747aeed38bd17d5227df43b93332ac4cb88fdeddcf18a556 | 
| vulnerabilities | |
| platform | linux/amd64 | 
| size | 243 MB | 
| packages | 1628 | 
📦 Base Image node:20-alpine
 
 Description
  | ||||||||||||
 
 Description
  | ||||||||||||
 
 Description
  | ||||||||||||
 
 Description
  | ||||||||||||
 
 Description
  | ||||||||||||
 
 Description
  | ||||||||||||
 
 Description
  | 
- Eliminated the console log statement from the `getProjectUnits` function in `redmine.ts` to clean up the code and improve readability. This change enhances the clarity of the code by removing unnecessary logging, which is not needed in the production environment.
…uration - Removed redundant error logging functions from `utils.ts` to simplify the codebase. - Introduced a new `.env.test` file for environment variable management during testing. - Updated `package.json` and `package-lock.json` to include new dependencies for improved functionality. - Adjusted the `weeklyFinancialReportsWorkflow` to enhance report generation by including project units in the output. These changes improve the maintainability of the worker by reducing complexity in error handling and enhancing environment configuration for testing.
…iles - Reordered and formatted imports in `redmine.test.ts` and `weeklyFinancialReports.test.ts` for better readability and consistency. - Adjusted the `vitest.config.ts` file to ensure proper environment configuration during testing. These changes enhance the clarity and maintainability of the test suite by standardizing import statements and improving overall code organization.
- Updated various dependencies in `package-lock.json` to their latest versions, including `@babel/parser`, `@babel/types`, `@esbuild`, `@rollup`, and others. - This change ensures that the project uses the most recent and stable versions of dependencies, improving performance and security. These updates enhance the overall reliability and maintainability of the project by keeping dependencies up to date.
- Reinstated the logger in the `beforeAll` setup of `redmine.test.ts` to improve logging during test execution. - Removed an unnecessary expectation check for the result length in the `getProjectUnits` test, streamlining the test logic. These changes enhance the test suite's logging capabilities and improve the clarity of the test assertions.
- Updated the logger implementation in both `redmine.test.ts` and `weeklyFinancialReports.test.ts` to ensure consistent logging during test execution. - Removed unnecessary error activity function from `weeklyFinancialReports.test.ts`, streamlining the test code. These changes improve the clarity of log outputs and enhance the maintainability of the test suite.
… dependencies - Added license information for several dependencies in `package-lock.json`, including `aws-ssl-profiles`, `denque`, `generate-function`, `iconv-lite`, `long`, `lru-cache`, `mysql2`, `named-placeholders`, `safer-buffer`, and `sqlstring`. - This update ensures compliance with licensing requirements and improves transparency regarding the usage of third-party packages. These changes enhance the maintainability of the project by providing clear licensing information for all dependencies.
…fore running coverage - Modified the code quality workflow to remove `node_modules` and `package-lock.json` before executing the coverage command. This ensures a clean environment for accurate test coverage results. This change improves the reliability of the coverage reports by preventing potential issues caused by stale dependencies.
…management - Updated the code quality workflow to ensure a clean installation of dependencies by removing `node_modules` and `package-lock.json` before running the coverage command. This change enhances the reliability of the coverage results by preventing issues from stale dependencies. These modifications contribute to a more consistent and accurate testing environment.
…nstallation - Updated the code quality workflow to separate the installation of common and main dependencies. This change improves clarity and ensures that each set of dependencies is installed correctly, enhancing the reliability of the testing environment. These modifications contribute to a more organized and efficient setup process for the project.
…edmine integration - Added a new `common` directory under the `main/src` path to house shared utilities, types, and configuration for all workers, enhancing modularity. - Updated import paths in `redmine.test.ts` and `redmine.ts` to reflect the new structure, ensuring proper integration with the Redmine class. - Removed the now obsolete `package.json` and `package-lock.json` files from the `common` directory, streamlining the project structure. These changes improve the organization of shared resources and facilitate better code reuse across workers.
- Adjusted import paths in `index.ts`, `redmine.test.ts`, and `redmine.ts` to ensure they correctly reference the new structure of the `common` directory. - Reformatted code in `Redmine.ts` and `utils.ts` for improved readability, including consistent spacing and line breaks. These changes enhance code clarity and maintainability by standardizing import statements and improving overall formatting.
- Added a new `redmine.types.ts` file to define `ProjectUnit` and `FinancialData` interfaces, improving type organization and clarity. - Updated `redmine.ts` to import types from `redmine.types.ts`, enhancing modularity and reducing redundancy. - Removed commented-out threshold settings in `vitest.config.ts` for cleaner configuration. - Refactored `weeklyFinancialReports` workflow to use an arrow function for better consistency in function definitions. These changes enhance code maintainability and improve type safety across the project.
- Removed the export statement for `temporalConfig` in `index.ts` as it is no longer needed. This change helps to clean up the code and improve maintainability by eliminating unnecessary exports. These modifications contribute to a more streamlined and organized codebase.
- Introduced `handleRunError` function in `index.ts` to centralize error logging and process termination for the main worker. This enhances error management by providing a consistent approach to handle unexpected errors during execution. These modifications improve the robustness of the application by ensuring that errors are logged appropriately before the process exits.
          
 | 
    


Redmineclass for managing database connections and fetching project units from Redmine.package.jsonandpackage-lock.jsonfor the common worker module, including necessary dependencies.docker-compose.ymlto include environment variables for Temporal CLI configuration.These changes enhance the integration with Redmine, allowing for better data management and reporting capabilities within the worker framework.