Skip to content

Conversation

@dmitryhruzin
Copy link
Collaborator

@dmitryhruzin dmitryhruzin commented Oct 1, 2025

List of changes

  • Update typescript packages
  • Update sonarcloud config
    • Split python and typescript apps to different sonarcloud projects
    • Fix python coverage report issue when sonarcloud wants to check not existed files
  • Update Admin Panel spa app to fix github warnings
  • Add NestJS Bedrock package
    • This package provides an abbillity to communicate with AWS Bedrock deployed AI model in your NestJS application
  • Added copilot rules

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation

Summary by CodeRabbit

  • New Features
    • Added AI chat endpoints and a new Bedrock integration module exposing service and module.
  • Improvements
    • UI effect now re-runs when view/grid state changes for more reliable updates.
  • CI/CD
    • Streamlined SonarCloud setup and fixed test coverage report handling for Python and TypeScript workflows.
  • Documentation
    • Added README with setup and usage guidance for the AI chat module.
  • Tests
    • Added unit and DTO validation tests for the AI chat module.
  • Style
    • Minor JSX and formatting cleanups.
  • Chores
    • Broad dependency version upgrades across apps and packages.

@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Walkthrough

Adds a new NestJS Bedrock AI package (module, service, controller, DTOs, tests, configs, README), introduces language-specific SonarCloud property files and CI steps to position/fix them, removes the root sonar-project.properties content, and applies broad dependency version bumps plus small test/type/JSX tweaks.

Changes

Cohort / File(s) Summary
CI workflows & Sonar files
.github/workflows/test_python.yml, .github/workflows/test_typescript.yml, sonar.ts.properties, sonar.python.properties, sonar-project.properties
Added steps to fix coverage.xml paths and to move/rename language-specific sonar.*.properties into sonar-project.properties; adjusted workflow path filters; removed content from previous root sonar-project.properties.
New NestJS Bedrock package
typescript/packages/nestjs-modules/bedrock/*
New package with BedrockModule, BedrockService, BedrockController (POST /ai-chats), DTOs (ChatRequestDto, ChatResponseDto), tests (*.spec.ts), README.md, package.json, tsconfig / tsconfig.spec.json, jest.config.ts, and src/index.ts exports.
Widespread dependency bumps
package.json, typescript/**/package.json (many apps/packages/modules)
Numerous dependency and devDependency version updates across root and many packages (NestJS, AWS SDK v3 clients, RxJS, Vite, ESLint, Firebase, Next, Strapi, Cypress, Jest tooling, Stripe, Sentry, etc.). No source logic changes.
Admin panel — tests & types & effect deps
typescript/apps/admin-panel-web-spa/package.json, typescript/apps/admin-panel-web-spa/src/testUtils/types.ts, typescript/apps/admin-panel-web-spa/src/feature/ProductList/ProductList.spec.tsx, typescript/apps/admin-panel-web-spa/src/feature/Type/Type.spec.tsx, typescript/apps/admin-panel-web-spa/src/feature/Type/Type.tsx
Added RouterLinkProps test type; updated mocked Link typings in specs to use RouterLinkProps; changed a useEffect dependency array to [availableViews, dispatch, gridApiRef]; SPA dependency bumps.
Bedrock test/config additions
typescript/packages/nestjs-modules/bedrock/jest.config.ts, typescript/packages/nestjs-modules/bedrock/tsconfig.json, typescript/packages/nestjs-modules/bedrock/tsconfig.spec.json
Added Jest wrapper config and TypeScript build/test configs for the new bedrock package.
Minor JSX/formatting edits in UI apps
typescript/apps/remix-firebase/app/routes/r.$topic.tsx, typescript/apps/strapi-payment-spa/src/pages/SubscriptionsPage/SubscriptionsPage.tsx
Reformatted JSX mapping expressions to multi-line/parenthesized blocks; no behavioral change.
Next/Remix small edits
typescript/apps/next-auth-auth0-app/next-env.d.ts, typescript/apps/remix-firebase/package.json
Updated Next.js TypeScript guidance comment; removed @types/cheerio in one app and applied dependency bumps.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Controller as BedrockController
  participant Service as BedrockService
  participant LLM as LangChain Bedrock

  Client->>Controller: POST /ai-chats { promptText, input }
  Controller->>Service: generate(promptText, input)
  Service->>Service: validate inputs
  Service->>LLM: invoke(SystemMessage, HumanMessage)
  alt success
    LLM-->>Service: AI text
    Service-->>Controller: { output: text }
    Controller-->>Client: 200 { output }
  else failure
    LLM-->>Service: error
    Service-->>Controller: throw HttpException(500, "AI service unavailable")
    Controller-->>Client: 500 error
  end
Loading
sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Move as Move sonar.*.properties
  participant Fix as Fix coverage.xml paths
  participant Scan as SonarCloud Scan

  GH->>Move: Rename/move `sonar.ts.properties` / `sonar.python.properties` -> `sonar-project.properties`
  opt Python workflow present
    GH->>Fix: Rewrite coverage.xml source paths (runner -> github workspace)
  end
  GH->>Scan: Run SonarCloud Scan using resulting `sonar-project.properties`
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

Hi — I’m a rabbit with a patch and grin,
I stitched a Bedrock route to let AI sing.
Sonar hops, workflows tidy their tracks,
Versions nudged, tests snug in their packs.
Carrots for CI — let's ship with a spring! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Release 25.10.01” is just a version tag and does not describe the content or primary changes of the pull request, so it fails to give readers any insight into what was actually updated or added. Please update the title to a concise summary of the main changes introduced, for example “Update TypeScript packages, refine SonarCloud config, and add NestJS Bedrock integration.”
Description Check ⚠️ Warning The pull request description only lists changes and a checklist but omits the required sections from the repository template such as the overall Description, Motivation and context, and Ticket reference, so it does not conform to the specified structure. Please restructure the description to include the mandatory template headings, adding a clear “### Description” and “### Motivation and context” with a ticket link, and ensure all required sections are filled out.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/REL-251001

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24e5a0a and 3f4ba43.

📒 Files selected for processing (1)
  • sonar.ts.properties (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-and-build
  • GitHub Check: test-and-build

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🧹 Nitpick comments (7)
typescript/packages/mobile-components/package.json (1)

39-39: Keep the minimum preset version at 7.24.7 or higher.

Line [39] relaxes the constraint from the known-good 7.24.7 to ^7.20.0, which allows installers (especially in fresh environments or mirrors) to resolve as far back as 7.20.0. That downgrades the minimum feature set we rely on. Stick with ^7.24.7 (or a newer upper-minor) so we preserve the fixes present in 7.24.x while still allowing automatic patch bumps.

typescript/packages/nestjs-modules/bedrock/jest.config.ts (1)

4-7: Optional: async function wrapper unnecessary.

The function doesn't perform any async operations, so the async keyword is unnecessary.

-export default async (): Promise<Config> => ({
+export default (): Config => ({
   ...nodeConfig,
   coveragePathIgnorePatterns: ['mocks']
 })
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts (1)

44-44: Note: Type assertion acceptable for test mocks.

The as any cast for the mock AIMessageChunk is acceptable in test context, though if AIMessageChunk has a simple constructor or factory, using that would be more type-safe.

typescript/packages/nestjs-modules/bedrock/package.json (1)

22-30: Update @langchain/core to 0.3.78 and verify security

  • Bump @langchain/core from 0.3.77 to 0.3.78 to align with the latest patch release.
  • Confirm no known vulnerabilities exist for any listed dependencies.
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (2)

27-33: Consider lazy initialization to defer AWS credential validation.

The ChatBedrockConverse client is initialized eagerly in the constructor. If AWS credentials are missing or invalid, the service will fail to instantiate, potentially preventing the entire NestJS application from starting. Consider lazy initialization (initializing llm on first use in the generate method) to defer credential validation and provide clearer error messages at invocation time rather than startup.

Example lazy initialization pattern:

-  constructor(private configService: ConfigService) {
-    this.llm = new ChatBedrockConverse({
-      model: this.configService.get<string>('AI_MODEL_NAME') || 'us.meta.llama4-maverick-17b-instruct-v1:0',
-      temperature: this.configService.get<number>('AI_MODEL_TEMPERATURE') || 0.3,
-      maxRetries: this.configService.get<number>('AI_MODEL_MAX_RETRIES') || 4
-    })
-  }
+  constructor(private configService: ConfigService) {}
+
+  private getLLM(): ChatBedrockConverse {
+    if (!this.llm) {
+      this.llm = new ChatBedrockConverse({
+        model: this.configService.get<string>('AI_MODEL_NAME') || 'us.meta.llama4-maverick-17b-instruct-v1:0',
+        temperature: this.configService.get<number>('AI_MODEL_TEMPERATURE') || 0.3,
+        maxRetries: this.configService.get<number>('AI_MODEL_MAX_RETRIES') || 4
+      })
+    }
+    return this.llm
+  }

Then update line 60 to use this.getLLM().invoke(messages).


1-66: Consider adding observability for production readiness.

For production use, consider adding structured logging and metrics:

  • Log invocation parameters (without sensitive prompt content if applicable)
  • Track latency, token usage, and error rates
  • Add configuration validation on startup

Example logging additions:

import { Injectable, Logger } from '@nestjs/common'

@Injectable()
export class BedrockService {
  private readonly logger = new Logger(BedrockService.name)
  // ... rest of implementation

  async generate(promptText: string, input: string): Promise<string> {
    if (!promptText || !input) {
      throw new Error('promptText and input are required')
    }

    this.logger.debug('Invoking Bedrock model')
    const messages = [new SystemMessage({ content: promptText }), new HumanMessage({ content: input })]
    try {
      const response = await this.llm.invoke(messages)
      this.logger.debug('Bedrock invocation successful')
      return response.text
    } catch (error) {
      this.logger.error('Bedrock invocation failed', error instanceof Error ? error.stack : String(error))
      throw new Error(`AI generation failed: ${error instanceof Error ? error.message : error?.toString()}`)
    }
  }
}
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock.dto.spec.ts (1)

76-93: Add missing test cases for ChatResponseDto.

The ChatResponseDto tests only cover valid data and empty string validation. Consider adding tests for:

  1. Missing output field validation
  2. Non-string type validation (similar to ChatRequestDto lines 55-73)

Add the following tests after line 92:

  it('should fail validation when output is missing', async () => {
    const dto = new ChatResponseDto()
    // output is missing

    const errors = await validate(dto)
    expect(errors.length).toBeGreaterThan(0)
    expect(errors[0].property).toBe('output')
  })

  it('should fail validation when output is not a string', async () => {
    const dto = new ChatResponseDto()
    ;(dto as any).output = 123 // Type violation

    const errors = await validate(dto)
    expect(errors.length).toBeGreaterThan(0)
    expect(errors[0].property).toBe('output')
  })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34945a6 and c102ea6.

⛔ Files ignored due to path filters (5)
  • python/packages/common/poetry.lock is excluded by !**/*.lock
  • python/packages/fast-api-modules/authz/poetry.lock is excluded by !**/*.lock
  • typescript/apps/admin-panel-web-spa/src/ui/DataTable/__snapshots__/DataTable.spec.tsx.snap is excluded by !**/*.snap
  • typescript/apps/admin-panel-web-spa/src/ui/Layout/__snapshots__/Layout.spec.tsx.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (71)
  • .github/workflows/test_python.yml (2 hunks)
  • .github/workflows/test_typescript.yml (2 hunks)
  • package.json (2 hunks)
  • typescript/apps/admin-panel-web-spa/package.json (1 hunks)
  • typescript/apps/admin-panel-web-spa/src/feature/ProductList/ProductList.spec.tsx (2 hunks)
  • typescript/apps/admin-panel-web-spa/src/feature/Type/Type.spec.tsx (1 hunks)
  • typescript/apps/admin-panel-web-spa/src/feature/Type/Type.tsx (1 hunks)
  • typescript/apps/admin-panel-web-spa/src/testUtils/types.ts (1 hunks)
  • typescript/apps/metabase-proxy-server/package.json (1 hunks)
  • typescript/apps/next-auth-auth0-app/next-env.d.ts (1 hunks)
  • typescript/apps/next-auth-auth0-app/package.json (1 hunks)
  • typescript/apps/rds-backup/package.json (1 hunks)
  • typescript/apps/remix-firebase/app/routes/r.$topic.tsx (1 hunks)
  • typescript/apps/remix-firebase/package.json (0 hunks)
  • typescript/apps/server-api/package.json (1 hunks)
  • typescript/apps/serverless-api-cqrs/package.json (1 hunks)
  • typescript/apps/serverless-api/package.json (1 hunks)
  • typescript/apps/serverless-scraper/package.json (1 hunks)
  • typescript/apps/serverless-settings-service/package.json (1 hunks)
  • typescript/apps/serverless-url-manager/package.json (1 hunks)
  • typescript/apps/strapi-payment-spa/src/pages/SubscriptionsPage/SubscriptionsPage.tsx (1 hunks)
  • typescript/apps/strapi/package.json (1 hunks)
  • typescript/apps/web-spa/package.json (1 hunks)
  • typescript/apps/web-ssr/package.json (1 hunks)
  • typescript/modules/nestjs/package.json (1 hunks)
  • typescript/packages/apollo-client/package.json (1 hunks)
  • typescript/packages/common/package.json (1 hunks)
  • typescript/packages/cypress/package.json (1 hunks)
  • typescript/packages/feature-config/package.json (1 hunks)
  • typescript/packages/firebase/package.json (1 hunks)
  • typescript/packages/jest-config/package.json (1 hunks)
  • typescript/packages/mobile-components/package.json (1 hunks)
  • typescript/packages/nestjs-modules/auth-jwt/package.json (1 hunks)
  • typescript/packages/nestjs-modules/authz/package.json (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/README.md (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/jest.config.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/package.json (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.module.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-response.dto.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock.dto.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/index.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/tsconfig.json (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/tsconfig.spec.json (1 hunks)
  • typescript/packages/nestjs-modules/cache-manager/package.json (1 hunks)
  • typescript/packages/nestjs-modules/database/package.json (1 hunks)
  • typescript/packages/nestjs-modules/health/package.json (1 hunks)
  • typescript/packages/nestjs-modules/logger/package.json (1 hunks)
  • typescript/packages/nestjs-modules/sendgrid/package.json (1 hunks)
  • typescript/packages/nestjs-modules/sentry/package.json (1 hunks)
  • typescript/packages/nestjs-modules/settings/package.json (1 hunks)
  • typescript/packages/nestjs-modules/strapi-roles/package.json (1 hunks)
  • typescript/packages/nestjs-modules/stripe-payment/package.json (1 hunks)
  • typescript/packages/nestjs-modules/stripe/package.json (1 hunks)
  • typescript/packages/next-intl-localization/package.json (1 hunks)
  • typescript/packages/react-google-maps/package.json (1 hunks)
  • typescript/packages/react-google-pay/package.json (1 hunks)
  • typescript/packages/react-localization-provider/package.json (1 hunks)
  • typescript/packages/react-microsoft-login/package.json (1 hunks)
  • typescript/packages/react-stripe/package.json (1 hunks)
  • typescript/packages/s3-log-transport/package.json (1 hunks)
  • typescript/packages/sendgrid/package.json (1 hunks)
  • typescript/packages/strapi-plugins/permissions-manager/package.json (1 hunks)
  • typescript/packages/web-features/package.json (1 hunks)
  • typescript/packages/web-storages/jotai-storage/package.json (1 hunks)
  • typescript/packages/web-storages/rtk-storage/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • typescript/apps/remix-firebase/package.json
🧰 Additional context used
🧬 Code graph analysis (9)
typescript/apps/admin-panel-web-spa/src/feature/Type/Type.spec.tsx (1)
typescript/apps/admin-panel-web-spa/src/testUtils/types.ts (1)
  • RouterLinkProps (3-3)
typescript/apps/admin-panel-web-spa/src/feature/ProductList/ProductList.spec.tsx (1)
typescript/apps/admin-panel-web-spa/src/testUtils/types.ts (1)
  • RouterLinkProps (3-3)
typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.ts (2)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1)
  • ChatRequestDto (3-21)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-response.dto.ts (1)
  • ChatResponseDto (3-12)
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (1)
  • BedrockService (2-2)
typescript/packages/nestjs-modules/bedrock/src/bedrock.module.spec.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (2)
  • BedrockModule (1-1)
  • BedrockService (2-2)
typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (1)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1)
  • ChatRequestDto (3-21)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock.dto.spec.ts (2)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1)
  • ChatRequestDto (3-21)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-response.dto.ts (1)
  • ChatResponseDto (3-12)
typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (2)
  • BedrockService (2-2)
  • BedrockModule (1-1)
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (1)
  • BedrockService (2-2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-and-build
  • GitHub Check: test-and-build
🔇 Additional comments (29)
typescript/apps/remix-firebase/app/routes/r.$topic.tsx (1)

76-78: Multi-line map formatting looks good

The expanded JSX improves readability without altering behavior.

typescript/apps/strapi-payment-spa/src/pages/SubscriptionsPage/SubscriptionsPage.tsx (1)

30-32: Readable JSX formatting ✅

Breaking the mapped <ProductCard> onto multiple lines improves readability without changing behavior. Looks good.

typescript/apps/admin-panel-web-spa/src/feature/Type/Type.tsx (1)

176-183: Verify the necessity of the expanded dependency array.

The updated dependency array [availableViews, dispatch, gridApiRef] replaces the original [], causing the effect to re-run whenever availableViews, dispatch, or gridApiRef change. This appears problematic:

  • gridApiRef: Ref objects from useGridApiRef() are stable but including them in dependency arrays can still trigger re-runs in some scenarios and is generally discouraged.
  • availableViews: If this becomes empty after being populated (e.g., all views deleted), the effect will attempt to save the default view again, which may not be intended.
  • dispatch: Stable from Redux, but unnecessary in the array.

The original [] dependency array ensured this initialization effect ran only once on mount, which aligns with the logic of checking if no views exist and creating a default.

Consider whether this effect should remain mount-only:

-  }, [availableViews, dispatch, gridApiRef])
+  }, [])

If the expanded dependencies are intentional, please verify that re-running the effect when availableViews changes doesn't cause unintended side effects (e.g., duplicate default view creation when views are cleared).

typescript/apps/admin-panel-web-spa/src/feature/ProductList/ProductList.spec.tsx (1)

13-13: LGTM! Type safety improvement for test mock.

Importing RouterLinkProps and using it to type the mocked Link component replaces any with proper type constraints, improving test type safety.

Also applies to: 23-23

typescript/apps/admin-panel-web-spa/src/testUtils/types.ts (1)

1-3: LGTM! Well-structured test utility type.

This centralized RouterLinkProps type properly combines AnchorHTMLAttributes with the required to prop, providing type safety for router Link mocks across test files.

typescript/apps/admin-panel-web-spa/src/feature/Type/Type.spec.tsx (1)

13-13: LGTM! Type safety improvement for test mock.

Importing and using RouterLinkProps to type the mocked Link component replaces any with proper type constraints, maintaining consistency with other test files and improving type safety.

Also applies to: 21-21

typescript/packages/s3-log-transport/package.json (1)

23-24: Verify Node 18+ support before bumping @aws-sdk/client-s3.

Version 3.895.0 of @aws-sdk/client-s3 (and the current 3.88x line) sets "engines": { "node": ">=18.0.0" }, reflecting AWS’s January 6 2025 policy that the JavaScript SDK v3 no longer supports Node 16.x.(app.unpkg.com) If any of our services, build agents, or Lambda runtimes are still pinned to Node 16, this upgrade will fail to install or emit ENOTSUP errors. Please confirm that every runtime consuming @dbbs/s3-log-transport is already on Node 18+ (or bump them alongside this change) before merging.(aws.amazon.com)

typescript/packages/web-storages/rtk-storage/package.json (1)

23-25: LGTM! Coordinated Redux ecosystem upgrade.

The dependency updates are part of a coordinated upgrade across multiple packages in the PR. The version bumps are incremental (minor and patch updates) and align with the broader ecosystem upgrade mentioned in the PR objectives.

typescript/packages/nestjs-modules/bedrock/src/index.ts (1)

1-2: LGTM! Clean barrel exports.

The module follows NestJS best practices by exporting both the module and service. The .js extensions are correct for ESM packages.

typescript/packages/nestjs-modules/bedrock/tsconfig.spec.json (1)

1-10: LGTM! Standard test configuration.

The test configuration properly extends the base TypeScript config and includes appropriate directories for test execution.

typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (1)

27-32: LGTM! Well-structured module with clear documentation.

The module follows NestJS best practices: properly registers controller and provider, exports the service for consumption by other modules, and includes comprehensive documentation.

typescript/packages/nestjs-modules/health/package.json (1)

23-28: Confirmed @nestjs/common@11.1.6 is published. Please review the changelog between 11.0.10 and 11.1.6 for any configuration updates or breaking changes affecting the health module.

typescript/packages/nestjs-modules/bedrock/src/bedrock.module.spec.ts (1)

17-38: LGTM! Module compilation and service provision tests are well-structured.

The tests correctly verify module compilation and BedrockService availability with proper mock setup.

typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts (1)

34-76: LGTM! Comprehensive test coverage with proper error handling.

The test suite thoroughly covers success, validation errors, and failure scenarios with appropriate mocking.

typescript/packages/nestjs-modules/bedrock/package.json (1)

1-11: LGTM! Package structure follows best practices.

The package configuration correctly uses ESM with proper exports, types fields, and files specification.

typescript/apps/admin-panel-web-spa/package.json (1)

17-33: Dependency versions verified; audit for vulnerabilities.

  • All specified versions exist on npm.
  • Run npm audit locally with your lockfile to confirm no high or critical vulnerabilities.
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-response.dto.ts (1)

1-12: LGTM! Clean DTO implementation.

The DTO structure is correct with appropriate validators for a required string response field. The JSDoc documentation clearly describes the field's purpose with a helpful example.

typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1)

1-21: LGTM! Well-documented request DTO.

The DTO correctly defines two required string fields with appropriate validators. The JSDoc comments provide clear context and practical examples for both the prompt text and user input fields.

typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (1)

1-61: LGTM! Comprehensive test coverage.

The test suite is well-structured with good coverage:

  • Controller initialization verification
  • Successful service invocation with correct parameter passing
  • Error handling with appropriate HttpException

The mock setup correctly simulates the BedrockService, and both happy path and error scenarios are tested.

typescript/packages/nestjs-modules/bedrock/README.md (2)

101-103: ```bash
#!/bin/bash

Locate and check for @langchain/aws in the bedrock package.json

echo "=== Locating bedrock/package.json ==="
pkg=$(find . -type f -path "*/typescript/packages/nestjs-modules/bedrock/package.json")
if [ -z "$pkg" ]; then
echo "Error: bedrock/package.json not found"
exit 1
fi
echo "Found: $pkg"
echo "=== Checking for @langchain/aws in dependencies ==="
jq '.dependencies, .peerDependencies' "$pkg" | grep -i "@langchain/aws" || echo "Dependency @langchain/aws not declared"


---

`9-13`: **Package name matches installation command.** No changes required.

</blockquote></details>
<details>
<summary>typescript/modules/nestjs/package.json (1)</summary><blockquote>

`24-27`: **Verified dependency updates; no unresolved security advisories.** All specified versions exist on npm and exceed the first-patched versions for their respective advisories, and no advisories affect @nestjs/config or @compodoc/compodoc.

</blockquote></details>
<details>
<summary>typescript/packages/nestjs-modules/authz/package.json (2)</summary><blockquote>

`23-28`: **LGTM! Dependency updates look good.**

The dependency version bumps are minor and patch updates that align with the PR's objective to update TypeScript packages. The NestJS updates (11.0.10 → 11.1.6) and other library updates follow semantic versioning appropriately.

---

`31-36`: **LGTM! DevDependency updates are appropriate.**

The devDependency updates are minor version bumps that should not introduce breaking changes.

</blockquote></details>
<details>
<summary>typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (2)</summary><blockquote>

`52-65`: **LGTM! Error handling and input validation are solid.**

The `generate` method correctly validates required inputs (lines 54-56) and wraps LLM invocation errors with context (lines 59-64). The error messages are clear and actionable.

---

`29-29`: **Verify AWS Bedrock default model name**  
The fallback value `'us.meta.llama4-maverick-17b-instruct-v1:0'` includes a region prefix and specific version. Confirm this model ID is valid and accessible in all target AWS regions by cross-checking AWS Bedrock documentation or the AWS Console.

</blockquote></details>
<details>
<summary>typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock.dto.spec.ts (1)</summary><blockquote>

`5-74`: **LGTM! Comprehensive test coverage for ChatRequestDto.**

The test suite thoroughly validates all constraints on `ChatRequestDto`:
- Valid data scenario (lines 6-13)
- Missing field validation (lines 15-33)
- Empty string validation (lines 35-53)
- Type validation with runtime checks (lines 55-73)

</blockquote></details>
<details>
<summary>typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.ts (2)</summary><blockquote>

`10-12`: **LGTM! Controller setup follows NestJS conventions.**

The controller route and dependency injection are properly configured.

---

`22-28`: **LGTM! Success path is clean and follows NestJS patterns.**

The method correctly delegates to the service and maps the response to the DTO format.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines 40 to 54
it('should import ConfigModule', async () => {
const createTestingModuleSpy = jest.spyOn(Test, 'createTestingModule')

await Test.createTestingModule({
imports: [BedrockModule]
})
.overrideProvider(ConfigService)
.useValue(mockConfigService)
.compile()

const passedModules = createTestingModuleSpy.mock.calls[0][0]
expect(passedModules.imports).toContain(BedrockModule)

createTestingModuleSpy.mockRestore()
})
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Test logic doesn't match the test name.

The test is named "should import ConfigModule" but it verifies that BedrockModule exists in the imports passed to Test.createTestingModule, not that BedrockModule internally imports ConfigModule. This assertion checks the test setup itself rather than BedrockModule's internal composition.

To properly verify that BedrockModule imports ConfigModule, consider either:

  1. Removing this test if ConfigModule import is an internal implementation detail, or
  2. Refactoring to inspect the module's actual imports metadata using NestJS reflection APIs
-  it('should import ConfigModule', async () => {
-    const createTestingModuleSpy = jest.spyOn(Test, 'createTestingModule')
-
-    await Test.createTestingModule({
-      imports: [BedrockModule]
-    })
-      .overrideProvider(ConfigService)
-      .useValue(mockConfigService)
-      .compile()
-
-    const passedModules = createTestingModuleSpy.mock.calls[0][0]
-    expect(passedModules.imports).toContain(BedrockModule)
-
-    createTestingModuleSpy.mockRestore()
-  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it('should import ConfigModule', async () => {
const createTestingModuleSpy = jest.spyOn(Test, 'createTestingModule')
await Test.createTestingModule({
imports: [BedrockModule]
})
.overrideProvider(ConfigService)
.useValue(mockConfigService)
.compile()
const passedModules = createTestingModuleSpy.mock.calls[0][0]
expect(passedModules.imports).toContain(BedrockModule)
createTestingModuleSpy.mockRestore()
})

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c102ea6 and 54769ad.

📒 Files selected for processing (4)
  • .github/workflows/test_python.yml (2 hunks)
  • sonar-project.properties (0 hunks)
  • sonar.python.properties (1 hunks)
  • sonar.ts.properties (1 hunks)
💤 Files with no reviewable changes (1)
  • sonar-project.properties
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test_python.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-and-build
  • GitHub Check: test-and-build

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
.github/workflows/test_python.yml (1)

102-111: Linux sed fix is correct; make replacement robust and drop stale comment.

Good switch to GNU sed -i. To avoid hard‑coded paths and handle wildcard fallbacks reliably, prefer finding reports and replacing ${GITHUB_WORKSPACE} with the container mount path. Also remove the now‑stale macOS note.

Apply this diff:

-      - name: Fix coverage.xml source paths
-        if: ${{ env.AFFECTED_PATHS != '' }}
-        run: |
-          for dir in $AFFECTED_PATHS; do
-            if [ -f "$dir/coverage.xml" ]; then
-              sed -i 's#<source>/home/runner/work/dbbs-solutions/dbbs-solutions#<source>/github/workspace#g' "$dir/coverage.xml"
-            fi
-          done
-        # change sed -i '' to sed -i if you are using linux runner
+      - name: Fix coverage.xml source paths
+        if: ${{ env.AFFECTED_PATHS != '' }}
+        shell: bash
+        run: |
+          # Replace host workspace prefix with the scanner's container mount path.
+          # Example: /home/runner/work/<repo>/<repo>  ->  /github/workspace
+          mapfile -t reports < <(find $AFFECTED_PATHS -type f -name coverage.xml 2>/dev/null || true)
+          for report in "${reports[@]}"; do
+            sed -i "s#<source>${GITHUB_WORKSPACE}#<source>/github/workspace#g" "$report"
+          done

If you still need macOS support in other runners, gate the sed -i flavor by OS in a separate step.

🧹 Nitpick comments (1)
.github/workflows/test_python.yml (1)

112-114: Guard the Sonar properties rename to avoid brittle failures.

Use a guarded copy; fail explicitly if the source is missing, rather than an unguarded mv.

-      - name: Setup sonarcloud
-        run: mv sonar.python.properties sonar-project.properties
+      - name: Setup sonarcloud
+        shell: bash
+        run: |
+          if [ -f sonar.python.properties ]; then
+            cp -f sonar.python.properties sonar-project.properties
+          else
+            echo "sonar.python.properties not found" >&2
+            exit 1
+          fi

Also verify the scan step uses the correct env var (SONAR_HOST_URL) for the action version you’re on.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54769ad and 4aa0066.

📒 Files selected for processing (1)
  • .github/workflows/test_python.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-and-build
  • GitHub Check: test-and-build
🔇 Additional comments (1)
.github/workflows/test_python.yml (1)

22-22: LGTM on PR path filter for Python sonar config.

Including sonar.python.properties ensures CI runs when Python Sonar settings change. No action needed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (3)
typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (3)

29-29: ConfigModule documentation still needed.

The past review comment regarding ConfigModule setup and AWS environment variables documentation remains valid and should be addressed.


29-29: Past review comment still applies: Document ConfigModule setup and required AWS environment variables.

The previous reviewer's concern about documenting ConfigModule setup and AWS environment variables remains valid. The README should instruct consumers to import ConfigModule.forRoot() in their root AppModule and document all required environment variables including AWS credentials and Bedrock-specific configuration.

Based on learnings


29-29: ConfigModule documentation concern already raised.

The past review comment correctly identified that the README should document ConfigModule.forRoot() setup requirements and list required environment variables (AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AI_MODEL_NAME, etc.).

🧹 Nitpick comments (9)
typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (2)

12-29: Consider using beforeEach for better test isolation.

While the current beforeAll approach works, using beforeEach is a safer pattern that prevents potential test pollution and makes each test truly independent. This is especially important if the test suite grows.

Apply this diff:

-  beforeAll(async () => {
+  beforeEach(async () => {
     const mockAIService = {
       generate: jest.fn()
     }

12-29: Consider using beforeEach instead of beforeAll for better test isolation.

While the current implementation works because each test uses jest.spyOn with fresh mock implementations, using beforeEach is a safer pattern that:

  • Ensures complete isolation between tests
  • Prevents potential call count accumulation
  • Makes tests more resilient to future changes

Apply this diff:

-  beforeAll(async () => {
+  beforeEach(async () => {
     const mockAIService = {
       generate: jest.fn()
     }
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (5)

50-55: Consider validating non-empty AI responses.

The service returns response.text without checking if it's empty or undefined. While this may be rare with properly configured models, adding a validation ensures consistent behavior.

Apply this diff:

     try {
       const response = await this.llm.invoke(messages)
-      return response.text
+      if (!response.text) {
+        throw new Error('AI service returned an empty response')
+      }
+      return response.text
     } catch (error) {
       throw new Error(`AI generation failed: ${error instanceof Error ? error.message : error?.toString()}`)
     }

50-55: Preserve error stack traces in error handling.

The current error wrapping creates a new Error instance, losing the original stack trace. This makes debugging LLM failures more difficult, especially when troubleshooting AWS Bedrock issues.

Consider preserving the original error as the cause:

     try {
       const response = await this.llm.invoke(messages)
       return response.text
     } catch (error) {
-      throw new Error(`AI generation failed: ${error instanceof Error ? error.message : error?.toString()}`)
+      const message = `AI generation failed: ${error instanceof Error ? error.message : String(error)}`
+      if (error instanceof Error) {
+        throw new Error(message, { cause: error })
+      }
+      throw new Error(message)
     }

51-51: Consider adding timeout handling for LLM invocation.

The llm.invoke call has no explicit timeout, relying solely on AWS SDK defaults and the configured maxRetries. Long-running requests could tie up application resources or lead to poor user experience in HTTP contexts.

While the BedrockController wraps this in HTTP error handling, consider adding an explicit timeout for better control:

import { setTimeout } from 'timers/promises'

// In generate method
const timeoutMs = 30000 // 30 seconds
const response = await Promise.race([
  this.llm.invoke(messages),
  setTimeout(timeoutMs).then(() => {
    throw new Error(`LLM invocation timed out after ${timeoutMs}ms`)
  })
])

Alternatively, document the expected behavior and ensure consuming applications implement appropriate timeouts at their level.


43-47: Consider more explicit validation for empty strings.

The current truthiness check catches most cases but could be more robust:

 async generate(promptText: string, input: string): Promise<string> {
   // Additional validation to ensure the service is robust and can handle non-HTTP use cases
-  if (!promptText || !input) {
+  if (!promptText?.trim() || !input?.trim()) {
     throw new Error('promptText and input are required')
   }

This ensures strings with only whitespace are also rejected.


53-55: Consider preserving original error for better debugging.

The current error wrapping loses the original stack trace. Consider preserving error context:

   } catch (error) {
-    throw new Error(`AI generation failed: ${error instanceof Error ? error.message : error?.toString()}`)
+    const message = error instanceof Error ? error.message : error?.toString();
+    throw new Error(`AI generation failed: ${message}`, { cause: error })
   }
 }

The cause option (Node.js 16.9+) preserves the original error for debugging while still providing a clear message.

typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (2)

36-41: Consider adding error handling for ChatBedrockConverse instantiation.

The factory creates a ChatBedrockConverse instance without error handling. If the AWS SDK cannot initialize (e.g., missing credentials, invalid region, network issues), this will fail silently at module initialization, making debugging difficult.

Consider wrapping the instantiation in a try-catch to provide clearer error messages:

       useFactory: (config: ConfigService) => {
+        try {
           new ChatBedrockConverse({
             model: config.get<string>('AI_MODEL_NAME') || 'us.meta.llama4-maverick-17b-instruct-v1:0',
             temperature: config.get<number>('AI_MODEL_TEMPERATURE') || 0.3,
             maxRetries: config.get<number>('AI_MODEL_MAX_RETRIES') || 4
           })
+        } catch (error) {
+          throw new Error(`Failed to initialize Bedrock LLM: ${error instanceof Error ? error.message : String(error)}`)
+        }
       }

36-41: Consider validating configuration values for production.

The factory provides sensible defaults but doesn't validate that custom values are within acceptable ranges. For production deployments, consider adding validation:

  • temperature should be between 0 and 1
  • maxRetries should be a positive integer
  • model should follow AWS Bedrock model ID format

This could prevent runtime errors from misconfigured environment variables.

Example validation:

 useFactory: (config: ConfigService) => {
+  const temperature = config.get<number>('AI_MODEL_TEMPERATURE') || 0.3;
+  const maxRetries = config.get<number>('AI_MODEL_MAX_RETRIES') || 4;
+  
+  if (temperature < 0 || temperature > 1) {
+    throw new Error('AI_MODEL_TEMPERATURE must be between 0 and 1');
+  }
+  if (maxRetries < 0 || !Number.isInteger(maxRetries)) {
+    throw new Error('AI_MODEL_MAX_RETRIES must be a positive integer');
+  }
+  
   return new ChatBedrockConverse({
     model: config.get<string>('AI_MODEL_NAME') || 'us.meta.llama4-maverick-17b-instruct-v1:0',
-    temperature: config.get<number>('AI_MODEL_TEMPERATURE') || 0.3,
-    maxRetries: config.get<number>('AI_MODEL_MAX_RETRIES') || 4
+    temperature,
+    maxRetries
   })
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49fa251 and 52da8ee.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • sonar.ts.properties (1 hunks)
  • typescript/apps/serverless-api-cqrs/package.json (1 hunks)
  • typescript/apps/serverless-api/package.json (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts (1 hunks)
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • typescript/apps/serverless-api-cqrs/package.json
  • typescript/apps/serverless-api/package.json
  • typescript/packages/nestjs-modules/bedrock/src/bedrock.service.spec.ts
🧰 Additional context used
🧬 Code graph analysis (3)
typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (2)
  • BedrockService (2-2)
  • BedrockModule (1-1)
typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (1)
typescript/packages/nestjs-modules/bedrock/src/index.ts (1)
  • BedrockService (2-2)
typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (1)
typescript/packages/nestjs-modules/bedrock/src/dtos/bedrock-request.dto.ts (1)
  • ChatRequestDto (3-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-and-build
  • GitHub Check: test-and-build
🔇 Additional comments (11)
typescript/packages/nestjs-modules/bedrock/src/bedrock.module.ts (2)

7-27: LGTM! Comprehensive module documentation.

The JSDoc provides clear examples and references to related components, making it easy for developers to understand how to use the module.


44-44: LGTM!

Correctly exports only BedrockService, allowing consuming modules to inject the service while keeping controller and LLM provider as internal implementation details.

typescript/packages/nestjs-modules/bedrock/src/bedrock.controller.spec.ts (4)

35-47: LGTM! Well-structured success case test.

The test properly verifies both the service method call and the response structure.


49-59: LGTM! Error handling test is comprehensive.

The test correctly validates that service failures are properly caught and transformed into appropriate HTTP exceptions.


35-47: LGTM!

The success test properly verifies:

  • Service method is called with correct parameters
  • Response is correctly shaped as { output: string }

49-59: LGTM!

The error test correctly verifies that service failures are caught and transformed into an appropriate HTTP exception with status 500 and a user-friendly message.

typescript/packages/nestjs-modules/bedrock/src/bedrock.service.ts (5)

5-16: LGTM! Clear and helpful service documentation.

The JSDoc provides a practical example that demonstrates how to use the service.


17-24: LGTM! Proper dependency injection setup.

The service correctly injects the BEDROCK_LLM token configured in the module.


44-47: Defensive validation is appropriate for service reusability.

The comment correctly identifies this as defensive programming for non-HTTP use cases. This is a good practice as it makes the service more robust and reusable beyond just the controller context.


17-24: LGTM!

The service correctly injects the ChatBedrockConverse LLM using the BEDROCK_LLM token and follows standard NestJS DI patterns.


49-52: LGTM!

Correct use of LangChain message types:

  • SystemMessage for AI context/instructions
  • HumanMessage for user input
  • Proper invocation and text extraction

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for ' DBB Software Platform Base Python'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for ' DBB Software Platform Base Typescript'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
94.7% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@dmitryhruzin dmitryhruzin merged commit cb9d08c into main Oct 16, 2025
5 checks passed
@dmitryhruzin dmitryhruzin deleted the feat/REL-251001 branch October 16, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants