Skip to content

Release 8.1.0 - #300

Merged
pallakartheekreddy merged 81 commits into
masterfrom
release-8.1.0
Dec 30, 2025
Merged

Release 8.1.0#300
pallakartheekreddy merged 81 commits into
masterfrom
release-8.1.0

Conversation

@Rakshitha-D

@Rakshitha-D Rakshitha-D commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added framework configuration management APIs for dynamic content attribute handling
    • Introduced search telemetry tracking capabilities
    • Enhanced content model with flexible property support
  • Bug Fixes

    • Improved null/undefined value handling in content grouping logic
    • Strengthened defensive checks for framework category data
  • Documentation

    • Added comprehensive development setup and continuous integration documentation
  • Chores

    • Version bumped to 8.1.4 with dependency updates
    • Migrated CI/CD from CircleCI to GitHub Actions
    • Replaced date library dependency

✏️ Tip: You can customize this high-level summary in your review settings.

Ajoymaity and others added 30 commits December 29, 2022 12:03
….1.1

Issue #ED-619 feat: Update dependencies and use dayjs instead of momentjs
Issue #0000 fix: Updated the cs-telemetry services to log the search events
…-6.0.0

Issue #ED-1950 fix: Updated typescript version and fix on typescript …
…-6.0.0-2131

Issue #ED-2131 fix: fix on ts-loader on publish npm
…ase-7.0.0

Issue #SB-ED-3073 feat: Added framework config implementation in framework service.
…ase-7.0.0

Issue #SB-ED-3073 chore: Updated package version.
…ase-7.0.0

Issue #SB-ED-3073 fix: Updated getCategoryMap issue.
…ase-7.0.0

Issue #SB-ED-3073 chore: Updated index in getFrameworkConfig.
…ase-7.0.0

Issue #SB-ED-3073 chore: Updated requiredCategories attribute.
Deeksha1502 and others added 26 commits May 27, 2025 11:33
SBCOSS-473: Added GitHub Actions for pull request yml file
SBCOSS-474: Added GitHib actions for publishing to NPM
#SBCOSS-557 - removed bmgs hardcoding
#SBCOSS-557: Fix jsonld.js global object dependency issue
SB-I367: cryptold version change to support RSAKeyPair constructor.
SB-I367: generate fresh lock file on installation
SB-I367: version of jsonld signatures reverted to v7
SB-I367: jsold versiosn changes for 8.1.0 version
@coderabbitai

coderabbitai Bot commented Dec 23, 2025

Copy link
Copy Markdown

Walkthrough

Removes CircleCI configuration and introduces GitHub Actions workflows for PR and release builds. Updates dependencies significantly, refactors content and course service interfaces, expands framework service with configuration management, adds telemetry search methods, updates test fixtures with new identifiers, and extends webpack configuration with Babel support and runtime polyfills.

Changes

Cohort / File(s) Summary
CI/CD Migration
.circleci/config.yml, .github/workflows/on_push.yml, .github/workflows/pull_request.yml
Deleted CircleCI 2.1 workflow; added GitHub Actions workflows for npm publishing on tag push (Node 22.15, webpack build, npm publish) and PR builds (Node 22.15, caching, SonarQube scanning, linting, testing).
Documentation & Package Version
README.md, package.json
Extended README with development setup (Node 22.15 prereqs, fork/clone/build steps) and CI/PR/release workflow documentation. Bumped version from 5.0.1 to 8.1.4; overhauled dependencies with updated packages (telemetry-sdk, jsonld, dayjs, crypto-ld, webpack toolchain, etc.).
Core Module Configuration
src/cs-module.ts
Added CsFrameworkConfig and CsFormConfig interfaces; imported CsFormService, FormParams, and Framework; added duplicate CsCertificateServiceConfig declaration.
Model Refactoring
src/models/content/index.ts, src/models/channel/index.ts
Refactored Content to extend ContentBase with flexible index signature [key: string]: any; removed specific fields (subject, board, medium, se_*). Added language field to Transcript. Minor formatting in channel model.
Service Interfaces & Configuration
src/services/course/interface/cs-course-service.ts, src/services/framework/interface/cs-framework-service.ts
Simplified GetUserEnrolledCoursesRequest.filters to generic [key: string]: any; made GetContentStateRequest.contentIds optional. Added FrameworkConfig interface; expanded CsFrameworkService with getFrameworkConfig and getFrameworkConfigMap methods.
Framework Service Implementation
src/services/framework/implementation/cs-framework-config-bloc.ts, src/services/framework/implementation/framework-service-impl.ts
Introduced CsFrameworkConfigBloc singleton for per-framework config caching. Extended FrameworkServiceImpl with four new methods: getFrameworkConfig, getFrameworkConfigMap, transformFramework, transformCategoriesToConfig; added CsFormService dependency; enhanced cache resolution and form-based config derivation.
Framework Service Testing
src/services/framework/implementation/framework-service-impl.spec.ts
Added mockFormService with form retrieval paths; expanded test suite covering getFrameworks and getFrameworkConfig scenarios (cache hits, form service calls, error fallbacks).
Telemetry Service
src/telemetry/interface/cs-telemetry-service.ts, src/telemetry/implementation/telemetry-service-Impl.ts
Added abstract methods raiseSearchTelemetry and raiseSearchTelemetryWith to interface; implemented in service with search telemetry provider calls and stub method.
Group Service & Test Data
src/services/group/implementation/group-service-impl.ts, src/services/group/activity/implementation/group-activity-service-impl.spec.ts
Replaced moment with dayjs for timestamp parsing in group sorting. Updated fixture data across multiple entries: appId (diksha→sunbird), framework (ncert_k-12→sample_framework), audience (Teacher→user1), license terms.
Content Utilities
src/services/content/utilities/content-group-generator/cs-contents-group-generator.ts, src/services/content/utilities/content-group-generator/cs-contents-group-generator.spec.data.ts
Hardened content grouping logic with defensive guards for undefined attributes; strengthened targeted-content prioritization checks; updated test fixtures with new appId and keyword mappings (teacher→user1, student→user2).
Certificate & Build Configuration
src/utilities/certificate/certificate-verifier.ts, webpack.config.js
Changed ES import to CommonJS require for crypto-ld. Extended webpack config: added babel-loader for JS files (excluding node_modules except jsonld-signatures), externals for crypto-ld and jsonld, ProvidePlugin for process/Buffer/global polyfills.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Release 8.1.0' is partially related to the changeset—it indicates a version bump to 8.1.4 in package.json, but the title references 8.1.0, creating a mismatch with the actual version being released. Clarify whether the release is for version 8.1.0 or 8.1.4 to ensure the title accurately reflects the actual version bump in the changeset.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch release-8.1.0

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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/utilities/certificate/certificate-verifier.ts (1)

94-105: Remove debug console.log statements before release.

Lines 94 and 105 contain console.log statements with TODO comments. These debug artifacts should be removed for production code to avoid exposing internal details and cluttering logs.

Proposed fix
-        console.log('====> host ', this.host); // TODO: log!
         const apiRequest: CsRequest = new CsRequest.Builder()
             .withHost('https://')
             .withType(CsHttpRequestType.GET)
             .withPath(url.split('//')[1])
             .withBearerToken(false)
             .withHeaders({
                 'Origin': this.host
             })
             .withUserToken(false)
             .build();
-        console.log('====> apiRequest ', apiRequest); // TODO: log!
         const jsonResp = await this.httpService.fetch(apiRequest)
src/cs-module.ts (1)

79-88: Remove duplicate CsCertificateServiceConfig interface declaration.

The CsCertificateServiceConfig interface is declared twice (lines 79-83 and 84-88) with identical fields. This is redundant and may cause confusion or compilation issues.

🔎 Proposed fix
 export interface CsCertificateServiceConfig {
     apiPath: string;
     apiPathLegacy?: string;
     rcApiPath: string;
 }
-export interface CsCertificateServiceConfig {
-    apiPath: string;
-    apiPathLegacy?: string;
-    rcApiPath: string;
-}

 export interface CsFrameworkConfig {
     apiPath: string;
     framework?: Framework;
 }
🧹 Nitpick comments (12)
src/telemetry/implementation/telemetry-service-Impl.ts (1)

72-74: Consider throwing an error for unimplemented stub.

The empty implementation is consistent with most other ...With telemetry methods in this file. However, raiseEndTelemetryWith (lines 15-17) throws an explicit "Method not implemented" error, which provides clearer feedback to callers.

🔎 Suggested implementation for clarity
 public raiseSearchTelemetryWith(cdata: Array<ICDataEntry>, env: string, edata: any, telemetryObject?: ITelemetryObject) {
-
+    throw new Error('Method not implemented.');
 }
src/utilities/certificate/certificate-verifier.ts (1)

4-4: Remove unused Ed25519KeyPair import.

Ed25519KeyPair is destructured from crypto-ld but never used in this file. The switch to CommonJS require aligns with the webpack external configuration.

Proposed fix
-const {RSAKeyPair, Ed25519KeyPair} = require('crypto-ld');
+const {RSAKeyPair} = require('crypto-ld');
README.md (1)

27-40: Add language specifiers to fenced code blocks.

Per markdown best practices (MD040), fenced code blocks should specify a language for proper syntax highlighting. Based on static analysis hints.

Proposed fix
-``` 
+```bash
  git clone https://github.com/your-username/sunbird-client-service.git

 cd sunbird-client-service
  1. Install dependencies:

- +bash
npm i

4. To run the project
-```
+```bash
npm run build
</details>

</blockquote></details>
<details>
<summary>.github/workflows/pull_request.yml (1)</summary><blockquote>

`43-44`: **Remove redundant webpack installation.**

Webpack and webpack-cli are already listed as devDependencies in package.json (lines 56-57) and will be installed by `npm i`. This separate installation step is unnecessary.



<details>
<summary>🔎 Proposed fix</summary>

```diff
-      - name: Install webpack
-        run: npm install --save-dev webpack webpack-cli
-
       - name: Install SonarQube scanner
         run: npm install -g sonarqube-scanner
.github/workflows/on_push.yml (1)

29-30: Remove redundant webpack installation.

Webpack and webpack-cli are already devDependencies and will be installed by npm install. This step is unnecessary.

🔎 Proposed fix
       - name: Install dependencies
         run: |
           npm install
-
-      - name: Install webpack
-        run: npm install --save-dev webpack webpack-cli
src/services/framework/implementation/cs-framework-config-bloc.ts (2)

18-20: Public getter exposes internal state for mutation.

The config getter returns a direct reference to the internal categoryConfig object, allowing external code to mutate it without going through updateState. Consider returning a defensive copy or making it readonly.

🔎 Proposed fix
   public get config() {
-    return this.categoryConfig;
+    return { ...this.categoryConfig };
   }

Alternatively, if you want to allow read-only access without copying:

  public get config(): Readonly<{ [frameworkId: string]: Array<FrameworkConfig> }> {
    return this.categoryConfig;
  }

22-28: Consider adding method documentation.

The updateState and dispose methods lack documentation explaining their purpose and usage. Adding JSDoc comments would improve maintainability.

🔎 Suggested documentation
+  /**
+   * Updates the framework configuration for a given framework ID.
+   * @param frameWorkId The framework identifier
+   * @param config Array of framework configuration objects
+   */
   updateState(frameWorkId: string, config: Array<FrameworkConfig>) {
     this.categoryConfig[frameWorkId] = config;
   }

+  /**
+   * Clears all cached framework configurations.
+   */
   dispose() {
     this.categoryConfig = {}
   }
src/services/framework/implementation/framework-service-impl.spec.ts (1)

62-131: LGTM with minor suggestion.

The new test suite for getFrameworkConfig provides good coverage of different scenarios. However, lines 71 and 96 have duplicate test descriptions which could cause confusion.

🔎 Suggested improvement for test clarity
-        it('should be able fetch the framework config if form config is available', (done) => {
+        it('should be able fetch the framework config if form config is available and form service returns error', (done) => {
             const sampleFrameWork: Framework = { name: "", identifier: "", categories: [{code: "SAMPLE_CODE", name: "SAMPLE_NAME", identifier:"SAMPLE_ID", description:"", index:1,status:""}]}
             mockFormService.getForm = jest.fn(() => {

This distinguishes the error-handling test case from the success case on line 71.

src/services/framework/interface/cs-framework-service.ts (1)

21-24: Simplify return type to improve type safety.

The return type Observable<FrameworkConfig[] | Array<any>> is redundant since FrameworkConfig[] is already an array. The Array<any> fallback defeats the purpose of type safety. Consider using only Observable<FrameworkConfig[]> or documenting why the any type is needed.

🔎 Proposed fix

If you always return FrameworkConfig arrays:

-    getFrameworkConfig(frameworkId: string, frameworkConfig?: CsFrameworkConfig, formConfig?: CsFormConfig): Observable<FrameworkConfig[] | Array<any>>;
+    getFrameworkConfig(frameworkId: string, frameworkConfig?: CsFrameworkConfig, formConfig?: CsFormConfig): Observable<FrameworkConfig[]>;

If you need flexibility for different return types, consider a generic or union of specific types:

getFrameworkConfig(frameworkId: string, frameworkConfig?: CsFrameworkConfig, formConfig?: CsFormConfig): Observable<FrameworkConfig[]>;
src/services/content/utilities/content-group-generator/cs-contents-group-generator.ts (1)

190-190: Type cast may be unsafe for symbol keys.

Casting groupBy as string assumes it's always a string key. If groupBy could be a symbol (which is a valid keyof Content), this cast would be incorrect. Consider adding a runtime check or constraining the generic type.

🔎 Suggested improvement
         return {
-            name: groupBy as string,
+            name: String(groupBy),
             sections,
             combination: resultingCombination
         };

Or constrain the type parameter:

static generate(config: {
    // ... other config
-    groupBy: keyof Content,
+    groupBy: string & keyof Content,
    // ...
}): CsContentSection {
src/services/framework/implementation/framework-service-impl.ts (2)

50-53: Error silently swallowed without logging.

The caught error e is discarded without any logging or telemetry. This could make debugging production issues difficult when the form service fails.

🔎 Proposed fix
                 catchError((e) => {
+                    console.warn('Failed to fetch form config, falling back to framework transform:', e);
                     return this.transformFramework(frameworkId, frameworkConfig?.apiPath ?? "");
-            
                 }))

79-83: LGTM!

The transformation logic correctly maps framework categories to the config format. Minor formatting: there's an extra blank line at line 81.

🔎 Optional: Remove extra blank line
      /** @internal */
      transformCategoriesToConfig(categories: FrameworkCategory[]): FrameworkConfig[] {
-         
         return categories.map(({ index, code, name }) => ({ code: code, label: name, identifier: `fwCategory${index}`, index: index, placeHolder: `Select ${code}`, name }))
     }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4045c7 and 9a5f6c7.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • src/services/content/utilities/content-group-generator/__snapshots__/cs-contents-group-generator.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (21)
  • .circleci/config.yml
  • .github/workflows/on_push.yml
  • .github/workflows/pull_request.yml
  • README.md
  • package.json
  • src/cs-module.ts
  • src/models/channel/index.ts
  • src/models/content/index.ts
  • src/services/content/utilities/content-group-generator/cs-contents-group-generator.spec.data.ts
  • src/services/content/utilities/content-group-generator/cs-contents-group-generator.ts
  • src/services/course/interface/cs-course-service.ts
  • src/services/framework/implementation/cs-framework-config-bloc.ts
  • src/services/framework/implementation/framework-service-impl.spec.ts
  • src/services/framework/implementation/framework-service-impl.ts
  • src/services/framework/interface/cs-framework-service.ts
  • src/services/group/activity/implementation/group-activity-service-impl.spec.ts
  • src/services/group/implementation/group-service-impl.ts
  • src/telemetry/implementation/telemetry-service-Impl.ts
  • src/telemetry/interface/cs-telemetry-service.ts
  • src/utilities/certificate/certificate-verifier.ts
  • webpack.config.js
💤 Files with no reviewable changes (1)
  • .circleci/config.yml
🧰 Additional context used
🧬 Code graph analysis (7)
src/telemetry/interface/cs-telemetry-service.ts (1)
src/telemetry/interface/cs-telemetry-request.ts (2)
  • ICDataEntry (31-34)
  • ITelemetryObject (14-19)
src/services/framework/implementation/cs-framework-config-bloc.ts (2)
src/services/framework/interface/cs-framework-service.ts (1)
  • FrameworkConfig (9-16)
src/cs-module.ts (1)
  • config (157-159)
src/cs-module.ts (2)
src/models/channel/index.ts (1)
  • Framework (1-11)
src/services/form/interface/cs-form-service.ts (1)
  • FormParams (5-12)
src/telemetry/implementation/telemetry-service-Impl.ts (1)
src/telemetry/interface/cs-telemetry-request.ts (2)
  • ICDataEntry (31-34)
  • ITelemetryObject (14-19)
src/services/framework/interface/cs-framework-service.ts (2)
src/cs-module.ts (3)
  • CsFrameworkServiceConfig (58-60)
  • CsFrameworkConfig (90-93)
  • CsFormConfig (95-98)
src/models/channel/index.ts (1)
  • Framework (1-11)
src/services/content/utilities/content-group-generator/cs-contents-group-generator.ts (1)
src/models/content/index.ts (1)
  • Content (67-69)
src/services/framework/implementation/framework-service-impl.spec.ts (6)
src/cs-module.ts (1)
  • frameworkService (173-175)
src/services/framework/interface/cs-framework-service.ts (1)
  • CsFrameworkService (18-26)
src/core/http-service/interface/cs-http-service.ts (1)
  • CsHttpService (7-12)
src/services/form/interface/cs-form-service.ts (1)
  • CsFormService (14-16)
src/models/channel/index.ts (1)
  • Framework (1-11)
src/core/http-service/interface/cs-response.ts (1)
  • CsResponse (10-58)
🪛 actionlint (1.7.9)
.github/workflows/pull_request.yml

25-25: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 Gitleaks (8.30.0)
src/services/group/activity/implementation/group-activity-service-impl.spec.ts

[high] 1339-1339: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 markdownlint-cli2 (0.18.1)
README.md

27-27: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


34-34: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


38-38: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (22)
src/models/channel/index.ts (1)

1-62: File structure is sound; trailing newline follows best practices.

The addition of a trailing newline at EOF aligns with the standard convention endorsed by linting tools. The interfaces are well-typed with appropriate optional properties and consistent naming conventions. No functional or API surface changes detected.

src/telemetry/interface/cs-telemetry-service.ts (1)

26-27: LGTM! Consistent API extension.

The new search telemetry methods follow the established naming and signature conventions of existing telemetry methods in this interface.

src/telemetry/implementation/telemetry-service-Impl.ts (1)

66-70: Implementation is correct and properly implements the interface contract.

The Search telemetry method is used to capture the search state when search is triggered for content, item, assets etc. The implementation correctly follows the established pattern with proper initialization guards. The raiseSearchTelemetry method is properly declared in the abstract interface (lines 26-27) and the implementation at lines 66-70 matches the interface contract, consistent with other telemetry methods like interact and impression.

src/services/course/interface/cs-course-service.ts (2)

5-10: API change: filters now accepts any key-value pairs.

The explicit filter fields have been replaced with an index signature [key: string]: any. This increases flexibility but removes compile-time type checking for filter properties. Consumers using previously defined filter fields will still work, but typos in filter keys won't be caught at compile time.

Ensure downstream consumers are aware of this interface change if they relied on specific filter field autocompletion or type checking.


18-24: API change: contentIds is now optional.

Changing contentIds: string[] to contentIds?: string[] means the API will now accept requests without content IDs. Verify this aligns with the backend API behavior—if the server still requires contentIds, runtime errors could occur.

Confirm the backend API supports omitting contentIds in the request payload.

webpack.config.js (2)

39-41: LGTM! External modules configuration.

Adding crypto-ld and jsonld as externals aligns with the CommonJS require usage in certificate-verifier.ts, ensuring these modules are not bundled but loaded at runtime.


55-64: Babel loader for jsonld-signatures compatibility.

The rule specifically includes jsonld-signatures from node_modules for Babel processing, which addresses ES module compatibility. This is a targeted fix for the library's module format.

src/services/group/activity/implementation/group-activity-service-impl.spec.ts (2)

875-875: LGTM! Test fixture identifier updates.

The batch count key rename from c_diksha_preprod_private_batch_count to c_sunbird_preprod_private_batch_count aligns with the broader rebranding in test fixtures.


1337-1345: Test fixture updates for branding consistency.

The appId changes from diksha to sunbird variants and audience updates to generic values are consistent with the test data normalization across the PR.

Note: The static analysis hint about line 1339 (lockKey) being a "Generic API Key" is a false positive—this is a UUID used as a test fixture identifier, not an actual API key.

src/models/content/index.ts (2)

1-69: API surface change: Content now extends ContentBase with index signature.

The refactoring separates typed fields into ContentBase and extends it with [key: string]: any in Content. This pattern enables:

  • Type safety for known fields via ContentBase
  • Flexibility for dynamic/additional properties via the index signature

Note that fields like subject, board, medium, and se_* attributes mentioned in the summary as removed will no longer have type definitions, though they can still be accessed via the index signature.

Verify that consumers depending on the removed typed fields (e.g., subject, board, medium) are updated or can handle the dynamic access pattern.


71-75: LGTM! Transcript interface updated with language field.

The addition of language: string to the Transcript interface provides necessary metadata for transcript content.

src/services/content/utilities/content-group-generator/cs-contents-group-generator.spec.data.ts (1)

48-48: LGTM! Test fixture branding updates.

The systematic appId changes from staging.diksha.portal to staging.sunbird.portal and keyword substitutions (teacheruser1, studentuser2) are consistent test data normalizations across all fixture variants.

package.json (2)

3-3: Verify the major version jump follows semantic versioning.

The version jumps from 5.0.1 to 8.1.4, skipping major versions 6 and 7. Ensure this aligns with your versioning strategy and that all breaking changes are documented.


18-32: Dependency versions are secure and free of known direct vulnerabilities.

Verification confirms that node-fetch (2.7.0), jsonld (5.2.0), and jszip (3.10.1) have no recorded direct security vulnerabilities. However, continue monitoring dependencies as new vulnerabilities may be discovered, particularly for those handling external data like node-fetch and jszip.

src/cs-module.ts (1)

90-98: LGTM! New configuration interfaces align well with the framework service enhancements.

The new CsFrameworkConfig and CsFormConfig interfaces provide clear structure for the enhanced framework configuration functionality.

src/services/framework/interface/cs-framework-service.ts (1)

9-16: LGTM! Well-defined FrameworkConfig interface.

The new FrameworkConfig interface is clear and properly typed with all necessary fields for framework configuration.

src/services/content/utilities/content-group-generator/cs-contents-group-generator.ts (3)

73-73: LGTM! Good defensive programming.

The fallback to an empty array handles cases where combination[attribute] might be undefined, preventing runtime errors.


98-107: LGTM! Improved null safety in preference extraction.

The added guards and intermediate value variable improve null safety and code clarity when extracting user preference values.


136-152: LGTM! Enhanced type safety for grouping logic.

The refactored grouping logic with keyof Content and explicit searchable key handling improves type safety. The string coercion on line 148 with the 'Other' fallback appropriately handles edge cases.

.github/workflows/on_push.yml (1)

42-42: The hardcoded package name pattern is correct. For a scoped package like @project-sunbird/client-services, npm pack ./dist generates a tarball named project-sunbird-client-services-8.1.4.tgz (the scope separator is converted to a dash), which matches the glob pattern project-sunbird-client-services-*. No changes needed.

Likely an incorrect or invalid review comment.

src/services/framework/implementation/framework-service-impl.ts (2)

15-20: LGTM!

The constructor properly injects all required dependencies using the inversify decorators.


60-68: LGTM!

The method correctly transforms the config array into a dictionary keyed by identifier. The reduce pattern is appropriate for the expected small size of framework categories.

Comment thread .github/workflows/on_push.yml
Comment thread .github/workflows/pull_request.yml
Comment thread .github/workflows/pull_request.yml
Comment thread .github/workflows/pull_request.yml
Comment thread package.json
Comment on lines +43 to +44
if (frameworkConfig?.framework) {
return of(this.transformCategoriesToConfig(frameworkConfig?.framework.categories!))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Risky non-null assertion on categories.

The non-null assertion categories! assumes categories will always exist when frameworkConfig?.framework is defined. If categories is undefined, transformCategoriesToConfig will fail when iterating.

🔎 Proposed fix
-            if (frameworkConfig?.framework) {
-                return of(this.transformCategoriesToConfig(frameworkConfig?.framework.categories!))
+            if (frameworkConfig?.framework?.categories) {
+                return of(this.transformCategoriesToConfig(frameworkConfig.framework.categories))
📝 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
if (frameworkConfig?.framework) {
return of(this.transformCategoriesToConfig(frameworkConfig?.framework.categories!))
if (frameworkConfig?.framework?.categories) {
return of(this.transformCategoriesToConfig(frameworkConfig.framework.categories))
🤖 Prompt for AI Agents
In src/services/framework/implementation/framework-service-impl.ts around lines
43-44, the code uses a risky non-null assertion on categories (categories!)
which can throw if categories is undefined; update the branch to guard against
undefined by passing a safe default (e.g., frameworkConfig.framework.categories
?? []) or check for categories presence and return an empty observable/config
when absent, and remove the non-null assertion so transformCategoriesToConfig
always receives a defined array.

Comment on lines +70 to +77
/** @internal */
transformFramework(frameworkId: string, apiPath: string): Observable<FrameworkConfig[]> {
return this.getFramework(frameworkId, {requiredCategories: []}, {apiPath: apiPath}).pipe(
map((framework) => {
return this.transformCategoriesToConfig(framework.categories!);
})
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add defensive check for framework.categories.

The non-null assertion framework.categories! assumes the API always returns categories. If the framework response lacks categories, this will throw when mapping.

🔎 Proposed fix
     /** @internal */
     transformFramework(frameworkId: string, apiPath: string): Observable<FrameworkConfig[]> {
         return this.getFramework(frameworkId, {requiredCategories: []}, {apiPath: apiPath}).pipe(
             map((framework) => {
-                return this.transformCategoriesToConfig(framework.categories!);
+                return this.transformCategoriesToConfig(framework.categories ?? []);
             })
         )
     }
📝 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
/** @internal */
transformFramework(frameworkId: string, apiPath: string): Observable<FrameworkConfig[]> {
return this.getFramework(frameworkId, {requiredCategories: []}, {apiPath: apiPath}).pipe(
map((framework) => {
return this.transformCategoriesToConfig(framework.categories!);
})
)
}
/** @internal */
transformFramework(frameworkId: string, apiPath: string): Observable<FrameworkConfig[]> {
return this.getFramework(frameworkId, {requiredCategories: []}, {apiPath: apiPath}).pipe(
map((framework) => {
return this.transformCategoriesToConfig(framework.categories ?? []);
})
)
}
🤖 Prompt for AI Agents
In src/services/framework/implementation/framework-service-impl.ts around lines
70 to 77, replace the unsafe non-null assertion on framework.categories with a
defensive check: when the framework returned from getFramework has no categories
(null/undefined), pass an empty array into transformCategoriesToConfig (or
return an empty FrameworkConfig[]), e.g. compute const categories =
framework.categories ?? [] and then call
this.transformCategoriesToConfig(categories) so the method never throws if
categories are missing.

Comment thread src/services/group/implementation/group-service-impl.ts
Comment on lines +330 to +331
return dayjs(bLastActivity.slice(0, bLastActivity.lastIndexOf(':'))).valueOf() -
dayjs(aLastActivity.slice(0, aLastActivity.lastIndexOf(':'))).valueOf();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "group-service-impl.ts" -type f

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 135


🏁 Script executed:

wc -l ./src/services/group/implementation/group-service-impl.ts

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 139


🏁 Script executed:

head -40 ./src/services/group/implementation/group-service-impl.ts && echo "..." && sed -n '320,340p' ./src/services/group/implementation/group-service-impl.ts

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 2764


🏁 Script executed:

cat ./package.json | grep -A 5 -B 5 dayjs

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 364


🏁 Script executed:

find . -path ./node_modules -prune -o -name "*.ts" -type f -exec grep -l "updatedOn\|createdOn" {} \; | head -10

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 527


🏁 Script executed:

sed -n '1,100p' ./src/models/group/index.ts | head -80

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 2006


🏁 Script executed:

grep -A 10 -B 2 "updatedOn\|createdOn" ./src/services/group/implementation/group-service-impl.spec.ts | head -50

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 3086


🏁 Script executed:

sed -n '1,200p' ./src/services/group/implementation/group-service-impl.spec.ts | grep -A 30 "sort\|describe"

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 7330


🏁 Script executed:

grep -B 5 -A 15 "search(" ./src/services/group/implementation/group-service-impl.spec.ts | grep -A 15 "expect\|should"

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 2718


🏁 Script executed:

git log --oneline -n 20 -- ./src/services/group/implementation/group-service-impl.ts 2>/dev/null | head -10

Repository: Sunbird-Ed/sunbird-client-services

Length of output: 140


Add a comment explaining the timestamp truncation logic, or remove the truncation if not intentional.

dayjs parses ISO 8601 format timestamps correctly including timezone offsets. The current slicing logic at lastIndexOf(':') truncates the timestamp to minute precision (removing milliseconds and timezone info). For timestamps like 2020-07-16 12:22:45:719+0000, this produces 2020-07-16 12:22:45.

If this precision level is intentional to ignore millisecond differences during sorting, add a clarifying comment. If not intentional, the truncation can be removed—dayjs will parse and compare the full timestamps correctly for accurate sorting.

🤖 Prompt for AI Agents
In src/services/group/implementation/group-service-impl.ts around lines 330-331,
the code slices timestamps at lastIndexOf(':') which strips timezone and
millisecond data before parsing with dayjs; either add a short comment above
this line explaining that truncation to minute precision is intentional to
ignore millisecond/timezone differences when sorting, or remove the slice calls
entirely so dayjs parses full ISO timestamps (including milliseconds/timezone)
for accurate comparison—update tests if any rely on the current behavior.

Comment thread webpack.config.js
@pallakartheekreddy
pallakartheekreddy merged commit 495367d into master Dec 30, 2025
2 of 3 checks passed
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.