Skip to content

Clean up most of the projects problem warnings#1523

Merged
rocketstack-matt merged 8 commits intofinos:mainfrom
rocketstack-matt:tidy-up
Aug 12, 2025
Merged

Clean up most of the projects problem warnings#1523
rocketstack-matt merged 8 commits intofinos:mainfrom
rocketstack-matt:tidy-up

Conversation

@rocketstack-matt
Copy link
Member

This pull request focuses on improving type safety and consistency when retrieving lists and maps from MongoDB and Nitrite database documents throughout the codebase. The main changes involve replacing unchecked casts with type-safe retrieval methods, primarily using getList and a new TypeSafeNitriteDocument utility. Additionally, there are corrections to map handling for schema retrieval.

Type-safe retrieval improvements (MongoDB stores):

  • Replaced unchecked casts like (List<Document>) result.get("...") with result.getList("...", Document.class) in all relevant methods for architectures, patterns, flows, standards, and ADRs, ensuring safer and more reliable data extraction from MongoDB documents.

Type-safe retrieval improvements (Nitrite stores):

  • Introduced and applied TypeSafeNitriteDocument for extracting lists from Nitrite documents in ADR and Architecture stores, replacing direct usage of get(..., List.class) and reducing the risk of class cast exceptions.

Schema map retrieval correction:

  • Fixed the logic in MongoCoreSchemaStore for retrieving the schemas map, ensuring all keys are properly cast to String and values are preserved, correcting a previous bug that resulted in empty maps.

Code cleanup:

  • Removed unused variables from NitriteDBConfig.initializeDatabase() for clarity and maintainability.

Dependency and import updates:

  • Added necessary imports for TypeSafeNitriteDocument and HashMap in affected files.

NO INTENDED FUNCTIONAL CHANGES

Copilot AI review requested due to automatic review settings August 11, 2025 14:58
@github-actions github-actions bot added calm-hub The Calm Hub Product config labels Aug 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves type safety and consistency in database document retrieval across MongoDB and Nitrite implementations. The changes replace unchecked casts with type-safe retrieval methods and fix schema map handling logic.

  • Replaced unchecked casts (List<Document>) result.get("...") with type-safe result.getList("...", Document.class) in MongoDB stores
  • Introduced TypeSafeNitriteDocument utility for safe list/map extraction from Nitrite documents
  • Fixed schema map retrieval bug in MongoCoreSchemaStore that was causing empty maps

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TypeSafeNitriteDocument.java New utility class for type-safe document field extraction
TestTypeSafeNitriteDocumentShould.java Test coverage for the new utility class
MongoDB store classes Updated to use type-safe getList method instead of unchecked casts
Nitrite store classes Updated to use TypeSafeNitriteDocument for safe field extraction
MongoCoreSchemaStore.java Fixed schema map retrieval logic to properly handle key-value pairs
NitriteDBConfig.java Removed unused variables for code cleanup
Test files Import reorganization and interface introduction for type safety

markscott-ms
markscott-ms previously approved these changes Aug 12, 2025
…StoreShould.java

Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
rocketstack-matt and others added 4 commits August 12, 2025 10:20
…StoreShould.java

Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java

Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java

Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
…StoreShould.java

Co-authored-by: jpgough-ms <152306432+jpgough-ms@users.noreply.github.com>
@rocketstack-matt rocketstack-matt merged commit 73aadef into finos:main Aug 12, 2025
13 checks passed
@rocketstack-matt rocketstack-matt deleted the tidy-up branch August 12, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

calm-hub The Calm Hub Product config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants