Skip to content

chore: move metadata calculation to datasource storage#39657

Merged
nsarupr merged 1 commit intoreleasefrom
chore/move-metadata-to-datastorage-service
Mar 11, 2025
Merged

chore: move metadata calculation to datasource storage#39657
nsarupr merged 1 commit intoreleasefrom
chore/move-metadata-to-datastorage-service

Conversation

@nsarupr
Copy link
Contributor

@nsarupr nsarupr commented Mar 11, 2025

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13782216026
Commit: b835526
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Tue, 11 Mar 2025 07:40:11 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Streamlined and optimized the data source configuration process by simplifying how associated metadata is handled.
    • Improved the underlying service interactions to enhance system performance and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

Walkthrough

This pull request removes dependencies on OrganizationService and ConfigService from the datasource service classes, simplifying their constructors and eliminating metadata handling logic. Conversely, similar dependencies are now injected into the datasource storage service classes. In one storage service implementation, an asynchronous method to set additional metadata using these services has been introduced, altering the metadata population flow before saving the datasource storage.

Changes

File(s) Change Summary
app/server/appsmith-server/.../DatasourceServiceCEImpl.java
app/server/appsmith-server/.../DatasourceServiceImpl.java
Removed OrganizationService and ConfigService from fields and constructor parameters. Removed the method setAdditionalMetadataInDatasourceStorage from DatasourceServiceCEImpl.
app/server/appsmith-server/.../DatasourceStorageServiceCECompatibleImpl.java
app/server/appsmith-server/.../DatasourceStorageServiceImpl.java
Updated constructor signatures to include new parameters: ConfigService configService and OrganizationService organizationService.
app/server/appsmith-server/.../DatasourceStorageServiceCEImpl.java Updated constructor to inject ConfigService and OrganizationService. Added a new method setAdditionalMetadataInDatasourceStorage which retrieves organization and instance IDs and incorporates the metadata into the datasource storage before saving.

Sequence Diagram(s)

sequenceDiagram
    participant DS as DatasourceStorageServiceCEImpl
    participant Org as OrganizationService
    participant Config as ConfigService
    participant Repo as DatasourceStorageRepository

    DS->>Org: Request organization ID
    DS->>Config: Request instance ID
    Org-->>DS: Return organization ID
    Config-->>DS: Return instance ID
    DS->>Repo: Save DatasourceStorage with metadata
Loading

Suggested labels

Task, Bug, Low, Needs Triaging, ok-to-test, Anvil Pod, Query & JS Pod

Suggested reviewers

  • abhvsn
  • NandanAnantharamu
  • ashit-rath

Poem

In lines of code, a change takes flight,
Dependencies trimmed with precision and light.
New services join the data dance,
Metadata blossoms at first glance.
CodeRabbit cheers beneath the starry night! 🚀

Happy coding!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Mar 11, 2025
@nsarupr nsarupr added ok-to-test Required label for CI and removed skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Mar 11, 2025
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Mar 11, 2025
Copy link
Contributor

@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

🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (1)

280-293: Added method to set metadata from organization and instance information.

This new method uses the injected services to fetch organization and instance IDs asynchronously and combines them into a metadata map. The Reactor operators are used correctly and the method maintains proper error handling through the Mono chain.

The comment on line 287 mentions changing to ORGANIZATION_ID once available in datasource storage. Consider creating a ticket to track this future improvement.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5537ea8 and b835526.

📒 Files selected for processing (5)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCECompatibleImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (5 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceImpl.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (11)
app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceImpl.java (2)

7-8: Added necessary imports for new service dependencies.

These imports correspond to the new service dependencies being added to the constructor.


22-32: Updated constructor with new dependencies.

The constructor has been properly updated to include ConfigService and OrganizationService parameters, and the super constructor is correctly invoked with these new parameters. This change aligns with the PR objective of moving metadata calculation to datasource storage.

app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCECompatibleImpl.java (2)

7-8: Added necessary imports for new service dependencies.

These imports correspond to the new service dependencies being added to the constructor.


21-31: Updated constructor with new dependencies.

The constructor has been properly updated to include ConfigService and OrganizationService parameters, and the super constructor is correctly invoked with these new parameters. This change maintains consistency with the implementation changes in DatasourceStorageServiceImpl.

app/server/appsmith-server/src/main/java/com/appsmith/server/datasourcestorages/base/DatasourceStorageServiceCEImpl.java (4)

7-8: Added imports for new service dependencies and constants.

The imports for ConfigService, OrganizationService, and constants for field names are appropriately added to support the new metadata calculation functionality.

Also applies to: 20-21, 35-36


48-49: Added service fields for metadata handling.

These private final fields are correctly added to hold the injected service instances necessary for metadata calculation.


56-65: Updated constructor with new dependencies.

The constructor properly initializes the ConfigService and OrganizationService fields with the injected parameters, maintaining the class's initialization logic.


266-270: Updated post-save flow with metadata setting.

The execution flow now includes setting additional metadata before executing post-save actions. This implementation correctly preserves the return value chain and maintains the method's contract.

app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceCEImpl.java (2)

121-121: Removed ConfigService and OrganizationService from constructor parameters.

The constructor properly removes the now unnecessary dependencies that have been moved to the DatasourceStorageService classes. This aligns with the PR objective of simplifying the constructor and removing metadata handling from this class.


227-247: Simplified datasource storage creation logic.

The nested logic for handling datasource storage has been streamlined by removing the metadata setting that was previously done here. The code now directly checks if the ID is populated without additional metadata processing, making the code cleaner and more focused on its core responsibility.

app/server/appsmith-server/src/main/java/com/appsmith/server/datasources/base/DatasourceServiceImpl.java (1)

27-64: Constructor simplified with focused dependencies

The removal of OrganizationService and ConfigService from the constructor aligns with the PR objective of moving metadata calculation to datasource storage. This change properly separates concerns and reduces unnecessary dependencies in this service implementation.

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

@nsarupr nsarupr merged commit 4c61d6b into release Mar 11, 2025
48 checks passed
@nsarupr nsarupr deleted the chore/move-metadata-to-datastorage-service branch March 11, 2025 09:16
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
…9657)

## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13782216026>
> Commit: b835526
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13782216026&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Tue, 11 Mar 2025 07:40:11 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Streamlined and optimized the data source configuration process by
simplifying how associated metadata is handled.
- Improved the underlying service interactions to enhance system
performance and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants