Skip to content

[router] Refactor data connector architecture with unified storage modules#12096

Merged
slin1237 merged 4 commits intosgl-project:mainfrom
key4ng:data-connector
Oct 25, 2025
Merged

[router] Refactor data connector architecture with unified storage modules#12096
slin1237 merged 4 commits intosgl-project:mainfrom
key4ng:data-connector

Conversation

@key4ng
Copy link
Collaborator

@key4ng key4ng commented Oct 24, 2025

The previous data connector implementation had significant architectural issues:

  • 6 separate storage files with duplicated code patterns across response/conversation/conversation_item storage
  • No centralized initialization logic, leading to inconsistent storage setup
  • Missing NoOp implementation for conversation items, causing incorrect fallback to Memory storage

Motivation

the previous data connector has duplicate code

Modifications

  1. dedup for oracle store, created OracleStore helper and utilities that can be used by all 3 entity
  2. Added factory.rs with create_storage() function to centralize storage initialization logic
  3. removed fragmented files

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @key4ng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive refactoring of the data connector architecture. The primary goal is to address existing architectural issues such as code duplication, fragmented initialization logic, and missing NoOp implementations. By centralizing core definitions, streamlining initialization through a factory function, and creating a shared helper for Oracle database interactions, the changes significantly enhance the modularity, consistency, and maintainability of the storage layer.

Highlights

  • Unified Data Connector Architecture: The data connector module has been completely refactored to centralize core types, traits, and error definitions into a single core.rs file. This eliminates previous fragmentation and improves consistency across storage implementations.
  • Centralized Storage Initialization: A new factory.rs module introduces a create_storage function, consolidating the initialization logic for all three storage backends (response, conversation, and conversation item). This resolves issues with inconsistent setup and missing NoOp implementations.
  • Oracle Storage Deduplication: A shared OracleStore helper has been implemented to manage connection pooling and error handling for all Oracle ATP storage backends. This significantly reduces code duplication across the Oracle implementations for responses, conversations, and conversation items.
  • Modular Storage Implementations: Dedicated modules (memory.rs, noop.rs, oracle.rs) now house the respective storage implementations, further improving code organization and maintainability by grouping related logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is an excellent refactoring of the data connector architecture. It successfully centralizes storage initialization into a new factory.rs module, which greatly improves maintainability and fixes a bug where the NoOp storage for conversation items was not being used correctly. The consolidation of duplicated code, especially for the Oracle backend into a generic OracleStore helper, is a significant improvement. The new module structure is much cleaner and easier to navigate. I have one suggestion to improve the robustness of the Oracle schema initialization to prevent potential race conditions during startup.

@slin1237 slin1237 merged commit 4ea42f7 into sgl-project:main Oct 25, 2025
35 checks passed
@slin1237 slin1237 mentioned this pull request Oct 27, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments